You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by "Hughes, Jonathan" <jh...@idanalytics.com> on 2007/07/12 20:00:40 UTC

Bug fix for linRGB offset bug in feColorMatrix implementation

There's an over-optimization bug in the render code for this filter.

 

The matrix values are pre-divided by 255 since they will be multiplied
by pixel values in the 0-255 range.

However the last values (a04, a14, a24, a34) are used as offsets (in
linearRGB space) and so shouldn't be pre-divided.

 

Here's the diff of the changes required to ColorMatrixRed.java (in
trunk/sources/org/apache/batik/ext/awt/image/rendered/ cvs rev: 479564)

 

151,154c151,154

<         final float a00=matrix[0][0]/255f, a01=matrix[0][1]/255f,
a02=matrix[0][2]/255f, a03=matrix[0][3]/255f, a04=matrix[0][4]/255f;

<         final float a10=matrix[1][0]/255f, a11=matrix[1][1]/255f,
a12=matrix[1][2]/255f, a13=matrix[1][3]/255f, a14=matrix[1][4]/255f;

<         final float a20=matrix[2][0]/255f, a21=matrix[2][1]/255f,
a22=matrix[2][2]/255f, a23=matrix[2][3]/255f, a24=matrix[2][4]/255f;

<         final float a30=matrix[3][0]/255f, a31=matrix[3][1]/255f,
a32=matrix[3][2]/255f, a33=matrix[3][3]/255f, a34=matrix[3][4]/255f;

---

>         final float a00=matrix[0][0]/255f, a01=matrix[0][1]/255f,
a02=matrix[0][2]/255f, a03=matrix[0][3]/255f, a04=matrix[0][4];

>         final float a10=matrix[1][0]/255f, a11=matrix[1][1]/255f,
a12=matrix[1][2]/255f, a13=matrix[1][3]/255f, a14=matrix[1][4];

>         final float a20=matrix[2][0]/255f, a21=matrix[2][1]/255f,
a22=matrix[2][2]/255f, a23=matrix[2][3]/255f, a24=matrix[2][4];

>         final float a30=matrix[3][0]/255f, a31=matrix[3][1]/255f,
a32=matrix[3][2]/255f, a33=matrix[3][3]/255f, a34=matrix[3][4];

 

Regards,

Jonathan Hughes

jph at acm dot org