16ba797d6Smrg#include <stdio.h>
26ba797d6Smrg#include <stdlib.h>
36ba797d6Smrg#include "pixman.h"
46ba797d6Smrg#include "gtk-utils.h"
56ba797d6Smrg
66ba797d6Smrgint
76ba797d6Smrgmain (int argc, char **argv)
86ba797d6Smrg{
96ba797d6Smrg#define WIDTH 200
106ba797d6Smrg#define HEIGHT 200
116ba797d6Smrg
126ba797d6Smrg#define d2f pixman_double_to_fixed
136ba797d6Smrg
146ba797d6Smrg    uint32_t *src = malloc (WIDTH * HEIGHT * 4);
156ba797d6Smrg    uint32_t *mask = malloc (WIDTH * HEIGHT * 4);
166ba797d6Smrg    uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
176ba797d6Smrg    pixman_fixed_t convolution[] =
186ba797d6Smrg    {
196ba797d6Smrg	d2f (3), d2f (3),
206ba797d6Smrg	d2f (0.5), d2f (0.5), d2f (0.5),
216ba797d6Smrg	d2f (0.5), d2f (0.5), d2f (0.5),
226ba797d6Smrg	d2f (0.5), d2f (0.5), d2f (0.5),
236ba797d6Smrg    };
246ba797d6Smrg    pixman_image_t *simg, *mimg, *dimg;
256ba797d6Smrg
266ba797d6Smrg    int i;
276ba797d6Smrg
286ba797d6Smrg    for (i = 0; i < WIDTH * HEIGHT; ++i)
296ba797d6Smrg    {
306ba797d6Smrg	src[i] = 0x7f007f00;
316ba797d6Smrg	mask[i] = (i % 256) * 0x01000000;
326ba797d6Smrg	dest[i] = 0;
336ba797d6Smrg    }
346ba797d6Smrg
356ba797d6Smrg    simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src, WIDTH * 4);
366ba797d6Smrg    mimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, mask, WIDTH * 4);
376ba797d6Smrg    dimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
386ba797d6Smrg
396ba797d6Smrg    pixman_image_set_filter (mimg, PIXMAN_FILTER_CONVOLUTION,
406ba797d6Smrg			     convolution, 11);
416ba797d6Smrg
426ba797d6Smrg    pixman_image_composite (PIXMAN_OP_OVER, simg, mimg, dimg, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
436ba797d6Smrg
446ba797d6Smrg    show_image (dimg);
456ba797d6Smrg
466ba797d6Smrg    return 0;
476ba797d6Smrg}
48