diff options
author | marha <marha@users.sourceforge.net> | 2009-07-25 15:41:56 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-07-25 15:41:56 +0000 |
commit | 4b195776d5fb64e83a4e56627367d8e9ea10cbf7 (patch) | |
tree | aa09d8e4f20fe439598711149b209a6ef45f5b0c /pixman/test/convolution-test.c | |
parent | 2fb179f86b0f9ecb7876759b87f9c64634a3f114 (diff) | |
download | vcxsrv-4b195776d5fb64e83a4e56627367d8e9ea10cbf7.tar.gz vcxsrv-4b195776d5fb64e83a4e56627367d8e9ea10cbf7.tar.bz2 vcxsrv-4b195776d5fb64e83a4e56627367d8e9ea10cbf7.zip |
Added pixman-0.15.18.tar.gz
Diffstat (limited to 'pixman/test/convolution-test.c')
-rw-r--r-- | pixman/test/convolution-test.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/pixman/test/convolution-test.c b/pixman/test/convolution-test.c new file mode 100644 index 000000000..8609d38a0 --- /dev/null +++ b/pixman/test/convolution-test.c @@ -0,0 +1,47 @@ +#include <stdio.h> +#include <stdlib.h> +#include "pixman.h" +#include "utils.h" + +int +main (int argc, char **argv) +{ +#define WIDTH 200 +#define HEIGHT 200 + +#define d2f pixman_double_to_fixed + + uint32_t *src = malloc (WIDTH * HEIGHT * 4); + uint32_t *mask = malloc (WIDTH * HEIGHT * 4); + uint32_t *dest = malloc (WIDTH * HEIGHT * 4); + pixman_fixed_t convolution[] = + { + d2f (3), d2f (3), + d2f (0.5), d2f (0.5), d2f (0.5), + d2f (0.5), d2f (0.5), d2f (0.5), + d2f (0.5), d2f (0.5), d2f (0.5), + }; + pixman_image_t *simg, *mimg, *dimg; + + int i; + + for (i = 0; i < WIDTH * HEIGHT; ++i) + { + src[i] = 0x7f007f00; + mask[i] = (i % 256) * 0x01000000; + dest[i] = 0; + } + + simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src, WIDTH * 4); + mimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, mask, WIDTH * 4); + dimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4); + + pixman_image_set_filter (mimg, PIXMAN_FILTER_CONVOLUTION, + convolution, 11); + + pixman_image_composite (PIXMAN_OP_OVER, simg, mimg, dimg, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + + show_image (dimg); + + return 0; +} |