6 main (int argc, char **argv)
11 uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
12 pixman_image_t *src_img;
13 pixman_image_t *dest_img;
18 pixman_point_fixed_t p0;
19 pixman_point_fixed_t p1;
22 pixman_gradient_stop_t onestop[1] =
24 { pixman_int_to_fixed (1), { 0xffff, 0xeeee, 0xeeee, 0xeeee } },
27 pixman_gradient_stop_t subsetstops[2] =
29 { pixman_int_to_fixed (1), { 0xffff, 0xeeee, 0xeeee, 0xeeee } },
30 { pixman_int_to_fixed (1), { 0xffff, 0xeeee, 0xeeee, 0xeeee } },
33 pixman_gradient_stop_t stops01[2] =
35 { pixman_int_to_fixed (0), { 0xffff, 0xeeee, 0xeeee, 0xeeee } },
36 { pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0x1111 } }
39 point_pair_t point_pairs [] =
40 { { { pixman_double_to_fixed (0), 0 },
41 { pixman_double_to_fixed (WIDTH / 8.), pixman_int_to_fixed (0) } },
42 { { pixman_double_to_fixed (WIDTH / 2.0), pixman_double_to_fixed (HEIGHT / 2.0) },
43 { pixman_double_to_fixed (WIDTH / 2.0), pixman_double_to_fixed (HEIGHT / 2.0) } }
46 pixman_transform_t transformations[] = {
48 { { pixman_double_to_fixed (2), pixman_double_to_fixed (0.5), pixman_double_to_fixed (-100), },
49 { pixman_double_to_fixed (0), pixman_double_to_fixed (3), pixman_double_to_fixed (0), },
50 { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) }
54 { { pixman_double_to_fixed (1), pixman_double_to_fixed (0), pixman_double_to_fixed (0), },
55 { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
56 { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) }
60 { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
61 { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
62 { pixman_double_to_fixed (2), pixman_double_to_fixed (1.000), pixman_double_to_fixed (1.0) }
66 { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
67 { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
68 { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (0) }
72 { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
73 { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
74 { pixman_double_to_fixed (2), pixman_double_to_fixed (-1), pixman_double_to_fixed (0) }
78 { { pixman_double_to_fixed (2), pixman_double_to_fixed (1), pixman_double_to_fixed (3), },
79 { pixman_double_to_fixed (1), pixman_double_to_fixed (1), pixman_double_to_fixed (0), },
80 { pixman_double_to_fixed (2), pixman_double_to_fixed (-1), pixman_double_to_fixed (0) }
85 pixman_fixed_t r_inner;
86 pixman_fixed_t r_outer;
88 enable_divbyzero_exceptions();
90 for (i = 0; i < WIDTH * HEIGHT; ++i)
91 dest[i] = 0x4f00004f; /* pale blue */
93 dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
99 r_outer = pixman_double_to_fixed (50.0);
101 for (i = 0; i < 3; ++i)
103 pixman_gradient_stop_t *stops;
109 num_stops = ARRAY_LENGTH (onestop);
114 num_stops = ARRAY_LENGTH (subsetstops);
119 num_stops = ARRAY_LENGTH (stops01);
122 for (j = 0; j < 3; ++j)
124 for (p = 0; p < ARRAY_LENGTH (point_pairs); ++p)
126 point_pair_t *pair = &(point_pairs[p]);
129 src_img = pixman_image_create_conical_gradient (&(pair->p0), r_inner,
132 src_img = pixman_image_create_radial_gradient (&(pair->p0), &(pair->p1),
136 src_img = pixman_image_create_linear_gradient (&(pair->p0), &(pair->p1),
139 for (k = 0; k < ARRAY_LENGTH (transformations); ++k)
141 pixman_image_set_transform (src_img, &transformations[k]);
143 pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NONE);
144 pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
145 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
148 pixman_image_unref (src_img);
154 pixman_image_unref (dest_img);