1 #include <stdlib.h>
2 #include "utils.h"
3
4 static const pixman_op_t pdf_ops[] =
5 {
6 PIXMAN_OP_MULTIPLY,
7 PIXMAN_OP_SCREEN,
8 PIXMAN_OP_OVERLAY,
9 PIXMAN_OP_DARKEN,
10 PIXMAN_OP_LIGHTEN,
11 PIXMAN_OP_COLOR_DODGE,
12 PIXMAN_OP_COLOR_BURN,
13 PIXMAN_OP_HARD_LIGHT,
14 PIXMAN_OP_SOFT_LIGHT,
15 PIXMAN_OP_DIFFERENCE,
16 PIXMAN_OP_EXCLUSION,
17 PIXMAN_OP_HSL_HUE,
18 PIXMAN_OP_HSL_SATURATION,
19 PIXMAN_OP_HSL_COLOR,
20 PIXMAN_OP_HSL_LUMINOSITY
21 };
22
23 static const uint32_t pixels[] =
24 {
25 0x00808080,
26 0x80123456,
27 0x00000000,
28 0xffffffff,
29 0x00ffffff,
30 0x80808080,
31 0x00123456,
32 };
33
34 int
main()35 main ()
36 {
37 int o, s, m, d;
38
39 enable_divbyzero_exceptions();
40
41 for (o = 0; o < ARRAY_LENGTH (pdf_ops); ++o)
42 {
43 pixman_op_t op = pdf_ops[o];
44
45 for (s = 0; s < ARRAY_LENGTH (pixels); ++s)
46 {
47 pixman_image_t *src;
48
49 src = pixman_image_create_bits (
50 PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[s]), 4);
51
52 for (m = -1; m < ARRAY_LENGTH (pixels); ++m)
53 {
54 pixman_image_t *msk = NULL;
55 if (m >= 0)
56 {
57 msk = pixman_image_create_bits (
58 PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[m]), 4);
59 }
60
61 for (d = 0; d < ARRAY_LENGTH (pixels); ++d)
62 {
63 pixman_image_t *dst;
64 uint32_t dp = pixels[d];
65
66 dst = pixman_image_create_bits (
67 PIXMAN_a8r8g8b8, 1, 1, &dp, 4);
68
69 pixman_image_composite (op, src, msk, dst,
70 0, 0, 0, 0, 0, 0, 1, 1);
71
72 pixman_image_unref (dst);
73 }
74 if (msk)
75 pixman_image_unref (msk);
76 }
77
78 pixman_image_unref (src);
79 }
80 }
81
82 return 0;
83 }
84