PDA

View Full Version : Help in Image Multiply Mode



mkarthik293
07-16-2008, 11:39 PM
Hello all,
I am trying to implement the image mode VG_IMAGE_MULTIPLY and but I am not getting it right. Can anyone help me to solve the same.
Here is my implementation. All the RGB values are non-linear 8-bit values.

p1a = base_mask - pa;
//premultiply the paint values.
pr = (pr * pa + base_mask) >> base_shift;
pg = (pg* pa + base_mask) >> base_shift;
pb = (pb* pa + base_mask) >> base_shift;

i1a = base_mask - ia;
//premultiply the image values.
ir = (ir * ia + base_mask) >> base_shift;
ig = (ig* ia + base_mask) >> base_shift;
ib = (ib* ia + base_mask) >> base_shift;

dr = (pr*(i1a) + (ir *p1a) +(pr *ir) + base_mask) >> base_shift;
dg = (pg*(i1a) + (ig *p1a) +(pg *ig)+ base_mask) >> base_shift;
db = (pb*(i1a) + (ib *p1a) +(pb *ib)+ base_mask) >> base_shift;
da = (pa +da*(p1a)+ base_mask) >> base_shift;

Thanks in Advance
Karthik M