1 
    2 #ifndef LIBRARIES_PIXMAN_H
    3 #define LIBRARIES_PIXMAN_H
    4 
    5 /*
    6 
    7 	MorphOS Shared PixManLib
    8 	
    9 	pixman.library 10.2 include
   10 	
   11 	Copyright © 2009-2026 The MorphOS Development Team (et al.), All Rights Reserved.
   12 
   13 */
   14 
   15 /*
   16  * Version info
   17  */
   18 #define PIXMAN_VERSION_H__
   19 
   20 #define PIXMAN_VERSION_MAJOR 0
   21 #define PIXMAN_VERSION_MINOR 46
   22 #define PIXMAN_VERSION_MICRO 4
   23 
   24 #define PIXMAN_VERSION_STRING "0.46.4"
   25 
   26 #define PIXMAN_VERSION_ENCODE(major, minor, micro) (	\
   27 	  ((major) * 10000)				\
   28 	+ ((minor) *   100)				\
   29 	+ ((micro) *     1))
   30 
   31 #define PIXMAN_VERSION PIXMAN_VERSION_ENCODE(	\
   32 	PIXMAN_VERSION_MAJOR,			\
   33 	PIXMAN_VERSION_MINOR,			\
   34 	PIXMAN_VERSION_MICRO)
   35 
   36 
   37 #ifdef  __cplusplus
   38 #define PIXMAN_BEGIN_DECLS extern "C" {
   39 #define PIXMAN_END_DECLS }
   40 #else
   41 #define PIXMAN_BEGIN_DECLS
   42 #define PIXMAN_END_DECLS
   43 #endif
   44 
   45 PIXMAN_BEGIN_DECLS
   46 
   47 /*
   48  * Standard integers
   49  */
   50 
   51 #if !defined (PIXMAN_DONT_DEFINE_STDINT)
   52 #include <stdint.h>
   53 #endif
   54 
   55 /*
   56  * Boolean
   57  */
   58 typedef int pixman_bool_t;
   59 
   60 /*
   61  * Fixpoint numbers
   62  */
   63 typedef int64_t			pixman_fixed_32_32_t;
   64 typedef pixman_fixed_32_32_t	pixman_fixed_48_16_t;
   65 typedef uint32_t		pixman_fixed_1_31_t;
   66 typedef uint32_t		pixman_fixed_1_16_t;
   67 typedef int32_t			pixman_fixed_16_16_t;
   68 typedef pixman_fixed_16_16_t	pixman_fixed_t;
   69 
   70 #define pixman_fixed_e			((pixman_fixed_t) 1)
   71 #define pixman_fixed_1			(pixman_int_to_fixed(1))
   72 #define pixman_fixed_1_minus_e		(pixman_fixed_1 - pixman_fixed_e)
   73 #define pixman_fixed_minus_1		(pixman_int_to_fixed(-1))
   74 #define pixman_fixed_to_int(f)		((int) ((f) >> 16))
   75 #define pixman_int_to_fixed(i)		((pixman_fixed_t) ((uint32_t) (i) << 16))
   76 #define pixman_fixed_to_double(f)	(double) ((f) / (double) pixman_fixed_1)
   77 #define pixman_double_to_fixed(d)	((pixman_fixed_t) ((d) * 65536.0))
   78 #define pixman_fixed_frac(f)		((f) & pixman_fixed_1_minus_e)
   79 #define pixman_fixed_floor(f)		((f) & ~pixman_fixed_1_minus_e)
   80 #define pixman_fixed_ceil(f)		pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
   81 #define pixman_fixed_fraction(f)	((f) & pixman_fixed_1_minus_e)
   82 #define pixman_fixed_mod_2(f)		((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
   83 #define pixman_max_fixed_48_16		((pixman_fixed_48_16_t) 0x7fffffff)
   84 #define pixman_min_fixed_48_16		(-((pixman_fixed_48_16_t) 1 << 31))
   85 
   86 /*
   87  * Misc structs
   88  */
   89 typedef struct pixman_color pixman_color_t;
   90 typedef struct pixman_point_fixed pixman_point_fixed_t;
   91 typedef struct pixman_line_fixed pixman_line_fixed_t;
   92 typedef struct pixman_vector pixman_vector_t;
   93 typedef struct pixman_transform pixman_transform_t;
   94 
   95 struct pixman_color
   96 {
   97     uint16_t	red;
   98     uint16_t    green;
   99     uint16_t    blue;
  100     uint16_t    alpha;
  101 };
  102 
  103 struct pixman_point_fixed
  104 {
  105     pixman_fixed_t	x;
  106     pixman_fixed_t	y;
  107 };
  108 
  109 struct pixman_line_fixed
  110 {
  111     pixman_point_fixed_t	p1, p2;
  112 };
  113 
  114 /*
  115  * Fixed point matrices
  116  */
  117 
  118 struct pixman_vector
  119 {
  120     pixman_fixed_t	vector[3];
  121 };
  122 
  123 struct pixman_transform
  124 {
  125     pixman_fixed_t	matrix[3][3];
  126 };
  127 
  128 /* forward declaration (sorry) */
  129 struct pixman_box16;
  130 typedef  union pixman_image		pixman_image_t;
  131 
  132 /*
  133  * Floating point matrices
  134  */
  135 typedef struct pixman_f_transform pixman_f_transform_t;
  136 typedef struct pixman_f_vector pixman_f_vector_t;
  137 
  138 struct pixman_f_vector
  139 {
  140     double  v[3];
  141 };
  142 
  143 struct pixman_f_transform
  144 {
  145     double  m[3][3];
  146 };
  147 
  148 typedef enum
  149 {
  150     PIXMAN_REPEAT_NONE,
  151     PIXMAN_REPEAT_NORMAL,
  152     PIXMAN_REPEAT_PAD,
  153     PIXMAN_REPEAT_REFLECT
  154 } pixman_repeat_t;
  155 
  156 typedef enum
  157 {
  158     PIXMAN_DITHER_NONE,
  159     PIXMAN_DITHER_FAST,
  160     PIXMAN_DITHER_GOOD,
  161     PIXMAN_DITHER_BEST,
  162     PIXMAN_DITHER_ORDERED_BAYER_8,
  163     PIXMAN_DITHER_ORDERED_BLUE_NOISE_64,
  164 } pixman_dither_t;
  165 
  166 typedef enum
  167 {
  168     PIXMAN_FILTER_FAST,
  169     PIXMAN_FILTER_GOOD,
  170     PIXMAN_FILTER_BEST,
  171     PIXMAN_FILTER_NEAREST,
  172     PIXMAN_FILTER_BILINEAR,
  173     PIXMAN_FILTER_CONVOLUTION,
  174 
  175     /* The SEPARABLE_CONVOLUTION filter takes the following parameters:
  176      *
  177      *         width:           integer given as 16.16 fixpoint number
  178      *         height:          integer given as 16.16 fixpoint number
  179      *         x_phase_bits:	integer given as 16.16 fixpoint
  180      *         y_phase_bits:	integer given as 16.16 fixpoint
  181      *         xtables:         (1 << x_phase_bits) tables of size width
  182      *         ytables:         (1 << y_phase_bits) tables of size height
  183      *
  184      * When sampling at (x, y), the location is first rounded to one of
  185      * n_x_phases * n_y_phases subpixel positions. These subpixel positions
  186      * determine an xtable and a ytable to use.
  187      *
  188      * Conceptually a width x height matrix is then formed in which each entry
  189      * is the product of the corresponding entries in the x and y tables.
  190      * This matrix is then aligned with the image pixels such that its center
  191      * is as close as possible to the subpixel location chosen earlier. Then
  192      * the image is convolved with the matrix and the resulting pixel returned.
  193      */
  194     PIXMAN_FILTER_SEPARABLE_CONVOLUTION
  195 } pixman_filter_t;
  196 
  197 typedef enum
  198 {
  199     PIXMAN_OP_CLEAR			= 0x00,
  200     PIXMAN_OP_SRC			= 0x01,
  201     PIXMAN_OP_DST			= 0x02,
  202     PIXMAN_OP_OVER			= 0x03,
  203     PIXMAN_OP_OVER_REVERSE		= 0x04,
  204     PIXMAN_OP_IN			= 0x05,
  205     PIXMAN_OP_IN_REVERSE		= 0x06,
  206     PIXMAN_OP_OUT			= 0x07,
  207     PIXMAN_OP_OUT_REVERSE		= 0x08,
  208     PIXMAN_OP_ATOP			= 0x09,
  209     PIXMAN_OP_ATOP_REVERSE		= 0x0a,
  210     PIXMAN_OP_XOR			= 0x0b,
  211     PIXMAN_OP_ADD			= 0x0c,
  212     PIXMAN_OP_SATURATE			= 0x0d,
  213 
  214     PIXMAN_OP_DISJOINT_CLEAR		= 0x10,
  215     PIXMAN_OP_DISJOINT_SRC		= 0x11,
  216     PIXMAN_OP_DISJOINT_DST		= 0x12,
  217     PIXMAN_OP_DISJOINT_OVER		= 0x13,
  218     PIXMAN_OP_DISJOINT_OVER_REVERSE	= 0x14,
  219     PIXMAN_OP_DISJOINT_IN		= 0x15,
  220     PIXMAN_OP_DISJOINT_IN_REVERSE	= 0x16,
  221     PIXMAN_OP_DISJOINT_OUT		= 0x17,
  222     PIXMAN_OP_DISJOINT_OUT_REVERSE	= 0x18,
  223     PIXMAN_OP_DISJOINT_ATOP		= 0x19,
  224     PIXMAN_OP_DISJOINT_ATOP_REVERSE	= 0x1a,
  225     PIXMAN_OP_DISJOINT_XOR		= 0x1b,
  226 
  227     PIXMAN_OP_CONJOINT_CLEAR		= 0x20,
  228     PIXMAN_OP_CONJOINT_SRC		= 0x21,
  229     PIXMAN_OP_CONJOINT_DST		= 0x22,
  230     PIXMAN_OP_CONJOINT_OVER		= 0x23,
  231     PIXMAN_OP_CONJOINT_OVER_REVERSE	= 0x24,
  232     PIXMAN_OP_CONJOINT_IN		= 0x25,
  233     PIXMAN_OP_CONJOINT_IN_REVERSE	= 0x26,
  234     PIXMAN_OP_CONJOINT_OUT		= 0x27,
  235     PIXMAN_OP_CONJOINT_OUT_REVERSE	= 0x28,
  236     PIXMAN_OP_CONJOINT_ATOP		= 0x29,
  237     PIXMAN_OP_CONJOINT_ATOP_REVERSE	= 0x2a,
  238     PIXMAN_OP_CONJOINT_XOR		= 0x2b,
  239 
  240     PIXMAN_OP_MULTIPLY                  = 0x30,
  241     PIXMAN_OP_SCREEN                    = 0x31,
  242     PIXMAN_OP_OVERLAY                   = 0x32,
  243     PIXMAN_OP_DARKEN                    = 0x33,
  244     PIXMAN_OP_LIGHTEN                   = 0x34,
  245     PIXMAN_OP_COLOR_DODGE               = 0x35,
  246     PIXMAN_OP_COLOR_BURN                = 0x36,
  247     PIXMAN_OP_HARD_LIGHT                = 0x37,
  248     PIXMAN_OP_SOFT_LIGHT                = 0x38,
  249     PIXMAN_OP_DIFFERENCE                = 0x39,
  250     PIXMAN_OP_EXCLUSION                 = 0x3a,
  251     PIXMAN_OP_HSL_HUE			= 0x3b,
  252     PIXMAN_OP_HSL_SATURATION		= 0x3c,
  253     PIXMAN_OP_HSL_COLOR			= 0x3d,
  254     PIXMAN_OP_HSL_LUMINOSITY		= 0x3e
  255 
  256 #ifdef PIXMAN_USE_INTERNAL_API
  257     ,
  258     PIXMAN_N_OPERATORS,
  259     PIXMAN_OP_NONE = PIXMAN_N_OPERATORS
  260 #endif
  261 } pixman_op_t;
  262 
  263 /*
  264  * Regions
  265  */
  266 typedef struct pixman_region16_data	pixman_region16_data_t;
  267 typedef struct pixman_box16		pixman_box16_t;
  268 typedef struct pixman_rectangle16	pixman_rectangle16_t;
  269 typedef struct pixman_region16		pixman_region16_t;
  270 
  271 struct pixman_region16_data {
  272     long		size;
  273     long		numRects;
  274 /*  pixman_box16_t	rects[size];   in memory but not explicitly declared */
  275 };
  276 
  277 struct pixman_rectangle16
  278 {
  279     int16_t	x, y;
  280     uint16_t	width, height;
  281 };
  282 
  283 struct pixman_box16
  284 {
  285     int16_t x1, y1, x2, y2;
  286 };
  287 
  288 struct pixman_region16
  289 {
  290     pixman_box16_t          extents;
  291     pixman_region16_data_t *data;
  292 };
  293 
  294 typedef enum
  295 {
  296     PIXMAN_REGION_OUT,
  297     PIXMAN_REGION_IN,
  298     PIXMAN_REGION_PART
  299 } pixman_region_overlap_t;
  300 
  301 /*
  302  * 32 bit regions
  303  */
  304 typedef struct pixman_region32_data	pixman_region32_data_t;
  305 typedef struct pixman_box32		pixman_box32_t;
  306 typedef struct pixman_rectangle32	pixman_rectangle32_t;
  307 typedef struct pixman_region32		pixman_region32_t;
  308 
  309 struct pixman_region32_data {
  310     long		size;
  311     long		numRects;
  312 /*  pixman_box32_t	rects[size];   in memory but not explicitly declared */
  313 };
  314 
  315 struct pixman_rectangle32
  316 {
  317     int32_t x, y;
  318     uint32_t width, height;
  319 };
  320 
  321 struct pixman_box32
  322 {
  323     int32_t x1, y1, x2, y2;
  324 };
  325 
  326 struct pixman_region32
  327 {
  328     pixman_box32_t          extents;
  329     pixman_region32_data_t  *data;
  330 };
  331 
  332 /*
  333  * 64 bit fractional regions
  334  */
  335 typedef struct pixman_region64f_data	pixman_region64f_data_t;
  336 typedef struct pixman_box64f		pixman_box64f_t;
  337 typedef struct pixman_rectangle64f	pixman_rectangle64f_t;
  338 typedef struct pixman_region64f		pixman_region64f_t;
  339 
  340 struct pixman_region64f_data {
  341     long		size;
  342     long		numRects;
  343 /*  pixman_box64f_t	rects[size];   in memory but not explicitly declared */
  344 };
  345 
  346 struct pixman_rectangle64f
  347 {
  348     double x, y;
  349     double width, height;
  350 };
  351 
  352 struct pixman_box64f
  353 {
  354     double x1, y1, x2, y2;
  355 };
  356 
  357 struct pixman_region64f
  358 {
  359     pixman_box64f_t          extents;
  360     pixman_region64f_data_t  *data;
  361 };
  362 
  363 /*
  364  * Images
  365  */
  366 typedef struct pixman_indexed		pixman_indexed_t;
  367 typedef struct pixman_gradient_stop	pixman_gradient_stop_t;
  368 
  369 typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
  370 typedef void     (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
  371 
  372 typedef void     (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data);
  373 
  374 struct pixman_gradient_stop {
  375     pixman_fixed_t x;
  376     pixman_color_t color;
  377 };
  378 
  379 #define PIXMAN_MAX_INDEXED  256 /* XXX depth must be <= 8 */
  380 
  381 #if PIXMAN_MAX_INDEXED <= 256
  382 typedef uint8_t pixman_index_type;
  383 #endif
  384 
  385 struct pixman_indexed
  386 {
  387     pixman_bool_t       color;
  388     uint32_t		rgba[PIXMAN_MAX_INDEXED];
  389     pixman_index_type	ent[32768];
  390 };
  391 
  392 /*
  393  * While the protocol is generous in format support, the
  394  * sample implementation allows only packed RGB and GBR
  395  * representations for data to simplify software rendering,
  396  */
  397 #define PIXMAN_FORMAT(bpp,type,a,r,g,b)	(((bpp) << 24) |  \
  398 					 ((type) << 16) | \
  399 					 ((a) << 12) |	  \
  400 					 ((r) << 8) |	  \
  401 					 ((g) << 4) |	  \
  402 					 ((b)))
  403 
  404 #define PIXMAN_FORMAT_BYTE(bpp,type,a,r,g,b) \
  405 	(((bpp >> 3) << 24) | \
  406 	(3 << 22) | ((type) << 16) | \
  407 	((a >> 3) << 12) | \
  408 	((r >> 3) << 8) | \
  409 	((g >> 3) << 4) | \
  410 	((b >> 3)))
  411 
  412 #define PIXMAN_FORMAT_RESHIFT(val, ofs, num) \
  413 	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  414 
  415 #define PIXMAN_FORMAT_BPP(f)	PIXMAN_FORMAT_RESHIFT(f, 24, 8)
  416 #define PIXMAN_FORMAT_SHIFT(f)	((uint32_t)((f >> 22) & 3))
  417 #define PIXMAN_FORMAT_TYPE(f)	(((f) >> 16) & 0x3f)
  418 #define PIXMAN_FORMAT_A(f)	PIXMAN_FORMAT_RESHIFT(f, 12, 4)
  419 #define PIXMAN_FORMAT_R(f)	PIXMAN_FORMAT_RESHIFT(f, 8, 4)
  420 #define PIXMAN_FORMAT_G(f)	PIXMAN_FORMAT_RESHIFT(f, 4, 4)
  421 #define PIXMAN_FORMAT_B(f)	PIXMAN_FORMAT_RESHIFT(f, 0, 4)
  422 #define PIXMAN_FORMAT_RGB(f)	(((f)      ) & 0xfff)
  423 #define PIXMAN_FORMAT_VIS(f)	(((f)      ) & 0xffff)
  424 #define PIXMAN_FORMAT_DEPTH(f)	(PIXMAN_FORMAT_A(f) +	\
  425 				 PIXMAN_FORMAT_R(f) +	\
  426 				 PIXMAN_FORMAT_G(f) +	\
  427 				 PIXMAN_FORMAT_B(f))
  428 
  429 #define PIXMAN_TYPE_OTHER	0
  430 #define PIXMAN_TYPE_A		1
  431 #define PIXMAN_TYPE_ARGB	2
  432 #define PIXMAN_TYPE_ABGR	3
  433 #define PIXMAN_TYPE_COLOR	4
  434 #define PIXMAN_TYPE_GRAY	5
  435 #define PIXMAN_TYPE_YUY2	6
  436 #define PIXMAN_TYPE_YV12	7
  437 #define PIXMAN_TYPE_BGRA	8
  438 #define PIXMAN_TYPE_RGBA	9
  439 #define PIXMAN_TYPE_ARGB_SRGB	10
  440 #define PIXMAN_TYPE_RGBA_FLOAT	11
  441 
  442 #define PIXMAN_FORMAT_COLOR(f)				\
  443 	(PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB ||	\
  444 	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR ||	\
  445 	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA ||	\
  446 	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA ||	\
  447 	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA_FLOAT)
  448 
  449 typedef enum {
  450 /* 128bpp formats */
  451     PIXMAN_rgba_float =	PIXMAN_FORMAT_BYTE(128,PIXMAN_TYPE_RGBA_FLOAT,32,32,32,32),
  452 /* 96bpp formats */
  453     PIXMAN_rgb_float =	PIXMAN_FORMAT_BYTE(96,PIXMAN_TYPE_RGBA_FLOAT,0,32,32,32),
  454 
  455 /* 64bpp formats */
  456     /* [63:0] A:B:G:R 16:16:16:16 native endian */
  457     PIXMAN_a16b16g16r16 = PIXMAN_FORMAT_BYTE(64,PIXMAN_TYPE_ABGR,16,16,16,16),
  458 
  459 /* 32bpp formats */
  460     PIXMAN_a8r8g8b8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
  461     PIXMAN_x8r8g8b8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
  462     PIXMAN_a8b8g8r8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
  463     PIXMAN_x8b8g8r8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
  464     PIXMAN_b8g8r8a8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
  465     PIXMAN_b8g8r8x8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
  466     PIXMAN_r8g8b8a8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
  467     PIXMAN_r8g8b8x8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
  468     PIXMAN_x14r6g6b6 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
  469     PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
  470     PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
  471     PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
  472     PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
  473 
  474 /* sRGB formats */
  475     PIXMAN_a8r8g8b8_sRGB = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_SRGB,8,8,8,8),
  476     PIXMAN_r8g8b8_sRGB = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB_SRGB,0,8,8,8),
  477 
  478 /* 24bpp formats */
  479     PIXMAN_r8g8b8 =	 PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
  480     PIXMAN_b8g8r8 =	 PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
  481 
  482 /* 16bpp formats */
  483     PIXMAN_r5g6b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
  484     PIXMAN_b5g6r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
  485 
  486     PIXMAN_a1r5g5b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
  487     PIXMAN_x1r5g5b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
  488     PIXMAN_a1b5g5r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
  489     PIXMAN_x1b5g5r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
  490     PIXMAN_a4r4g4b4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
  491     PIXMAN_x4r4g4b4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
  492     PIXMAN_a4b4g4r4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
  493     PIXMAN_x4b4g4r4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
  494 
  495 /* 8bpp formats */
  496     PIXMAN_a8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
  497     PIXMAN_r3g3b2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
  498     PIXMAN_b2g3r3 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
  499     PIXMAN_a2r2g2b2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
  500     PIXMAN_a2b2g2r2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
  501 
  502     PIXMAN_c8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
  503     PIXMAN_g8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
  504 
  505     PIXMAN_x4a4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
  506 
  507     PIXMAN_x4c4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
  508     PIXMAN_x4g4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
  509 
  510 /* 4bpp formats */
  511     PIXMAN_a4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
  512     PIXMAN_r1g2b1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
  513     PIXMAN_b1g2r1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
  514     PIXMAN_a1r1g1b1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
  515     PIXMAN_a1b1g1r1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
  516 
  517     PIXMAN_c4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
  518     PIXMAN_g4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
  519 
  520 /* 1bpp formats */
  521     PIXMAN_a1 =		 PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
  522 
  523     PIXMAN_g1 =		 PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
  524 
  525 /* YUV formats */
  526     PIXMAN_yuy2 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
  527     PIXMAN_yv12 =	 PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
  528 } pixman_format_code_t;
  529 
  530 typedef enum
  531 {
  532     PIXMAN_KERNEL_IMPULSE,
  533     PIXMAN_KERNEL_BOX,
  534     PIXMAN_KERNEL_LINEAR,
  535     PIXMAN_KERNEL_CUBIC,
  536     PIXMAN_KERNEL_GAUSSIAN,
  537     PIXMAN_KERNEL_LANCZOS2,
  538     PIXMAN_KERNEL_LANCZOS3,
  539     PIXMAN_KERNEL_LANCZOS3_STRETCHED       /* Jim Blinn's 'nice' filter */
  540 } pixman_kernel_t;
  541 
  542 /*
  543  * Glyphs
  544  */
  545 typedef struct pixman_glyph_cache_t pixman_glyph_cache_t;
  546 typedef struct
  547 {
  548     int		x, y;
  549     const void *glyph;
  550 } pixman_glyph_t;
  551 
  552 /*
  553  * Trapezoids
  554  */
  555 typedef struct pixman_edge pixman_edge_t;
  556 typedef struct pixman_trapezoid pixman_trapezoid_t;
  557 typedef struct pixman_trap pixman_trap_t;
  558 typedef struct pixman_span_fix pixman_span_fix_t;
  559 typedef struct pixman_triangle pixman_triangle_t;
  560 
  561 /*
  562  * An edge structure.  This represents a single polygon edge
  563  * and can be quickly stepped across small or large gaps in the
  564  * sample grid
  565  */
  566 struct pixman_edge
  567 {
  568     pixman_fixed_t	x;
  569     pixman_fixed_t	e;
  570     pixman_fixed_t	stepx;
  571     pixman_fixed_t	signdx;
  572     pixman_fixed_t	dy;
  573     pixman_fixed_t	dx;
  574 
  575     pixman_fixed_t	stepx_small;
  576     pixman_fixed_t	stepx_big;
  577     pixman_fixed_t	dx_small;
  578     pixman_fixed_t	dx_big;
  579 };
  580 
  581 struct pixman_trapezoid
  582 {
  583     pixman_fixed_t	top, bottom;
  584     pixman_line_fixed_t	left, right;
  585 };
  586 
  587 struct pixman_triangle
  588 {
  589     pixman_point_fixed_t p1, p2, p3;
  590 };
  591 
  592 /* whether 't' is a well defined not obviously empty trapezoid */
  593 #define pixman_trapezoid_valid(t)				   \
  594     ((t)->left.p1.y != (t)->left.p2.y &&			   \
  595      (t)->right.p1.y != (t)->right.p2.y &&			   \
  596      ((t)->bottom > (t)->top))
  597 
  598 struct pixman_span_fix
  599 {
  600     pixman_fixed_t	l, r, y;
  601 };
  602 
  603 struct pixman_trap
  604 {
  605     pixman_span_fix_t	top, bot;
  606 };
  607 
  608 PIXMAN_END_DECLS
  609 
  610 #endif /* LIBRARIES_PIXMAN_H */