11176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/***********************************************************
21176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
31176bdada62cabc6ec4b0308a930e83b679d5d36John ReckCopyright 1987, 1998  The Open Group
41176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
51176bdada62cabc6ec4b0308a930e83b679d5d36John ReckPermission to use, copy, modify, distribute, and sell this software and its
61176bdada62cabc6ec4b0308a930e83b679d5d36John Reckdocumentation for any purpose is hereby granted without fee, provided that
71176bdada62cabc6ec4b0308a930e83b679d5d36John Reckthe above copyright notice appear in all copies and that both that
81176bdada62cabc6ec4b0308a930e83b679d5d36John Reckcopyright notice and this permission notice appear in supporting
91176bdada62cabc6ec4b0308a930e83b679d5d36John Reckdocumentation.
101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
111176bdada62cabc6ec4b0308a930e83b679d5d36John ReckThe above copyright notice and this permission notice shall be included in
121176bdada62cabc6ec4b0308a930e83b679d5d36John Reckall copies or substantial portions of the Software.
131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
141176bdada62cabc6ec4b0308a930e83b679d5d36John ReckTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
151176bdada62cabc6ec4b0308a930e83b679d5d36John ReckIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
161176bdada62cabc6ec4b0308a930e83b679d5d36John ReckFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
171176bdada62cabc6ec4b0308a930e83b679d5d36John ReckOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
181176bdada62cabc6ec4b0308a930e83b679d5d36John ReckAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
191176bdada62cabc6ec4b0308a930e83b679d5d36John ReckCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
211176bdada62cabc6ec4b0308a930e83b679d5d36John ReckExcept as contained in this notice, the name of The Open Group shall not be
221176bdada62cabc6ec4b0308a930e83b679d5d36John Reckused in advertising or otherwise to promote the sale, use or other dealings
231176bdada62cabc6ec4b0308a930e83b679d5d36John Reckin this Software without prior written authorization from The Open Group.
241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
251176bdada62cabc6ec4b0308a930e83b679d5d36John ReckCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck                        All Rights Reserved
281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
291176bdada62cabc6ec4b0308a930e83b679d5d36John ReckPermission to use, copy, modify, and distribute this software and its
301176bdada62cabc6ec4b0308a930e83b679d5d36John Reckdocumentation for any purpose and without fee is hereby granted,
311176bdada62cabc6ec4b0308a930e83b679d5d36John Reckprovided that the above copyright notice appear in all copies and that
321176bdada62cabc6ec4b0308a930e83b679d5d36John Reckboth that copyright notice and this permission notice appear in
331176bdada62cabc6ec4b0308a930e83b679d5d36John Recksupporting documentation, and that the name of Digital not be
341176bdada62cabc6ec4b0308a930e83b679d5d36John Reckused in advertising or publicity pertaining to distribution of the
351176bdada62cabc6ec4b0308a930e83b679d5d36John Recksoftware without specific, written prior permission.
361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
371176bdada62cabc6ec4b0308a930e83b679d5d36John ReckDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
381176bdada62cabc6ec4b0308a930e83b679d5d36John ReckALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
391176bdada62cabc6ec4b0308a930e83b679d5d36John ReckDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
401176bdada62cabc6ec4b0308a930e83b679d5d36John ReckANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
411176bdada62cabc6ec4b0308a930e83b679d5d36John ReckWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
421176bdada62cabc6ec4b0308a930e83b679d5d36John ReckARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
431176bdada62cabc6ec4b0308a930e83b679d5d36John ReckSOFTWARE.
441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck******************************************************************/
461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Copyright © 1998, 2004 Keith Packard
481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Copyright   2007 Red Hat, Inc.
491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck *
501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Permission to use, copy, modify, distribute, and sell this software and its
511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * documentation for any purpose is hereby granted without fee, provided that
521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * the above copyright notice appear in all copies and that both that
531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * copyright notice and this permission notice appear in supporting
541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * documentation, and that the name of Keith Packard not be used in
551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * advertising or publicity pertaining to distribution of the software without
561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * specific, written prior permission.  Keith Packard makes no
571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * representations about the suitability of this software for any purpose.  It
581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * is provided "as is" without express or implied warranty.
591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck *
601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * PERFORMANCE OF THIS SOFTWARE.
671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#ifndef PIXMAN_H__
701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_H__
711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7270005f9fa14753353faf0fe2e57359913ed3e75aJohn Reck#include "pixman-version.h"
731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#ifdef  __cplusplus
751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_BEGIN_DECLS extern "C" {
761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_END_DECLS }
771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#else
781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_BEGIN_DECLS
791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_END_DECLS
801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#endif
811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
821176bdada62cabc6ec4b0308a930e83b679d5d36John ReckPIXMAN_BEGIN_DECLS
831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Standard integers
861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
881176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#if !defined (PIXMAN_DONT_DEFINE_STDINT)
891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) || defined (__HP_cc)
911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#  include <inttypes.h>
921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* VS 2010 (_MSC_VER 1600) has stdint.h */
931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#elif defined (_MSC_VER) && _MSC_VER < 1600
941176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef __int8 int8_t;
951176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef unsigned __int8 uint8_t;
961176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef __int16 int16_t;
971176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef unsigned __int16 uint16_t;
981176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef __int32 int32_t;
991176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef unsigned __int32 uint32_t;
1001176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef __int64 int64_t;
1011176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef unsigned __int64 uint64_t;
1021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#elif defined (_AIX)
1031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#  include <sys/inttypes.h>
1041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#else
1051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#  include <stdint.h>
1061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#endif
1071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#endif
1091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
1111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Boolean
1121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
1131176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef int pixman_bool_t;
1141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
1161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Fixpoint numbers
1171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
1181176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef int64_t			pixman_fixed_32_32_t;
1191176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef pixman_fixed_32_32_t	pixman_fixed_48_16_t;
1201176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef uint32_t		pixman_fixed_1_31_t;
1211176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef uint32_t		pixman_fixed_1_16_t;
1221176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef int32_t			pixman_fixed_16_16_t;
1231176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef pixman_fixed_16_16_t	pixman_fixed_t;
1241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_e			((pixman_fixed_t) 1)
1261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_1			(pixman_int_to_fixed(1))
1271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_1_minus_e		(pixman_fixed_1 - pixman_fixed_e)
1281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_minus_1		(pixman_int_to_fixed(-1))
1291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_to_int(f)		((int) ((f) >> 16))
1301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_int_to_fixed(i)		((pixman_fixed_t) ((i) << 16))
1311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_to_double(f)	(double) ((f) / (double) pixman_fixed_1)
1321176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_double_to_fixed(d)	((pixman_fixed_t) ((d) * 65536.0))
1331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_frac(f)		((f) & pixman_fixed_1_minus_e)
1341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_floor(f)		((f) & ~pixman_fixed_1_minus_e)
1351176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_ceil(f)		pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
1361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_fraction(f)	((f) & pixman_fixed_1_minus_e)
1371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_fixed_mod_2(f)		((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
1381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_max_fixed_48_16		((pixman_fixed_48_16_t) 0x7fffffff)
1391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_min_fixed_48_16		(-((pixman_fixed_48_16_t) 1 << 31))
1401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
1421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Misc structs
1431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
1441176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_color pixman_color_t;
1451176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_point_fixed pixman_point_fixed_t;
1461176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_line_fixed pixman_line_fixed_t;
1471176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_vector pixman_vector_t;
1481176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_transform pixman_transform_t;
1491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1501176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_color
1511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
1521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint16_t	red;
1531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint16_t    green;
1541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint16_t    blue;
1551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint16_t    alpha;
1561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
1571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1581176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_point_fixed
1591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
1601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	x;
1611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	y;
1621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
1631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1641176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_line_fixed
1651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
1661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_point_fixed_t	p1, p2;
1671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
1681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
1701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Fixed point matrices
1711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
1721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1731176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_vector
1741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
1751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	vector[3];
1761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
1771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1781176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_transform
1791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
1801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	matrix[3][3];
1811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
1821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* forward declaration (sorry) */
1841176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_box16;
1851176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef  union pixman_image		pixman_image_t;
1861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
1871176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_transform_init_identity    (struct pixman_transform       *matrix);
1881176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_point_3d         (const struct pixman_transform *transform,
1891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 struct pixman_vector          *vector);
1901176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_point            (const struct pixman_transform *transform,
1911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 struct pixman_vector          *vector);
1921176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_multiply         (struct pixman_transform       *dst,
1931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 const struct pixman_transform *l,
1941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 const struct pixman_transform *r);
1951176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_transform_init_scale       (struct pixman_transform       *t,
1961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 sx,
1971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 sy);
1981176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_scale            (struct pixman_transform       *forward,
1991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 struct pixman_transform       *reverse,
2001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 sx,
2011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 sy);
2021176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_transform_init_rotate      (struct pixman_transform       *t,
2031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 cos,
2041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 sin);
2051176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_rotate           (struct pixman_transform       *forward,
2061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 struct pixman_transform       *reverse,
2071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 c,
2081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 s);
2091176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_transform_init_translate   (struct pixman_transform       *t,
2101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 tx,
2111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 ty);
2121176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_translate        (struct pixman_transform       *forward,
2131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 struct pixman_transform       *reverse,
2141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 tx,
2151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 pixman_fixed_t                 ty);
2161176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_bounds           (const struct pixman_transform *matrix,
2171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 struct pixman_box16           *b);
2181176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_invert           (struct pixman_transform       *dst,
2191176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 const struct pixman_transform *src);
2201176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_is_identity      (const struct pixman_transform *t);
2211176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_is_scale         (const struct pixman_transform *t);
2221176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_is_int_translate (const struct pixman_transform *t);
2231176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_is_inverse       (const struct pixman_transform *a,
2241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						 const struct pixman_transform *b);
2251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
2271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Floating point matrices
2281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
2291176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_f_transform pixman_f_transform_t;
2301176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_f_vector pixman_f_vector_t;
2311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2321176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_f_vector
2331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
2341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    double  v[3];
2351176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
2361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2371176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_f_transform
2381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
2391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    double  m[3][3];
2401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
2411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2421176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_transform_from_pixman_f_transform (struct pixman_transform         *t,
2431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							const struct pixman_f_transform *ft);
2441176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_from_pixman_transform (struct pixman_f_transform       *ft,
2451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							const struct pixman_transform   *t);
2461176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_f_transform_invert                (struct pixman_f_transform       *dst,
2471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							const struct pixman_f_transform *src);
2481176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_f_transform_point                 (const struct pixman_f_transform *t,
2491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							struct pixman_f_vector          *v);
2501176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_point_3d              (const struct pixman_f_transform *t,
2511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							struct pixman_f_vector          *v);
2521176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_multiply              (struct pixman_f_transform       *dst,
2531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							const struct pixman_f_transform *l,
2541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							const struct pixman_f_transform *r);
2551176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_init_scale            (struct pixman_f_transform       *t,
2561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           sx,
2571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           sy);
2581176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_f_transform_scale                 (struct pixman_f_transform       *forward,
2591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							struct pixman_f_transform       *reverse,
2601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           sx,
2611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           sy);
2621176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_init_rotate           (struct pixman_f_transform       *t,
2631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           cos,
2641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           sin);
2651176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_f_transform_rotate                (struct pixman_f_transform       *forward,
2661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							struct pixman_f_transform       *reverse,
2671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           c,
2681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           s);
2691176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_init_translate        (struct pixman_f_transform       *t,
2701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           tx,
2711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           ty);
2721176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_f_transform_translate             (struct pixman_f_transform       *forward,
2731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							struct pixman_f_transform       *reverse,
2741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           tx,
2751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							double                           ty);
2761176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_f_transform_bounds                (const struct pixman_f_transform *t,
2771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							struct pixman_box16             *b);
2781176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_f_transform_init_identity         (struct pixman_f_transform       *t);
2791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2801176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef enum
2811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
2821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REPEAT_NONE,
2831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REPEAT_NORMAL,
2841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REPEAT_PAD,
2851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REPEAT_REFLECT
2861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_repeat_t;
2871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2881176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef enum
2891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
2901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_FAST,
2911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_GOOD,
2921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_BEST,
2931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_NEAREST,
2941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_BILINEAR,
2951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_CONVOLUTION,
2961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
2971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    /* The SEPARABLE_CONVOLUTION filter takes the following parameters:
2981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *
2991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *         width:           integer given as 16.16 fixpoint number
3001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *         height:          integer given as 16.16 fixpoint number
3011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *         x_phase_bits:	integer given as 16.16 fixpoint
3021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *         y_phase_bits:	integer given as 16.16 fixpoint
3031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *         xtables:         (1 << x_phase_bits) tables of size width
3041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *         ytables:         (1 << y_phase_bits) tables of size height
3051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *
3061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * When sampling at (x, y), the location is first rounded to one of
3071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * n_x_phases * n_y_phases subpixel positions. These subpixel positions
3081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * determine an xtable and a ytable to use.
3091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     *
3101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * Conceptually a width x height matrix is then formed in which each entry
3111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * is the product of the corresponding entries in the x and y tables.
3121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * This matrix is then aligned with the image pixels such that its center
3131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * is as close as possible to the subpixel location chosen earlier. Then
3141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     * the image is convolved with the matrix and the resulting pixel returned.
3151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     */
3161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_FILTER_SEPARABLE_CONVOLUTION
3171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_filter_t;
3181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3191176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef enum
3201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
3211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CLEAR			= 0x00,
3221176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_SRC			= 0x01,
3231176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DST			= 0x02,
3241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_OVER			= 0x03,
3251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_OVER_REVERSE		= 0x04,
3261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_IN			= 0x05,
3271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_IN_REVERSE		= 0x06,
3281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_OUT			= 0x07,
3291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_OUT_REVERSE		= 0x08,
3301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_ATOP			= 0x09,
3311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_ATOP_REVERSE		= 0x0a,
3321176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_XOR			= 0x0b,
3331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_ADD			= 0x0c,
3341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_SATURATE			= 0x0d,
3351176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_CLEAR		= 0x10,
3371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_SRC		= 0x11,
3381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_DST		= 0x12,
3391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_OVER		= 0x13,
3401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_OVER_REVERSE	= 0x14,
3411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_IN		= 0x15,
3421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_IN_REVERSE	= 0x16,
3431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_OUT		= 0x17,
3441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_OUT_REVERSE	= 0x18,
3451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_ATOP		= 0x19,
3461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_ATOP_REVERSE	= 0x1a,
3471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DISJOINT_XOR		= 0x1b,
3481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_CLEAR		= 0x20,
3501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_SRC		= 0x21,
3511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_DST		= 0x22,
3521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_OVER		= 0x23,
3531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_OVER_REVERSE	= 0x24,
3541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_IN		= 0x25,
3551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_IN_REVERSE	= 0x26,
3561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_OUT		= 0x27,
3571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_OUT_REVERSE	= 0x28,
3581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_ATOP		= 0x29,
3591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_ATOP_REVERSE	= 0x2a,
3601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_CONJOINT_XOR		= 0x2b,
3611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_MULTIPLY                  = 0x30,
3631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_SCREEN                    = 0x31,
3641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_OVERLAY                   = 0x32,
3651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DARKEN                    = 0x33,
3661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_LIGHTEN                   = 0x34,
3671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_COLOR_DODGE               = 0x35,
3681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_COLOR_BURN                = 0x36,
3691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_HARD_LIGHT                = 0x37,
3701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_SOFT_LIGHT                = 0x38,
3711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_DIFFERENCE                = 0x39,
3721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_EXCLUSION                 = 0x3a,
3731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_HSL_HUE			= 0x3b,
3741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_HSL_SATURATION		= 0x3c,
3751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_HSL_COLOR			= 0x3d,
3761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_HSL_LUMINOSITY		= 0x3e
3771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#ifdef PIXMAN_USE_INTERNAL_API
3791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    ,
3801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_N_OPERATORS,
3811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_OP_NONE = PIXMAN_N_OPERATORS
3821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#endif
3831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_op_t;
3841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
3861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Regions
3871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
3881176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_region16_data	pixman_region16_data_t;
3891176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_box16		pixman_box16_t;
3901176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_rectangle16	pixman_rectangle16_t;
3911176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_region16		pixman_region16_t;
3921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3931176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_region16_data {
3941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    long		size;
3951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    long		numRects;
3961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*  pixman_box16_t	rects[size];   in memory but not explicitly declared */
3971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
3981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
3991176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_rectangle16
4001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
4011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    int16_t	x, y;
4021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint16_t	width, height;
4031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
4041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4051176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_box16
4061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
4071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    int16_t x1, y1, x2, y2;
4081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
4091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4101176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_region16
4111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
4121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_box16_t          extents;
4131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_region16_data_t *data;
4141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
4151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4161176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef enum
4171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
4181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REGION_OUT,
4191176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REGION_IN,
4201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_REGION_PART
4211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_region_overlap_t;
4221176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4231176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* This function exists only to make it possible to preserve
4241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * the X ABI - it should go away at first opportunity.
4251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
4261176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid pixman_region_set_static_pointers (pixman_box16_t         *empty_box,
4271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					pixman_region16_data_t *empty_data,
4281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					pixman_region16_data_t *broken_data);
4291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* creation/destruction */
4311176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_init               (pixman_region16_t *region);
4321176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_init_rect          (pixman_region16_t *region,
4331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                x,
4341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                y,
4351176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  unsigned int       width,
4361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  unsigned int       height);
4371176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_init_rects         (pixman_region16_t *region,
4381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  const pixman_box16_t *boxes,
4391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                count);
4401176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_init_with_extents  (pixman_region16_t *region,
4411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_box16_t    *extents);
4421176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_init_from_image    (pixman_region16_t *region,
4431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_image_t    *image);
4441176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_fini               (pixman_region16_t *region);
4451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
4471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* manipulation */
4481176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_translate          (pixman_region16_t *region,
4491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                x,
4501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                y);
4511176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_copy               (pixman_region16_t *dest,
4521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *source);
4531176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_intersect          (pixman_region16_t *new_reg,
4541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg1,
4551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg2);
4561176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_union              (pixman_region16_t *new_reg,
4571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg1,
4581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg2);
4591176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_union_rect         (pixman_region16_t *dest,
4601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *source,
4611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                x,
4621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                y,
4631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  unsigned int       width,
4641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  unsigned int       height);
4651176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t		pixman_region_intersect_rect     (pixman_region16_t *dest,
4661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *source,
4671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                x,
4681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                y,
4691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  unsigned int       width,
4701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  unsigned int       height);
4711176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_subtract           (pixman_region16_t *reg_d,
4721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg_m,
4731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg_s);
4741176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_inverse            (pixman_region16_t *new_reg,
4751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *reg1,
4761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_box16_t    *inv_rect);
4771176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_contains_point     (pixman_region16_t *region,
4781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                x,
4791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int                y,
4801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_box16_t    *box);
4811176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *region,
4821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_box16_t    *prect);
4831176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_not_empty          (pixman_region16_t *region);
4841176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_box16_t *        pixman_region_extents            (pixman_region16_t *region);
4851176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint                     pixman_region_n_rects            (pixman_region16_t *region);
4861176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_box16_t *        pixman_region_rectangles         (pixman_region16_t *region,
4871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  int               *n_rects);
4881176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_equal              (pixman_region16_t *region1,
4891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_region16_t *region2);
4901176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region_selfcheck          (pixman_region16_t *region);
4911176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region_reset              (pixman_region16_t *region,
4921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							  pixman_box16_t    *box);
4931176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid			pixman_region_clear		 (pixman_region16_t *region);
4941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
4951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * 32 bit regions
4961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
4971176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_region32_data	pixman_region32_data_t;
4981176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_box32		pixman_box32_t;
4991176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_rectangle32	pixman_rectangle32_t;
5001176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_region32		pixman_region32_t;
5011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5021176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_region32_data {
5031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    long		size;
5041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    long		numRects;
5051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*  pixman_box32_t	rects[size];   in memory but not explicitly declared */
5061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
5071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5081176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_rectangle32
5091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
5101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    int32_t x, y;
5111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint32_t width, height;
5121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
5131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5141176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_box32
5151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
5161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    int32_t x1, y1, x2, y2;
5171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
5181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5191176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_region32
5201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
5211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_box32_t          extents;
5221176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_region32_data_t  *data;
5231176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
5241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* creation/destruction */
5261176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_init               (pixman_region32_t *region);
5271176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_init_rect          (pixman_region32_t *region,
5281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                x,
5291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                y,
5301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    unsigned int       width,
5311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    unsigned int       height);
5321176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_init_rects         (pixman_region32_t *region,
5331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    const pixman_box32_t *boxes,
5341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                count);
5351176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_init_with_extents  (pixman_region32_t *region,
5361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_box32_t    *extents);
5371176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_init_from_image    (pixman_region32_t *region,
5381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_image_t    *image);
5391176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_fini               (pixman_region32_t *region);
5401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* manipulation */
5431176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_translate          (pixman_region32_t *region,
5441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                x,
5451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                y);
5461176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_copy               (pixman_region32_t *dest,
5471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *source);
5481176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_intersect          (pixman_region32_t *new_reg,
5491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg1,
5501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg2);
5511176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_union              (pixman_region32_t *new_reg,
5521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg1,
5531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg2);
5541176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t		pixman_region32_intersect_rect     (pixman_region32_t *dest,
5551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *source,
5561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                x,
5571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                y,
5581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    unsigned int       width,
5591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    unsigned int       height);
5601176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_union_rect         (pixman_region32_t *dest,
5611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *source,
5621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                x,
5631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                y,
5641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    unsigned int       width,
5651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    unsigned int       height);
5661176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_subtract           (pixman_region32_t *reg_d,
5671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg_m,
5681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg_s);
5691176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_inverse            (pixman_region32_t *new_reg,
5701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *reg1,
5711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_box32_t    *inv_rect);
5721176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_contains_point     (pixman_region32_t *region,
5731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                x,
5741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int                y,
5751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_box32_t    *box);
5761176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_region_overlap_t pixman_region32_contains_rectangle (pixman_region32_t *region,
5771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_box32_t    *prect);
5781176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_not_empty          (pixman_region32_t *region);
5791176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_box32_t *        pixman_region32_extents            (pixman_region32_t *region);
5801176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint                     pixman_region32_n_rects            (pixman_region32_t *region);
5811176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_box32_t *        pixman_region32_rectangles         (pixman_region32_t *region,
5821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    int               *n_rects);
5831176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_equal              (pixman_region32_t *region1,
5841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_region32_t *region2);
5851176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t           pixman_region32_selfcheck          (pixman_region32_t *region);
5861176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                    pixman_region32_reset              (pixman_region32_t *region,
5871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck							    pixman_box32_t    *box);
5881176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid			pixman_region32_clear		   (pixman_region32_t *region);
5891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
5911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Copy / Fill / Misc */
5921176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_blt                (uint32_t           *src_bits,
5931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 uint32_t           *dst_bits,
5941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 src_stride,
5951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 dst_stride,
5961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 src_bpp,
5971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 dst_bpp,
5981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 src_x,
5991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 src_y,
6001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 dest_x,
6011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 dest_y,
6021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 width,
6031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 height);
6041176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_fill               (uint32_t           *bits,
6051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 stride,
6061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 bpp,
6071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 x,
6081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 y,
6091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 width,
6101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 int                 height,
6111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 uint32_t            _xor);
6121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6131176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint           pixman_version            (void);
6141176bdada62cabc6ec4b0308a930e83b679d5d36John Reckconst char*   pixman_version_string     (void);
6151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
6171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Images
6181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
6191176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_indexed		pixman_indexed_t;
6201176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_gradient_stop	pixman_gradient_stop_t;
6211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6221176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
6231176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef void     (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
6241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6251176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef void     (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data);
6261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6271176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_gradient_stop {
6281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t x;
6291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_color_t color;
6301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
6311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6321176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_MAX_INDEXED  256 /* XXX depth must be <= 8 */
6331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#if PIXMAN_MAX_INDEXED <= 256
6351176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef uint8_t pixman_index_type;
6361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#endif
6371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6381176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_indexed
6391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
6401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_bool_t       color;
6411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    uint32_t		rgba[PIXMAN_MAX_INDEXED];
6421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_index_type	ent[32768];
6431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
6441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
6461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * While the protocol is generous in format support, the
6471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * sample implementation allows only packed RGB and GBR
6481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * representations for data to simplify software rendering,
6491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
6501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT(bpp,type,a,r,g,b)	(((bpp) << 24) |  \
6511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 ((type) << 16) | \
6521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 ((a) << 12) |	  \
6531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 ((r) << 8) |	  \
6541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 ((g) << 4) |	  \
6551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					 ((b)))
6561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_BPP(f)	(((f) >> 24)       )
6581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_TYPE(f)	(((f) >> 16) & 0xff)
6591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_A(f)	(((f) >> 12) & 0x0f)
6601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_R(f)	(((f) >>  8) & 0x0f)
6611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_G(f)	(((f) >>  4) & 0x0f)
6621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_B(f)	(((f)      ) & 0x0f)
6631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_RGB(f)	(((f)      ) & 0xfff)
6641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_VIS(f)	(((f)      ) & 0xffff)
6651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_DEPTH(f)	(PIXMAN_FORMAT_A(f) +	\
6661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck				 PIXMAN_FORMAT_R(f) +	\
6671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck				 PIXMAN_FORMAT_G(f) +	\
6681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck				 PIXMAN_FORMAT_B(f))
6691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_OTHER	0
6711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_A		1
6721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_ARGB	2
6731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_ABGR	3
6741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_COLOR	4
6751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_GRAY	5
6761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_YUY2	6
6771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_YV12	7
6781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_BGRA	8
6791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_RGBA	9
6801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_TYPE_ARGB_SRGB	10
6811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define PIXMAN_FORMAT_COLOR(f)				\
6831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck	(PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB ||	\
6841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR ||	\
6851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA ||	\
6861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck	 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA)
6871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
6881176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* 32bpp formats */
6891176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef enum {
6901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a8r8g8b8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
6911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x8r8g8b8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
6921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a8b8g8r8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
6931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x8b8g8r8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
6941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_b8g8r8a8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
6951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_b8g8r8x8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
6961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_r8g8b8a8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
6971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_r8g8b8x8 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
6981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x14r6g6b6 =	 PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
6991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
7001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
7011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
7021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
7031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* sRGB formats */
7051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a8r8g8b8_sRGB = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_SRGB,8,8,8,8),
7061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* 24bpp formats */
7081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_r8g8b8 =	 PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
7091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_b8g8r8 =	 PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
7101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* 16bpp formats */
7121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_r5g6b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
7131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_b5g6r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
7141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a1r5g5b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
7161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x1r5g5b5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
7171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a1b5g5r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
7181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x1b5g5r5 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
7191176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a4r4g4b4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
7201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x4r4g4b4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
7211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a4b4g4r4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
7221176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x4b4g4r4 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
7231176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* 8bpp formats */
7251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
7261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_r3g3b2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
7271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_b2g3r3 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
7281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a2r2g2b2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
7291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a2b2g2r2 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
7301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_c8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
7321176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_g8 =		 PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
7331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x4a4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
7351176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x4c4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
7371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_x4g4 =	 PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
7381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* 4bpp formats */
7401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
7411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_r1g2b1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
7421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_b1g2r1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
7431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a1r1g1b1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
7441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a1b1g1r1 =	 PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
7451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_c4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
7471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_g4 =		 PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
7481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* 1bpp formats */
7501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_a1 =		 PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
7511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_g1 =		 PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
7531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* YUV formats */
7551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_yuy2 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
7561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_yv12 =	 PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
7571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_format_code_t;
7581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Querying supported format values. */
7601176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
7611176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_format_supported_source      (pixman_format_code_t format);
7621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Constructors */
7641176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_create_solid_fill       (const pixman_color_t         *color);
7651176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_create_linear_gradient  (const pixman_point_fixed_t   *p1,
7661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_point_fixed_t   *p2,
7671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_gradient_stop_t *stops,
7681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           n_stops);
7691176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_create_radial_gradient  (const pixman_point_fixed_t   *inner,
7701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_point_fixed_t   *outer,
7711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_fixed_t                inner_radius,
7721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_fixed_t                outer_radius,
7731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_gradient_stop_t *stops,
7741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           n_stops);
7751176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_create_conical_gradient (const pixman_point_fixed_t   *center,
7761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_fixed_t                angle,
7771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_gradient_stop_t *stops,
7781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           n_stops);
7791176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_create_bits             (pixman_format_code_t          format,
7801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           width,
7811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           height,
7821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      uint32_t                     *bits,
7831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           rowstride_bytes);
7841176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_create_bits_no_clear    (pixman_format_code_t format,
7851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                  width,
7861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                  height,
7871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      uint32_t *           bits,
7881176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                  rowstride_bytes);
7891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Destructor */
7911176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_image_t *pixman_image_ref                     (pixman_image_t               *image);
7921176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_unref                   (pixman_image_t               *image);
7931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7941176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid		pixman_image_set_destroy_function    (pixman_image_t		   *image,
7951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_image_destroy_func_t   function,
7961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      void			   *data);
7971176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid *		pixman_image_get_destroy_data        (pixman_image_t		   *image);
7981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
7991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Set properties */
8001176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_set_clip_region         (pixman_image_t               *image,
8011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_region16_t            *region);
8021176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_set_clip_region32       (pixman_image_t               *image,
8031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_region32_t            *region);
8041176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid		pixman_image_set_has_client_clip     (pixman_image_t               *image,
8051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_bool_t		    clien_clip);
8061176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_set_transform           (pixman_image_t               *image,
8071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_transform_t     *transform);
8081176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid            pixman_image_set_repeat              (pixman_image_t               *image,
8091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_repeat_t               repeat);
8101176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_set_filter              (pixman_image_t               *image,
8111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_filter_t               filter,
8121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_fixed_t         *filter_params,
8131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int                           n_filter_params);
8141176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid		pixman_image_set_source_clipping     (pixman_image_t		   *image,
8151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_bool_t                 source_clipping);
8161176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid            pixman_image_set_alpha_map           (pixman_image_t               *image,
8171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_image_t               *alpha_map,
8181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int16_t                       x,
8191176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int16_t                       y);
8201176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid            pixman_image_set_component_alpha     (pixman_image_t               *image,
8211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_bool_t                 component_alpha);
8221176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_get_component_alpha     (pixman_image_t               *image);
8231176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid		pixman_image_set_accessors	     (pixman_image_t		   *image,
8241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_read_memory_func_t	    read_func,
8251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_write_memory_func_t    write_func);
8261176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid		pixman_image_set_indexed	     (pixman_image_t		   *image,
8271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_indexed_t	   *indexed);
8281176bdada62cabc6ec4b0308a930e83b679d5d36John Reckuint32_t       *pixman_image_get_data                (pixman_image_t               *image);
8291176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint		pixman_image_get_width               (pixman_image_t               *image);
8301176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint             pixman_image_get_height              (pixman_image_t               *image);
8311176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint		pixman_image_get_stride              (pixman_image_t               *image); /* in bytes */
8321176bdada62cabc6ec4b0308a930e83b679d5d36John Reckint		pixman_image_get_depth               (pixman_image_t		   *image);
8331176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_format_code_t pixman_image_get_format	     (pixman_image_t		   *image);
8341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
8351176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef enum
8361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
8371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_IMPULSE,
8381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_BOX,
8391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_LINEAR,
8401176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_CUBIC,
8411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_GAUSSIAN,
8421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_LANCZOS2,
8431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_LANCZOS3,
8441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    PIXMAN_KERNEL_LANCZOS3_STRETCHED       /* Jim Blinn's 'nice' filter */
8451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_kernel_t;
8461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
8471176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Create the parameter list for a SEPARABLE_CONVOLUTION filter
8481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * with the given kernels and scale parameters.
8491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
8501176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_fixed_t *
8511176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_filter_create_separable_convolution (int             *n_values,
8521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t   scale_x,
8531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t   scale_y,
8541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_kernel_t  reconstruct_x,
8551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_kernel_t  reconstruct_y,
8561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_kernel_t  sample_x,
8571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_kernel_t  sample_y,
8581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int              subsample_bits_x,
8591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int              subsample_bits_y);
8601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
8611176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t	pixman_image_fill_rectangles	     (pixman_op_t		    op,
8621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      pixman_image_t		   *image,
8631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_color_t	   *color,
8641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      int			    n_rects,
8651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						      const pixman_rectangle16_t   *rects);
8661176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t   pixman_image_fill_boxes              (pixman_op_t                   op,
8671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck                                                      pixman_image_t               *dest,
8681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck                                                      const pixman_color_t         *color,
8691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck                                                      int                           n_boxes,
8701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck                                                      const pixman_box32_t         *boxes);
8711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
8721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Composite */
8731176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_bool_t pixman_compute_composite_region (pixman_region16_t *region,
8741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *src_image,
8751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *mask_image,
8761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *dest_image,
8771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            src_x,
8781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            src_y,
8791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            mask_x,
8801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            mask_y,
8811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            dest_x,
8821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            dest_y,
8831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       uint16_t           width,
8841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       uint16_t           height);
8851176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_image_composite          (pixman_op_t        op,
8861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *src,
8871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *mask,
8881176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *dest,
8891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            src_x,
8901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            src_y,
8911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            mask_x,
8921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            mask_y,
8931176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            dest_x,
8941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int16_t            dest_y,
8951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       uint16_t           width,
8961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       uint16_t           height);
8971176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_image_composite32        (pixman_op_t        op,
8981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *src,
8991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *mask,
9001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       pixman_image_t    *dest,
9011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            src_x,
9021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            src_y,
9031176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            mask_x,
9041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            mask_y,
9051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            dest_x,
9061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            dest_y,
9071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            width,
9081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					       int32_t            height);
9091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
9101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* Executive Summary: This function is a no-op that only exists
9111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * for historical reasons.
9121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck *
9131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * There used to be a bug in the X server where it would rely on
9141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * out-of-bounds accesses when it was asked to composite with a
9151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * window as the source. It would create a pixman image pointing
9161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * to some bogus position in memory, but then set a clip region
9171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * to the position where the actual bits were.
9181176bdada62cabc6ec4b0308a930e83b679d5d36John Reck *
9191176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Due to a bug in old versions of pixman, where it would not clip
9201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * against the image bounds when a clip region was set, this would
9211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * actually work. So when the pixman bug was fixed, a workaround was
9221176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * added to allow certain out-of-bound accesses. This function disabled
9231176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * those workarounds.
9241176bdada62cabc6ec4b0308a930e83b679d5d36John Reck *
9251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this
9261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * function is a no-op.
9271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
9281176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid pixman_disable_out_of_bounds_workaround (void);
9291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
9301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
9311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Glyphs
9321176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
9331176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_glyph_cache_t pixman_glyph_cache_t;
9341176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct
9351176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
9361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    int		x, y;
9371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    const void *glyph;
9381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck} pixman_glyph_t;
9391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
9401176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_glyph_cache_t *pixman_glyph_cache_create       (void);
9411176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_glyph_cache_destroy      (pixman_glyph_cache_t *cache);
9421176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_glyph_cache_freeze       (pixman_glyph_cache_t *cache);
9431176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_glyph_cache_thaw         (pixman_glyph_cache_t *cache);
9441176bdada62cabc6ec4b0308a930e83b679d5d36John Reckconst void *          pixman_glyph_cache_lookup       (pixman_glyph_cache_t *cache,
9451176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       void                 *font_key,
9461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       void                 *glyph_key);
9471176bdada62cabc6ec4b0308a930e83b679d5d36John Reckconst void *          pixman_glyph_cache_insert       (pixman_glyph_cache_t *cache,
9481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       void                 *font_key,
9491176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       void                 *glyph_key,
9501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int		     origin_x,
9511176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int                   origin_y,
9521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_image_t       *glyph_image);
9531176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_glyph_cache_remove       (pixman_glyph_cache_t *cache,
9541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       void                 *font_key,
9551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       void                 *glyph_key);
9561176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_glyph_get_extents        (pixman_glyph_cache_t *cache,
9571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int                   n_glyphs,
9581176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_glyph_t       *glyphs,
9591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_box32_t       *extents);
9601176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_format_code_t  pixman_glyph_get_mask_format    (pixman_glyph_cache_t *cache,
9611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int		     n_glyphs,
9621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       const pixman_glyph_t *glyphs);
9631176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_composite_glyphs         (pixman_op_t           op,
9641176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_image_t       *src,
9651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_image_t       *dest,
9661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_format_code_t  mask_format,
9671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               src_x,
9681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               src_y,
9691176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t		     mask_x,
9701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t		     mask_y,
9711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               dest_x,
9721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               dest_y,
9731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t		     width,
9741176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t		     height,
9751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_glyph_cache_t *cache,
9761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int		     n_glyphs,
9771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       const pixman_glyph_t *glyphs);
9781176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid                  pixman_composite_glyphs_no_mask (pixman_op_t           op,
9791176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_image_t       *src,
9801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_image_t       *dest,
9811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               src_x,
9821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               src_y,
9831176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               dest_x,
9841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int32_t               dest_y,
9851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       pixman_glyph_cache_t *cache,
9861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       int		     n_glyphs,
9871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck						       const pixman_glyph_t *glyphs);
9881176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
9891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
9901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * Trapezoids
9911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
9921176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_edge pixman_edge_t;
9931176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_trapezoid pixman_trapezoid_t;
9941176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_trap pixman_trap_t;
9951176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_span_fix pixman_span_fix_t;
9961176bdada62cabc6ec4b0308a930e83b679d5d36John Recktypedef struct pixman_triangle pixman_triangle_t;
9971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
9981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/*
9991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * An edge structure.  This represents a single polygon edge
10001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * and can be quickly stepped across small or large gaps in the
10011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck * sample grid
10021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck */
10031176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_edge
10041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
10051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	x;
10061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	e;
10071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	stepx;
10081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	signdx;
10091176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	dy;
10101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	dx;
10111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10121176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	stepx_small;
10131176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	stepx_big;
10141176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	dx_small;
10151176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	dx_big;
10161176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
10171176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10181176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_trapezoid
10191176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
10201176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	top, bottom;
10211176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_line_fixed_t	left, right;
10221176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
10231176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10241176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_triangle
10251176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
10261176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_point_fixed_t p1, p2, p3;
10271176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
10281176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10291176bdada62cabc6ec4b0308a930e83b679d5d36John Reck/* whether 't' is a well defined not obviously empty trapezoid */
10301176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#define pixman_trapezoid_valid(t)				   \
10311176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    ((t)->left.p1.y != (t)->left.p2.y &&			   \
10321176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     (t)->right.p1.y != (t)->right.p2.y &&			   \
10331176bdada62cabc6ec4b0308a930e83b679d5d36John Reck     (int) ((t)->bottom - (t)->top) > 0)
10341176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10351176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_span_fix
10361176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
10371176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_fixed_t	l, r, y;
10381176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
10391176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10401176bdada62cabc6ec4b0308a930e83b679d5d36John Reckstruct pixman_trap
10411176bdada62cabc6ec4b0308a930e83b679d5d36John Reck{
10421176bdada62cabc6ec4b0308a930e83b679d5d36John Reck    pixman_span_fix_t	top, bot;
10431176bdada62cabc6ec4b0308a930e83b679d5d36John Reck};
10441176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
10451176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_fixed_t pixman_sample_ceil_y        (pixman_fixed_t             y,
10461176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        bpp);
10471176bdada62cabc6ec4b0308a930e83b679d5d36John Reckpixman_fixed_t pixman_sample_floor_y       (pixman_fixed_t             y,
10481176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        bpp);
10491176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_edge_step            (pixman_edge_t             *e,
10501176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        n);
10511176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_edge_init            (pixman_edge_t             *e,
10521176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        bpp,
10531176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             y_start,
10541176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             x_top,
10551176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             y_top,
10561176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             x_bot,
10571176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             y_bot);
10581176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_line_fixed_edge_init (pixman_edge_t             *e,
10591176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        bpp,
10601176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             y,
10611176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    const pixman_line_fixed_t *line,
10621176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        x_off,
10631176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        y_off);
10641176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_rasterize_edges      (pixman_image_t            *image,
10651176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_edge_t             *l,
10661176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_edge_t             *r,
10671176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             t,
10681176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    pixman_fixed_t             b);
10691176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_add_traps            (pixman_image_t            *image,
10701176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int16_t                    x_off,
10711176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int16_t                    y_off,
10721176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        ntrap,
10731176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    const pixman_trap_t       *traps);
10741176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_add_trapezoids       (pixman_image_t            *image,
10751176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int16_t                    x_off,
10761176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        y_off,
10771176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        ntraps,
10781176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    const pixman_trapezoid_t  *traps);
10791176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid           pixman_rasterize_trapezoid  (pixman_image_t            *image,
10801176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    const pixman_trapezoid_t  *trap,
10811176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        x_off,
10821176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					    int                        y_off);
10831176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_composite_trapezoids (pixman_op_t		       op,
10841176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   pixman_image_t *	       src,
10851176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   pixman_image_t *	       dst,
10861176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   pixman_format_code_t	       mask_format,
10871176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   int			       x_src,
10881176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   int			       y_src,
10891176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   int			       x_dst,
10901176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   int			       y_dst,
10911176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   int			       n_traps,
10921176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					   const pixman_trapezoid_t *  traps);
10931176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid          pixman_composite_triangles (pixman_op_t		       op,
10941176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  pixman_image_t *	       src,
10951176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  pixman_image_t *	       dst,
10961176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  pixman_format_code_t	       mask_format,
10971176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int			       x_src,
10981176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int			       y_src,
10991176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int			       x_dst,
11001176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int			       y_dst,
11011176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int			       n_tris,
11021176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  const pixman_triangle_t *    tris);
11031176bdada62cabc6ec4b0308a930e83b679d5d36John Reckvoid	      pixman_add_triangles       (pixman_image_t              *image,
11041176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int32_t	               x_off,
11051176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int32_t	               y_off,
11061176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  int	                       n_tris,
11071176bdada62cabc6ec4b0308a930e83b679d5d36John Reck					  const pixman_triangle_t     *tris);
11081176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
11091176bdada62cabc6ec4b0308a930e83b679d5d36John ReckPIXMAN_END_DECLS
11101176bdada62cabc6ec4b0308a930e83b679d5d36John Reck
11111176bdada62cabc6ec4b0308a930e83b679d5d36John Reck#endif /* PIXMAN_H__ */
1112