### Now that Owen explained the algorithm, I think I implemented it right for

```	* gdk-pixbuf/pixops/pixops.c: (pixops_composite_nearest),
(composite_pixel), (composite_line):
* gdk-pixbuf/test-gdk-pixbuf.c: (simple_composite_test_one_type):
Now that Owen explained the algorithm, I think I implemented it
right for the cases where the destination pixbuf is not opaque.
The test does seem to confirm it.```
parent 24fa8a64
 2000-05-04 Darin Adler * gdk-pixbuf/pixops/pixops.c: (pixops_composite_nearest), (composite_pixel), (composite_line): * gdk-pixbuf/test-gdk-pixbuf.c: (simple_composite_test_one_type): Now that Owen explained the algorithm, I think I implemented it right for the cases where the destination pixbuf is not opaque. The test does seem to confirm it. 2000-05-04 Darin Adler * gdk-pixbuf/.cvsignore: ... ...
 ... ... @@ -177,10 +177,24 @@ pixops_composite_nearest (guchar *dest_buf, if (dest_has_alpha) { dest = (a0 * src + (0xff - a0) * dest) / 0xff; dest = (a0 * src + (0xff - a0) * dest) / 0xff; dest = (a0 * src + (0xff - a0) * dest) / 0xff; dest = (0xff * a0 + (0xff - a0) * dest) / 0xff; unsigned int w0 = 0xff * a0; unsigned int w1 = (0xff - a0) * dest; unsigned int w = w0 + w1; if (w != 0) { dest = (w0 * src + w1 * dest) / w; dest = (w0 * src + w1 * dest) / w; dest = (w0 * src + w1 * dest) / w; dest = w / 0xff; } else { dest = 0; dest = 0; dest = 0; dest = 0; } } else { ... ... @@ -296,12 +310,24 @@ composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha { if (dest_has_alpha) { unsigned int w = (0xff0000 - a) * dest; unsigned int w0 = a - (a >> 8); unsigned int w1 = ((0xff0000 - a) >> 8) * dest; unsigned int w = w0 + w1; dest = (r + (0xff0000 - a) * dest) / 0xff0000; dest = (g + (0xff0000 - a) * dest) / 0xff0000; dest = (b + (0xff0000 - a) * dest) / 0xff0000; dest = (0xff * a + (0xff0000 - a) * dest) / 0xff0000; if (w != 0) { dest = (r - (r >> 8) + w1 * dest) / w; dest = (g - (g >> 8) + w1 * dest) / w; dest = (b - (b >> 8) + w1 * dest) / w; dest = w / 0xff00; } else { dest = 0; dest = 0; dest = 0; dest = 0; } } else { ... ... @@ -354,12 +380,24 @@ composite_line (int *weights, int n_x, int n_y, if (dest_has_alpha) { unsigned int w = (0xff0000 - a) * dest; unsigned int w0 = a - (a >> 8); unsigned int w1 = ((0xff0000 - a) >> 8) * dest; unsigned int w = w0 + w1; dest = (r + (0xff0000 - a) * dest) / 0xff0000; dest = (g + (0xff0000 - a) * dest) / 0xff0000; dest = (b + (0xff0000 - a) * dest) / 0xff0000; dest = (0xff * a + (0xff0000 - a) * dest) / 0xff0000; if (w != 0) { dest = (r - (r >> 8) + w1 * dest) / w; dest = (g - (g >> 8) + w1 * dest) / w; dest = (b - (b >> 8) + w1 * dest) / w; dest = w / 0xff00; } else { dest = 0; dest = 0; dest = 0; dest = 0; } } else { ... ...
 ... ... @@ -201,7 +201,8 @@ simple_composite_test_one_type (GdkInterpType type) success &= simple_composite_test_one (type, 0x00000000, TRUE, 0xFF0000FF, TRUE, 0xFF0000FF); success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x00FF00FF, TRUE, 0x00FF00FF); success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x0000FFFF, TRUE, 0x0000FFFF); success &= simple_composite_test_one (type, 0x00FF0080, TRUE, 0xFFFFFF00, TRUE, 0x7FFF7F80); success &= simple_composite_test_one (type, 0x00FF0080, TRUE, 0xFFFFFF00, TRUE, 0x00FF0080); success &= simple_composite_test_one (type, 0xFF000080, TRUE, 0x00FF0040, TRUE, 0xCC32009F); success &= simple_composite_test_one (type, 0xFFFFFFFF, TRUE, 0xFFFFFFFF, TRUE, 0xFFFFFFFF); return success; ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!