gfx/cairo/libpixman/src/pixman.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/libpixman/src/pixman.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,1116 @@
     1.4 +/***********************************************************
     1.5 +
     1.6 +Copyright 1987, 1998  The Open Group
     1.7 +
     1.8 +Permission to use, copy, modify, distribute, and sell this software and its
     1.9 +documentation for any purpose is hereby granted without fee, provided that
    1.10 +the above copyright notice appear in all copies and that both that
    1.11 +copyright notice and this permission notice appear in supporting
    1.12 +documentation.
    1.13 +
    1.14 +The above copyright notice and this permission notice shall be included in
    1.15 +all copies or substantial portions of the Software.
    1.16 +
    1.17 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.18 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.19 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    1.20 +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    1.21 +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    1.22 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    1.23 +
    1.24 +Except as contained in this notice, the name of The Open Group shall not be
    1.25 +used in advertising or otherwise to promote the sale, use or other dealings
    1.26 +in this Software without prior written authorization from The Open Group.
    1.27 +
    1.28 +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
    1.29 +
    1.30 +                        All Rights Reserved
    1.31 +
    1.32 +Permission to use, copy, modify, and distribute this software and its
    1.33 +documentation for any purpose and without fee is hereby granted,
    1.34 +provided that the above copyright notice appear in all copies and that
    1.35 +both that copyright notice and this permission notice appear in
    1.36 +supporting documentation, and that the name of Digital not be
    1.37 +used in advertising or publicity pertaining to distribution of the
    1.38 +software without specific, written prior permission.
    1.39 +
    1.40 +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
    1.41 +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
    1.42 +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
    1.43 +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
    1.44 +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
    1.45 +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
    1.46 +SOFTWARE.
    1.47 +
    1.48 +******************************************************************/
    1.49 +/*
    1.50 + * Copyright © 1998, 2004 Keith Packard
    1.51 + * Copyright   2007 Red Hat, Inc.
    1.52 + *
    1.53 + * Permission to use, copy, modify, distribute, and sell this software and its
    1.54 + * documentation for any purpose is hereby granted without fee, provided that
    1.55 + * the above copyright notice appear in all copies and that both that
    1.56 + * copyright notice and this permission notice appear in supporting
    1.57 + * documentation, and that the name of Keith Packard not be used in
    1.58 + * advertising or publicity pertaining to distribution of the software without
    1.59 + * specific, written prior permission.  Keith Packard makes no
    1.60 + * representations about the suitability of this software for any purpose.  It
    1.61 + * is provided "as is" without express or implied warranty.
    1.62 + *
    1.63 + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
    1.64 + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
    1.65 + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
    1.66 + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
    1.67 + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
    1.68 + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    1.69 + * PERFORMANCE OF THIS SOFTWARE.
    1.70 + */
    1.71 +
    1.72 +#ifndef PIXMAN_H__
    1.73 +#define PIXMAN_H__
    1.74 +
    1.75 +#ifdef MOZILLA_VERSION
    1.76 +#include "cairo/pixman-rename.h"
    1.77 +#endif
    1.78 +
    1.79 +
    1.80 +#include <pixman-version.h>
    1.81 +
    1.82 +#ifdef  __cplusplus
    1.83 +#define PIXMAN_BEGIN_DECLS extern "C" {
    1.84 +#define PIXMAN_END_DECLS }
    1.85 +#else
    1.86 +#define PIXMAN_BEGIN_DECLS
    1.87 +#define PIXMAN_END_DECLS
    1.88 +#endif
    1.89 +
    1.90 +PIXMAN_BEGIN_DECLS
    1.91 +
    1.92 +/*
    1.93 + * Standard integers
    1.94 + */
    1.95 +
    1.96 +#if !defined (PIXMAN_DONT_DEFINE_STDINT)
    1.97 +
    1.98 +#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) || defined (__HP_cc)
    1.99 +#  include <inttypes.h>
   1.100 +/* VS 2010 (_MSC_VER 1600) has stdint.h */
   1.101 +#elif defined (_MSC_VER) && _MSC_VER < 1600
   1.102 +typedef __int8 int8_t;
   1.103 +typedef unsigned __int8 uint8_t;
   1.104 +typedef __int16 int16_t;
   1.105 +typedef unsigned __int16 uint16_t;
   1.106 +typedef __int32 int32_t;
   1.107 +typedef unsigned __int32 uint32_t;
   1.108 +typedef __int64 int64_t;
   1.109 +typedef unsigned __int64 uint64_t;
   1.110 +#elif defined (_AIX)
   1.111 +#  include <sys/inttypes.h>
   1.112 +#else
   1.113 +#  include <stdint.h>
   1.114 +#endif
   1.115 +
   1.116 +#endif
   1.117 +
   1.118 +/*
   1.119 + * Boolean
   1.120 + */
   1.121 +typedef int pixman_bool_t;
   1.122 +
   1.123 +/*
   1.124 + * Fixpoint numbers
   1.125 + */
   1.126 +typedef int64_t			pixman_fixed_32_32_t;
   1.127 +typedef pixman_fixed_32_32_t	pixman_fixed_48_16_t;
   1.128 +typedef uint32_t		pixman_fixed_1_31_t;
   1.129 +typedef uint32_t		pixman_fixed_1_16_t;
   1.130 +typedef int32_t			pixman_fixed_16_16_t;
   1.131 +typedef pixman_fixed_16_16_t	pixman_fixed_t;
   1.132 +
   1.133 +#define pixman_fixed_e			((pixman_fixed_t) 1)
   1.134 +#define pixman_fixed_1			(pixman_int_to_fixed(1))
   1.135 +#define pixman_fixed_1_minus_e		(pixman_fixed_1 - pixman_fixed_e)
   1.136 +#define pixman_fixed_minus_1		(pixman_int_to_fixed(-1))
   1.137 +#define pixman_fixed_to_int(f)		((int) ((f) >> 16))
   1.138 +#define pixman_int_to_fixed(i)		((pixman_fixed_t) ((i) << 16))
   1.139 +#define pixman_fixed_to_double(f)	(double) ((f) / (double) pixman_fixed_1)
   1.140 +#define pixman_double_to_fixed(d)	((pixman_fixed_t) ((d) * 65536.0))
   1.141 +#define pixman_fixed_frac(f)		((f) & pixman_fixed_1_minus_e)
   1.142 +#define pixman_fixed_floor(f)		((f) & ~pixman_fixed_1_minus_e)
   1.143 +#define pixman_fixed_ceil(f)		pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
   1.144 +#define pixman_fixed_fraction(f)	((f) & pixman_fixed_1_minus_e)
   1.145 +#define pixman_fixed_mod_2(f)		((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
   1.146 +#define pixman_max_fixed_48_16		((pixman_fixed_48_16_t) 0x7fffffff)
   1.147 +#define pixman_min_fixed_48_16		(-((pixman_fixed_48_16_t) 1 << 31))
   1.148 +
   1.149 +/*
   1.150 + * Misc structs
   1.151 + */
   1.152 +typedef struct pixman_color pixman_color_t;
   1.153 +typedef struct pixman_point_fixed pixman_point_fixed_t;
   1.154 +typedef struct pixman_line_fixed pixman_line_fixed_t;
   1.155 +typedef struct pixman_vector pixman_vector_t;
   1.156 +typedef struct pixman_transform pixman_transform_t;
   1.157 +
   1.158 +struct pixman_color
   1.159 +{
   1.160 +    uint16_t	red;
   1.161 +    uint16_t    green;
   1.162 +    uint16_t    blue;
   1.163 +    uint16_t    alpha;
   1.164 +};
   1.165 +
   1.166 +struct pixman_point_fixed
   1.167 +{
   1.168 +    pixman_fixed_t	x;
   1.169 +    pixman_fixed_t	y;
   1.170 +};
   1.171 +
   1.172 +struct pixman_line_fixed
   1.173 +{
   1.174 +    pixman_point_fixed_t	p1, p2;
   1.175 +};
   1.176 +
   1.177 +/*
   1.178 + * Fixed point matrices
   1.179 + */
   1.180 +
   1.181 +struct pixman_vector
   1.182 +{
   1.183 +    pixman_fixed_t	vector[3];
   1.184 +};
   1.185 +
   1.186 +struct pixman_transform
   1.187 +{
   1.188 +    pixman_fixed_t	matrix[3][3];
   1.189 +};
   1.190 +
   1.191 +/* forward declaration (sorry) */
   1.192 +struct pixman_box16;
   1.193 +typedef  union pixman_image		pixman_image_t;
   1.194 +
   1.195 +void          pixman_transform_init_identity    (struct pixman_transform       *matrix);
   1.196 +pixman_bool_t pixman_transform_point_3d         (const struct pixman_transform *transform,
   1.197 +						 struct pixman_vector          *vector);
   1.198 +pixman_bool_t pixman_transform_point            (const struct pixman_transform *transform,
   1.199 +						 struct pixman_vector          *vector);
   1.200 +pixman_bool_t pixman_transform_multiply         (struct pixman_transform       *dst,
   1.201 +						 const struct pixman_transform *l,
   1.202 +						 const struct pixman_transform *r);
   1.203 +void          pixman_transform_init_scale       (struct pixman_transform       *t,
   1.204 +						 pixman_fixed_t                 sx,
   1.205 +						 pixman_fixed_t                 sy);
   1.206 +pixman_bool_t pixman_transform_scale            (struct pixman_transform       *forward,
   1.207 +						 struct pixman_transform       *reverse,
   1.208 +						 pixman_fixed_t                 sx,
   1.209 +						 pixman_fixed_t                 sy);
   1.210 +void          pixman_transform_init_rotate      (struct pixman_transform       *t,
   1.211 +						 pixman_fixed_t                 cos,
   1.212 +						 pixman_fixed_t                 sin);
   1.213 +pixman_bool_t pixman_transform_rotate           (struct pixman_transform       *forward,
   1.214 +						 struct pixman_transform       *reverse,
   1.215 +						 pixman_fixed_t                 c,
   1.216 +						 pixman_fixed_t                 s);
   1.217 +void          pixman_transform_init_translate   (struct pixman_transform       *t,
   1.218 +						 pixman_fixed_t                 tx,
   1.219 +						 pixman_fixed_t                 ty);
   1.220 +pixman_bool_t pixman_transform_translate        (struct pixman_transform       *forward,
   1.221 +						 struct pixman_transform       *reverse,
   1.222 +						 pixman_fixed_t                 tx,
   1.223 +						 pixman_fixed_t                 ty);
   1.224 +pixman_bool_t pixman_transform_bounds           (const struct pixman_transform *matrix,
   1.225 +						 struct pixman_box16           *b);
   1.226 +pixman_bool_t pixman_transform_invert           (struct pixman_transform       *dst,
   1.227 +						 const struct pixman_transform *src);
   1.228 +pixman_bool_t pixman_transform_is_identity      (const struct pixman_transform *t);
   1.229 +pixman_bool_t pixman_transform_is_scale         (const struct pixman_transform *t);
   1.230 +pixman_bool_t pixman_transform_is_int_translate (const struct pixman_transform *t);
   1.231 +pixman_bool_t pixman_transform_is_inverse       (const struct pixman_transform *a,
   1.232 +						 const struct pixman_transform *b);
   1.233 +
   1.234 +/*
   1.235 + * Floating point matrices
   1.236 + */
   1.237 +typedef struct pixman_f_transform pixman_f_transform_t;
   1.238 +typedef struct pixman_f_vector pixman_f_vector_t;
   1.239 +
   1.240 +struct pixman_f_vector
   1.241 +{
   1.242 +    double  v[3];
   1.243 +};
   1.244 +
   1.245 +struct pixman_f_transform
   1.246 +{
   1.247 +    double  m[3][3];
   1.248 +};
   1.249 +
   1.250 +pixman_bool_t pixman_transform_from_pixman_f_transform (struct pixman_transform         *t,
   1.251 +							const struct pixman_f_transform *ft);
   1.252 +void          pixman_f_transform_from_pixman_transform (struct pixman_f_transform       *ft,
   1.253 +							const struct pixman_transform   *t);
   1.254 +pixman_bool_t pixman_f_transform_invert                (struct pixman_f_transform       *dst,
   1.255 +							const struct pixman_f_transform *src);
   1.256 +pixman_bool_t pixman_f_transform_point                 (const struct pixman_f_transform *t,
   1.257 +							struct pixman_f_vector          *v);
   1.258 +void          pixman_f_transform_point_3d              (const struct pixman_f_transform *t,
   1.259 +							struct pixman_f_vector          *v);
   1.260 +void          pixman_f_transform_multiply              (struct pixman_f_transform       *dst,
   1.261 +							const struct pixman_f_transform *l,
   1.262 +							const struct pixman_f_transform *r);
   1.263 +void          pixman_f_transform_init_scale            (struct pixman_f_transform       *t,
   1.264 +							double                           sx,
   1.265 +							double                           sy);
   1.266 +pixman_bool_t pixman_f_transform_scale                 (struct pixman_f_transform       *forward,
   1.267 +							struct pixman_f_transform       *reverse,
   1.268 +							double                           sx,
   1.269 +							double                           sy);
   1.270 +void          pixman_f_transform_init_rotate           (struct pixman_f_transform       *t,
   1.271 +							double                           cos,
   1.272 +							double                           sin);
   1.273 +pixman_bool_t pixman_f_transform_rotate                (struct pixman_f_transform       *forward,
   1.274 +							struct pixman_f_transform       *reverse,
   1.275 +							double                           c,
   1.276 +							double                           s);
   1.277 +void          pixman_f_transform_init_translate        (struct pixman_f_transform       *t,
   1.278 +							double                           tx,
   1.279 +							double                           ty);
   1.280 +pixman_bool_t pixman_f_transform_translate             (struct pixman_f_transform       *forward,
   1.281 +							struct pixman_f_transform       *reverse,
   1.282 +							double                           tx,
   1.283 +							double                           ty);
   1.284 +pixman_bool_t pixman_f_transform_bounds                (const struct pixman_f_transform *t,
   1.285 +							struct pixman_box16             *b);
   1.286 +void          pixman_f_transform_init_identity         (struct pixman_f_transform       *t);
   1.287 +
   1.288 +typedef enum
   1.289 +{
   1.290 +    PIXMAN_REPEAT_NONE,
   1.291 +    PIXMAN_REPEAT_NORMAL,
   1.292 +    PIXMAN_REPEAT_PAD,
   1.293 +    PIXMAN_REPEAT_REFLECT
   1.294 +} pixman_repeat_t;
   1.295 +
   1.296 +typedef enum
   1.297 +{
   1.298 +    PIXMAN_FILTER_FAST,
   1.299 +    PIXMAN_FILTER_GOOD,
   1.300 +    PIXMAN_FILTER_BEST,
   1.301 +    PIXMAN_FILTER_NEAREST,
   1.302 +    PIXMAN_FILTER_BILINEAR,
   1.303 +    PIXMAN_FILTER_CONVOLUTION,
   1.304 +
   1.305 +    /* The SEPARABLE_CONVOLUTION filter takes the following parameters:
   1.306 +     *
   1.307 +     *         width:           integer given as 16.16 fixpoint number
   1.308 +     *         height:          integer given as 16.16 fixpoint number
   1.309 +     *         x_phase_bits:	integer given as 16.16 fixpoint
   1.310 +     *         y_phase_bits:	integer given as 16.16 fixpoint
   1.311 +     *         xtables:         (1 << x_phase_bits) tables of size width
   1.312 +     *         ytables:         (1 << y_phase_bits) tables of size height
   1.313 +     *
   1.314 +     * When sampling at (x, y), the location is first rounded to one of
   1.315 +     * n_x_phases * n_y_phases subpixel positions. These subpixel positions
   1.316 +     * determine an xtable and a ytable to use.
   1.317 +     *
   1.318 +     * Conceptually a width x height matrix is then formed in which each entry
   1.319 +     * is the product of the corresponding entries in the x and y tables.
   1.320 +     * This matrix is then aligned with the image pixels such that its center
   1.321 +     * is as close as possible to the subpixel location chosen earlier. Then
   1.322 +     * the image is convolved with the matrix and the resulting pixel returned.
   1.323 +     */
   1.324 +    PIXMAN_FILTER_SEPARABLE_CONVOLUTION
   1.325 +} pixman_filter_t;
   1.326 +
   1.327 +typedef enum
   1.328 +{
   1.329 +    PIXMAN_OP_CLEAR			= 0x00,
   1.330 +    PIXMAN_OP_SRC			= 0x01,
   1.331 +    PIXMAN_OP_DST			= 0x02,
   1.332 +    PIXMAN_OP_OVER			= 0x03,
   1.333 +    PIXMAN_OP_OVER_REVERSE		= 0x04,
   1.334 +    PIXMAN_OP_IN			= 0x05,
   1.335 +    PIXMAN_OP_IN_REVERSE		= 0x06,
   1.336 +    PIXMAN_OP_OUT			= 0x07,
   1.337 +    PIXMAN_OP_OUT_REVERSE		= 0x08,
   1.338 +    PIXMAN_OP_ATOP			= 0x09,
   1.339 +    PIXMAN_OP_ATOP_REVERSE		= 0x0a,
   1.340 +    PIXMAN_OP_XOR			= 0x0b,
   1.341 +    PIXMAN_OP_ADD			= 0x0c,
   1.342 +    PIXMAN_OP_SATURATE			= 0x0d,
   1.343 +
   1.344 +    PIXMAN_OP_DISJOINT_CLEAR		= 0x10,
   1.345 +    PIXMAN_OP_DISJOINT_SRC		= 0x11,
   1.346 +    PIXMAN_OP_DISJOINT_DST		= 0x12,
   1.347 +    PIXMAN_OP_DISJOINT_OVER		= 0x13,
   1.348 +    PIXMAN_OP_DISJOINT_OVER_REVERSE	= 0x14,
   1.349 +    PIXMAN_OP_DISJOINT_IN		= 0x15,
   1.350 +    PIXMAN_OP_DISJOINT_IN_REVERSE	= 0x16,
   1.351 +    PIXMAN_OP_DISJOINT_OUT		= 0x17,
   1.352 +    PIXMAN_OP_DISJOINT_OUT_REVERSE	= 0x18,
   1.353 +    PIXMAN_OP_DISJOINT_ATOP		= 0x19,
   1.354 +    PIXMAN_OP_DISJOINT_ATOP_REVERSE	= 0x1a,
   1.355 +    PIXMAN_OP_DISJOINT_XOR		= 0x1b,
   1.356 +
   1.357 +    PIXMAN_OP_CONJOINT_CLEAR		= 0x20,
   1.358 +    PIXMAN_OP_CONJOINT_SRC		= 0x21,
   1.359 +    PIXMAN_OP_CONJOINT_DST		= 0x22,
   1.360 +    PIXMAN_OP_CONJOINT_OVER		= 0x23,
   1.361 +    PIXMAN_OP_CONJOINT_OVER_REVERSE	= 0x24,
   1.362 +    PIXMAN_OP_CONJOINT_IN		= 0x25,
   1.363 +    PIXMAN_OP_CONJOINT_IN_REVERSE	= 0x26,
   1.364 +    PIXMAN_OP_CONJOINT_OUT		= 0x27,
   1.365 +    PIXMAN_OP_CONJOINT_OUT_REVERSE	= 0x28,
   1.366 +    PIXMAN_OP_CONJOINT_ATOP		= 0x29,
   1.367 +    PIXMAN_OP_CONJOINT_ATOP_REVERSE	= 0x2a,
   1.368 +    PIXMAN_OP_CONJOINT_XOR		= 0x2b,
   1.369 +
   1.370 +    PIXMAN_OP_MULTIPLY                  = 0x30,
   1.371 +    PIXMAN_OP_SCREEN                    = 0x31,
   1.372 +    PIXMAN_OP_OVERLAY                   = 0x32,
   1.373 +    PIXMAN_OP_DARKEN                    = 0x33,
   1.374 +    PIXMAN_OP_LIGHTEN                   = 0x34,
   1.375 +    PIXMAN_OP_COLOR_DODGE               = 0x35,
   1.376 +    PIXMAN_OP_COLOR_BURN                = 0x36,
   1.377 +    PIXMAN_OP_HARD_LIGHT                = 0x37,
   1.378 +    PIXMAN_OP_SOFT_LIGHT                = 0x38,
   1.379 +    PIXMAN_OP_DIFFERENCE                = 0x39,
   1.380 +    PIXMAN_OP_EXCLUSION                 = 0x3a,
   1.381 +    PIXMAN_OP_HSL_HUE			= 0x3b,
   1.382 +    PIXMAN_OP_HSL_SATURATION		= 0x3c,
   1.383 +    PIXMAN_OP_HSL_COLOR			= 0x3d,
   1.384 +    PIXMAN_OP_HSL_LUMINOSITY		= 0x3e
   1.385 +
   1.386 +#ifdef PIXMAN_USE_INTERNAL_API
   1.387 +    ,
   1.388 +    PIXMAN_N_OPERATORS,
   1.389 +    PIXMAN_OP_NONE = PIXMAN_N_OPERATORS
   1.390 +#endif
   1.391 +} pixman_op_t;
   1.392 +
   1.393 +/*
   1.394 + * Regions
   1.395 + */
   1.396 +typedef struct pixman_region16_data	pixman_region16_data_t;
   1.397 +typedef struct pixman_box16		pixman_box16_t;
   1.398 +typedef struct pixman_rectangle16	pixman_rectangle16_t;
   1.399 +typedef struct pixman_region16		pixman_region16_t;
   1.400 +
   1.401 +struct pixman_region16_data {
   1.402 +    long		size;
   1.403 +    long		numRects;
   1.404 +/*  pixman_box16_t	rects[size];   in memory but not explicitly declared */
   1.405 +};
   1.406 +
   1.407 +struct pixman_rectangle16
   1.408 +{
   1.409 +    int16_t	x, y;
   1.410 +    uint16_t	width, height;
   1.411 +};
   1.412 +
   1.413 +struct pixman_box16
   1.414 +{
   1.415 +    int16_t x1, y1, x2, y2;
   1.416 +};
   1.417 +
   1.418 +struct pixman_region16
   1.419 +{
   1.420 +    pixman_box16_t          extents;
   1.421 +    pixman_region16_data_t *data;
   1.422 +};
   1.423 +
   1.424 +typedef enum
   1.425 +{
   1.426 +    PIXMAN_REGION_OUT,
   1.427 +    PIXMAN_REGION_IN,
   1.428 +    PIXMAN_REGION_PART
   1.429 +} pixman_region_overlap_t;
   1.430 +
   1.431 +/* This function exists only to make it possible to preserve
   1.432 + * the X ABI - it should go away at first opportunity.
   1.433 + */
   1.434 +void pixman_region_set_static_pointers (pixman_box16_t         *empty_box,
   1.435 +					pixman_region16_data_t *empty_data,
   1.436 +					pixman_region16_data_t *broken_data);
   1.437 +
   1.438 +/* creation/destruction */
   1.439 +void                    pixman_region_init               (pixman_region16_t *region);
   1.440 +void                    pixman_region_init_rect          (pixman_region16_t *region,
   1.441 +							  int                x,
   1.442 +							  int                y,
   1.443 +							  unsigned int       width,
   1.444 +							  unsigned int       height);
   1.445 +pixman_bool_t           pixman_region_init_rects         (pixman_region16_t *region,
   1.446 +							  const pixman_box16_t *boxes,
   1.447 +							  int                count);
   1.448 +void                    pixman_region_init_with_extents  (pixman_region16_t *region,
   1.449 +							  pixman_box16_t    *extents);
   1.450 +void                    pixman_region_init_from_image    (pixman_region16_t *region,
   1.451 +							  pixman_image_t    *image);
   1.452 +void                    pixman_region_fini               (pixman_region16_t *region);
   1.453 +
   1.454 +
   1.455 +/* manipulation */
   1.456 +void                    pixman_region_translate          (pixman_region16_t *region,
   1.457 +							  int                x,
   1.458 +							  int                y);
   1.459 +pixman_bool_t           pixman_region_copy               (pixman_region16_t *dest,
   1.460 +							  pixman_region16_t *source);
   1.461 +pixman_bool_t           pixman_region_intersect          (pixman_region16_t *new_reg,
   1.462 +							  pixman_region16_t *reg1,
   1.463 +							  pixman_region16_t *reg2);
   1.464 +pixman_bool_t           pixman_region_union              (pixman_region16_t *new_reg,
   1.465 +							  pixman_region16_t *reg1,
   1.466 +							  pixman_region16_t *reg2);
   1.467 +pixman_bool_t           pixman_region_union_rect         (pixman_region16_t *dest,
   1.468 +							  pixman_region16_t *source,
   1.469 +							  int                x,
   1.470 +							  int                y,
   1.471 +							  unsigned int       width,
   1.472 +							  unsigned int       height);
   1.473 +pixman_bool_t		pixman_region_intersect_rect     (pixman_region16_t *dest,
   1.474 +							  pixman_region16_t *source,
   1.475 +							  int                x,
   1.476 +							  int                y,
   1.477 +							  unsigned int       width,
   1.478 +							  unsigned int       height);
   1.479 +pixman_bool_t           pixman_region_subtract           (pixman_region16_t *reg_d,
   1.480 +							  pixman_region16_t *reg_m,
   1.481 +							  pixman_region16_t *reg_s);
   1.482 +pixman_bool_t           pixman_region_inverse            (pixman_region16_t *new_reg,
   1.483 +							  pixman_region16_t *reg1,
   1.484 +							  pixman_box16_t    *inv_rect);
   1.485 +pixman_bool_t           pixman_region_contains_point     (pixman_region16_t *region,
   1.486 +							  int                x,
   1.487 +							  int                y,
   1.488 +							  pixman_box16_t    *box);
   1.489 +pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *region,
   1.490 +							  pixman_box16_t    *prect);
   1.491 +pixman_bool_t           pixman_region_not_empty          (pixman_region16_t *region);
   1.492 +pixman_box16_t *        pixman_region_extents            (pixman_region16_t *region);
   1.493 +int                     pixman_region_n_rects            (pixman_region16_t *region);
   1.494 +pixman_box16_t *        pixman_region_rectangles         (pixman_region16_t *region,
   1.495 +							  int               *n_rects);
   1.496 +pixman_bool_t           pixman_region_equal              (pixman_region16_t *region1,
   1.497 +							  pixman_region16_t *region2);
   1.498 +pixman_bool_t           pixman_region_selfcheck          (pixman_region16_t *region);
   1.499 +void                    pixman_region_reset              (pixman_region16_t *region,
   1.500 +							  pixman_box16_t    *box);
   1.501 +void			pixman_region_clear		 (pixman_region16_t *region);
   1.502 +/*
   1.503 + * 32 bit regions
   1.504 + */
   1.505 +typedef struct pixman_region32_data	pixman_region32_data_t;
   1.506 +typedef struct pixman_box32		pixman_box32_t;
   1.507 +typedef struct pixman_rectangle32	pixman_rectangle32_t;
   1.508 +typedef struct pixman_region32		pixman_region32_t;
   1.509 +
   1.510 +struct pixman_region32_data {
   1.511 +    long		size;
   1.512 +    long		numRects;
   1.513 +/*  pixman_box32_t	rects[size];   in memory but not explicitly declared */
   1.514 +};
   1.515 +
   1.516 +struct pixman_rectangle32
   1.517 +{
   1.518 +    int32_t x, y;
   1.519 +    uint32_t width, height;
   1.520 +};
   1.521 +
   1.522 +struct pixman_box32
   1.523 +{
   1.524 +    int32_t x1, y1, x2, y2;
   1.525 +};
   1.526 +
   1.527 +struct pixman_region32
   1.528 +{
   1.529 +    pixman_box32_t          extents;
   1.530 +    pixman_region32_data_t  *data;
   1.531 +};
   1.532 +
   1.533 +/* creation/destruction */
   1.534 +void                    pixman_region32_init               (pixman_region32_t *region);
   1.535 +void                    pixman_region32_init_rect          (pixman_region32_t *region,
   1.536 +							    int                x,
   1.537 +							    int                y,
   1.538 +							    unsigned int       width,
   1.539 +							    unsigned int       height);
   1.540 +pixman_bool_t           pixman_region32_init_rects         (pixman_region32_t *region,
   1.541 +							    const pixman_box32_t *boxes,
   1.542 +							    int                count);
   1.543 +void                    pixman_region32_init_with_extents  (pixman_region32_t *region,
   1.544 +							    pixman_box32_t    *extents);
   1.545 +void                    pixman_region32_init_from_image    (pixman_region32_t *region,
   1.546 +							    pixman_image_t    *image);
   1.547 +void                    pixman_region32_fini               (pixman_region32_t *region);
   1.548 +
   1.549 +
   1.550 +/* manipulation */
   1.551 +void                    pixman_region32_translate          (pixman_region32_t *region,
   1.552 +							    int                x,
   1.553 +							    int                y);
   1.554 +pixman_bool_t           pixman_region32_copy               (pixman_region32_t *dest,
   1.555 +							    pixman_region32_t *source);
   1.556 +pixman_bool_t           pixman_region32_intersect          (pixman_region32_t *new_reg,
   1.557 +							    pixman_region32_t *reg1,
   1.558 +							    pixman_region32_t *reg2);
   1.559 +pixman_bool_t           pixman_region32_union              (pixman_region32_t *new_reg,
   1.560 +							    pixman_region32_t *reg1,
   1.561 +							    pixman_region32_t *reg2);
   1.562 +pixman_bool_t		pixman_region32_intersect_rect     (pixman_region32_t *dest,
   1.563 +							    pixman_region32_t *source,
   1.564 +							    int                x,
   1.565 +							    int                y,
   1.566 +							    unsigned int       width,
   1.567 +							    unsigned int       height);
   1.568 +pixman_bool_t           pixman_region32_union_rect         (pixman_region32_t *dest,
   1.569 +							    pixman_region32_t *source,
   1.570 +							    int                x,
   1.571 +							    int                y,
   1.572 +							    unsigned int       width,
   1.573 +							    unsigned int       height);
   1.574 +pixman_bool_t           pixman_region32_subtract           (pixman_region32_t *reg_d,
   1.575 +							    pixman_region32_t *reg_m,
   1.576 +							    pixman_region32_t *reg_s);
   1.577 +pixman_bool_t           pixman_region32_inverse            (pixman_region32_t *new_reg,
   1.578 +							    pixman_region32_t *reg1,
   1.579 +							    pixman_box32_t    *inv_rect);
   1.580 +pixman_bool_t           pixman_region32_contains_point     (pixman_region32_t *region,
   1.581 +							    int                x,
   1.582 +							    int                y,
   1.583 +							    pixman_box32_t    *box);
   1.584 +pixman_region_overlap_t pixman_region32_contains_rectangle (pixman_region32_t *region,
   1.585 +							    pixman_box32_t    *prect);
   1.586 +pixman_bool_t           pixman_region32_not_empty          (pixman_region32_t *region);
   1.587 +pixman_box32_t *        pixman_region32_extents            (pixman_region32_t *region);
   1.588 +int                     pixman_region32_n_rects            (pixman_region32_t *region);
   1.589 +pixman_box32_t *        pixman_region32_rectangles         (pixman_region32_t *region,
   1.590 +							    int               *n_rects);
   1.591 +pixman_bool_t           pixman_region32_equal              (pixman_region32_t *region1,
   1.592 +							    pixman_region32_t *region2);
   1.593 +pixman_bool_t           pixman_region32_selfcheck          (pixman_region32_t *region);
   1.594 +void                    pixman_region32_reset              (pixman_region32_t *region,
   1.595 +							    pixman_box32_t    *box);
   1.596 +void			pixman_region32_clear		   (pixman_region32_t *region);
   1.597 +
   1.598 +
   1.599 +/* Copy / Fill / Misc */
   1.600 +pixman_bool_t pixman_blt                (uint32_t           *src_bits,
   1.601 +					 uint32_t           *dst_bits,
   1.602 +					 int                 src_stride,
   1.603 +					 int                 dst_stride,
   1.604 +					 int                 src_bpp,
   1.605 +					 int                 dst_bpp,
   1.606 +					 int                 src_x,
   1.607 +					 int                 src_y,
   1.608 +					 int                 dest_x,
   1.609 +					 int                 dest_y,
   1.610 +					 int                 width,
   1.611 +					 int                 height);
   1.612 +pixman_bool_t pixman_fill               (uint32_t           *bits,
   1.613 +					 int                 stride,
   1.614 +					 int                 bpp,
   1.615 +					 int                 x,
   1.616 +					 int                 y,
   1.617 +					 int                 width,
   1.618 +					 int                 height,
   1.619 +					 uint32_t            _xor);
   1.620 +
   1.621 +int           pixman_version            (void);
   1.622 +const char*   pixman_version_string     (void);
   1.623 +
   1.624 +/*
   1.625 + * Images
   1.626 + */
   1.627 +typedef struct pixman_indexed		pixman_indexed_t;
   1.628 +typedef struct pixman_gradient_stop	pixman_gradient_stop_t;
   1.629 +
   1.630 +typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
   1.631 +typedef void     (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
   1.632 +
   1.633 +typedef void     (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data);
   1.634 +
   1.635 +struct pixman_gradient_stop {
   1.636 +    pixman_fixed_t x;
   1.637 +    pixman_color_t color;
   1.638 +};
   1.639 +
   1.640 +#define PIXMAN_MAX_INDEXED  256 /* XXX depth must be <= 8 */
   1.641 +
   1.642 +#if PIXMAN_MAX_INDEXED <= 256
   1.643 +typedef uint8_t pixman_index_type;
   1.644 +#endif
   1.645 +
   1.646 +struct pixman_indexed
   1.647 +{
   1.648 +    pixman_bool_t       color;
   1.649 +    uint32_t		rgba[PIXMAN_MAX_INDEXED];
   1.650 +    pixman_index_type	ent[32768];
   1.651 +};
   1.652 +
   1.653 +/*
   1.654 + * While the protocol is generous in format support, the
   1.655 + * sample implementation allows only packed RGB and GBR
   1.656 + * representations for data to simplify software rendering,
   1.657 + */
   1.658 +#define PIXMAN_FORMAT(bpp,type,a,r,g,b)	(((bpp) << 24) |  \
   1.659 +					 ((type) << 16) | \
   1.660 +					 ((a) << 12) |	  \
   1.661 +					 ((r) << 8) |	  \
   1.662 +					 ((g) << 4) |	  \
   1.663 +					 ((b)))
   1.664 +
   1.665 +#define PIXMAN_FORMAT_BPP(f)	(((f) >> 24)       )
   1.666 +#define PIXMAN_FORMAT_TYPE(f)	(((f) >> 16) & 0xff)
   1.667 +#define PIXMAN_FORMAT_A(f)	(((f) >> 12) & 0x0f)
   1.668 +#define PIXMAN_FORMAT_R(f)	(((f) >>  8) & 0x0f)
   1.669 +#define PIXMAN_FORMAT_G(f)	(((f) >>  4) & 0x0f)
   1.670 +#define PIXMAN_FORMAT_B(f)	(((f)      ) & 0x0f)
   1.671 +#define PIXMAN_FORMAT_RGB(f)	(((f)      ) & 0xfff)
   1.672 +#define PIXMAN_FORMAT_VIS(f)	(((f)      ) & 0xffff)
   1.673 +#define PIXMAN_FORMAT_DEPTH(f)	(PIXMAN_FORMAT_A(f) +	\
   1.674 +				 PIXMAN_FORMAT_R(f) +	\
   1.675 +				 PIXMAN_FORMAT_G(f) +	\
   1.676 +				 PIXMAN_FORMAT_B(f))
   1.677 +
   1.678 +#define PIXMAN_TYPE_OTHER	0
   1.679 +#define PIXMAN_TYPE_A		1
   1.680 +#define PIXMAN_TYPE_ARGB	2
   1.681 +#define PIXMAN_TYPE_ABGR	3
   1.682 +#define PIXMAN_TYPE_COLOR	4
   1.683 +#define PIXMAN_TYPE_GRAY	5
   1.684 +#define PIXMAN_TYPE_YUY2	6
   1.685 +#define PIXMAN_TYPE_YV12	7
   1.686 +#define PIXMAN_TYPE_BGRA	8
   1.687 +#define PIXMAN_TYPE_RGBA	9
   1.688 +#define PIXMAN_TYPE_ARGB_SRGB	10
   1.689 +
   1.690 +#define PIXMAN_FORMAT_COLOR(f)				\
   1.691 +	(PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB ||	\
   1.692 +	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR ||	\
   1.693 +	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA ||	\
   1.694 +	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA)
   1.695 +
   1.696 +/* 32bpp formats */
   1.697 +typedef enum {
   1.698 +    PIXMAN_a8r8g8b8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
   1.699 +    PIXMAN_x8r8g8b8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
   1.700 +    PIXMAN_a8b8g8r8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
   1.701 +    PIXMAN_x8b8g8r8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
   1.702 +    PIXMAN_b8g8r8a8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
   1.703 +    PIXMAN_b8g8r8x8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
   1.704 +    PIXMAN_r8g8b8a8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
   1.705 +    PIXMAN_r8g8b8x8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
   1.706 +    PIXMAN_x14r6g6b6 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
   1.707 +    PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
   1.708 +    PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
   1.709 +    PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
   1.710 +    PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
   1.711 +
   1.712 +/* sRGB formats */
   1.713 +    PIXMAN_a8r8g8b8_sRGB = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_SRGB,8,8,8,8),
   1.714 +
   1.715 +/* 24bpp formats */
   1.716 +    PIXMAN_r8g8b8 =	 PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
   1.717 +    PIXMAN_b8g8r8 =	 PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
   1.718 +
   1.719 +/* 16bpp formats */
   1.720 +    PIXMAN_r5g6b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
   1.721 +    PIXMAN_b5g6r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
   1.722 +
   1.723 +    PIXMAN_a1r5g5b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
   1.724 +    PIXMAN_x1r5g5b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
   1.725 +    PIXMAN_a1b5g5r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
   1.726 +    PIXMAN_x1b5g5r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
   1.727 +    PIXMAN_a4r4g4b4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
   1.728 +    PIXMAN_x4r4g4b4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
   1.729 +    PIXMAN_a4b4g4r4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
   1.730 +    PIXMAN_x4b4g4r4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
   1.731 +
   1.732 +/* 8bpp formats */
   1.733 +    PIXMAN_a8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
   1.734 +    PIXMAN_r3g3b2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
   1.735 +    PIXMAN_b2g3r3 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
   1.736 +    PIXMAN_a2r2g2b2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
   1.737 +    PIXMAN_a2b2g2r2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
   1.738 +
   1.739 +    PIXMAN_c8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
   1.740 +    PIXMAN_g8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
   1.741 +
   1.742 +    PIXMAN_x4a4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
   1.743 +
   1.744 +    PIXMAN_x4c4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
   1.745 +    PIXMAN_x4g4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
   1.746 +
   1.747 +/* 4bpp formats */
   1.748 +    PIXMAN_a4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
   1.749 +    PIXMAN_r1g2b1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
   1.750 +    PIXMAN_b1g2r1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
   1.751 +    PIXMAN_a1r1g1b1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
   1.752 +    PIXMAN_a1b1g1r1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
   1.753 +
   1.754 +    PIXMAN_c4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
   1.755 +    PIXMAN_g4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
   1.756 +
   1.757 +/* 1bpp formats */
   1.758 +    PIXMAN_a1 =		 PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
   1.759 +
   1.760 +    PIXMAN_g1 =		 PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
   1.761 +
   1.762 +/* YUV formats */
   1.763 +    PIXMAN_yuy2 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
   1.764 +    PIXMAN_yv12 =	 PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
   1.765 +} pixman_format_code_t;
   1.766 +
   1.767 +/* Querying supported format values. */
   1.768 +pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
   1.769 +pixman_bool_t pixman_format_supported_source      (pixman_format_code_t format);
   1.770 +
   1.771 +/* Constructors */
   1.772 +pixman_image_t *pixman_image_create_solid_fill       (const pixman_color_t         *color);
   1.773 +pixman_image_t *pixman_image_create_linear_gradient  (const pixman_point_fixed_t   *p1,
   1.774 +						      const pixman_point_fixed_t   *p2,
   1.775 +						      const pixman_gradient_stop_t *stops,
   1.776 +						      int                           n_stops);
   1.777 +pixman_image_t *pixman_image_create_radial_gradient  (const pixman_point_fixed_t   *inner,
   1.778 +						      const pixman_point_fixed_t   *outer,
   1.779 +						      pixman_fixed_t                inner_radius,
   1.780 +						      pixman_fixed_t                outer_radius,
   1.781 +						      const pixman_gradient_stop_t *stops,
   1.782 +						      int                           n_stops);
   1.783 +pixman_image_t *pixman_image_create_conical_gradient (const pixman_point_fixed_t   *center,
   1.784 +						      pixman_fixed_t                angle,
   1.785 +						      const pixman_gradient_stop_t *stops,
   1.786 +						      int                           n_stops);
   1.787 +pixman_image_t *pixman_image_create_bits             (pixman_format_code_t          format,
   1.788 +						      int                           width,
   1.789 +						      int                           height,
   1.790 +						      uint32_t                     *bits,
   1.791 +						      int                           rowstride_bytes);
   1.792 +pixman_image_t *pixman_image_create_bits_no_clear    (pixman_format_code_t format,
   1.793 +						      int                  width,
   1.794 +						      int                  height,
   1.795 +						      uint32_t *           bits,
   1.796 +						      int                  rowstride_bytes);
   1.797 +
   1.798 +/* Destructor */
   1.799 +pixman_image_t *pixman_image_ref                     (pixman_image_t               *image);
   1.800 +pixman_bool_t   pixman_image_unref                   (pixman_image_t               *image);
   1.801 +
   1.802 +void		pixman_image_set_destroy_function    (pixman_image_t		   *image,
   1.803 +						      pixman_image_destroy_func_t   function,
   1.804 +						      void			   *data);
   1.805 +void *		pixman_image_get_destroy_data        (pixman_image_t		   *image);
   1.806 +
   1.807 +/* Set properties */
   1.808 +pixman_bool_t   pixman_image_set_clip_region         (pixman_image_t               *image,
   1.809 +						      pixman_region16_t            *region);
   1.810 +pixman_bool_t   pixman_image_set_clip_region32       (pixman_image_t               *image,
   1.811 +						      pixman_region32_t            *region);
   1.812 +void		pixman_image_set_has_client_clip     (pixman_image_t               *image,
   1.813 +						      pixman_bool_t		    clien_clip);
   1.814 +pixman_bool_t   pixman_image_set_transform           (pixman_image_t               *image,
   1.815 +						      const pixman_transform_t     *transform);
   1.816 +void            pixman_image_set_repeat              (pixman_image_t               *image,
   1.817 +						      pixman_repeat_t               repeat);
   1.818 +pixman_bool_t   pixman_image_set_filter              (pixman_image_t               *image,
   1.819 +						      pixman_filter_t               filter,
   1.820 +						      const pixman_fixed_t         *filter_params,
   1.821 +						      int                           n_filter_params);
   1.822 +void		pixman_image_set_source_clipping     (pixman_image_t		   *image,
   1.823 +						      pixman_bool_t                 source_clipping);
   1.824 +void            pixman_image_set_alpha_map           (pixman_image_t               *image,
   1.825 +						      pixman_image_t               *alpha_map,
   1.826 +						      int16_t                       x,
   1.827 +						      int16_t                       y);
   1.828 +void            pixman_image_set_component_alpha     (pixman_image_t               *image,
   1.829 +						      pixman_bool_t                 component_alpha);
   1.830 +pixman_bool_t   pixman_image_get_component_alpha     (pixman_image_t               *image);
   1.831 +void		pixman_image_set_accessors	     (pixman_image_t		   *image,
   1.832 +						      pixman_read_memory_func_t	    read_func,
   1.833 +						      pixman_write_memory_func_t    write_func);
   1.834 +void		pixman_image_set_indexed	     (pixman_image_t		   *image,
   1.835 +						      const pixman_indexed_t	   *indexed);
   1.836 +uint32_t       *pixman_image_get_data                (pixman_image_t               *image);
   1.837 +int		pixman_image_get_width               (pixman_image_t               *image);
   1.838 +int             pixman_image_get_height              (pixman_image_t               *image);
   1.839 +int		pixman_image_get_stride              (pixman_image_t               *image); /* in bytes */
   1.840 +int		pixman_image_get_depth               (pixman_image_t		   *image);
   1.841 +pixman_format_code_t pixman_image_get_format	     (pixman_image_t		   *image);
   1.842 +
   1.843 +typedef enum
   1.844 +{
   1.845 +    PIXMAN_KERNEL_IMPULSE,
   1.846 +    PIXMAN_KERNEL_BOX,
   1.847 +    PIXMAN_KERNEL_LINEAR,
   1.848 +    PIXMAN_KERNEL_CUBIC,
   1.849 +    PIXMAN_KERNEL_GAUSSIAN,
   1.850 +    PIXMAN_KERNEL_LANCZOS2,
   1.851 +    PIXMAN_KERNEL_LANCZOS3,
   1.852 +    PIXMAN_KERNEL_LANCZOS3_STRETCHED       /* Jim Blinn's 'nice' filter */
   1.853 +} pixman_kernel_t;
   1.854 +
   1.855 +/* Create the parameter list for a SEPARABLE_CONVOLUTION filter
   1.856 + * with the given kernels and scale parameters.
   1.857 + */
   1.858 +pixman_fixed_t *
   1.859 +pixman_filter_create_separable_convolution (int             *n_values,
   1.860 +					    pixman_fixed_t   scale_x,
   1.861 +					    pixman_fixed_t   scale_y,
   1.862 +					    pixman_kernel_t  reconstruct_x,
   1.863 +					    pixman_kernel_t  reconstruct_y,
   1.864 +					    pixman_kernel_t  sample_x,
   1.865 +					    pixman_kernel_t  sample_y,
   1.866 +					    int              subsample_bits_x,
   1.867 +					    int              subsample_bits_y);
   1.868 +
   1.869 +pixman_bool_t	pixman_image_fill_rectangles	     (pixman_op_t		    op,
   1.870 +						      pixman_image_t		   *image,
   1.871 +						      const pixman_color_t	   *color,
   1.872 +						      int			    n_rects,
   1.873 +						      const pixman_rectangle16_t   *rects);
   1.874 +pixman_bool_t   pixman_image_fill_boxes              (pixman_op_t                   op,
   1.875 +                                                      pixman_image_t               *dest,
   1.876 +                                                      const pixman_color_t         *color,
   1.877 +                                                      int                           n_boxes,
   1.878 +                                                      const pixman_box32_t         *boxes);
   1.879 +
   1.880 +/* Composite */
   1.881 +pixman_bool_t pixman_compute_composite_region (pixman_region16_t *region,
   1.882 +					       pixman_image_t    *src_image,
   1.883 +					       pixman_image_t    *mask_image,
   1.884 +					       pixman_image_t    *dest_image,
   1.885 +					       int16_t            src_x,
   1.886 +					       int16_t            src_y,
   1.887 +					       int16_t            mask_x,
   1.888 +					       int16_t            mask_y,
   1.889 +					       int16_t            dest_x,
   1.890 +					       int16_t            dest_y,
   1.891 +					       uint16_t           width,
   1.892 +					       uint16_t           height);
   1.893 +void          pixman_image_composite          (pixman_op_t        op,
   1.894 +					       pixman_image_t    *src,
   1.895 +					       pixman_image_t    *mask,
   1.896 +					       pixman_image_t    *dest,
   1.897 +					       int16_t            src_x,
   1.898 +					       int16_t            src_y,
   1.899 +					       int16_t            mask_x,
   1.900 +					       int16_t            mask_y,
   1.901 +					       int16_t            dest_x,
   1.902 +					       int16_t            dest_y,
   1.903 +					       uint16_t           width,
   1.904 +					       uint16_t           height);
   1.905 +void          pixman_image_composite32        (pixman_op_t        op,
   1.906 +					       pixman_image_t    *src,
   1.907 +					       pixman_image_t    *mask,
   1.908 +					       pixman_image_t    *dest,
   1.909 +					       int32_t            src_x,
   1.910 +					       int32_t            src_y,
   1.911 +					       int32_t            mask_x,
   1.912 +					       int32_t            mask_y,
   1.913 +					       int32_t            dest_x,
   1.914 +					       int32_t            dest_y,
   1.915 +					       int32_t            width,
   1.916 +					       int32_t            height);
   1.917 +
   1.918 +/* Executive Summary: This function is a no-op that only exists
   1.919 + * for historical reasons.
   1.920 + *
   1.921 + * There used to be a bug in the X server where it would rely on
   1.922 + * out-of-bounds accesses when it was asked to composite with a
   1.923 + * window as the source. It would create a pixman image pointing
   1.924 + * to some bogus position in memory, but then set a clip region
   1.925 + * to the position where the actual bits were.
   1.926 + *
   1.927 + * Due to a bug in old versions of pixman, where it would not clip
   1.928 + * against the image bounds when a clip region was set, this would
   1.929 + * actually work. So when the pixman bug was fixed, a workaround was
   1.930 + * added to allow certain out-of-bound accesses. This function disabled
   1.931 + * those workarounds.
   1.932 + *
   1.933 + * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this
   1.934 + * function is a no-op.
   1.935 + */
   1.936 +void pixman_disable_out_of_bounds_workaround (void);
   1.937 +
   1.938 +/*
   1.939 + * Glyphs
   1.940 + */
   1.941 +typedef struct pixman_glyph_cache_t pixman_glyph_cache_t;
   1.942 +typedef struct
   1.943 +{
   1.944 +    int		x, y;
   1.945 +    const void *glyph;
   1.946 +} pixman_glyph_t;
   1.947 +
   1.948 +pixman_glyph_cache_t *pixman_glyph_cache_create       (void);
   1.949 +void                  pixman_glyph_cache_destroy      (pixman_glyph_cache_t *cache);
   1.950 +void                  pixman_glyph_cache_freeze       (pixman_glyph_cache_t *cache);
   1.951 +void                  pixman_glyph_cache_thaw         (pixman_glyph_cache_t *cache);
   1.952 +const void *          pixman_glyph_cache_lookup       (pixman_glyph_cache_t *cache,
   1.953 +						       void                 *font_key,
   1.954 +						       void                 *glyph_key);
   1.955 +const void *          pixman_glyph_cache_insert       (pixman_glyph_cache_t *cache,
   1.956 +						       void                 *font_key,
   1.957 +						       void                 *glyph_key,
   1.958 +						       int		     origin_x,
   1.959 +						       int                   origin_y,
   1.960 +						       pixman_image_t       *glyph_image);
   1.961 +void                  pixman_glyph_cache_remove       (pixman_glyph_cache_t *cache,
   1.962 +						       void                 *font_key,
   1.963 +						       void                 *glyph_key);
   1.964 +void                  pixman_glyph_get_extents        (pixman_glyph_cache_t *cache,
   1.965 +						       int                   n_glyphs,
   1.966 +						       pixman_glyph_t       *glyphs,
   1.967 +						       pixman_box32_t       *extents);
   1.968 +pixman_format_code_t  pixman_glyph_get_mask_format    (pixman_glyph_cache_t *cache,
   1.969 +						       int		     n_glyphs,
   1.970 +						       const pixman_glyph_t *glyphs);
   1.971 +void                  pixman_composite_glyphs         (pixman_op_t           op,
   1.972 +						       pixman_image_t       *src,
   1.973 +						       pixman_image_t       *dest,
   1.974 +						       pixman_format_code_t  mask_format,
   1.975 +						       int32_t               src_x,
   1.976 +						       int32_t               src_y,
   1.977 +						       int32_t		     mask_x,
   1.978 +						       int32_t		     mask_y,
   1.979 +						       int32_t               dest_x,
   1.980 +						       int32_t               dest_y,
   1.981 +						       int32_t		     width,
   1.982 +						       int32_t		     height,
   1.983 +						       pixman_glyph_cache_t *cache,
   1.984 +						       int		     n_glyphs,
   1.985 +						       const pixman_glyph_t *glyphs);
   1.986 +void                  pixman_composite_glyphs_no_mask (pixman_op_t           op,
   1.987 +						       pixman_image_t       *src,
   1.988 +						       pixman_image_t       *dest,
   1.989 +						       int32_t               src_x,
   1.990 +						       int32_t               src_y,
   1.991 +						       int32_t               dest_x,
   1.992 +						       int32_t               dest_y,
   1.993 +						       pixman_glyph_cache_t *cache,
   1.994 +						       int		     n_glyphs,
   1.995 +						       const pixman_glyph_t *glyphs);
   1.996 +
   1.997 +/*
   1.998 + * Trapezoids
   1.999 + */
  1.1000 +typedef struct pixman_edge pixman_edge_t;
  1.1001 +typedef struct pixman_trapezoid pixman_trapezoid_t;
  1.1002 +typedef struct pixman_trap pixman_trap_t;
  1.1003 +typedef struct pixman_span_fix pixman_span_fix_t;
  1.1004 +typedef struct pixman_triangle pixman_triangle_t;
  1.1005 +
  1.1006 +/*
  1.1007 + * An edge structure.  This represents a single polygon edge
  1.1008 + * and can be quickly stepped across small or large gaps in the
  1.1009 + * sample grid
  1.1010 + */
  1.1011 +struct pixman_edge
  1.1012 +{
  1.1013 +    pixman_fixed_t	x;
  1.1014 +    pixman_fixed_t	e;
  1.1015 +    pixman_fixed_t	stepx;
  1.1016 +    pixman_fixed_t	signdx;
  1.1017 +    pixman_fixed_t	dy;
  1.1018 +    pixman_fixed_t	dx;
  1.1019 +
  1.1020 +    pixman_fixed_t	stepx_small;
  1.1021 +    pixman_fixed_t	stepx_big;
  1.1022 +    pixman_fixed_t	dx_small;
  1.1023 +    pixman_fixed_t	dx_big;
  1.1024 +};
  1.1025 +
  1.1026 +struct pixman_trapezoid
  1.1027 +{
  1.1028 +    pixman_fixed_t	top, bottom;
  1.1029 +    pixman_line_fixed_t	left, right;
  1.1030 +};
  1.1031 +
  1.1032 +struct pixman_triangle
  1.1033 +{
  1.1034 +    pixman_point_fixed_t p1, p2, p3;
  1.1035 +};
  1.1036 +
  1.1037 +/* whether 't' is a well defined not obviously empty trapezoid */
  1.1038 +#define pixman_trapezoid_valid(t)				   \
  1.1039 +    ((t)->left.p1.y != (t)->left.p2.y &&			   \
  1.1040 +     (t)->right.p1.y != (t)->right.p2.y &&			   \
  1.1041 +     (int) ((t)->bottom - (t)->top) > 0)
  1.1042 +
  1.1043 +struct pixman_span_fix
  1.1044 +{
  1.1045 +    pixman_fixed_t	l, r, y;
  1.1046 +};
  1.1047 +
  1.1048 +struct pixman_trap
  1.1049 +{
  1.1050 +    pixman_span_fix_t	top, bot;
  1.1051 +};
  1.1052 +
  1.1053 +pixman_fixed_t pixman_sample_ceil_y        (pixman_fixed_t             y,
  1.1054 +					    int                        bpp);
  1.1055 +pixman_fixed_t pixman_sample_floor_y       (pixman_fixed_t             y,
  1.1056 +					    int                        bpp);
  1.1057 +void           pixman_edge_step            (pixman_edge_t             *e,
  1.1058 +					    int                        n);
  1.1059 +void           pixman_edge_init            (pixman_edge_t             *e,
  1.1060 +					    int                        bpp,
  1.1061 +					    pixman_fixed_t             y_start,
  1.1062 +					    pixman_fixed_t             x_top,
  1.1063 +					    pixman_fixed_t             y_top,
  1.1064 +					    pixman_fixed_t             x_bot,
  1.1065 +					    pixman_fixed_t             y_bot);
  1.1066 +void           pixman_line_fixed_edge_init (pixman_edge_t             *e,
  1.1067 +					    int                        bpp,
  1.1068 +					    pixman_fixed_t             y,
  1.1069 +					    const pixman_line_fixed_t *line,
  1.1070 +					    int                        x_off,
  1.1071 +					    int                        y_off);
  1.1072 +void           pixman_rasterize_edges      (pixman_image_t            *image,
  1.1073 +					    pixman_edge_t             *l,
  1.1074 +					    pixman_edge_t             *r,
  1.1075 +					    pixman_fixed_t             t,
  1.1076 +					    pixman_fixed_t             b);
  1.1077 +void           pixman_add_traps            (pixman_image_t            *image,
  1.1078 +					    int16_t                    x_off,
  1.1079 +					    int16_t                    y_off,
  1.1080 +					    int                        ntrap,
  1.1081 +					    const pixman_trap_t       *traps);
  1.1082 +void           pixman_add_trapezoids       (pixman_image_t            *image,
  1.1083 +					    int16_t                    x_off,
  1.1084 +					    int                        y_off,
  1.1085 +					    int                        ntraps,
  1.1086 +					    const pixman_trapezoid_t  *traps);
  1.1087 +void           pixman_rasterize_trapezoid  (pixman_image_t            *image,
  1.1088 +					    const pixman_trapezoid_t  *trap,
  1.1089 +					    int                        x_off,
  1.1090 +					    int                        y_off);
  1.1091 +void          pixman_composite_trapezoids (pixman_op_t		       op,
  1.1092 +					   pixman_image_t *	       src,
  1.1093 +					   pixman_image_t *	       dst,
  1.1094 +					   pixman_format_code_t	       mask_format,
  1.1095 +					   int			       x_src,
  1.1096 +					   int			       y_src,
  1.1097 +					   int			       x_dst,
  1.1098 +					   int			       y_dst,
  1.1099 +					   int			       n_traps,
  1.1100 +					   const pixman_trapezoid_t *  traps);
  1.1101 +void          pixman_composite_triangles (pixman_op_t		       op,
  1.1102 +					  pixman_image_t *	       src,
  1.1103 +					  pixman_image_t *	       dst,
  1.1104 +					  pixman_format_code_t	       mask_format,
  1.1105 +					  int			       x_src,
  1.1106 +					  int			       y_src,
  1.1107 +					  int			       x_dst,
  1.1108 +					  int			       y_dst,
  1.1109 +					  int			       n_tris,
  1.1110 +					  const pixman_triangle_t *    tris);
  1.1111 +void	      pixman_add_triangles       (pixman_image_t              *image,
  1.1112 +					  int32_t	               x_off,
  1.1113 +					  int32_t	               y_off,
  1.1114 +					  int	                       n_tris,
  1.1115 +					  const pixman_triangle_t     *tris);
  1.1116 +
  1.1117 +PIXMAN_END_DECLS
  1.1118 +
  1.1119 +#endif /* PIXMAN_H__ */

mercurial