1953d7d37Smrg#include <stdlib.h> 2953d7d37Smrg#include "utils.h" 3953d7d37Smrg 4953d7d37Smrgstatic const pixman_op_t pdf_ops[] = 5953d7d37Smrg{ 6953d7d37Smrg PIXMAN_OP_MULTIPLY, 7953d7d37Smrg PIXMAN_OP_SCREEN, 8953d7d37Smrg PIXMAN_OP_OVERLAY, 9953d7d37Smrg PIXMAN_OP_DARKEN, 10953d7d37Smrg PIXMAN_OP_LIGHTEN, 11953d7d37Smrg PIXMAN_OP_COLOR_DODGE, 12953d7d37Smrg PIXMAN_OP_COLOR_BURN, 13953d7d37Smrg PIXMAN_OP_HARD_LIGHT, 14953d7d37Smrg PIXMAN_OP_SOFT_LIGHT, 15953d7d37Smrg PIXMAN_OP_DIFFERENCE, 16953d7d37Smrg PIXMAN_OP_EXCLUSION, 17953d7d37Smrg PIXMAN_OP_HSL_HUE, 18953d7d37Smrg PIXMAN_OP_HSL_SATURATION, 19953d7d37Smrg PIXMAN_OP_HSL_COLOR, 20953d7d37Smrg PIXMAN_OP_HSL_LUMINOSITY 21953d7d37Smrg}; 22953d7d37Smrg 23953d7d37Smrgstatic const uint32_t pixels[] = 24953d7d37Smrg{ 25953d7d37Smrg 0x00808080, 26953d7d37Smrg 0x80123456, 27953d7d37Smrg 0x00000000, 28953d7d37Smrg 0xffffffff, 29953d7d37Smrg 0x00ffffff, 30953d7d37Smrg 0x80808080, 31953d7d37Smrg 0x00123456, 32953d7d37Smrg}; 33953d7d37Smrg 34953d7d37Smrgint 35953d7d37Smrgmain () 36953d7d37Smrg{ 37953d7d37Smrg int o, s, m, d; 38953d7d37Smrg 399ad247e8Sjmcneill enable_divbyzero_exceptions(); 40953d7d37Smrg 41953d7d37Smrg for (o = 0; o < ARRAY_LENGTH (pdf_ops); ++o) 42953d7d37Smrg { 43953d7d37Smrg pixman_op_t op = pdf_ops[o]; 44953d7d37Smrg 45953d7d37Smrg for (s = 0; s < ARRAY_LENGTH (pixels); ++s) 46953d7d37Smrg { 47953d7d37Smrg pixman_image_t *src; 48953d7d37Smrg 49953d7d37Smrg src = pixman_image_create_bits ( 50953d7d37Smrg PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[s]), 4); 51953d7d37Smrg 52953d7d37Smrg for (m = -1; m < ARRAY_LENGTH (pixels); ++m) 53953d7d37Smrg { 54953d7d37Smrg pixman_image_t *msk = NULL; 55953d7d37Smrg if (m >= 0) 56953d7d37Smrg { 57953d7d37Smrg msk = pixman_image_create_bits ( 58953d7d37Smrg PIXMAN_a8r8g8b8, 1, 1, (uint32_t *)&(pixels[m]), 4); 59953d7d37Smrg } 60953d7d37Smrg 61953d7d37Smrg for (d = 0; d < ARRAY_LENGTH (pixels); ++d) 62953d7d37Smrg { 63953d7d37Smrg pixman_image_t *dst; 64953d7d37Smrg uint32_t dp = pixels[d]; 65953d7d37Smrg 66953d7d37Smrg dst = pixman_image_create_bits ( 67953d7d37Smrg PIXMAN_a8r8g8b8, 1, 1, &dp, 4); 68953d7d37Smrg 69953d7d37Smrg pixman_image_composite (op, src, msk, dst, 70953d7d37Smrg 0, 0, 0, 0, 0, 0, 1, 1); 71953d7d37Smrg 72953d7d37Smrg pixman_image_unref (dst); 73953d7d37Smrg } 74953d7d37Smrg if (msk) 75953d7d37Smrg pixman_image_unref (msk); 76953d7d37Smrg } 77953d7d37Smrg 78953d7d37Smrg pixman_image_unref (src); 79953d7d37Smrg } 80953d7d37Smrg } 81953d7d37Smrg 82953d7d37Smrg return 0; 83953d7d37Smrg} 84