114b11b2bSmrg#include "utils.h"
2f4f78bb6Smrg#include "gtk-utils.h"
3f4f78bb6Smrg
4f4f78bb6Smrg#define WIDTH 1024
5f4f78bb6Smrg#define HEIGHT 640
6f4f78bb6Smrg
7f4f78bb6Smrgint
8f4f78bb6Smrgmain (int argc, char **argv)
9f4f78bb6Smrg{
10f4f78bb6Smrg    pixman_image_t *src_img, *dest_img;
11f4f78bb6Smrg    pixman_gradient_stop_t stops[] = {
12f4f78bb6Smrg        { 0x00000, { 0x0000, 0x0000, 0x4444, 0xdddd } },
13f4f78bb6Smrg        { 0x10000, { 0xeeee, 0xeeee, 0x8888, 0xdddd } },
14f4f78bb6Smrg#if 0
15f4f78bb6Smrg        /* These colors make it very obvious that dithering
16f4f78bb6Smrg         * is useful even for 8-bit gradients
17f4f78bb6Smrg         */
18f4f78bb6Smrg	{ 0x00000, { 0x6666, 0x3333, 0x3333, 0xffff } },
19f4f78bb6Smrg	{ 0x10000, { 0x3333, 0x6666, 0x6666, 0xffff } },
20f4f78bb6Smrg#endif
21f4f78bb6Smrg    };
22f4f78bb6Smrg    pixman_point_fixed_t p1, p2;
23f4f78bb6Smrg
24f4f78bb6Smrg    enable_divbyzero_exceptions ();
25f4f78bb6Smrg
26f4f78bb6Smrg    dest_img = pixman_image_create_bits (PIXMAN_x8r8g8b8,
27f4f78bb6Smrg					 WIDTH, HEIGHT,
28f4f78bb6Smrg					 NULL, 0);
29f4f78bb6Smrg
30f4f78bb6Smrg    p1.x = p1.y = 0x0000;
31f4f78bb6Smrg    p2.x = WIDTH << 16;
32f4f78bb6Smrg    p2.y = HEIGHT << 16;
33f4f78bb6Smrg
34f4f78bb6Smrg    src_img = pixman_image_create_linear_gradient (&p1, &p2, stops, ARRAY_LENGTH (stops));
35f4f78bb6Smrg
36f4f78bb6Smrg    pixman_image_composite32 (PIXMAN_OP_OVER,
37f4f78bb6Smrg			      src_img,
38f4f78bb6Smrg			      NULL,
39f4f78bb6Smrg			      dest_img,
40f4f78bb6Smrg			      0, 0,
41f4f78bb6Smrg			      0, 0,
42f4f78bb6Smrg			      0, 0,
43f4f78bb6Smrg			      WIDTH, HEIGHT);
44f4f78bb6Smrg
45f4f78bb6Smrg    show_image (dest_img);
46f4f78bb6Smrg
47f4f78bb6Smrg    pixman_image_unref (dest_img);
48f4f78bb6Smrg
49f4f78bb6Smrg    return 0;
50f4f78bb6Smrg}
51