8 main (int argc, char **argv)
13 pixman_image_t *src_img;
14 pixman_image_t *mask_img;
15 pixman_image_t *dest_img;
17 pixman_color_t red = { 0xffff, 0x0000, 0x0000, 0xffff };
18 uint32_t *bits = malloc (WIDTH * HEIGHT * 4);
19 uint32_t *mbits = malloc (WIDTH * HEIGHT);
21 memset (mbits, 0, WIDTH * HEIGHT);
22 memset (bits, 0xff, WIDTH * HEIGHT * 4);
24 trap.top.l = pixman_double_to_fixed (0.5);
25 trap.top.r = pixman_double_to_fixed (1.5);
26 trap.top.y = pixman_double_to_fixed (0.5);
28 trap.bot.l = pixman_double_to_fixed (0.5);
29 trap.bot.r = pixman_double_to_fixed (1.5);
30 trap.bot.y = pixman_double_to_fixed (1.5);
32 mask_img = pixman_image_create_bits (
33 PIXMAN_a1, WIDTH, HEIGHT, mbits, WIDTH);
34 src_img = pixman_image_create_solid_fill (&red);
35 dest_img = pixman_image_create_bits (
36 PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, WIDTH * 4);
38 pixman_add_traps (mask_img, 0, 0, 1, &trap);
40 pixman_image_composite (PIXMAN_OP_OVER,
41 src_img, mask_img, dest_img,
42 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
44 assert (bits[0] == 0xffff0000);
45 assert (bits[1] == 0xffffffff);
46 assert (bits[1 * WIDTH + 0] == 0xffffffff);
47 assert (bits[1 * WIDTH + 1] == 0xffffffff);