9 static pixman_image_t *
10 create_solid_bits (uint32_t pixel)
12 uint32_t *pixels = malloc (WIDTH * HEIGHT * 4);
15 for (i = 0; i < WIDTH * HEIGHT; ++i)
18 return pixman_image_create_bits (PIXMAN_a8r8g8b8,
25 main (int argc, char **argv)
27 pixman_image_t *gradient_img;
28 pixman_image_t *src_img, *dst_img;
29 pixman_gradient_stop_t stops[2] =
31 { pixman_int_to_fixed (0), { 0xffff, 0x0000, 0x0000, 0xffff } },
32 { pixman_int_to_fixed (1), { 0xffff, 0xffff, 0x0000, 0xffff } }
35 pixman_point_fixed_t p1 = { 0, 0 };
36 pixman_point_fixed_t p2 = { pixman_int_to_fixed (WIDTH),
37 pixman_int_to_fixed (HEIGHT) };
39 pixman_point_fixed_t c_inner;
40 pixman_point_fixed_t c_outer;
41 pixman_fixed_t r_inner;
42 pixman_fixed_t r_outer;
43 pixman_region32_t clip_region;
44 pixman_transform_t trans = {
45 { { pixman_double_to_fixed (1.3), pixman_double_to_fixed (0), pixman_double_to_fixed (-0.5), },
46 { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (-0.5), },
47 { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (1.0) }
51 src_img = create_solid_bits (0xff0000ff);
53 c_inner.x = pixman_double_to_fixed (100.0);
54 c_inner.y = pixman_double_to_fixed (100.0);
55 c_outer.x = pixman_double_to_fixed (100.0);
56 c_outer.y = pixman_double_to_fixed (100.0);
58 r_outer = pixman_double_to_fixed (100.0);
60 gradient_img = pixman_image_create_radial_gradient (&c_inner, &c_outer,
65 gradient_img = pixman_image_create_linear_gradient (&p1, &p2,
70 pixman_image_composite (PIXMAN_OP_OVER, gradient_img, NULL, src_img,
71 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
73 pixman_region32_init_rect (&clip_region, 50, 0, 100, 200);
74 pixman_image_set_clip_region32 (src_img, &clip_region);
75 pixman_image_set_source_clipping (src_img, TRUE);
76 pixman_image_set_has_client_clip (src_img, TRUE);
77 pixman_image_set_transform (src_img, &trans);
78 pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL);
80 dst_img = create_solid_bits (0xffff0000);
81 pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dst_img,
82 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
86 printf ("0, 0: %x\n", src[0]);
87 printf ("10, 10: %x\n", src[10 * 10 + 10]);
88 printf ("w, h: %x\n", src[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
93 pixman_image_unref (gradient_img);
94 pixman_image_unref (src_img);