>I was expecting something like "0 0 0 1 1 1 1 2 2 2",
>and the result was "0 0 0 0 0 1 1 1 2 2" !
>
>The result is not symmetrical !
>
>Can You give me some explanation ?

This looks to me like a classic error of open/closed intervals:

Pictorially, you felt you started with:

        +-----+-----+
        |     |     |
        |  0  |  2  |
        |     |     |
        +-----+-----+

That is, you thought of your images as two rectangles (each only one pixel
on a side), entirely covered with a single value (0 or 2).

Streching this, you expected:

        +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
        |     |     |     |     |     |     |     |     |     |     |
        |  0  |  0  |  0  |  1  |  1  |  1  |  1  |  2  |  2  |  2  |
        |     |     |     |     |     |     |     |     |     |     |
        +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+

However, I suspect that the code treated the source as:

        +-----+-
        |     |
        |0    |2
        |     |
        +-----+-

That is, as values on a half open interval, where 0 was at the left edge,
and the right edge, just beyond the one pixel enclosed, was 2.

With this interpretation of the source, I would expect your code to expand
this to:

        +-----+-----+-----+-----+-----+-----+-----+-----+-----+-
        |     |     |     |     |     |     |     |     |     |
        |0    |0    |0    |0    |0    |1    |1    |1    |1    |2
        |     |     |     |     |     |     |     |     |     |
        +-----+-----+-----+-----+-----+-----+-----+-----+-----+-

[The right-most 0 could just as easily be a 1... in fact, one might very
well want it randomly picked, with the error propigated over the full
image...]

But, alas, you saw:

        +-----+-----+-----+-----+-----+-----+-----+-----+-----+-
        |     |     |     |     |     |     |     |     |     |
        |0    |0    |0    |0    |0    |1    |1    |1    |2    |2
        |     |     |     |     |     |     |     |     |     |
        +-----+-----+-----+-----+-----+-----+-----+-----+-----+-

My guess is that this result is a combination of both the 'edge',
half-open, style of interpretation, coupled with some slightly incorrect
edge condition code in Java2D.  Looks like the filter code does pixels 0
through n - 2 via the filter, then copies pixel n - 1 to the edge.  Then
this is either happening twice, or the edge conditions are being pushed
through the filter incorrectly.  Either way, there is no way the resulting
values are correct.

        - Mark


-------------------
Mark Lentczner
President
Glyphic Technology
444 Castro Street, Suite 811
Mtn. View, CA 94041

[EMAIL PROTECTED]
http://www.glyphic.com/
650/964-5311 voice
650/967-4379 fax

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to