Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/pixman-1/pixman.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***********************************************************
0002 
0003 Copyright 1987, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
0026 
0027                         All Rights Reserved
0028 
0029 Permission to use, copy, modify, and distribute this software and its
0030 documentation for any purpose and without fee is hereby granted,
0031 provided that the above copyright notice appear in all copies and that
0032 both that copyright notice and this permission notice appear in
0033 supporting documentation, and that the name of Digital not be
0034 used in advertising or publicity pertaining to distribution of the
0035 software without specific, written prior permission.
0036 
0037 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
0038 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
0039 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
0040 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
0041 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
0042 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
0043 SOFTWARE.
0044 
0045 ******************************************************************/
0046 /*
0047  * Copyright © 1998, 2004 Keith Packard
0048  * Copyright   2007 Red Hat, Inc.
0049  *
0050  * Permission to use, copy, modify, distribute, and sell this software and its
0051  * documentation for any purpose is hereby granted without fee, provided that
0052  * the above copyright notice appear in all copies and that both that
0053  * copyright notice and this permission notice appear in supporting
0054  * documentation, and that the name of Keith Packard not be used in
0055  * advertising or publicity pertaining to distribution of the software without
0056  * specific, written prior permission.  Keith Packard makes no
0057  * representations about the suitability of this software for any purpose.  It
0058  * is provided "as is" without express or implied warranty.
0059  *
0060  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
0061  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
0062  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
0063  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
0064  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
0065  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0066  * PERFORMANCE OF THIS SOFTWARE.
0067  */
0068 
0069 #ifndef PIXMAN_H__
0070 #define PIXMAN_H__
0071 
0072 #include <pixman-version.h>
0073 
0074 #ifdef  __cplusplus
0075 #define PIXMAN_BEGIN_DECLS extern "C" {
0076 #define PIXMAN_END_DECLS }
0077 #else
0078 #define PIXMAN_BEGIN_DECLS
0079 #define PIXMAN_END_DECLS
0080 #endif
0081 
0082 PIXMAN_BEGIN_DECLS
0083 
0084 /*
0085  * Standard integers
0086  */
0087 
0088 #if !defined (PIXMAN_DONT_DEFINE_STDINT)
0089 
0090 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) || defined (__HP_cc)
0091 #  include <inttypes.h>
0092 /* VS 2010 (_MSC_VER 1600) has stdint.h */
0093 #elif defined (_MSC_VER) && _MSC_VER < 1600
0094 typedef __int8 int8_t;
0095 typedef unsigned __int8 uint8_t;
0096 typedef __int16 int16_t;
0097 typedef unsigned __int16 uint16_t;
0098 typedef __int32 int32_t;
0099 typedef unsigned __int32 uint32_t;
0100 typedef __int64 int64_t;
0101 typedef unsigned __int64 uint64_t;
0102 #elif defined (_AIX)
0103 #  include <sys/inttypes.h>
0104 #else
0105 #  include <stdint.h>
0106 #endif
0107 
0108 #endif
0109 
0110 /*
0111  * Boolean
0112  */
0113 typedef int pixman_bool_t;
0114 
0115 /*
0116  * Fixpoint numbers
0117  */
0118 typedef int64_t         pixman_fixed_32_32_t;
0119 typedef pixman_fixed_32_32_t    pixman_fixed_48_16_t;
0120 typedef uint32_t        pixman_fixed_1_31_t;
0121 typedef uint32_t        pixman_fixed_1_16_t;
0122 typedef int32_t         pixman_fixed_16_16_t;
0123 typedef pixman_fixed_16_16_t    pixman_fixed_t;
0124 
0125 #define pixman_fixed_e          ((pixman_fixed_t) 1)
0126 #define pixman_fixed_1          (pixman_int_to_fixed(1))
0127 #define pixman_fixed_1_minus_e      (pixman_fixed_1 - pixman_fixed_e)
0128 #define pixman_fixed_minus_1        (pixman_int_to_fixed(-1))
0129 #define pixman_fixed_to_int(f)      ((int) ((f) >> 16))
0130 #define pixman_int_to_fixed(i)      ((pixman_fixed_t) ((uint32_t) (i) << 16))
0131 #define pixman_fixed_to_double(f)   (double) ((f) / (double) pixman_fixed_1)
0132 #define pixman_double_to_fixed(d)   ((pixman_fixed_t) ((d) * 65536.0))
0133 #define pixman_fixed_frac(f)        ((f) & pixman_fixed_1_minus_e)
0134 #define pixman_fixed_floor(f)       ((f) & ~pixman_fixed_1_minus_e)
0135 #define pixman_fixed_ceil(f)        pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
0136 #define pixman_fixed_fraction(f)    ((f) & pixman_fixed_1_minus_e)
0137 #define pixman_fixed_mod_2(f)       ((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
0138 #define pixman_max_fixed_48_16      ((pixman_fixed_48_16_t) 0x7fffffff)
0139 #define pixman_min_fixed_48_16      (-((pixman_fixed_48_16_t) 1 << 31))
0140 
0141 /*
0142  * Misc structs
0143  */
0144 typedef struct pixman_color pixman_color_t;
0145 typedef struct pixman_point_fixed pixman_point_fixed_t;
0146 typedef struct pixman_line_fixed pixman_line_fixed_t;
0147 typedef struct pixman_vector pixman_vector_t;
0148 typedef struct pixman_transform pixman_transform_t;
0149 
0150 struct pixman_color
0151 {
0152     uint16_t    red;
0153     uint16_t    green;
0154     uint16_t    blue;
0155     uint16_t    alpha;
0156 };
0157 
0158 struct pixman_point_fixed
0159 {
0160     pixman_fixed_t  x;
0161     pixman_fixed_t  y;
0162 };
0163 
0164 struct pixman_line_fixed
0165 {
0166     pixman_point_fixed_t    p1, p2;
0167 };
0168 
0169 /*
0170  * Fixed point matrices
0171  */
0172 
0173 struct pixman_vector
0174 {
0175     pixman_fixed_t  vector[3];
0176 };
0177 
0178 struct pixman_transform
0179 {
0180     pixman_fixed_t  matrix[3][3];
0181 };
0182 
0183 /* forward declaration (sorry) */
0184 struct pixman_box16;
0185 typedef  union pixman_image     pixman_image_t;
0186 
0187 PIXMAN_API
0188 void          pixman_transform_init_identity    (struct pixman_transform       *matrix);
0189 
0190 PIXMAN_API
0191 pixman_bool_t pixman_transform_point_3d         (const struct pixman_transform *transform,
0192                          struct pixman_vector          *vector);
0193 
0194 PIXMAN_API
0195 pixman_bool_t pixman_transform_point            (const struct pixman_transform *transform,
0196                          struct pixman_vector          *vector);
0197 
0198 PIXMAN_API
0199 pixman_bool_t pixman_transform_multiply         (struct pixman_transform       *dst,
0200                          const struct pixman_transform *l,
0201                          const struct pixman_transform *r);
0202 
0203 PIXMAN_API
0204 void          pixman_transform_init_scale       (struct pixman_transform       *t,
0205                          pixman_fixed_t                 sx,
0206                          pixman_fixed_t                 sy);
0207 
0208 PIXMAN_API
0209 pixman_bool_t pixman_transform_scale            (struct pixman_transform       *forward,
0210                          struct pixman_transform       *reverse,
0211                          pixman_fixed_t                 sx,
0212                          pixman_fixed_t                 sy);
0213 
0214 PIXMAN_API
0215 void          pixman_transform_init_rotate      (struct pixman_transform       *t,
0216                          pixman_fixed_t                 cos,
0217                          pixman_fixed_t                 sin);
0218 
0219 PIXMAN_API
0220 pixman_bool_t pixman_transform_rotate           (struct pixman_transform       *forward,
0221                          struct pixman_transform       *reverse,
0222                          pixman_fixed_t                 c,
0223                          pixman_fixed_t                 s);
0224 
0225 PIXMAN_API
0226 void          pixman_transform_init_translate   (struct pixman_transform       *t,
0227                          pixman_fixed_t                 tx,
0228                          pixman_fixed_t                 ty);
0229 
0230 PIXMAN_API
0231 pixman_bool_t pixman_transform_translate        (struct pixman_transform       *forward,
0232                          struct pixman_transform       *reverse,
0233                          pixman_fixed_t                 tx,
0234                          pixman_fixed_t                 ty);
0235 
0236 PIXMAN_API
0237 pixman_bool_t pixman_transform_bounds           (const struct pixman_transform *matrix,
0238                          struct pixman_box16           *b);
0239 
0240 PIXMAN_API
0241 pixman_bool_t pixman_transform_invert           (struct pixman_transform       *dst,
0242                          const struct pixman_transform *src);
0243 
0244 PIXMAN_API
0245 pixman_bool_t pixman_transform_is_identity      (const struct pixman_transform *t);
0246 
0247 PIXMAN_API
0248 pixman_bool_t pixman_transform_is_scale         (const struct pixman_transform *t);
0249 
0250 PIXMAN_API
0251 pixman_bool_t pixman_transform_is_int_translate (const struct pixman_transform *t);
0252 
0253 PIXMAN_API
0254 pixman_bool_t pixman_transform_is_inverse       (const struct pixman_transform *a,
0255                          const struct pixman_transform *b);
0256 
0257 /*
0258  * Floating point matrices
0259  */
0260 typedef struct pixman_f_transform pixman_f_transform_t;
0261 typedef struct pixman_f_vector pixman_f_vector_t;
0262 
0263 struct pixman_f_vector
0264 {
0265     double  v[3];
0266 };
0267 
0268 struct pixman_f_transform
0269 {
0270     double  m[3][3];
0271 };
0272 
0273 
0274 PIXMAN_API
0275 pixman_bool_t pixman_transform_from_pixman_f_transform (struct pixman_transform         *t,
0276                             const struct pixman_f_transform *ft);
0277 
0278 PIXMAN_API
0279 void          pixman_f_transform_from_pixman_transform (struct pixman_f_transform       *ft,
0280                             const struct pixman_transform   *t);
0281 
0282 PIXMAN_API
0283 pixman_bool_t pixman_f_transform_invert                (struct pixman_f_transform       *dst,
0284                             const struct pixman_f_transform *src);
0285 
0286 PIXMAN_API
0287 pixman_bool_t pixman_f_transform_point                 (const struct pixman_f_transform *t,
0288                             struct pixman_f_vector          *v);
0289 
0290 PIXMAN_API
0291 void          pixman_f_transform_point_3d              (const struct pixman_f_transform *t,
0292                             struct pixman_f_vector          *v);
0293 
0294 PIXMAN_API
0295 void          pixman_f_transform_multiply              (struct pixman_f_transform       *dst,
0296                             const struct pixman_f_transform *l,
0297                             const struct pixman_f_transform *r);
0298 
0299 PIXMAN_API
0300 void          pixman_f_transform_init_scale            (struct pixman_f_transform       *t,
0301                             double                           sx,
0302                             double                           sy);
0303 
0304 PIXMAN_API
0305 pixman_bool_t pixman_f_transform_scale                 (struct pixman_f_transform       *forward,
0306                             struct pixman_f_transform       *reverse,
0307                             double                           sx,
0308                             double                           sy);
0309 
0310 PIXMAN_API
0311 void          pixman_f_transform_init_rotate           (struct pixman_f_transform       *t,
0312                             double                           cos,
0313                             double                           sin);
0314 
0315 PIXMAN_API
0316 pixman_bool_t pixman_f_transform_rotate                (struct pixman_f_transform       *forward,
0317                             struct pixman_f_transform       *reverse,
0318                             double                           c,
0319                             double                           s);
0320 
0321 PIXMAN_API
0322 void          pixman_f_transform_init_translate        (struct pixman_f_transform       *t,
0323                             double                           tx,
0324                             double                           ty);
0325 
0326 PIXMAN_API
0327 pixman_bool_t pixman_f_transform_translate             (struct pixman_f_transform       *forward,
0328                             struct pixman_f_transform       *reverse,
0329                             double                           tx,
0330                             double                           ty);
0331 
0332 PIXMAN_API
0333 pixman_bool_t pixman_f_transform_bounds                (const struct pixman_f_transform *t,
0334                             struct pixman_box16             *b);
0335 
0336 PIXMAN_API
0337 void          pixman_f_transform_init_identity         (struct pixman_f_transform       *t);
0338 
0339 typedef enum
0340 {
0341     PIXMAN_REPEAT_NONE,
0342     PIXMAN_REPEAT_NORMAL,
0343     PIXMAN_REPEAT_PAD,
0344     PIXMAN_REPEAT_REFLECT
0345 } pixman_repeat_t;
0346 
0347 typedef enum
0348 {
0349     PIXMAN_DITHER_NONE,
0350     PIXMAN_DITHER_FAST,
0351     PIXMAN_DITHER_GOOD,
0352     PIXMAN_DITHER_BEST,
0353     PIXMAN_DITHER_ORDERED_BAYER_8,
0354     PIXMAN_DITHER_ORDERED_BLUE_NOISE_64,
0355 } pixman_dither_t;
0356 
0357 typedef enum
0358 {
0359     PIXMAN_FILTER_FAST,
0360     PIXMAN_FILTER_GOOD,
0361     PIXMAN_FILTER_BEST,
0362     PIXMAN_FILTER_NEAREST,
0363     PIXMAN_FILTER_BILINEAR,
0364     PIXMAN_FILTER_CONVOLUTION,
0365 
0366     /* The SEPARABLE_CONVOLUTION filter takes the following parameters:
0367      *
0368      *         width:           integer given as 16.16 fixpoint number
0369      *         height:          integer given as 16.16 fixpoint number
0370      *         x_phase_bits:    integer given as 16.16 fixpoint
0371      *         y_phase_bits:    integer given as 16.16 fixpoint
0372      *         xtables:         (1 << x_phase_bits) tables of size width
0373      *         ytables:         (1 << y_phase_bits) tables of size height
0374      *
0375      * When sampling at (x, y), the location is first rounded to one of
0376      * n_x_phases * n_y_phases subpixel positions. These subpixel positions
0377      * determine an xtable and a ytable to use.
0378      *
0379      * Conceptually a width x height matrix is then formed in which each entry
0380      * is the product of the corresponding entries in the x and y tables.
0381      * This matrix is then aligned with the image pixels such that its center
0382      * is as close as possible to the subpixel location chosen earlier. Then
0383      * the image is convolved with the matrix and the resulting pixel returned.
0384      */
0385     PIXMAN_FILTER_SEPARABLE_CONVOLUTION
0386 } pixman_filter_t;
0387 
0388 typedef enum
0389 {
0390     PIXMAN_OP_CLEAR         = 0x00,
0391     PIXMAN_OP_SRC           = 0x01,
0392     PIXMAN_OP_DST           = 0x02,
0393     PIXMAN_OP_OVER          = 0x03,
0394     PIXMAN_OP_OVER_REVERSE      = 0x04,
0395     PIXMAN_OP_IN            = 0x05,
0396     PIXMAN_OP_IN_REVERSE        = 0x06,
0397     PIXMAN_OP_OUT           = 0x07,
0398     PIXMAN_OP_OUT_REVERSE       = 0x08,
0399     PIXMAN_OP_ATOP          = 0x09,
0400     PIXMAN_OP_ATOP_REVERSE      = 0x0a,
0401     PIXMAN_OP_XOR           = 0x0b,
0402     PIXMAN_OP_ADD           = 0x0c,
0403     PIXMAN_OP_SATURATE          = 0x0d,
0404 
0405     PIXMAN_OP_DISJOINT_CLEAR        = 0x10,
0406     PIXMAN_OP_DISJOINT_SRC      = 0x11,
0407     PIXMAN_OP_DISJOINT_DST      = 0x12,
0408     PIXMAN_OP_DISJOINT_OVER     = 0x13,
0409     PIXMAN_OP_DISJOINT_OVER_REVERSE = 0x14,
0410     PIXMAN_OP_DISJOINT_IN       = 0x15,
0411     PIXMAN_OP_DISJOINT_IN_REVERSE   = 0x16,
0412     PIXMAN_OP_DISJOINT_OUT      = 0x17,
0413     PIXMAN_OP_DISJOINT_OUT_REVERSE  = 0x18,
0414     PIXMAN_OP_DISJOINT_ATOP     = 0x19,
0415     PIXMAN_OP_DISJOINT_ATOP_REVERSE = 0x1a,
0416     PIXMAN_OP_DISJOINT_XOR      = 0x1b,
0417 
0418     PIXMAN_OP_CONJOINT_CLEAR        = 0x20,
0419     PIXMAN_OP_CONJOINT_SRC      = 0x21,
0420     PIXMAN_OP_CONJOINT_DST      = 0x22,
0421     PIXMAN_OP_CONJOINT_OVER     = 0x23,
0422     PIXMAN_OP_CONJOINT_OVER_REVERSE = 0x24,
0423     PIXMAN_OP_CONJOINT_IN       = 0x25,
0424     PIXMAN_OP_CONJOINT_IN_REVERSE   = 0x26,
0425     PIXMAN_OP_CONJOINT_OUT      = 0x27,
0426     PIXMAN_OP_CONJOINT_OUT_REVERSE  = 0x28,
0427     PIXMAN_OP_CONJOINT_ATOP     = 0x29,
0428     PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a,
0429     PIXMAN_OP_CONJOINT_XOR      = 0x2b,
0430 
0431     PIXMAN_OP_MULTIPLY                  = 0x30,
0432     PIXMAN_OP_SCREEN                    = 0x31,
0433     PIXMAN_OP_OVERLAY                   = 0x32,
0434     PIXMAN_OP_DARKEN                    = 0x33,
0435     PIXMAN_OP_LIGHTEN                   = 0x34,
0436     PIXMAN_OP_COLOR_DODGE               = 0x35,
0437     PIXMAN_OP_COLOR_BURN                = 0x36,
0438     PIXMAN_OP_HARD_LIGHT                = 0x37,
0439     PIXMAN_OP_SOFT_LIGHT                = 0x38,
0440     PIXMAN_OP_DIFFERENCE                = 0x39,
0441     PIXMAN_OP_EXCLUSION                 = 0x3a,
0442     PIXMAN_OP_HSL_HUE           = 0x3b,
0443     PIXMAN_OP_HSL_SATURATION        = 0x3c,
0444     PIXMAN_OP_HSL_COLOR         = 0x3d,
0445     PIXMAN_OP_HSL_LUMINOSITY        = 0x3e
0446 
0447 #ifdef PIXMAN_USE_INTERNAL_API
0448     ,
0449     PIXMAN_N_OPERATORS,
0450     PIXMAN_OP_NONE = PIXMAN_N_OPERATORS
0451 #endif
0452 } pixman_op_t;
0453 
0454 /*
0455  * Regions
0456  */
0457 typedef struct pixman_region16_data pixman_region16_data_t;
0458 typedef struct pixman_box16     pixman_box16_t;
0459 typedef struct pixman_rectangle16   pixman_rectangle16_t;
0460 typedef struct pixman_region16      pixman_region16_t;
0461 
0462 struct pixman_region16_data {
0463     long        size;
0464     long        numRects;
0465 /*  pixman_box16_t  rects[size];   in memory but not explicitly declared */
0466 };
0467 
0468 struct pixman_rectangle16
0469 {
0470     int16_t x, y;
0471     uint16_t    width, height;
0472 };
0473 
0474 struct pixman_box16
0475 {
0476     int16_t x1, y1, x2, y2;
0477 };
0478 
0479 struct pixman_region16
0480 {
0481     pixman_box16_t          extents;
0482     pixman_region16_data_t *data;
0483 };
0484 
0485 typedef enum
0486 {
0487     PIXMAN_REGION_OUT,
0488     PIXMAN_REGION_IN,
0489     PIXMAN_REGION_PART
0490 } pixman_region_overlap_t;
0491 
0492 /* This function exists only to make it possible to preserve
0493  * the X ABI - it should go away at first opportunity.
0494  */
0495 PIXMAN_API
0496 void pixman_region_set_static_pointers (pixman_box16_t         *empty_box,
0497                     pixman_region16_data_t *empty_data,
0498                     pixman_region16_data_t *broken_data);
0499 
0500 /* creation/destruction */
0501 PIXMAN_API
0502 void                    pixman_region_init               (pixman_region16_t *region);
0503 
0504 PIXMAN_API
0505 void                    pixman_region_init_rect          (pixman_region16_t *region,
0506                               int                x,
0507                               int                y,
0508                               unsigned int       width,
0509                               unsigned int       height);
0510 
0511 PIXMAN_API
0512 pixman_bool_t           pixman_region_init_rects         (pixman_region16_t *region,
0513                               const pixman_box16_t *boxes,
0514                               int                count);
0515 
0516 PIXMAN_API
0517 void                    pixman_region_init_with_extents  (pixman_region16_t    *region,
0518                               const pixman_box16_t *extents);
0519 
0520 PIXMAN_API
0521 void                    pixman_region_init_from_image    (pixman_region16_t *region,
0522                               pixman_image_t    *image);
0523 
0524 PIXMAN_API
0525 void                    pixman_region_fini               (pixman_region16_t *region);
0526 
0527 
0528 /* manipulation */
0529 PIXMAN_API
0530 void                    pixman_region_translate          (pixman_region16_t *region,
0531                               int                x,
0532                               int                y);
0533 
0534 PIXMAN_API
0535 pixman_bool_t           pixman_region_copy               (pixman_region16_t       *dest,
0536                               const pixman_region16_t *source);
0537 
0538 PIXMAN_API
0539 pixman_bool_t           pixman_region_intersect          (pixman_region16_t       *new_reg,
0540                               const pixman_region16_t *reg1,
0541                               const pixman_region16_t *reg2);
0542 
0543 PIXMAN_API
0544 pixman_bool_t           pixman_region_union              (pixman_region16_t       *new_reg,
0545                               const pixman_region16_t *reg1,
0546                               const pixman_region16_t *reg2);
0547 
0548 PIXMAN_API
0549 pixman_bool_t           pixman_region_union_rect         (pixman_region16_t       *dest,
0550                               const pixman_region16_t *source,
0551                               int                     x,
0552                               int                     y,
0553                               unsigned int            width,
0554                               unsigned int            height);
0555 
0556 PIXMAN_API
0557 pixman_bool_t       pixman_region_intersect_rect     (pixman_region16_t       *dest,
0558                               const pixman_region16_t *source,
0559                               int                      x,
0560                               int                      y,
0561                               unsigned int             width,
0562                               unsigned int             height);
0563 
0564 PIXMAN_API
0565 pixman_bool_t           pixman_region_subtract           (pixman_region16_t       *reg_d,
0566                               const pixman_region16_t *reg_m,
0567                               const pixman_region16_t *reg_s);
0568 
0569 PIXMAN_API
0570 pixman_bool_t           pixman_region_inverse            (pixman_region16_t       *new_reg,
0571                               const pixman_region16_t *reg1,
0572                               const pixman_box16_t    *inv_rect);
0573 
0574 PIXMAN_API
0575 pixman_bool_t           pixman_region_contains_point     (const pixman_region16_t *region,
0576                               int                      x,
0577                               int                      y,
0578                               pixman_box16_t          *box);
0579 
0580 PIXMAN_API
0581 pixman_region_overlap_t pixman_region_contains_rectangle (const pixman_region16_t *region,
0582                               const pixman_box16_t    *prect);
0583 
0584 PIXMAN_API
0585 pixman_bool_t           pixman_region_empty              (const pixman_region16_t *region);
0586 
0587 PIXMAN_API
0588 pixman_bool_t           pixman_region_not_empty          (const pixman_region16_t *region);
0589 
0590 PIXMAN_API
0591 pixman_box16_t *        pixman_region_extents            (const pixman_region16_t *region);
0592 
0593 PIXMAN_API
0594 int                     pixman_region_n_rects            (const pixman_region16_t *region);
0595 
0596 PIXMAN_API
0597 pixman_box16_t *        pixman_region_rectangles         (const pixman_region16_t *region,
0598                               int                     *n_rects);
0599 
0600 PIXMAN_API
0601 pixman_bool_t           pixman_region_equal              (const pixman_region16_t *region1,
0602                               const pixman_region16_t *region2);
0603 
0604 PIXMAN_API
0605 pixman_bool_t           pixman_region_selfcheck          (pixman_region16_t *region);
0606 
0607 PIXMAN_API
0608 void                    pixman_region_reset              (pixman_region16_t       *region,
0609                               const pixman_box16_t    *box);
0610 
0611 PIXMAN_API
0612 void            pixman_region_clear      (pixman_region16_t *region);
0613 /*
0614  * 32 bit regions
0615  */
0616 typedef struct pixman_region32_data pixman_region32_data_t;
0617 typedef struct pixman_box32     pixman_box32_t;
0618 typedef struct pixman_rectangle32   pixman_rectangle32_t;
0619 typedef struct pixman_region32      pixman_region32_t;
0620 
0621 struct pixman_region32_data {
0622     long        size;
0623     long        numRects;
0624 /*  pixman_box32_t  rects[size];   in memory but not explicitly declared */
0625 };
0626 
0627 struct pixman_rectangle32
0628 {
0629     int32_t x, y;
0630     uint32_t width, height;
0631 };
0632 
0633 struct pixman_box32
0634 {
0635     int32_t x1, y1, x2, y2;
0636 };
0637 
0638 struct pixman_region32
0639 {
0640     pixman_box32_t          extents;
0641     pixman_region32_data_t  *data;
0642 };
0643 
0644 /* creation/destruction */
0645 PIXMAN_API
0646 void                    pixman_region32_init               (pixman_region32_t *region);
0647 
0648 PIXMAN_API
0649 void                    pixman_region32_init_rect          (pixman_region32_t *region,
0650                                 int                x,
0651                                 int                y,
0652                                 unsigned int       width,
0653                                 unsigned int       height);
0654 
0655 PIXMAN_API
0656 pixman_bool_t           pixman_region32_init_rects         (pixman_region32_t *region,
0657                                 const pixman_box32_t *boxes,
0658                                 int                count);
0659 
0660 PIXMAN_API
0661 void                    pixman_region32_init_with_extents  (pixman_region32_t    *region,
0662                                 const pixman_box32_t *extents);
0663 
0664 PIXMAN_API
0665 void                    pixman_region32_init_from_image    (pixman_region32_t *region,
0666                                 pixman_image_t    *image);
0667 
0668 PIXMAN_API
0669 void                    pixman_region32_fini               (pixman_region32_t *region);
0670 
0671 
0672 /* manipulation */
0673 PIXMAN_API
0674 void                    pixman_region32_translate          (pixman_region32_t *region,
0675                                 int                x,
0676                                 int                y);
0677 
0678 PIXMAN_API
0679 pixman_bool_t           pixman_region32_copy               (pixman_region32_t       *dest,
0680                                 const pixman_region32_t *source);
0681 
0682 PIXMAN_API
0683 pixman_bool_t           pixman_region32_intersect          (pixman_region32_t       *new_reg,
0684                                 const pixman_region32_t *reg1,
0685                                 const pixman_region32_t *reg2);
0686 
0687 PIXMAN_API
0688 pixman_bool_t           pixman_region32_union              (pixman_region32_t       *new_reg,
0689                                 const pixman_region32_t *reg1,
0690                                 const pixman_region32_t *reg2);
0691 
0692 PIXMAN_API
0693 pixman_bool_t       pixman_region32_intersect_rect     (pixman_region32_t       *dest,
0694                                 const pixman_region32_t *source,
0695                                 int                      x,
0696                                 int                      y,
0697                                 unsigned int             width,
0698                                 unsigned int             height);
0699 
0700 PIXMAN_API
0701 pixman_bool_t           pixman_region32_union_rect         (pixman_region32_t       *dest,
0702                                 const pixman_region32_t *source,
0703                                 int                      x,
0704                                 int                      y,
0705                                 unsigned int             width,
0706                                 unsigned int             height);
0707 
0708 PIXMAN_API
0709 pixman_bool_t           pixman_region32_subtract           (pixman_region32_t       *reg_d,
0710                                 const pixman_region32_t *reg_m,
0711                                 const pixman_region32_t *reg_s);
0712 
0713 PIXMAN_API
0714 pixman_bool_t           pixman_region32_inverse            (pixman_region32_t       *new_reg,
0715                                 const pixman_region32_t *reg1,
0716                                 const pixman_box32_t    *inv_rect);
0717 
0718 PIXMAN_API
0719 pixman_bool_t           pixman_region32_contains_point     (const pixman_region32_t *region,
0720                                 int                      x,
0721                                 int                      y,
0722                                 pixman_box32_t          *box);
0723 
0724 PIXMAN_API
0725 pixman_region_overlap_t pixman_region32_contains_rectangle (const pixman_region32_t *region,
0726                                 const pixman_box32_t    *prect);
0727 
0728 PIXMAN_API
0729 pixman_bool_t           pixman_region32_empty              (const pixman_region32_t *region);
0730 
0731 PIXMAN_API
0732 pixman_bool_t           pixman_region32_not_empty          (const pixman_region32_t *region);
0733 
0734 PIXMAN_API
0735 pixman_box32_t *        pixman_region32_extents            (const pixman_region32_t *region);
0736 
0737 PIXMAN_API
0738 int                     pixman_region32_n_rects            (const pixman_region32_t *region);
0739 
0740 PIXMAN_API
0741 pixman_box32_t *        pixman_region32_rectangles         (const pixman_region32_t *region,
0742                                 int                     *n_rects);
0743 
0744 PIXMAN_API
0745 pixman_bool_t           pixman_region32_equal              (const pixman_region32_t *region1,
0746                                 const pixman_region32_t *region2);
0747 
0748 PIXMAN_API
0749 pixman_bool_t           pixman_region32_selfcheck          (pixman_region32_t *region);
0750 
0751 PIXMAN_API
0752 void                    pixman_region32_reset              (pixman_region32_t    *region,
0753                                 const pixman_box32_t *box);
0754 
0755 PIXMAN_API
0756 void            pixman_region32_clear          (pixman_region32_t *region);
0757 /*
0758  * 64 bit fractional regions
0759  */
0760 typedef struct pixman_region64f_data    pixman_region64f_data_t;
0761 typedef struct pixman_box64f        pixman_box64f_t;
0762 typedef struct pixman_rectangle64f  pixman_rectangle64f_t;
0763 typedef struct pixman_region64f     pixman_region64f_t;
0764 
0765 struct pixman_region64f_data {
0766     long        size;
0767     long        numRects;
0768 /*  pixman_box64f_t rects[size];   in memory but not explicitly declared */
0769 };
0770 
0771 struct pixman_rectangle64f
0772 {
0773     double x, y;
0774     double width, height;
0775 };
0776 
0777 struct pixman_box64f
0778 {
0779     double x1, y1, x2, y2;
0780 };
0781 
0782 struct pixman_region64f
0783 {
0784     pixman_box64f_t          extents;
0785     pixman_region64f_data_t  *data;
0786 };
0787 
0788 /* creation/destruction */
0789 PIXMAN_API
0790 void                    pixman_region64f_init              (pixman_region64f_t *region);
0791 
0792 PIXMAN_API
0793 void                    pixman_region64f_init_rect         (pixman_region64f_t *region,
0794                                 int                 x,
0795                                 int                 y,
0796                                 unsigned int        width,
0797                                 unsigned int        height);
0798 
0799 PIXMAN_API
0800 void                    pixman_region64f_init_rectf        (pixman_region64f_t *region,
0801                                 double              x,
0802                                 double              y,
0803                                 double              width,
0804                                 double              height);
0805 
0806 PIXMAN_API
0807 pixman_bool_t           pixman_region64f_init_rects        (pixman_region64f_t *region,
0808                                 const pixman_box64f_t *boxes,
0809                                 int                 count);
0810 
0811 PIXMAN_API
0812 void                    pixman_region64f_init_with_extents (pixman_region64f_t    *region,
0813                                 const pixman_box64f_t *extents);
0814 
0815 PIXMAN_API
0816 void                    pixman_region64f_init_from_image   (pixman_region64f_t *region,
0817                                 pixman_image_t     *image);
0818 
0819 PIXMAN_API
0820 void                    pixman_region64f_fini              (pixman_region64f_t *region);
0821 
0822 
0823 /* manipulation */
0824 PIXMAN_API
0825 void                    pixman_region64f_translate         (pixman_region64f_t *region,
0826                                 int                 x,
0827                                 int                 y);
0828 
0829 PIXMAN_API
0830 void                    pixman_region64f_translatef        (pixman_region64f_t *region,
0831                                 double              x,
0832                                 double              y);
0833 
0834 PIXMAN_API
0835 pixman_bool_t           pixman_region64f_copy              (pixman_region64f_t       *dest,
0836                                 const pixman_region64f_t *source);
0837 
0838 PIXMAN_API
0839 pixman_bool_t           pixman_region64f_intersect         (pixman_region64f_t       *new_reg,
0840                                 const pixman_region64f_t *reg1,
0841                                 const pixman_region64f_t *reg2);
0842 
0843 PIXMAN_API
0844 pixman_bool_t           pixman_region64f_union             (pixman_region64f_t       *new_reg,
0845                                 const pixman_region64f_t *reg1,
0846                                 const pixman_region64f_t *reg2);
0847 
0848 PIXMAN_API
0849 pixman_bool_t       pixman_region64f_intersect_rect    (pixman_region64f_t       *dest,
0850                                 const pixman_region64f_t *source,
0851                                 int                       x,
0852                                 int                       y,
0853                                 unsigned int              width,
0854                                 unsigned int              height);
0855 
0856 PIXMAN_API
0857 pixman_bool_t       pixman_region64f_intersect_rectf   (pixman_region64f_t       *dest,
0858                                 const pixman_region64f_t *source,
0859                                 double                    x,
0860                                 double                    y,
0861                                 double                    width,
0862                                 double                    height);
0863 
0864 PIXMAN_API
0865 pixman_bool_t           pixman_region64f_union_rect        (pixman_region64f_t       *dest,
0866                                 const pixman_region64f_t *source,
0867                                 int                       x,
0868                                 int                       y,
0869                                 unsigned int              width,
0870                                 unsigned int              height);
0871 
0872 PIXMAN_API
0873 pixman_bool_t           pixman_region64f_union_rectf       (pixman_region64f_t       *dest,
0874                                 const pixman_region64f_t *source,
0875                                 double                    x,
0876                                 double                    y,
0877                                 double                    width,
0878                                 double                    height);
0879 
0880 PIXMAN_API
0881 pixman_bool_t           pixman_region64f_subtract          (pixman_region64f_t       *reg_d,
0882                                 const pixman_region64f_t *reg_m,
0883                                 const pixman_region64f_t *reg_s);
0884 
0885 PIXMAN_API
0886 pixman_bool_t           pixman_region64f_inverse           (pixman_region64f_t       *new_reg,
0887                                 const pixman_region64f_t *reg1,
0888                                 const pixman_box64f_t    *inv_rect);
0889 
0890 PIXMAN_API
0891 pixman_bool_t           pixman_region64f_contains_point    (const pixman_region64f_t *region,
0892                                 int                       x,
0893                                 int                       y,
0894                                 pixman_box64f_t          *box);
0895 
0896 PIXMAN_API
0897 pixman_bool_t           pixman_region64f_contains_pointf   (const pixman_region64f_t *region,
0898                                 double                    x,
0899                                 double                    y,
0900                                 pixman_box64f_t          *box);
0901 
0902 PIXMAN_API
0903 pixman_region_overlap_t pixman_region64f_contains_rectangle(const pixman_region64f_t *region,
0904                                 const pixman_box64f_t    *prect);
0905 
0906 PIXMAN_API
0907 pixman_bool_t           pixman_region64f_empty             (const pixman_region64f_t *region);
0908 
0909 PIXMAN_API
0910 pixman_bool_t           pixman_region64f_not_empty         (const pixman_region64f_t *region);
0911 
0912 PIXMAN_API
0913 pixman_box64f_t *       pixman_region64f_extents           (const pixman_region64f_t *region);
0914 
0915 PIXMAN_API
0916 int                     pixman_region64f_n_rects           (const pixman_region64f_t *region);
0917 
0918 PIXMAN_API
0919 pixman_box64f_t *       pixman_region64f_rectangles        (const pixman_region64f_t *region,
0920                                 int                      *n_rects);
0921 
0922 PIXMAN_API
0923 pixman_bool_t           pixman_region64f_equal             (const pixman_region64f_t *region1,
0924                                 const pixman_region64f_t *region2);
0925 
0926 PIXMAN_API
0927 pixman_bool_t           pixman_region64f_selfcheck         (pixman_region64f_t *region);
0928 
0929 PIXMAN_API
0930 void                    pixman_region64f_reset             (pixman_region64f_t    *region,
0931                                 const pixman_box64f_t *box);
0932 
0933 PIXMAN_API
0934 void            pixman_region64f_clear         (pixman_region64f_t *region);
0935 
0936 
0937 /* Copy / Fill / Misc */
0938 PIXMAN_API
0939 pixman_bool_t pixman_blt                (uint32_t           *src_bits,
0940                      uint32_t           *dst_bits,
0941                      int                 src_stride,
0942                      int                 dst_stride,
0943                      int                 src_bpp,
0944                      int                 dst_bpp,
0945                      int                 src_x,
0946                      int                 src_y,
0947                      int                 dest_x,
0948                      int                 dest_y,
0949                      int                 width,
0950                      int                 height);
0951 
0952 PIXMAN_API
0953 pixman_bool_t pixman_fill               (uint32_t           *bits,
0954                      int                 stride,
0955                      int                 bpp,
0956                      int                 x,
0957                      int                 y,
0958                      int                 width,
0959                      int                 height,
0960                      uint32_t            _xor);
0961 
0962 
0963 PIXMAN_API
0964 int           pixman_version            (void);
0965 
0966 PIXMAN_API
0967 const char*   pixman_version_string     (void);
0968 
0969 /*
0970  * Images
0971  */
0972 typedef struct pixman_indexed       pixman_indexed_t;
0973 typedef struct pixman_gradient_stop pixman_gradient_stop_t;
0974 
0975 typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
0976 typedef void     (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
0977 
0978 typedef void     (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data);
0979 
0980 struct pixman_gradient_stop {
0981     pixman_fixed_t x;
0982     pixman_color_t color;
0983 };
0984 
0985 #define PIXMAN_MAX_INDEXED  256 /* XXX depth must be <= 8 */
0986 
0987 #if PIXMAN_MAX_INDEXED <= 256
0988 typedef uint8_t pixman_index_type;
0989 #endif
0990 
0991 struct pixman_indexed
0992 {
0993     pixman_bool_t       color;
0994     uint32_t        rgba[PIXMAN_MAX_INDEXED];
0995     pixman_index_type   ent[32768];
0996 };
0997 
0998 /*
0999  * While the protocol is generous in format support, the
1000  * sample implementation allows only packed RGB and GBR
1001  * representations for data to simplify software rendering,
1002  */
1003 #define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) |  \
1004                      ((type) << 16) | \
1005                      ((a) << 12) |    \
1006                      ((r) << 8) |     \
1007                      ((g) << 4) |     \
1008                      ((b)))
1009 
1010 #define PIXMAN_FORMAT_BYTE(bpp,type,a,r,g,b) \
1011     (((bpp >> 3) << 24) | \
1012     (3 << 22) | ((type) << 16) | \
1013     ((a >> 3) << 12) | \
1014     ((r >> 3) << 8) | \
1015     ((g >> 3) << 4) | \
1016     ((b >> 3)))
1017 
1018 #define PIXMAN_FORMAT_RESHIFT(val, ofs, num) \
1019     (((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
1020 
1021 #define PIXMAN_FORMAT_BPP(f)    PIXMAN_FORMAT_RESHIFT(f, 24, 8)
1022 #define PIXMAN_FORMAT_SHIFT(f)  ((uint32_t)((f >> 22) & 3))
1023 #define PIXMAN_FORMAT_TYPE(f)   (((f) >> 16) & 0x3f)
1024 #define PIXMAN_FORMAT_A(f)  PIXMAN_FORMAT_RESHIFT(f, 12, 4)
1025 #define PIXMAN_FORMAT_R(f)  PIXMAN_FORMAT_RESHIFT(f, 8, 4)
1026 #define PIXMAN_FORMAT_G(f)  PIXMAN_FORMAT_RESHIFT(f, 4, 4)
1027 #define PIXMAN_FORMAT_B(f)  PIXMAN_FORMAT_RESHIFT(f, 0, 4)
1028 #define PIXMAN_FORMAT_RGB(f)    (((f)      ) & 0xfff)
1029 #define PIXMAN_FORMAT_VIS(f)    (((f)      ) & 0xffff)
1030 #define PIXMAN_FORMAT_DEPTH(f)  (PIXMAN_FORMAT_A(f) +   \
1031                  PIXMAN_FORMAT_R(f) +   \
1032                  PIXMAN_FORMAT_G(f) +   \
1033                  PIXMAN_FORMAT_B(f))
1034 
1035 #define PIXMAN_TYPE_OTHER   0
1036 #define PIXMAN_TYPE_A       1
1037 #define PIXMAN_TYPE_ARGB    2
1038 #define PIXMAN_TYPE_ABGR    3
1039 #define PIXMAN_TYPE_COLOR   4
1040 #define PIXMAN_TYPE_GRAY    5
1041 #define PIXMAN_TYPE_YUY2    6
1042 #define PIXMAN_TYPE_YV12    7
1043 #define PIXMAN_TYPE_BGRA    8
1044 #define PIXMAN_TYPE_RGBA    9
1045 #define PIXMAN_TYPE_ARGB_SRGB   10
1046 #define PIXMAN_TYPE_RGBA_FLOAT  11
1047 
1048 #define PIXMAN_FORMAT_COLOR(f)              \
1049     (PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB ||   \
1050      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR ||   \
1051      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA ||   \
1052      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA ||   \
1053      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA_FLOAT)
1054 
1055 typedef enum {
1056 /* 128bpp formats */
1057     PIXMAN_rgba_float = PIXMAN_FORMAT_BYTE(128,PIXMAN_TYPE_RGBA_FLOAT,32,32,32,32),
1058 /* 96bpp formats */
1059     PIXMAN_rgb_float =  PIXMAN_FORMAT_BYTE(96,PIXMAN_TYPE_RGBA_FLOAT,0,32,32,32),
1060 
1061 /* 64bpp formats */
1062     /* [63:0] A:B:G:R 16:16:16:16 native endian */
1063     PIXMAN_a16b16g16r16 = PIXMAN_FORMAT_BYTE(64,PIXMAN_TYPE_ABGR,16,16,16,16),
1064 
1065 /* 32bpp formats */
1066     PIXMAN_a8r8g8b8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
1067     PIXMAN_x8r8g8b8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
1068     PIXMAN_a8b8g8r8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
1069     PIXMAN_x8b8g8r8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
1070     PIXMAN_b8g8r8a8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
1071     PIXMAN_b8g8r8x8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
1072     PIXMAN_r8g8b8a8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
1073     PIXMAN_r8g8b8x8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
1074     PIXMAN_x14r6g6b6 =   PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
1075     PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
1076     PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
1077     PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
1078     PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
1079 
1080 /* sRGB formats */
1081     PIXMAN_a8r8g8b8_sRGB = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_SRGB,8,8,8,8),
1082     PIXMAN_r8g8b8_sRGB = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB_SRGB,0,8,8,8),
1083 
1084 /* 24bpp formats */
1085     PIXMAN_r8g8b8 =  PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
1086     PIXMAN_b8g8r8 =  PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
1087 
1088 /* 16bpp formats */
1089     PIXMAN_r5g6b5 =  PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
1090     PIXMAN_b5g6r5 =  PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
1091 
1092     PIXMAN_a1r5g5b5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
1093     PIXMAN_x1r5g5b5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
1094     PIXMAN_a1b5g5r5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
1095     PIXMAN_x1b5g5r5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
1096     PIXMAN_a4r4g4b4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
1097     PIXMAN_x4r4g4b4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
1098     PIXMAN_a4b4g4r4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
1099     PIXMAN_x4b4g4r4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
1100 
1101 /* 8bpp formats */
1102     PIXMAN_a8 =      PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
1103     PIXMAN_r3g3b2 =  PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
1104     PIXMAN_b2g3r3 =  PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
1105     PIXMAN_a2r2g2b2 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
1106     PIXMAN_a2b2g2r2 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
1107 
1108     PIXMAN_c8 =      PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
1109     PIXMAN_g8 =      PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
1110 
1111     PIXMAN_x4a4 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
1112 
1113     PIXMAN_x4c4 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
1114     PIXMAN_x4g4 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
1115 
1116 /* 4bpp formats */
1117     PIXMAN_a4 =      PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
1118     PIXMAN_r1g2b1 =  PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
1119     PIXMAN_b1g2r1 =  PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
1120     PIXMAN_a1r1g1b1 =    PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
1121     PIXMAN_a1b1g1r1 =    PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
1122 
1123     PIXMAN_c4 =      PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
1124     PIXMAN_g4 =      PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
1125 
1126 /* 1bpp formats */
1127     PIXMAN_a1 =      PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
1128 
1129     PIXMAN_g1 =      PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
1130 
1131 /* YUV formats */
1132     PIXMAN_yuy2 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
1133     PIXMAN_yv12 =    PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
1134 } pixman_format_code_t;
1135 
1136 /* Querying supported format values. */
1137 PIXMAN_API
1138 pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
1139 
1140 PIXMAN_API
1141 pixman_bool_t pixman_format_supported_source      (pixman_format_code_t format);
1142 
1143 /* Constructors */
1144 PIXMAN_API
1145 pixman_image_t *pixman_image_create_solid_fill       (const pixman_color_t         *color);
1146 
1147 PIXMAN_API
1148 pixman_image_t *pixman_image_create_linear_gradient  (const pixman_point_fixed_t   *p1,
1149                               const pixman_point_fixed_t   *p2,
1150                               const pixman_gradient_stop_t *stops,
1151                               int                           n_stops);
1152 
1153 PIXMAN_API
1154 pixman_image_t *pixman_image_create_radial_gradient  (const pixman_point_fixed_t   *inner,
1155                               const pixman_point_fixed_t   *outer,
1156                               pixman_fixed_t                inner_radius,
1157                               pixman_fixed_t                outer_radius,
1158                               const pixman_gradient_stop_t *stops,
1159                               int                           n_stops);
1160 
1161 PIXMAN_API
1162 pixman_image_t *pixman_image_create_conical_gradient (const pixman_point_fixed_t   *center,
1163                               pixman_fixed_t                angle,
1164                               const pixman_gradient_stop_t *stops,
1165                               int                           n_stops);
1166 
1167 PIXMAN_API
1168 pixman_image_t *pixman_image_create_bits             (pixman_format_code_t          format,
1169                               int                           width,
1170                               int                           height,
1171                               uint32_t                     *bits,
1172                               int                           rowstride_bytes);
1173 
1174 PIXMAN_API
1175 pixman_image_t *pixman_image_create_bits_no_clear    (pixman_format_code_t format,
1176                               int                  width,
1177                               int                  height,
1178                               uint32_t *           bits,
1179                               int                  rowstride_bytes);
1180 
1181 /* Destructor */
1182 PIXMAN_API
1183 pixman_image_t *pixman_image_ref                     (pixman_image_t               *image);
1184 
1185 PIXMAN_API
1186 pixman_bool_t   pixman_image_unref                   (pixman_image_t               *image);
1187 
1188 
1189 PIXMAN_API
1190 void        pixman_image_set_destroy_function    (pixman_image_t           *image,
1191                               pixman_image_destroy_func_t   function,
1192                               void             *data);
1193 
1194 PIXMAN_API
1195 void *      pixman_image_get_destroy_data        (pixman_image_t           *image);
1196 
1197 /* Set properties */
1198 PIXMAN_API
1199 pixman_bool_t   pixman_image_set_clip_region         (pixman_image_t               *image,
1200                               const pixman_region16_t            *region);
1201 
1202 PIXMAN_API
1203 pixman_bool_t   pixman_image_set_clip_region32       (pixman_image_t               *image,
1204                               const pixman_region32_t            *region);
1205 
1206 PIXMAN_API
1207 pixman_bool_t   pixman_image_set_clip_region64f      (pixman_image_t               *image,
1208                               const pixman_region64f_t           *region);
1209 
1210 PIXMAN_API
1211 void        pixman_image_set_has_client_clip     (pixman_image_t               *image,
1212                               pixman_bool_t         clien_clip);
1213 
1214 PIXMAN_API
1215 pixman_bool_t   pixman_image_set_transform           (pixman_image_t               *image,
1216                               const pixman_transform_t     *transform);
1217 
1218 PIXMAN_API
1219 void            pixman_image_set_repeat              (pixman_image_t               *image,
1220                               pixman_repeat_t               repeat);
1221 
1222 PIXMAN_API
1223 void            pixman_image_set_dither              (pixman_image_t               *image,
1224                               pixman_dither_t               dither);
1225 
1226 PIXMAN_API
1227 void            pixman_image_set_dither_offset       (pixman_image_t               *image,
1228                               int                           offset_x,
1229                               int                           offset_y);
1230 
1231 PIXMAN_API
1232 pixman_bool_t   pixman_image_set_filter              (pixman_image_t               *image,
1233                               pixman_filter_t               filter,
1234                               const pixman_fixed_t         *filter_params,
1235                               int                           n_filter_params);
1236 
1237 PIXMAN_API
1238 void        pixman_image_set_source_clipping     (pixman_image_t           *image,
1239                               pixman_bool_t                 source_clipping);
1240 
1241 PIXMAN_API
1242 void            pixman_image_set_alpha_map           (pixman_image_t               *image,
1243                               pixman_image_t               *alpha_map,
1244                               int16_t                       x,
1245                               int16_t                       y);
1246 
1247 PIXMAN_API
1248 void            pixman_image_set_component_alpha     (pixman_image_t               *image,
1249                               pixman_bool_t                 component_alpha);
1250 
1251 PIXMAN_API
1252 pixman_bool_t   pixman_image_get_component_alpha     (pixman_image_t               *image);
1253 
1254 PIXMAN_API
1255 void        pixman_image_set_accessors       (pixman_image_t           *image,
1256                               pixman_read_memory_func_t     read_func,
1257                               pixman_write_memory_func_t    write_func);
1258 
1259 PIXMAN_API
1260 void        pixman_image_set_indexed         (pixman_image_t           *image,
1261                               const pixman_indexed_t       *indexed);
1262 
1263 PIXMAN_API
1264 uint32_t       *pixman_image_get_data                (pixman_image_t               *image);
1265 
1266 PIXMAN_API
1267 int     pixman_image_get_width               (pixman_image_t               *image);
1268 
1269 PIXMAN_API
1270 int             pixman_image_get_height              (pixman_image_t               *image);
1271 
1272 PIXMAN_API
1273 int     pixman_image_get_stride              (pixman_image_t               *image); /* in bytes */
1274 
1275 PIXMAN_API
1276 int     pixman_image_get_depth               (pixman_image_t           *image);
1277 
1278 PIXMAN_API
1279 pixman_format_code_t pixman_image_get_format         (pixman_image_t           *image);
1280 
1281 typedef enum
1282 {
1283     PIXMAN_KERNEL_IMPULSE,
1284     PIXMAN_KERNEL_BOX,
1285     PIXMAN_KERNEL_LINEAR,
1286     PIXMAN_KERNEL_CUBIC,
1287     PIXMAN_KERNEL_GAUSSIAN,
1288     PIXMAN_KERNEL_LANCZOS2,
1289     PIXMAN_KERNEL_LANCZOS3,
1290     PIXMAN_KERNEL_LANCZOS3_STRETCHED       /* Jim Blinn's 'nice' filter */
1291 } pixman_kernel_t;
1292 
1293 /* Create the parameter list for a SEPARABLE_CONVOLUTION filter
1294  * with the given kernels and scale parameters.
1295  */
1296 PIXMAN_API
1297 pixman_fixed_t *
1298 pixman_filter_create_separable_convolution (int             *n_values,
1299                         pixman_fixed_t   scale_x,
1300                         pixman_fixed_t   scale_y,
1301                         pixman_kernel_t  reconstruct_x,
1302                         pixman_kernel_t  reconstruct_y,
1303                         pixman_kernel_t  sample_x,
1304                         pixman_kernel_t  sample_y,
1305                         int              subsample_bits_x,
1306                         int              subsample_bits_y);
1307 
1308 
1309 PIXMAN_API
1310 pixman_bool_t   pixman_image_fill_rectangles         (pixman_op_t           op,
1311                               pixman_image_t           *image,
1312                               const pixman_color_t     *color,
1313                               int               n_rects,
1314                               const pixman_rectangle16_t   *rects);
1315 
1316 PIXMAN_API
1317 pixman_bool_t   pixman_image_fill_boxes              (pixman_op_t                   op,
1318                                                       pixman_image_t               *dest,
1319                                                       const pixman_color_t         *color,
1320                                                       int                           n_boxes,
1321                                                       const pixman_box32_t         *boxes);
1322 
1323 /* Composite */
1324 PIXMAN_API
1325 pixman_bool_t pixman_compute_composite_region (pixman_region16_t *region,
1326                            pixman_image_t    *src_image,
1327                            pixman_image_t    *mask_image,
1328                            pixman_image_t    *dest_image,
1329                            int16_t            src_x,
1330                            int16_t            src_y,
1331                            int16_t            mask_x,
1332                            int16_t            mask_y,
1333                            int16_t            dest_x,
1334                            int16_t            dest_y,
1335                            uint16_t           width,
1336                            uint16_t           height);
1337 
1338 PIXMAN_API
1339 void          pixman_image_composite          (pixman_op_t        op,
1340                            pixman_image_t    *src,
1341                            pixman_image_t    *mask,
1342                            pixman_image_t    *dest,
1343                            int16_t            src_x,
1344                            int16_t            src_y,
1345                            int16_t            mask_x,
1346                            int16_t            mask_y,
1347                            int16_t            dest_x,
1348                            int16_t            dest_y,
1349                            uint16_t           width,
1350                            uint16_t           height);
1351 
1352 PIXMAN_API
1353 void          pixman_image_composite32        (pixman_op_t        op,
1354                            pixman_image_t    *src,
1355                            pixman_image_t    *mask,
1356                            pixman_image_t    *dest,
1357                            int32_t            src_x,
1358                            int32_t            src_y,
1359                            int32_t            mask_x,
1360                            int32_t            mask_y,
1361                            int32_t            dest_x,
1362                            int32_t            dest_y,
1363                            int32_t            width,
1364                            int32_t            height);
1365 
1366 PIXMAN_API
1367 void          pixman_image_composite64f       (pixman_op_t        op,
1368                            pixman_image_t    *src,
1369                            pixman_image_t    *mask,
1370                            pixman_image_t    *dest,
1371                            double             src_x,
1372                            double             src_y,
1373                            double             mask_x,
1374                            double             mask_y,
1375                            double             dest_x,
1376                            double             dest_y,
1377                            double             width,
1378                            double             height);
1379 
1380 /* Executive Summary: This function is a no-op that only exists
1381  * for historical reasons.
1382  *
1383  * There used to be a bug in the X server where it would rely on
1384  * out-of-bounds accesses when it was asked to composite with a
1385  * window as the source. It would create a pixman image pointing
1386  * to some bogus position in memory, but then set a clip region
1387  * to the position where the actual bits were.
1388  *
1389  * Due to a bug in old versions of pixman, where it would not clip
1390  * against the image bounds when a clip region was set, this would
1391  * actually work. So when the pixman bug was fixed, a workaround was
1392  * added to allow certain out-of-bound accesses. This function disabled
1393  * those workarounds.
1394  *
1395  * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this
1396  * function is a no-op.
1397  */
1398 PIXMAN_API
1399 void pixman_disable_out_of_bounds_workaround (void);
1400 
1401 /*
1402  * Glyphs
1403  */
1404 typedef struct pixman_glyph_cache_t pixman_glyph_cache_t;
1405 typedef struct
1406 {
1407     int     x, y;
1408     const void *glyph;
1409 } pixman_glyph_t;
1410 
1411 PIXMAN_API
1412 pixman_glyph_cache_t *pixman_glyph_cache_create       (void);
1413 
1414 PIXMAN_API
1415 void                  pixman_glyph_cache_destroy      (pixman_glyph_cache_t *cache);
1416 
1417 PIXMAN_API
1418 void                  pixman_glyph_cache_freeze       (pixman_glyph_cache_t *cache);
1419 
1420 PIXMAN_API
1421 void                  pixman_glyph_cache_thaw         (pixman_glyph_cache_t *cache);
1422 
1423 PIXMAN_API
1424 const void *          pixman_glyph_cache_lookup       (pixman_glyph_cache_t *cache,
1425                                void                 *font_key,
1426                                void                 *glyph_key);
1427 
1428 PIXMAN_API
1429 const void *          pixman_glyph_cache_insert       (pixman_glyph_cache_t *cache,
1430                                void                 *font_key,
1431                                void                 *glyph_key,
1432                                int           origin_x,
1433                                int                   origin_y,
1434                                pixman_image_t       *glyph_image);
1435 
1436 PIXMAN_API
1437 void                  pixman_glyph_cache_remove       (pixman_glyph_cache_t *cache,
1438                                void                 *font_key,
1439                                void                 *glyph_key);
1440 
1441 PIXMAN_API
1442 void                  pixman_glyph_get_extents        (pixman_glyph_cache_t *cache,
1443                                int                   n_glyphs,
1444                                pixman_glyph_t       *glyphs,
1445                                pixman_box32_t       *extents);
1446 
1447 PIXMAN_API
1448 pixman_format_code_t  pixman_glyph_get_mask_format    (pixman_glyph_cache_t *cache,
1449                                int           n_glyphs,
1450                                const pixman_glyph_t *glyphs);
1451 
1452 PIXMAN_API
1453 void                  pixman_composite_glyphs         (pixman_op_t           op,
1454                                pixman_image_t       *src,
1455                                pixman_image_t       *dest,
1456                                pixman_format_code_t  mask_format,
1457                                int32_t               src_x,
1458                                int32_t               src_y,
1459                                int32_t           mask_x,
1460                                int32_t           mask_y,
1461                                int32_t               dest_x,
1462                                int32_t               dest_y,
1463                                int32_t           width,
1464                                int32_t           height,
1465                                pixman_glyph_cache_t *cache,
1466                                int           n_glyphs,
1467                                const pixman_glyph_t *glyphs);
1468 
1469 PIXMAN_API
1470 void                  pixman_composite_glyphs_no_mask (pixman_op_t           op,
1471                                pixman_image_t       *src,
1472                                pixman_image_t       *dest,
1473                                int32_t               src_x,
1474                                int32_t               src_y,
1475                                int32_t               dest_x,
1476                                int32_t               dest_y,
1477                                pixman_glyph_cache_t *cache,
1478                                int           n_glyphs,
1479                                const pixman_glyph_t *glyphs);
1480 
1481 /*
1482  * Trapezoids
1483  */
1484 typedef struct pixman_edge pixman_edge_t;
1485 typedef struct pixman_trapezoid pixman_trapezoid_t;
1486 typedef struct pixman_trap pixman_trap_t;
1487 typedef struct pixman_span_fix pixman_span_fix_t;
1488 typedef struct pixman_triangle pixman_triangle_t;
1489 
1490 /*
1491  * An edge structure.  This represents a single polygon edge
1492  * and can be quickly stepped across small or large gaps in the
1493  * sample grid
1494  */
1495 struct pixman_edge
1496 {
1497     pixman_fixed_t  x;
1498     pixman_fixed_t  e;
1499     pixman_fixed_t  stepx;
1500     pixman_fixed_t  signdx;
1501     pixman_fixed_t  dy;
1502     pixman_fixed_t  dx;
1503 
1504     pixman_fixed_t  stepx_small;
1505     pixman_fixed_t  stepx_big;
1506     pixman_fixed_t  dx_small;
1507     pixman_fixed_t  dx_big;
1508 };
1509 
1510 struct pixman_trapezoid
1511 {
1512     pixman_fixed_t  top, bottom;
1513     pixman_line_fixed_t left, right;
1514 };
1515 
1516 struct pixman_triangle
1517 {
1518     pixman_point_fixed_t p1, p2, p3;
1519 };
1520 
1521 /* whether 't' is a well defined not obviously empty trapezoid */
1522 #define pixman_trapezoid_valid(t)                  \
1523     ((t)->left.p1.y != (t)->left.p2.y &&               \
1524      (t)->right.p1.y != (t)->right.p2.y &&             \
1525      ((t)->bottom > (t)->top))
1526 
1527 struct pixman_span_fix
1528 {
1529     pixman_fixed_t  l, r, y;
1530 };
1531 
1532 struct pixman_trap
1533 {
1534     pixman_span_fix_t   top, bot;
1535 };
1536 
1537 PIXMAN_API
1538 pixman_fixed_t pixman_sample_ceil_y        (pixman_fixed_t             y,
1539                         int                        bpp);
1540 
1541 PIXMAN_API
1542 pixman_fixed_t pixman_sample_floor_y       (pixman_fixed_t             y,
1543                         int                        bpp);
1544 
1545 PIXMAN_API
1546 void           pixman_edge_step            (pixman_edge_t             *e,
1547                         int                        n);
1548 
1549 PIXMAN_API
1550 void           pixman_edge_init            (pixman_edge_t             *e,
1551                         int                        bpp,
1552                         pixman_fixed_t             y_start,
1553                         pixman_fixed_t             x_top,
1554                         pixman_fixed_t             y_top,
1555                         pixman_fixed_t             x_bot,
1556                         pixman_fixed_t             y_bot);
1557 
1558 PIXMAN_API
1559 void           pixman_line_fixed_edge_init (pixman_edge_t             *e,
1560                         int                        bpp,
1561                         pixman_fixed_t             y,
1562                         const pixman_line_fixed_t *line,
1563                         int                        x_off,
1564                         int                        y_off);
1565 
1566 PIXMAN_API
1567 void           pixman_rasterize_edges      (pixman_image_t            *image,
1568                         pixman_edge_t             *l,
1569                         pixman_edge_t             *r,
1570                         pixman_fixed_t             t,
1571                         pixman_fixed_t             b);
1572 
1573 PIXMAN_API
1574 void           pixman_add_traps            (pixman_image_t            *image,
1575                         int16_t                    x_off,
1576                         int16_t                    y_off,
1577                         int                        ntrap,
1578                         const pixman_trap_t       *traps);
1579 
1580 PIXMAN_API
1581 void           pixman_add_trapezoids       (pixman_image_t            *image,
1582                         int16_t                    x_off,
1583                         int                        y_off,
1584                         int                        ntraps,
1585                         const pixman_trapezoid_t  *traps);
1586 
1587 PIXMAN_API
1588 void           pixman_rasterize_trapezoid  (pixman_image_t            *image,
1589                         const pixman_trapezoid_t  *trap,
1590                         int                        x_off,
1591                         int                        y_off);
1592 
1593 PIXMAN_API
1594 void          pixman_composite_trapezoids (pixman_op_t             op,
1595                        pixman_image_t *        src,
1596                        pixman_image_t *        dst,
1597                        pixman_format_code_t        mask_format,
1598                        int                 x_src,
1599                        int                 y_src,
1600                        int                 x_dst,
1601                        int                 y_dst,
1602                        int                 n_traps,
1603                        const pixman_trapezoid_t *  traps);
1604 
1605 PIXMAN_API
1606 void          pixman_composite_triangles (pixman_op_t              op,
1607                       pixman_image_t *         src,
1608                       pixman_image_t *         dst,
1609                       pixman_format_code_t         mask_format,
1610                       int                  x_src,
1611                       int                  y_src,
1612                       int                  x_dst,
1613                       int                  y_dst,
1614                       int                  n_tris,
1615                       const pixman_triangle_t *    tris);
1616 
1617 PIXMAN_API
1618 void          pixman_add_triangles       (pixman_image_t              *image,
1619                       int32_t                  x_off,
1620                       int32_t                  y_off,
1621                       int                          n_tris,
1622                       const pixman_triangle_t     *tris);
1623 
1624 PIXMAN_END_DECLS
1625 
1626 #endif /* PIXMAN_H__ */