Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:02

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 
0759 /* Copy / Fill / Misc */
0760 PIXMAN_API
0761 pixman_bool_t pixman_blt                (uint32_t           *src_bits,
0762                      uint32_t           *dst_bits,
0763                      int                 src_stride,
0764                      int                 dst_stride,
0765                      int                 src_bpp,
0766                      int                 dst_bpp,
0767                      int                 src_x,
0768                      int                 src_y,
0769                      int                 dest_x,
0770                      int                 dest_y,
0771                      int                 width,
0772                      int                 height);
0773 
0774 PIXMAN_API
0775 pixman_bool_t pixman_fill               (uint32_t           *bits,
0776                      int                 stride,
0777                      int                 bpp,
0778                      int                 x,
0779                      int                 y,
0780                      int                 width,
0781                      int                 height,
0782                      uint32_t            _xor);
0783 
0784 
0785 PIXMAN_API
0786 int           pixman_version            (void);
0787 
0788 PIXMAN_API
0789 const char*   pixman_version_string     (void);
0790 
0791 /*
0792  * Images
0793  */
0794 typedef struct pixman_indexed       pixman_indexed_t;
0795 typedef struct pixman_gradient_stop pixman_gradient_stop_t;
0796 
0797 typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
0798 typedef void     (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
0799 
0800 typedef void     (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data);
0801 
0802 struct pixman_gradient_stop {
0803     pixman_fixed_t x;
0804     pixman_color_t color;
0805 };
0806 
0807 #define PIXMAN_MAX_INDEXED  256 /* XXX depth must be <= 8 */
0808 
0809 #if PIXMAN_MAX_INDEXED <= 256
0810 typedef uint8_t pixman_index_type;
0811 #endif
0812 
0813 struct pixman_indexed
0814 {
0815     pixman_bool_t       color;
0816     uint32_t        rgba[PIXMAN_MAX_INDEXED];
0817     pixman_index_type   ent[32768];
0818 };
0819 
0820 /*
0821  * While the protocol is generous in format support, the
0822  * sample implementation allows only packed RGB and GBR
0823  * representations for data to simplify software rendering,
0824  */
0825 #define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) |  \
0826                      ((type) << 16) | \
0827                      ((a) << 12) |    \
0828                      ((r) << 8) |     \
0829                      ((g) << 4) |     \
0830                      ((b)))
0831 
0832 #define PIXMAN_FORMAT_BYTE(bpp,type,a,r,g,b) \
0833     (((bpp >> 3) << 24) | \
0834     (3 << 22) | ((type) << 16) | \
0835     ((a >> 3) << 12) | \
0836     ((r >> 3) << 8) | \
0837     ((g >> 3) << 4) | \
0838     ((b >> 3)))
0839 
0840 #define PIXMAN_FORMAT_RESHIFT(val, ofs, num) \
0841     (((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
0842 
0843 #define PIXMAN_FORMAT_BPP(f)    PIXMAN_FORMAT_RESHIFT(f, 24, 8)
0844 #define PIXMAN_FORMAT_SHIFT(f)  ((uint32_t)((f >> 22) & 3))
0845 #define PIXMAN_FORMAT_TYPE(f)   (((f) >> 16) & 0x3f)
0846 #define PIXMAN_FORMAT_A(f)  PIXMAN_FORMAT_RESHIFT(f, 12, 4)
0847 #define PIXMAN_FORMAT_R(f)  PIXMAN_FORMAT_RESHIFT(f, 8, 4)
0848 #define PIXMAN_FORMAT_G(f)  PIXMAN_FORMAT_RESHIFT(f, 4, 4)
0849 #define PIXMAN_FORMAT_B(f)  PIXMAN_FORMAT_RESHIFT(f, 0, 4)
0850 #define PIXMAN_FORMAT_RGB(f)    (((f)      ) & 0xfff)
0851 #define PIXMAN_FORMAT_VIS(f)    (((f)      ) & 0xffff)
0852 #define PIXMAN_FORMAT_DEPTH(f)  (PIXMAN_FORMAT_A(f) +   \
0853                  PIXMAN_FORMAT_R(f) +   \
0854                  PIXMAN_FORMAT_G(f) +   \
0855                  PIXMAN_FORMAT_B(f))
0856 
0857 #define PIXMAN_TYPE_OTHER   0
0858 #define PIXMAN_TYPE_A       1
0859 #define PIXMAN_TYPE_ARGB    2
0860 #define PIXMAN_TYPE_ABGR    3
0861 #define PIXMAN_TYPE_COLOR   4
0862 #define PIXMAN_TYPE_GRAY    5
0863 #define PIXMAN_TYPE_YUY2    6
0864 #define PIXMAN_TYPE_YV12    7
0865 #define PIXMAN_TYPE_BGRA    8
0866 #define PIXMAN_TYPE_RGBA    9
0867 #define PIXMAN_TYPE_ARGB_SRGB   10
0868 #define PIXMAN_TYPE_RGBA_FLOAT  11
0869 
0870 #define PIXMAN_FORMAT_COLOR(f)              \
0871     (PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB ||   \
0872      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR ||   \
0873      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA ||   \
0874      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA ||   \
0875      PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA_FLOAT)
0876 
0877 typedef enum {
0878 /* 128bpp formats */
0879     PIXMAN_rgba_float = PIXMAN_FORMAT_BYTE(128,PIXMAN_TYPE_RGBA_FLOAT,32,32,32,32),
0880 /* 96bpp formats */
0881     PIXMAN_rgb_float =  PIXMAN_FORMAT_BYTE(96,PIXMAN_TYPE_RGBA_FLOAT,0,32,32,32),
0882 
0883 /* 32bpp formats */
0884     PIXMAN_a8r8g8b8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
0885     PIXMAN_x8r8g8b8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
0886     PIXMAN_a8b8g8r8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
0887     PIXMAN_x8b8g8r8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
0888     PIXMAN_b8g8r8a8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
0889     PIXMAN_b8g8r8x8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
0890     PIXMAN_r8g8b8a8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
0891     PIXMAN_r8g8b8x8 =    PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
0892     PIXMAN_x14r6g6b6 =   PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
0893     PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
0894     PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
0895     PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
0896     PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
0897 
0898 /* sRGB formats */
0899     PIXMAN_a8r8g8b8_sRGB = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_SRGB,8,8,8,8),
0900     PIXMAN_r8g8b8_sRGB = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB_SRGB,0,8,8,8),
0901 
0902 /* 24bpp formats */
0903     PIXMAN_r8g8b8 =  PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
0904     PIXMAN_b8g8r8 =  PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
0905 
0906 /* 16bpp formats */
0907     PIXMAN_r5g6b5 =  PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
0908     PIXMAN_b5g6r5 =  PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
0909 
0910     PIXMAN_a1r5g5b5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
0911     PIXMAN_x1r5g5b5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
0912     PIXMAN_a1b5g5r5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
0913     PIXMAN_x1b5g5r5 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
0914     PIXMAN_a4r4g4b4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
0915     PIXMAN_x4r4g4b4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
0916     PIXMAN_a4b4g4r4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
0917     PIXMAN_x4b4g4r4 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
0918 
0919 /* 8bpp formats */
0920     PIXMAN_a8 =      PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
0921     PIXMAN_r3g3b2 =  PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
0922     PIXMAN_b2g3r3 =  PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
0923     PIXMAN_a2r2g2b2 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
0924     PIXMAN_a2b2g2r2 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
0925 
0926     PIXMAN_c8 =      PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
0927     PIXMAN_g8 =      PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
0928 
0929     PIXMAN_x4a4 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
0930 
0931     PIXMAN_x4c4 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
0932     PIXMAN_x4g4 =    PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
0933 
0934 /* 4bpp formats */
0935     PIXMAN_a4 =      PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
0936     PIXMAN_r1g2b1 =  PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
0937     PIXMAN_b1g2r1 =  PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
0938     PIXMAN_a1r1g1b1 =    PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
0939     PIXMAN_a1b1g1r1 =    PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
0940 
0941     PIXMAN_c4 =      PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
0942     PIXMAN_g4 =      PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
0943 
0944 /* 1bpp formats */
0945     PIXMAN_a1 =      PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
0946 
0947     PIXMAN_g1 =      PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
0948 
0949 /* YUV formats */
0950     PIXMAN_yuy2 =    PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
0951     PIXMAN_yv12 =    PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
0952 } pixman_format_code_t;
0953 
0954 /* Querying supported format values. */
0955 PIXMAN_API
0956 pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
0957 
0958 PIXMAN_API
0959 pixman_bool_t pixman_format_supported_source      (pixman_format_code_t format);
0960 
0961 /* Constructors */
0962 PIXMAN_API
0963 pixman_image_t *pixman_image_create_solid_fill       (const pixman_color_t         *color);
0964 
0965 PIXMAN_API
0966 pixman_image_t *pixman_image_create_linear_gradient  (const pixman_point_fixed_t   *p1,
0967                               const pixman_point_fixed_t   *p2,
0968                               const pixman_gradient_stop_t *stops,
0969                               int                           n_stops);
0970 
0971 PIXMAN_API
0972 pixman_image_t *pixman_image_create_radial_gradient  (const pixman_point_fixed_t   *inner,
0973                               const pixman_point_fixed_t   *outer,
0974                               pixman_fixed_t                inner_radius,
0975                               pixman_fixed_t                outer_radius,
0976                               const pixman_gradient_stop_t *stops,
0977                               int                           n_stops);
0978 
0979 PIXMAN_API
0980 pixman_image_t *pixman_image_create_conical_gradient (const pixman_point_fixed_t   *center,
0981                               pixman_fixed_t                angle,
0982                               const pixman_gradient_stop_t *stops,
0983                               int                           n_stops);
0984 
0985 PIXMAN_API
0986 pixman_image_t *pixman_image_create_bits             (pixman_format_code_t          format,
0987                               int                           width,
0988                               int                           height,
0989                               uint32_t                     *bits,
0990                               int                           rowstride_bytes);
0991 
0992 PIXMAN_API
0993 pixman_image_t *pixman_image_create_bits_no_clear    (pixman_format_code_t format,
0994                               int                  width,
0995                               int                  height,
0996                               uint32_t *           bits,
0997                               int                  rowstride_bytes);
0998 
0999 /* Destructor */
1000 PIXMAN_API
1001 pixman_image_t *pixman_image_ref                     (pixman_image_t               *image);
1002 
1003 PIXMAN_API
1004 pixman_bool_t   pixman_image_unref                   (pixman_image_t               *image);
1005 
1006 
1007 PIXMAN_API
1008 void        pixman_image_set_destroy_function    (pixman_image_t           *image,
1009                               pixman_image_destroy_func_t   function,
1010                               void             *data);
1011 
1012 PIXMAN_API
1013 void *      pixman_image_get_destroy_data        (pixman_image_t           *image);
1014 
1015 /* Set properties */
1016 PIXMAN_API
1017 pixman_bool_t   pixman_image_set_clip_region         (pixman_image_t               *image,
1018                               const pixman_region16_t            *region);
1019 
1020 PIXMAN_API
1021 pixman_bool_t   pixman_image_set_clip_region32       (pixman_image_t               *image,
1022                               const pixman_region32_t            *region);
1023 
1024 PIXMAN_API
1025 void        pixman_image_set_has_client_clip     (pixman_image_t               *image,
1026                               pixman_bool_t         clien_clip);
1027 
1028 PIXMAN_API
1029 pixman_bool_t   pixman_image_set_transform           (pixman_image_t               *image,
1030                               const pixman_transform_t     *transform);
1031 
1032 PIXMAN_API
1033 void            pixman_image_set_repeat              (pixman_image_t               *image,
1034                               pixman_repeat_t               repeat);
1035 
1036 PIXMAN_API
1037 void            pixman_image_set_dither              (pixman_image_t               *image,
1038                               pixman_dither_t               dither);
1039 
1040 PIXMAN_API
1041 void            pixman_image_set_dither_offset       (pixman_image_t               *image,
1042                               int                           offset_x,
1043                               int                           offset_y);
1044 
1045 PIXMAN_API
1046 pixman_bool_t   pixman_image_set_filter              (pixman_image_t               *image,
1047                               pixman_filter_t               filter,
1048                               const pixman_fixed_t         *filter_params,
1049                               int                           n_filter_params);
1050 
1051 PIXMAN_API
1052 void        pixman_image_set_source_clipping     (pixman_image_t           *image,
1053                               pixman_bool_t                 source_clipping);
1054 
1055 PIXMAN_API
1056 void            pixman_image_set_alpha_map           (pixman_image_t               *image,
1057                               pixman_image_t               *alpha_map,
1058                               int16_t                       x,
1059                               int16_t                       y);
1060 
1061 PIXMAN_API
1062 void            pixman_image_set_component_alpha     (pixman_image_t               *image,
1063                               pixman_bool_t                 component_alpha);
1064 
1065 PIXMAN_API
1066 pixman_bool_t   pixman_image_get_component_alpha     (pixman_image_t               *image);
1067 
1068 PIXMAN_API
1069 void        pixman_image_set_accessors       (pixman_image_t           *image,
1070                               pixman_read_memory_func_t     read_func,
1071                               pixman_write_memory_func_t    write_func);
1072 
1073 PIXMAN_API
1074 void        pixman_image_set_indexed         (pixman_image_t           *image,
1075                               const pixman_indexed_t       *indexed);
1076 
1077 PIXMAN_API
1078 uint32_t       *pixman_image_get_data                (pixman_image_t               *image);
1079 
1080 PIXMAN_API
1081 int     pixman_image_get_width               (pixman_image_t               *image);
1082 
1083 PIXMAN_API
1084 int             pixman_image_get_height              (pixman_image_t               *image);
1085 
1086 PIXMAN_API
1087 int     pixman_image_get_stride              (pixman_image_t               *image); /* in bytes */
1088 
1089 PIXMAN_API
1090 int     pixman_image_get_depth               (pixman_image_t           *image);
1091 
1092 PIXMAN_API
1093 pixman_format_code_t pixman_image_get_format         (pixman_image_t           *image);
1094 
1095 typedef enum
1096 {
1097     PIXMAN_KERNEL_IMPULSE,
1098     PIXMAN_KERNEL_BOX,
1099     PIXMAN_KERNEL_LINEAR,
1100     PIXMAN_KERNEL_CUBIC,
1101     PIXMAN_KERNEL_GAUSSIAN,
1102     PIXMAN_KERNEL_LANCZOS2,
1103     PIXMAN_KERNEL_LANCZOS3,
1104     PIXMAN_KERNEL_LANCZOS3_STRETCHED       /* Jim Blinn's 'nice' filter */
1105 } pixman_kernel_t;
1106 
1107 /* Create the parameter list for a SEPARABLE_CONVOLUTION filter
1108  * with the given kernels and scale parameters.
1109  */
1110 PIXMAN_API
1111 pixman_fixed_t *
1112 pixman_filter_create_separable_convolution (int             *n_values,
1113                         pixman_fixed_t   scale_x,
1114                         pixman_fixed_t   scale_y,
1115                         pixman_kernel_t  reconstruct_x,
1116                         pixman_kernel_t  reconstruct_y,
1117                         pixman_kernel_t  sample_x,
1118                         pixman_kernel_t  sample_y,
1119                         int              subsample_bits_x,
1120                         int              subsample_bits_y);
1121 
1122 
1123 PIXMAN_API
1124 pixman_bool_t   pixman_image_fill_rectangles         (pixman_op_t           op,
1125                               pixman_image_t           *image,
1126                               const pixman_color_t     *color,
1127                               int               n_rects,
1128                               const pixman_rectangle16_t   *rects);
1129 
1130 PIXMAN_API
1131 pixman_bool_t   pixman_image_fill_boxes              (pixman_op_t                   op,
1132                                                       pixman_image_t               *dest,
1133                                                       const pixman_color_t         *color,
1134                                                       int                           n_boxes,
1135                                                       const pixman_box32_t         *boxes);
1136 
1137 /* Composite */
1138 PIXMAN_API
1139 pixman_bool_t pixman_compute_composite_region (pixman_region16_t *region,
1140                            pixman_image_t    *src_image,
1141                            pixman_image_t    *mask_image,
1142                            pixman_image_t    *dest_image,
1143                            int16_t            src_x,
1144                            int16_t            src_y,
1145                            int16_t            mask_x,
1146                            int16_t            mask_y,
1147                            int16_t            dest_x,
1148                            int16_t            dest_y,
1149                            uint16_t           width,
1150                            uint16_t           height);
1151 
1152 PIXMAN_API
1153 void          pixman_image_composite          (pixman_op_t        op,
1154                            pixman_image_t    *src,
1155                            pixman_image_t    *mask,
1156                            pixman_image_t    *dest,
1157                            int16_t            src_x,
1158                            int16_t            src_y,
1159                            int16_t            mask_x,
1160                            int16_t            mask_y,
1161                            int16_t            dest_x,
1162                            int16_t            dest_y,
1163                            uint16_t           width,
1164                            uint16_t           height);
1165 
1166 PIXMAN_API
1167 void          pixman_image_composite32        (pixman_op_t        op,
1168                            pixman_image_t    *src,
1169                            pixman_image_t    *mask,
1170                            pixman_image_t    *dest,
1171                            int32_t            src_x,
1172                            int32_t            src_y,
1173                            int32_t            mask_x,
1174                            int32_t            mask_y,
1175                            int32_t            dest_x,
1176                            int32_t            dest_y,
1177                            int32_t            width,
1178                            int32_t            height);
1179 
1180 /* Executive Summary: This function is a no-op that only exists
1181  * for historical reasons.
1182  *
1183  * There used to be a bug in the X server where it would rely on
1184  * out-of-bounds accesses when it was asked to composite with a
1185  * window as the source. It would create a pixman image pointing
1186  * to some bogus position in memory, but then set a clip region
1187  * to the position where the actual bits were.
1188  *
1189  * Due to a bug in old versions of pixman, where it would not clip
1190  * against the image bounds when a clip region was set, this would
1191  * actually work. So when the pixman bug was fixed, a workaround was
1192  * added to allow certain out-of-bound accesses. This function disabled
1193  * those workarounds.
1194  *
1195  * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this
1196  * function is a no-op.
1197  */
1198 PIXMAN_API
1199 void pixman_disable_out_of_bounds_workaround (void);
1200 
1201 /*
1202  * Glyphs
1203  */
1204 typedef struct pixman_glyph_cache_t pixman_glyph_cache_t;
1205 typedef struct
1206 {
1207     int     x, y;
1208     const void *glyph;
1209 } pixman_glyph_t;
1210 
1211 PIXMAN_API
1212 pixman_glyph_cache_t *pixman_glyph_cache_create       (void);
1213 
1214 PIXMAN_API
1215 void                  pixman_glyph_cache_destroy      (pixman_glyph_cache_t *cache);
1216 
1217 PIXMAN_API
1218 void                  pixman_glyph_cache_freeze       (pixman_glyph_cache_t *cache);
1219 
1220 PIXMAN_API
1221 void                  pixman_glyph_cache_thaw         (pixman_glyph_cache_t *cache);
1222 
1223 PIXMAN_API
1224 const void *          pixman_glyph_cache_lookup       (pixman_glyph_cache_t *cache,
1225                                void                 *font_key,
1226                                void                 *glyph_key);
1227 
1228 PIXMAN_API
1229 const void *          pixman_glyph_cache_insert       (pixman_glyph_cache_t *cache,
1230                                void                 *font_key,
1231                                void                 *glyph_key,
1232                                int           origin_x,
1233                                int                   origin_y,
1234                                pixman_image_t       *glyph_image);
1235 
1236 PIXMAN_API
1237 void                  pixman_glyph_cache_remove       (pixman_glyph_cache_t *cache,
1238                                void                 *font_key,
1239                                void                 *glyph_key);
1240 
1241 PIXMAN_API
1242 void                  pixman_glyph_get_extents        (pixman_glyph_cache_t *cache,
1243                                int                   n_glyphs,
1244                                pixman_glyph_t       *glyphs,
1245                                pixman_box32_t       *extents);
1246 
1247 PIXMAN_API
1248 pixman_format_code_t  pixman_glyph_get_mask_format    (pixman_glyph_cache_t *cache,
1249                                int           n_glyphs,
1250                                const pixman_glyph_t *glyphs);
1251 
1252 PIXMAN_API
1253 void                  pixman_composite_glyphs         (pixman_op_t           op,
1254                                pixman_image_t       *src,
1255                                pixman_image_t       *dest,
1256                                pixman_format_code_t  mask_format,
1257                                int32_t               src_x,
1258                                int32_t               src_y,
1259                                int32_t           mask_x,
1260                                int32_t           mask_y,
1261                                int32_t               dest_x,
1262                                int32_t               dest_y,
1263                                int32_t           width,
1264                                int32_t           height,
1265                                pixman_glyph_cache_t *cache,
1266                                int           n_glyphs,
1267                                const pixman_glyph_t *glyphs);
1268 
1269 PIXMAN_API
1270 void                  pixman_composite_glyphs_no_mask (pixman_op_t           op,
1271                                pixman_image_t       *src,
1272                                pixman_image_t       *dest,
1273                                int32_t               src_x,
1274                                int32_t               src_y,
1275                                int32_t               dest_x,
1276                                int32_t               dest_y,
1277                                pixman_glyph_cache_t *cache,
1278                                int           n_glyphs,
1279                                const pixman_glyph_t *glyphs);
1280 
1281 /*
1282  * Trapezoids
1283  */
1284 typedef struct pixman_edge pixman_edge_t;
1285 typedef struct pixman_trapezoid pixman_trapezoid_t;
1286 typedef struct pixman_trap pixman_trap_t;
1287 typedef struct pixman_span_fix pixman_span_fix_t;
1288 typedef struct pixman_triangle pixman_triangle_t;
1289 
1290 /*
1291  * An edge structure.  This represents a single polygon edge
1292  * and can be quickly stepped across small or large gaps in the
1293  * sample grid
1294  */
1295 struct pixman_edge
1296 {
1297     pixman_fixed_t  x;
1298     pixman_fixed_t  e;
1299     pixman_fixed_t  stepx;
1300     pixman_fixed_t  signdx;
1301     pixman_fixed_t  dy;
1302     pixman_fixed_t  dx;
1303 
1304     pixman_fixed_t  stepx_small;
1305     pixman_fixed_t  stepx_big;
1306     pixman_fixed_t  dx_small;
1307     pixman_fixed_t  dx_big;
1308 };
1309 
1310 struct pixman_trapezoid
1311 {
1312     pixman_fixed_t  top, bottom;
1313     pixman_line_fixed_t left, right;
1314 };
1315 
1316 struct pixman_triangle
1317 {
1318     pixman_point_fixed_t p1, p2, p3;
1319 };
1320 
1321 /* whether 't' is a well defined not obviously empty trapezoid */
1322 #define pixman_trapezoid_valid(t)                  \
1323     ((t)->left.p1.y != (t)->left.p2.y &&               \
1324      (t)->right.p1.y != (t)->right.p2.y &&             \
1325      ((t)->bottom > (t)->top))
1326 
1327 struct pixman_span_fix
1328 {
1329     pixman_fixed_t  l, r, y;
1330 };
1331 
1332 struct pixman_trap
1333 {
1334     pixman_span_fix_t   top, bot;
1335 };
1336 
1337 PIXMAN_API
1338 pixman_fixed_t pixman_sample_ceil_y        (pixman_fixed_t             y,
1339                         int                        bpp);
1340 
1341 PIXMAN_API
1342 pixman_fixed_t pixman_sample_floor_y       (pixman_fixed_t             y,
1343                         int                        bpp);
1344 
1345 PIXMAN_API
1346 void           pixman_edge_step            (pixman_edge_t             *e,
1347                         int                        n);
1348 
1349 PIXMAN_API
1350 void           pixman_edge_init            (pixman_edge_t             *e,
1351                         int                        bpp,
1352                         pixman_fixed_t             y_start,
1353                         pixman_fixed_t             x_top,
1354                         pixman_fixed_t             y_top,
1355                         pixman_fixed_t             x_bot,
1356                         pixman_fixed_t             y_bot);
1357 
1358 PIXMAN_API
1359 void           pixman_line_fixed_edge_init (pixman_edge_t             *e,
1360                         int                        bpp,
1361                         pixman_fixed_t             y,
1362                         const pixman_line_fixed_t *line,
1363                         int                        x_off,
1364                         int                        y_off);
1365 
1366 PIXMAN_API
1367 void           pixman_rasterize_edges      (pixman_image_t            *image,
1368                         pixman_edge_t             *l,
1369                         pixman_edge_t             *r,
1370                         pixman_fixed_t             t,
1371                         pixman_fixed_t             b);
1372 
1373 PIXMAN_API
1374 void           pixman_add_traps            (pixman_image_t            *image,
1375                         int16_t                    x_off,
1376                         int16_t                    y_off,
1377                         int                        ntrap,
1378                         const pixman_trap_t       *traps);
1379 
1380 PIXMAN_API
1381 void           pixman_add_trapezoids       (pixman_image_t            *image,
1382                         int16_t                    x_off,
1383                         int                        y_off,
1384                         int                        ntraps,
1385                         const pixman_trapezoid_t  *traps);
1386 
1387 PIXMAN_API
1388 void           pixman_rasterize_trapezoid  (pixman_image_t            *image,
1389                         const pixman_trapezoid_t  *trap,
1390                         int                        x_off,
1391                         int                        y_off);
1392 
1393 PIXMAN_API
1394 void          pixman_composite_trapezoids (pixman_op_t             op,
1395                        pixman_image_t *        src,
1396                        pixman_image_t *        dst,
1397                        pixman_format_code_t        mask_format,
1398                        int                 x_src,
1399                        int                 y_src,
1400                        int                 x_dst,
1401                        int                 y_dst,
1402                        int                 n_traps,
1403                        const pixman_trapezoid_t *  traps);
1404 
1405 PIXMAN_API
1406 void          pixman_composite_triangles (pixman_op_t              op,
1407                       pixman_image_t *         src,
1408                       pixman_image_t *         dst,
1409                       pixman_format_code_t         mask_format,
1410                       int                  x_src,
1411                       int                  y_src,
1412                       int                  x_dst,
1413                       int                  y_dst,
1414                       int                  n_tris,
1415                       const pixman_triangle_t *    tris);
1416 
1417 PIXMAN_API
1418 void          pixman_add_triangles       (pixman_image_t              *image,
1419                       int32_t                  x_off,
1420                       int32_t                  y_off,
1421                       int                          n_tris,
1422                       const pixman_triangle_t     *tris);
1423 
1424 PIXMAN_END_DECLS
1425 
1426 #endif /* PIXMAN_H__ */