1#include <stdio.h>
2#include <stdlib.h>
3#include "pixman.h"
4#include "gtk-utils.h"
5
6int
7main (int argc, char **argv)
8{
9#define WIDTH 200
10#define HEIGHT 200
11
12#define d2f pixman_double_to_fixed
13
14    uint32_t *src = malloc (WIDTH * HEIGHT * 4);
15    uint32_t *mask = malloc (WIDTH * HEIGHT * 4);
16    uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
17    pixman_fixed_t convolution[] =
18    {
19	d2f (3), d2f (3),
20	d2f (0.5), d2f (0.5), d2f (0.5),
21	d2f (0.5), d2f (0.5), d2f (0.5),
22	d2f (0.5), d2f (0.5), d2f (0.5),
23    };
24    pixman_image_t *simg, *mimg, *dimg;
25
26    int i;
27
28    for (i = 0; i < WIDTH * HEIGHT; ++i)
29    {
30	src[i] = 0x7f007f00;
31	mask[i] = (i % 256) * 0x01000000;
32	dest[i] = 0;
33    }
34
35    simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src, WIDTH * 4);
36    mimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, mask, WIDTH * 4);
37    dimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
38
39    pixman_image_set_filter (mimg, PIXMAN_FILTER_CONVOLUTION,
40			     convolution, 11);
41
42    pixman_image_composite (PIXMAN_OP_OVER, simg, mimg, dimg, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
43
44    show_image (dimg);
45
46    return 0;
47}
48