7 main (int argc, char **argv)
12 uint32_t *alpha = malloc (WIDTH * HEIGHT * 4);
13 uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
14 uint32_t *src = malloc (WIDTH * HEIGHT * 4);
15 pixman_image_t *grad_img;
16 pixman_image_t *alpha_img;
17 pixman_image_t *dest_img;
18 pixman_image_t *src_img;
20 pixman_gradient_stop_t stops[2] =
22 { pixman_int_to_fixed (0), { 0x0000, 0x0000, 0x0000, 0x0000 } },
23 { pixman_int_to_fixed (1), { 0xffff, 0x0000, 0x1111, 0xffff } }
25 pixman_point_fixed_t p1 = { pixman_double_to_fixed (0), 0 };
26 pixman_point_fixed_t p2 = { pixman_double_to_fixed (WIDTH),
27 pixman_int_to_fixed (0) };
29 pixman_transform_t trans = {
30 { { pixman_double_to_fixed (2), pixman_double_to_fixed (0.5), pixman_double_to_fixed (-100), },
31 { pixman_double_to_fixed (0), pixman_double_to_fixed (3), pixman_double_to_fixed (0), },
32 { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) }
36 pixman_transform_t trans = {
37 { { pixman_fixed_1, 0, 0 },
38 { 0, pixman_fixed_1, 0 },
39 { 0, 0, pixman_fixed_1 } }
43 pixman_point_fixed_t c_inner;
44 pixman_point_fixed_t c_outer;
45 pixman_fixed_t r_inner;
46 pixman_fixed_t r_outer;
48 for (i = 0; i < WIDTH * HEIGHT; ++i)
49 alpha[i] = 0x4f00004f; /* pale blue */
51 alpha_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
56 for (i = 0; i < WIDTH * HEIGHT; ++i)
57 dest[i] = 0xffffff00; /* yellow */
59 dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
64 for (i = 0; i < WIDTH * HEIGHT; ++i)
67 src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
72 c_inner.x = pixman_double_to_fixed (50.0);
73 c_inner.y = pixman_double_to_fixed (50.0);
74 c_outer.x = pixman_double_to_fixed (50.0);
75 c_outer.y = pixman_double_to_fixed (50.0);
77 r_outer = pixman_double_to_fixed (50.0);
80 grad_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
84 grad_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
86 grad_img = pixman_image_create_linear_gradient (&c_inner, &c_outer,
91 grad_img = pixman_image_create_linear_gradient (&p1, &p2,
94 pixman_image_set_transform (grad_img, &trans);
95 pixman_image_set_repeat (grad_img, PIXMAN_REPEAT_PAD);
97 pixman_image_composite (PIXMAN_OP_OVER, grad_img, NULL, alpha_img,
98 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
100 pixman_image_set_alpha_map (src_img, alpha_img, 10, 10);
102 pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
103 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
105 printf ("0, 0: %x\n", dest[0]);
106 printf ("10, 10: %x\n", dest[10 * 10 + 10]);
107 printf ("w, h: %x\n", dest[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
109 show_image (dest_img);
111 pixman_image_unref (src_img);
112 pixman_image_unref (grad_img);
113 pixman_image_unref (alpha_img);