VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/pixman-0.43.4/pixman.h@ 105930

Last change on this file since 105930 was 105930, checked in by vboxsync, 3 months ago

Additions: Linux: Fix build error for new pixman-0.40.0, bugref:10758.

  • Property svn:eol-style set to native
File size: 47.4 KB
Line 
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26
27 All Rights Reserved
28
29Permission to use, copy, modify, and distribute this software and its
30documentation for any purpose and without fee is hereby granted,
31provided that the above copyright notice appear in all copies and that
32both that copyright notice and this permission notice appear in
33supporting documentation, and that the name of Digital not be
34used in advertising or publicity pertaining to distribution of the
35software without specific, written prior permission.
36
37DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43SOFTWARE.
44
45******************************************************************/
46/*
47 * Copyright © 1998, 2004 Keith Packard
48 * Copyright 2007 Red Hat, Inc.
49 *
50 * Permission to use, copy, modify, distribute, and sell this software and its
51 * documentation for any purpose is hereby granted without fee, provided that
52 * the above copyright notice appear in all copies and that both that
53 * copyright notice and this permission notice appear in supporting
54 * documentation, and that the name of Keith Packard not be used in
55 * advertising or publicity pertaining to distribution of the software without
56 * specific, written prior permission. Keith Packard makes no
57 * representations about the suitability of this software for any purpose. It
58 * is provided "as is" without express or implied warranty.
59 *
60 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
61 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
62 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
63 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
64 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
65 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
66 * PERFORMANCE OF THIS SOFTWARE.
67 */
68
69#ifndef PIXMAN_H__
70#define PIXMAN_H__
71
72#include <pixman-version.h>
73
74#ifdef __cplusplus
75#define PIXMAN_BEGIN_DECLS extern "C" {
76#define PIXMAN_END_DECLS }
77#else
78#define PIXMAN_BEGIN_DECLS
79#define PIXMAN_END_DECLS
80#endif
81
82PIXMAN_BEGIN_DECLS
83
84/*
85 * Standard integers
86 */
87
88#if !defined (PIXMAN_DONT_DEFINE_STDINT)
89
90#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) || defined (__HP_cc)
91# include <inttypes.h>
92/* VS 2010 (_MSC_VER 1600) has stdint.h */
93#elif defined (_MSC_VER) && _MSC_VER < 1600
94typedef __int8 int8_t;
95typedef unsigned __int8 uint8_t;
96typedef __int16 int16_t;
97typedef unsigned __int16 uint16_t;
98typedef __int32 int32_t;
99typedef unsigned __int32 uint32_t;
100typedef __int64 int64_t;
101typedef unsigned __int64 uint64_t;
102#elif defined (_AIX)
103# include <sys/inttypes.h>
104#else
105# include <stdint.h>
106#endif
107
108#endif
109
110/*
111 * Boolean
112 */
113typedef int pixman_bool_t;
114
115/*
116 * Fixpoint numbers
117 */
118typedef int64_t pixman_fixed_32_32_t;
119typedef pixman_fixed_32_32_t pixman_fixed_48_16_t;
120typedef uint32_t pixman_fixed_1_31_t;
121typedef uint32_t pixman_fixed_1_16_t;
122typedef int32_t pixman_fixed_16_16_t;
123typedef pixman_fixed_16_16_t pixman_fixed_t;
124
125#define pixman_fixed_e ((pixman_fixed_t) 1)
126#define pixman_fixed_1 (pixman_int_to_fixed(1))
127#define pixman_fixed_1_minus_e (pixman_fixed_1 - pixman_fixed_e)
128#define pixman_fixed_minus_1 (pixman_int_to_fixed(-1))
129#define pixman_fixed_to_int(f) ((int) ((f) >> 16))
130#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((uint32_t) (i) << 16))
131#define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1)
132#define pixman_double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0))
133#define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e)
134#define pixman_fixed_floor(f) ((f) & ~pixman_fixed_1_minus_e)
135#define pixman_fixed_ceil(f) pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
136#define pixman_fixed_fraction(f) ((f) & pixman_fixed_1_minus_e)
137#define pixman_fixed_mod_2(f) ((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
138#define pixman_max_fixed_48_16 ((pixman_fixed_48_16_t) 0x7fffffff)
139#define pixman_min_fixed_48_16 (-((pixman_fixed_48_16_t) 1 << 31))
140
141/*
142 * Misc structs
143 */
144typedef struct pixman_color pixman_color_t;
145typedef struct pixman_point_fixed pixman_point_fixed_t;
146typedef struct pixman_line_fixed pixman_line_fixed_t;
147typedef struct pixman_vector pixman_vector_t;
148typedef struct pixman_transform pixman_transform_t;
149
150struct pixman_color
151{
152 uint16_t red;
153 uint16_t green;
154 uint16_t blue;
155 uint16_t alpha;
156};
157
158struct pixman_point_fixed
159{
160 pixman_fixed_t x;
161 pixman_fixed_t y;
162};
163
164struct pixman_line_fixed
165{
166 pixman_point_fixed_t p1, p2;
167};
168
169/*
170 * Fixed point matrices
171 */
172
173struct pixman_vector
174{
175 pixman_fixed_t vector[3];
176};
177
178struct pixman_transform
179{
180 pixman_fixed_t matrix[3][3];
181};
182
183/* forward declaration (sorry) */
184struct pixman_box16;
185typedef union pixman_image pixman_image_t;
186
187PIXMAN_API
188void pixman_transform_init_identity (struct pixman_transform *matrix);
189
190PIXMAN_API
191pixman_bool_t pixman_transform_point_3d (const struct pixman_transform *transform,
192 struct pixman_vector *vector);
193
194PIXMAN_API
195pixman_bool_t pixman_transform_point (const struct pixman_transform *transform,
196 struct pixman_vector *vector);
197
198PIXMAN_API
199pixman_bool_t pixman_transform_multiply (struct pixman_transform *dst,
200 const struct pixman_transform *l,
201 const struct pixman_transform *r);
202
203PIXMAN_API
204void pixman_transform_init_scale (struct pixman_transform *t,
205 pixman_fixed_t sx,
206 pixman_fixed_t sy);
207
208PIXMAN_API
209pixman_bool_t pixman_transform_scale (struct pixman_transform *forward,
210 struct pixman_transform *reverse,
211 pixman_fixed_t sx,
212 pixman_fixed_t sy);
213
214PIXMAN_API
215void pixman_transform_init_rotate (struct pixman_transform *t,
216 pixman_fixed_t cos,
217 pixman_fixed_t sin);
218
219PIXMAN_API
220pixman_bool_t pixman_transform_rotate (struct pixman_transform *forward,
221 struct pixman_transform *reverse,
222 pixman_fixed_t c,
223 pixman_fixed_t s);
224
225PIXMAN_API
226void pixman_transform_init_translate (struct pixman_transform *t,
227 pixman_fixed_t tx,
228 pixman_fixed_t ty);
229
230PIXMAN_API
231pixman_bool_t pixman_transform_translate (struct pixman_transform *forward,
232 struct pixman_transform *reverse,
233 pixman_fixed_t tx,
234 pixman_fixed_t ty);
235
236PIXMAN_API
237pixman_bool_t pixman_transform_bounds (const struct pixman_transform *matrix,
238 struct pixman_box16 *b);
239
240PIXMAN_API
241pixman_bool_t pixman_transform_invert (struct pixman_transform *dst,
242 const struct pixman_transform *src);
243
244PIXMAN_API
245pixman_bool_t pixman_transform_is_identity (const struct pixman_transform *t);
246
247PIXMAN_API
248pixman_bool_t pixman_transform_is_scale (const struct pixman_transform *t);
249
250PIXMAN_API
251pixman_bool_t pixman_transform_is_int_translate (const struct pixman_transform *t);
252
253PIXMAN_API
254pixman_bool_t pixman_transform_is_inverse (const struct pixman_transform *a,
255 const struct pixman_transform *b);
256
257/*
258 * Floating point matrices
259 */
260typedef struct pixman_f_transform pixman_f_transform_t;
261typedef struct pixman_f_vector pixman_f_vector_t;
262
263struct pixman_f_vector
264{
265 double v[3];
266};
267
268struct pixman_f_transform
269{
270 double m[3][3];
271};
272
273
274PIXMAN_API
275pixman_bool_t pixman_transform_from_pixman_f_transform (struct pixman_transform *t,
276 const struct pixman_f_transform *ft);
277
278PIXMAN_API
279void pixman_f_transform_from_pixman_transform (struct pixman_f_transform *ft,
280 const struct pixman_transform *t);
281
282PIXMAN_API
283pixman_bool_t pixman_f_transform_invert (struct pixman_f_transform *dst,
284 const struct pixman_f_transform *src);
285
286PIXMAN_API
287pixman_bool_t pixman_f_transform_point (const struct pixman_f_transform *t,
288 struct pixman_f_vector *v);
289
290PIXMAN_API
291void pixman_f_transform_point_3d (const struct pixman_f_transform *t,
292 struct pixman_f_vector *v);
293
294PIXMAN_API
295void pixman_f_transform_multiply (struct pixman_f_transform *dst,
296 const struct pixman_f_transform *l,
297 const struct pixman_f_transform *r);
298
299PIXMAN_API
300void pixman_f_transform_init_scale (struct pixman_f_transform *t,
301 double sx,
302 double sy);
303
304PIXMAN_API
305pixman_bool_t pixman_f_transform_scale (struct pixman_f_transform *forward,
306 struct pixman_f_transform *reverse,
307 double sx,
308 double sy);
309
310PIXMAN_API
311void pixman_f_transform_init_rotate (struct pixman_f_transform *t,
312 double cos,
313 double sin);
314
315PIXMAN_API
316pixman_bool_t pixman_f_transform_rotate (struct pixman_f_transform *forward,
317 struct pixman_f_transform *reverse,
318 double c,
319 double s);
320
321PIXMAN_API
322void pixman_f_transform_init_translate (struct pixman_f_transform *t,
323 double tx,
324 double ty);
325
326PIXMAN_API
327pixman_bool_t pixman_f_transform_translate (struct pixman_f_transform *forward,
328 struct pixman_f_transform *reverse,
329 double tx,
330 double ty);
331
332PIXMAN_API
333pixman_bool_t pixman_f_transform_bounds (const struct pixman_f_transform *t,
334 struct pixman_box16 *b);
335
336PIXMAN_API
337void pixman_f_transform_init_identity (struct pixman_f_transform *t);
338
339typedef enum
340{
341 PIXMAN_REPEAT_NONE,
342 PIXMAN_REPEAT_NORMAL,
343 PIXMAN_REPEAT_PAD,
344 PIXMAN_REPEAT_REFLECT
345} pixman_repeat_t;
346
347typedef enum
348{
349 PIXMAN_DITHER_NONE,
350 PIXMAN_DITHER_FAST,
351 PIXMAN_DITHER_GOOD,
352 PIXMAN_DITHER_BEST,
353 PIXMAN_DITHER_ORDERED_BAYER_8,
354 PIXMAN_DITHER_ORDERED_BLUE_NOISE_64
355} pixman_dither_t;
356
357typedef enum
358{
359 PIXMAN_FILTER_FAST,
360 PIXMAN_FILTER_GOOD,
361 PIXMAN_FILTER_BEST,
362 PIXMAN_FILTER_NEAREST,
363 PIXMAN_FILTER_BILINEAR,
364 PIXMAN_FILTER_CONVOLUTION
365
366 /* The SEPARABLE_CONVOLUTION filter takes the following parameters:
367 *
368 * width: integer given as 16.16 fixpoint number
369 * height: integer given as 16.16 fixpoint number
370 * x_phase_bits: integer given as 16.16 fixpoint
371 * y_phase_bits: integer given as 16.16 fixpoint
372 * xtables: (1 << x_phase_bits) tables of size width
373 * ytables: (1 << y_phase_bits) tables of size height
374 *
375 * When sampling at (x, y), the location is first rounded to one of
376 * n_x_phases * n_y_phases subpixel positions. These subpixel positions
377 * determine an xtable and a ytable to use.
378 *
379 * Conceptually a width x height matrix is then formed in which each entry
380 * is the product of the corresponding entries in the x and y tables.
381 * This matrix is then aligned with the image pixels such that its center
382 * is as close as possible to the subpixel location chosen earlier. Then
383 * the image is convolved with the matrix and the resulting pixel returned.
384 */
385 PIXMAN_FILTER_SEPARABLE_CONVOLUTION
386} pixman_filter_t;
387
388typedef enum
389{
390 PIXMAN_OP_CLEAR = 0x00,
391 PIXMAN_OP_SRC = 0x01,
392 PIXMAN_OP_DST = 0x02,
393 PIXMAN_OP_OVER = 0x03,
394 PIXMAN_OP_OVER_REVERSE = 0x04,
395 PIXMAN_OP_IN = 0x05,
396 PIXMAN_OP_IN_REVERSE = 0x06,
397 PIXMAN_OP_OUT = 0x07,
398 PIXMAN_OP_OUT_REVERSE = 0x08,
399 PIXMAN_OP_ATOP = 0x09,
400 PIXMAN_OP_ATOP_REVERSE = 0x0a,
401 PIXMAN_OP_XOR = 0x0b,
402 PIXMAN_OP_ADD = 0x0c,
403 PIXMAN_OP_SATURATE = 0x0d,
404
405 PIXMAN_OP_DISJOINT_CLEAR = 0x10,
406 PIXMAN_OP_DISJOINT_SRC = 0x11,
407 PIXMAN_OP_DISJOINT_DST = 0x12,
408 PIXMAN_OP_DISJOINT_OVER = 0x13,
409 PIXMAN_OP_DISJOINT_OVER_REVERSE = 0x14,
410 PIXMAN_OP_DISJOINT_IN = 0x15,
411 PIXMAN_OP_DISJOINT_IN_REVERSE = 0x16,
412 PIXMAN_OP_DISJOINT_OUT = 0x17,
413 PIXMAN_OP_DISJOINT_OUT_REVERSE = 0x18,
414 PIXMAN_OP_DISJOINT_ATOP = 0x19,
415 PIXMAN_OP_DISJOINT_ATOP_REVERSE = 0x1a,
416 PIXMAN_OP_DISJOINT_XOR = 0x1b,
417
418 PIXMAN_OP_CONJOINT_CLEAR = 0x20,
419 PIXMAN_OP_CONJOINT_SRC = 0x21,
420 PIXMAN_OP_CONJOINT_DST = 0x22,
421 PIXMAN_OP_CONJOINT_OVER = 0x23,
422 PIXMAN_OP_CONJOINT_OVER_REVERSE = 0x24,
423 PIXMAN_OP_CONJOINT_IN = 0x25,
424 PIXMAN_OP_CONJOINT_IN_REVERSE = 0x26,
425 PIXMAN_OP_CONJOINT_OUT = 0x27,
426 PIXMAN_OP_CONJOINT_OUT_REVERSE = 0x28,
427 PIXMAN_OP_CONJOINT_ATOP = 0x29,
428 PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a,
429 PIXMAN_OP_CONJOINT_XOR = 0x2b,
430
431 PIXMAN_OP_MULTIPLY = 0x30,
432 PIXMAN_OP_SCREEN = 0x31,
433 PIXMAN_OP_OVERLAY = 0x32,
434 PIXMAN_OP_DARKEN = 0x33,
435 PIXMAN_OP_LIGHTEN = 0x34,
436 PIXMAN_OP_COLOR_DODGE = 0x35,
437 PIXMAN_OP_COLOR_BURN = 0x36,
438 PIXMAN_OP_HARD_LIGHT = 0x37,
439 PIXMAN_OP_SOFT_LIGHT = 0x38,
440 PIXMAN_OP_DIFFERENCE = 0x39,
441 PIXMAN_OP_EXCLUSION = 0x3a,
442 PIXMAN_OP_HSL_HUE = 0x3b,
443 PIXMAN_OP_HSL_SATURATION = 0x3c,
444 PIXMAN_OP_HSL_COLOR = 0x3d,
445 PIXMAN_OP_HSL_LUMINOSITY = 0x3e
446
447#ifdef PIXMAN_USE_INTERNAL_API
448 ,
449 PIXMAN_N_OPERATORS,
450 PIXMAN_OP_NONE = PIXMAN_N_OPERATORS
451#endif
452} pixman_op_t;
453
454/*
455 * Regions
456 */
457typedef struct pixman_region16_data pixman_region16_data_t;
458typedef struct pixman_box16 pixman_box16_t;
459typedef struct pixman_rectangle16 pixman_rectangle16_t;
460typedef struct pixman_region16 pixman_region16_t;
461
462struct pixman_region16_data {
463 long size;
464 long numRects;
465/* pixman_box16_t rects[size]; in memory but not explicitly declared */
466};
467
468struct pixman_rectangle16
469{
470 int16_t x, y;
471 uint16_t width, height;
472};
473
474struct pixman_box16
475{
476 int16_t x1, y1, x2, y2;
477};
478
479struct pixman_region16
480{
481 pixman_box16_t extents;
482 pixman_region16_data_t *data;
483};
484
485typedef enum
486{
487 PIXMAN_REGION_OUT,
488 PIXMAN_REGION_IN,
489 PIXMAN_REGION_PART
490} pixman_region_overlap_t;
491
492/* This function exists only to make it possible to preserve
493 * the X ABI - it should go away at first opportunity.
494 */
495PIXMAN_API
496void pixman_region_set_static_pointers (pixman_box16_t *empty_box,
497 pixman_region16_data_t *empty_data,
498 pixman_region16_data_t *broken_data);
499
500/* creation/destruction */
501PIXMAN_API
502void pixman_region_init (pixman_region16_t *region);
503
504PIXMAN_API
505void pixman_region_init_rect (pixman_region16_t *region,
506 int x,
507 int y,
508 unsigned int width,
509 unsigned int height);
510
511PIXMAN_API
512pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
513 const pixman_box16_t *boxes,
514 int count);
515
516PIXMAN_API
517void pixman_region_init_with_extents (pixman_region16_t *region,
518 const pixman_box16_t *extents);
519
520PIXMAN_API
521void pixman_region_init_from_image (pixman_region16_t *region,
522 pixman_image_t *image);
523
524PIXMAN_API
525void pixman_region_fini (pixman_region16_t *region);
526
527
528/* manipulation */
529PIXMAN_API
530void pixman_region_translate (pixman_region16_t *region,
531 int x,
532 int y);
533
534PIXMAN_API
535pixman_bool_t pixman_region_copy (pixman_region16_t *dest,
536 const pixman_region16_t *source);
537
538PIXMAN_API
539pixman_bool_t pixman_region_intersect (pixman_region16_t *new_reg,
540 const pixman_region16_t *reg1,
541 const pixman_region16_t *reg2);
542
543PIXMAN_API
544pixman_bool_t pixman_region_union (pixman_region16_t *new_reg,
545 const pixman_region16_t *reg1,
546 const pixman_region16_t *reg2);
547
548PIXMAN_API
549pixman_bool_t pixman_region_union_rect (pixman_region16_t *dest,
550 const pixman_region16_t *source,
551 int x,
552 int y,
553 unsigned int width,
554 unsigned int height);
555
556PIXMAN_API
557pixman_bool_t pixman_region_intersect_rect (pixman_region16_t *dest,
558 const pixman_region16_t *source,
559 int x,
560 int y,
561 unsigned int width,
562 unsigned int height);
563
564PIXMAN_API
565pixman_bool_t pixman_region_subtract (pixman_region16_t *reg_d,
566 const pixman_region16_t *reg_m,
567 const pixman_region16_t *reg_s);
568
569PIXMAN_API
570pixman_bool_t pixman_region_inverse (pixman_region16_t *new_reg,
571 const pixman_region16_t *reg1,
572 const pixman_box16_t *inv_rect);
573
574PIXMAN_API
575pixman_bool_t pixman_region_contains_point (const pixman_region16_t *region,
576 int x,
577 int y,
578 pixman_box16_t *box);
579
580PIXMAN_API
581pixman_region_overlap_t pixman_region_contains_rectangle (const pixman_region16_t *region,
582 const pixman_box16_t *prect);
583
584PIXMAN_API
585pixman_bool_t pixman_region_empty (const pixman_region16_t *region);
586
587PIXMAN_API
588pixman_bool_t pixman_region_not_empty (const pixman_region16_t *region);
589
590PIXMAN_API
591pixman_box16_t * pixman_region_extents (const pixman_region16_t *region);
592
593PIXMAN_API
594int pixman_region_n_rects (const pixman_region16_t *region);
595
596PIXMAN_API
597pixman_box16_t * pixman_region_rectangles (const pixman_region16_t *region,
598 int *n_rects);
599
600PIXMAN_API
601pixman_bool_t pixman_region_equal (const pixman_region16_t *region1,
602 const pixman_region16_t *region2);
603
604PIXMAN_API
605pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region);
606
607PIXMAN_API
608void pixman_region_reset (pixman_region16_t *region,
609 const pixman_box16_t *box);
610
611PIXMAN_API
612void pixman_region_clear (pixman_region16_t *region);
613/*
614 * 32 bit regions
615 */
616typedef struct pixman_region32_data pixman_region32_data_t;
617typedef struct pixman_box32 pixman_box32_t;
618typedef struct pixman_rectangle32 pixman_rectangle32_t;
619typedef struct pixman_region32 pixman_region32_t;
620
621struct pixman_region32_data {
622 long size;
623 long numRects;
624/* pixman_box32_t rects[size]; in memory but not explicitly declared */
625};
626
627struct pixman_rectangle32
628{
629 int32_t x, y;
630 uint32_t width, height;
631};
632
633struct pixman_box32
634{
635 int32_t x1, y1, x2, y2;
636};
637
638struct pixman_region32
639{
640 pixman_box32_t extents;
641 pixman_region32_data_t *data;
642};
643
644/* creation/destruction */
645PIXMAN_API
646void pixman_region32_init (pixman_region32_t *region);
647
648PIXMAN_API
649void pixman_region32_init_rect (pixman_region32_t *region,
650 int x,
651 int y,
652 unsigned int width,
653 unsigned int height);
654
655PIXMAN_API
656pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region,
657 const pixman_box32_t *boxes,
658 int count);
659
660PIXMAN_API
661void pixman_region32_init_with_extents (pixman_region32_t *region,
662 const pixman_box32_t *extents);
663
664PIXMAN_API
665void pixman_region32_init_from_image (pixman_region32_t *region,
666 pixman_image_t *image);
667
668PIXMAN_API
669void pixman_region32_fini (pixman_region32_t *region);
670
671
672/* manipulation */
673PIXMAN_API
674void pixman_region32_translate (pixman_region32_t *region,
675 int x,
676 int y);
677
678PIXMAN_API
679pixman_bool_t pixman_region32_copy (pixman_region32_t *dest,
680 const pixman_region32_t *source);
681
682PIXMAN_API
683pixman_bool_t pixman_region32_intersect (pixman_region32_t *new_reg,
684 const pixman_region32_t *reg1,
685 const pixman_region32_t *reg2);
686
687PIXMAN_API
688pixman_bool_t pixman_region32_union (pixman_region32_t *new_reg,
689 const pixman_region32_t *reg1,
690 const pixman_region32_t *reg2);
691
692PIXMAN_API
693pixman_bool_t pixman_region32_intersect_rect (pixman_region32_t *dest,
694 const pixman_region32_t *source,
695 int x,
696 int y,
697 unsigned int width,
698 unsigned int height);
699
700PIXMAN_API
701pixman_bool_t pixman_region32_union_rect (pixman_region32_t *dest,
702 const pixman_region32_t *source,
703 int x,
704 int y,
705 unsigned int width,
706 unsigned int height);
707
708PIXMAN_API
709pixman_bool_t pixman_region32_subtract (pixman_region32_t *reg_d,
710 const pixman_region32_t *reg_m,
711 const pixman_region32_t *reg_s);
712
713PIXMAN_API
714pixman_bool_t pixman_region32_inverse (pixman_region32_t *new_reg,
715 const pixman_region32_t *reg1,
716 const pixman_box32_t *inv_rect);
717
718PIXMAN_API
719pixman_bool_t pixman_region32_contains_point (const pixman_region32_t *region,
720 int x,
721 int y,
722 pixman_box32_t *box);
723
724PIXMAN_API
725pixman_region_overlap_t pixman_region32_contains_rectangle (const pixman_region32_t *region,
726 const pixman_box32_t *prect);
727
728PIXMAN_API
729pixman_bool_t pixman_region32_empty (const pixman_region32_t *region);
730
731PIXMAN_API
732pixman_bool_t pixman_region32_not_empty (const pixman_region32_t *region);
733
734PIXMAN_API
735pixman_box32_t * pixman_region32_extents (const pixman_region32_t *region);
736
737PIXMAN_API
738int pixman_region32_n_rects (const pixman_region32_t *region);
739
740PIXMAN_API
741pixman_box32_t * pixman_region32_rectangles (const pixman_region32_t *region,
742 int *n_rects);
743
744PIXMAN_API
745pixman_bool_t pixman_region32_equal (const pixman_region32_t *region1,
746 const pixman_region32_t *region2);
747
748PIXMAN_API
749pixman_bool_t pixman_region32_selfcheck (pixman_region32_t *region);
750
751PIXMAN_API
752void pixman_region32_reset (pixman_region32_t *region,
753 const pixman_box32_t *box);
754
755PIXMAN_API
756void pixman_region32_clear (pixman_region32_t *region);
757
758
759/* Copy / Fill / Misc */
760PIXMAN_API
761pixman_bool_t pixman_blt (uint32_t *src_bits,
762 uint32_t *dst_bits,
763 int src_stride,
764 int dst_stride,
765 int src_bpp,
766 int dst_bpp,
767 int src_x,
768 int src_y,
769 int dest_x,
770 int dest_y,
771 int width,
772 int height);
773
774PIXMAN_API
775pixman_bool_t pixman_fill (uint32_t *bits,
776 int stride,
777 int bpp,
778 int x,
779 int y,
780 int width,
781 int height,
782 uint32_t _xor);
783
784
785PIXMAN_API
786int pixman_version (void);
787
788PIXMAN_API
789const char* pixman_version_string (void);
790
791/*
792 * Images
793 */
794typedef struct pixman_indexed pixman_indexed_t;
795typedef struct pixman_gradient_stop pixman_gradient_stop_t;
796
797typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
798typedef void (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
799
800typedef void (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data);
801
802struct pixman_gradient_stop {
803 pixman_fixed_t x;
804 pixman_color_t color;
805};
806
807#define PIXMAN_MAX_INDEXED 256 /* XXX depth must be <= 8 */
808
809#if PIXMAN_MAX_INDEXED <= 256
810typedef uint8_t pixman_index_type;
811#endif
812
813struct pixman_indexed
814{
815 pixman_bool_t color;
816 uint32_t rgba[PIXMAN_MAX_INDEXED];
817 pixman_index_type ent[32768];
818};
819
820/*
821 * While the protocol is generous in format support, the
822 * sample implementation allows only packed RGB and GBR
823 * representations for data to simplify software rendering,
824 */
825#define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \
826 ((type) << 16) | \
827 ((a) << 12) | \
828 ((r) << 8) | \
829 ((g) << 4) | \
830 ((b)))
831
832#define PIXMAN_FORMAT_BYTE(bpp,type,a,r,g,b) \
833 (((bpp >> 3) << 24) | \
834 (3 << 22) | ((type) << 16) | \
835 ((a >> 3) << 12) | \
836 ((r >> 3) << 8) | \
837 ((g >> 3) << 4) | \
838 ((b >> 3)))
839
840#define PIXMAN_FORMAT_RESHIFT(val, ofs, num) \
841 (((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
842
843#define PIXMAN_FORMAT_BPP(f) PIXMAN_FORMAT_RESHIFT(f, 24, 8)
844#define PIXMAN_FORMAT_SHIFT(f) ((uint32_t)((f >> 22) & 3))
845#define PIXMAN_FORMAT_TYPE(f) (((f) >> 16) & 0x3f)
846#define PIXMAN_FORMAT_A(f) PIXMAN_FORMAT_RESHIFT(f, 12, 4)
847#define PIXMAN_FORMAT_R(f) PIXMAN_FORMAT_RESHIFT(f, 8, 4)
848#define PIXMAN_FORMAT_G(f) PIXMAN_FORMAT_RESHIFT(f, 4, 4)
849#define PIXMAN_FORMAT_B(f) PIXMAN_FORMAT_RESHIFT(f, 0, 4)
850#define PIXMAN_FORMAT_RGB(f) (((f) ) & 0xfff)
851#define PIXMAN_FORMAT_VIS(f) (((f) ) & 0xffff)
852#define PIXMAN_FORMAT_DEPTH(f) (PIXMAN_FORMAT_A(f) + \
853 PIXMAN_FORMAT_R(f) + \
854 PIXMAN_FORMAT_G(f) + \
855 PIXMAN_FORMAT_B(f))
856
857#define PIXMAN_TYPE_OTHER 0
858#define PIXMAN_TYPE_A 1
859#define PIXMAN_TYPE_ARGB 2
860#define PIXMAN_TYPE_ABGR 3
861#define PIXMAN_TYPE_COLOR 4
862#define PIXMAN_TYPE_GRAY 5
863#define PIXMAN_TYPE_YUY2 6
864#define PIXMAN_TYPE_YV12 7
865#define PIXMAN_TYPE_BGRA 8
866#define PIXMAN_TYPE_RGBA 9
867#define PIXMAN_TYPE_ARGB_SRGB 10
868#define PIXMAN_TYPE_RGBA_FLOAT 11
869
870#define PIXMAN_FORMAT_COLOR(f) \
871 (PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB || \
872 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR || \
873 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA || \
874 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA || \
875 PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA_FLOAT)
876
877typedef enum {
878/* 128bpp formats */
879 PIXMAN_rgba_float = PIXMAN_FORMAT_BYTE(128,PIXMAN_TYPE_RGBA_FLOAT,32,32,32,32),
880/* 96bpp formats */
881 PIXMAN_rgb_float = PIXMAN_FORMAT_BYTE(96,PIXMAN_TYPE_RGBA_FLOAT,0,32,32,32),
882
883/* 32bpp formats */
884 PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
885 PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
886 PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
887 PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
888 PIXMAN_b8g8r8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
889 PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
890 PIXMAN_r8g8b8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
891 PIXMAN_r8g8b8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
892 PIXMAN_x14r6g6b6 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
893 PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
894 PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
895 PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
896 PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
897
898/* sRGB formats */
899 PIXMAN_a8r8g8b8_sRGB = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_SRGB,8,8,8,8),
900 PIXMAN_r8g8b8_sRGB = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB_SRGB,0,8,8,8),
901
902/* 24bpp formats */
903 PIXMAN_r8g8b8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
904 PIXMAN_b8g8r8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
905
906/* 16bpp formats */
907 PIXMAN_r5g6b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
908 PIXMAN_b5g6r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
909
910 PIXMAN_a1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
911 PIXMAN_x1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
912 PIXMAN_a1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
913 PIXMAN_x1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
914 PIXMAN_a4r4g4b4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
915 PIXMAN_x4r4g4b4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
916 PIXMAN_a4b4g4r4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
917 PIXMAN_x4b4g4r4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
918
919/* 8bpp formats */
920 PIXMAN_a8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
921 PIXMAN_r3g3b2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
922 PIXMAN_b2g3r3 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
923 PIXMAN_a2r2g2b2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
924 PIXMAN_a2b2g2r2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
925
926 PIXMAN_c8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
927 PIXMAN_g8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
928
929 PIXMAN_x4a4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
930
931 PIXMAN_x4c4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
932 PIXMAN_x4g4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
933
934/* 4bpp formats */
935 PIXMAN_a4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
936 PIXMAN_r1g2b1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
937 PIXMAN_b1g2r1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
938 PIXMAN_a1r1g1b1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
939 PIXMAN_a1b1g1r1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
940
941 PIXMAN_c4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
942 PIXMAN_g4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
943
944/* 1bpp formats */
945 PIXMAN_a1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
946
947 PIXMAN_g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
948
949/* YUV formats */
950 PIXMAN_yuy2 = PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
951 PIXMAN_yv12 = PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
952} pixman_format_code_t;
953
954/* Querying supported format values. */
955PIXMAN_API
956pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
957
958PIXMAN_API
959pixman_bool_t pixman_format_supported_source (pixman_format_code_t format);
960
961/* Constructors */
962PIXMAN_API
963pixman_image_t *pixman_image_create_solid_fill (const pixman_color_t *color);
964
965PIXMAN_API
966pixman_image_t *pixman_image_create_linear_gradient (const pixman_point_fixed_t *p1,
967 const pixman_point_fixed_t *p2,
968 const pixman_gradient_stop_t *stops,
969 int n_stops);
970
971PIXMAN_API
972pixman_image_t *pixman_image_create_radial_gradient (const pixman_point_fixed_t *inner,
973 const pixman_point_fixed_t *outer,
974 pixman_fixed_t inner_radius,
975 pixman_fixed_t outer_radius,
976 const pixman_gradient_stop_t *stops,
977 int n_stops);
978
979PIXMAN_API
980pixman_image_t *pixman_image_create_conical_gradient (const pixman_point_fixed_t *center,
981 pixman_fixed_t angle,
982 const pixman_gradient_stop_t *stops,
983 int n_stops);
984
985PIXMAN_API
986pixman_image_t *pixman_image_create_bits (pixman_format_code_t format,
987 int width,
988 int height,
989 uint32_t *bits,
990 int rowstride_bytes);
991
992PIXMAN_API
993pixman_image_t *pixman_image_create_bits_no_clear (pixman_format_code_t format,
994 int width,
995 int height,
996 uint32_t * bits,
997 int rowstride_bytes);
998
999/* Destructor */
1000PIXMAN_API
1001pixman_image_t *pixman_image_ref (pixman_image_t *image);
1002
1003PIXMAN_API
1004pixman_bool_t pixman_image_unref (pixman_image_t *image);
1005
1006
1007PIXMAN_API
1008void pixman_image_set_destroy_function (pixman_image_t *image,
1009 pixman_image_destroy_func_t function,
1010 void *data);
1011
1012PIXMAN_API
1013void * pixman_image_get_destroy_data (pixman_image_t *image);
1014
1015/* Set properties */
1016PIXMAN_API
1017pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image,
1018 const pixman_region16_t *region);
1019
1020PIXMAN_API
1021pixman_bool_t pixman_image_set_clip_region32 (pixman_image_t *image,
1022 const pixman_region32_t *region);
1023
1024PIXMAN_API
1025void pixman_image_set_has_client_clip (pixman_image_t *image,
1026 pixman_bool_t clien_clip);
1027
1028PIXMAN_API
1029pixman_bool_t pixman_image_set_transform (pixman_image_t *image,
1030 const pixman_transform_t *transform);
1031
1032PIXMAN_API
1033void pixman_image_set_repeat (pixman_image_t *image,
1034 pixman_repeat_t repeat);
1035
1036PIXMAN_API
1037void pixman_image_set_dither (pixman_image_t *image,
1038 pixman_dither_t dither);
1039
1040PIXMAN_API
1041void pixman_image_set_dither_offset (pixman_image_t *image,
1042 int offset_x,
1043 int offset_y);
1044
1045PIXMAN_API
1046pixman_bool_t pixman_image_set_filter (pixman_image_t *image,
1047 pixman_filter_t filter,
1048 const pixman_fixed_t *filter_params,
1049 int n_filter_params);
1050
1051PIXMAN_API
1052void pixman_image_set_source_clipping (pixman_image_t *image,
1053 pixman_bool_t source_clipping);
1054
1055PIXMAN_API
1056void pixman_image_set_alpha_map (pixman_image_t *image,
1057 pixman_image_t *alpha_map,
1058 int16_t x,
1059 int16_t y);
1060
1061PIXMAN_API
1062void pixman_image_set_component_alpha (pixman_image_t *image,
1063 pixman_bool_t component_alpha);
1064
1065PIXMAN_API
1066pixman_bool_t pixman_image_get_component_alpha (pixman_image_t *image);
1067
1068PIXMAN_API
1069void pixman_image_set_accessors (pixman_image_t *image,
1070 pixman_read_memory_func_t read_func,
1071 pixman_write_memory_func_t write_func);
1072
1073PIXMAN_API
1074void pixman_image_set_indexed (pixman_image_t *image,
1075 const pixman_indexed_t *indexed);
1076
1077PIXMAN_API
1078uint32_t *pixman_image_get_data (pixman_image_t *image);
1079
1080PIXMAN_API
1081int pixman_image_get_width (pixman_image_t *image);
1082
1083PIXMAN_API
1084int pixman_image_get_height (pixman_image_t *image);
1085
1086PIXMAN_API
1087int pixman_image_get_stride (pixman_image_t *image); /* in bytes */
1088
1089PIXMAN_API
1090int pixman_image_get_depth (pixman_image_t *image);
1091
1092PIXMAN_API
1093pixman_format_code_t pixman_image_get_format (pixman_image_t *image);
1094
1095typedef enum
1096{
1097 PIXMAN_KERNEL_IMPULSE,
1098 PIXMAN_KERNEL_BOX,
1099 PIXMAN_KERNEL_LINEAR,
1100 PIXMAN_KERNEL_CUBIC,
1101 PIXMAN_KERNEL_GAUSSIAN,
1102 PIXMAN_KERNEL_LANCZOS2,
1103 PIXMAN_KERNEL_LANCZOS3,
1104 PIXMAN_KERNEL_LANCZOS3_STRETCHED /* Jim Blinn's 'nice' filter */
1105} pixman_kernel_t;
1106
1107/* Create the parameter list for a SEPARABLE_CONVOLUTION filter
1108 * with the given kernels and scale parameters.
1109 */
1110PIXMAN_API
1111pixman_fixed_t *
1112pixman_filter_create_separable_convolution (int *n_values,
1113 pixman_fixed_t scale_x,
1114 pixman_fixed_t scale_y,
1115 pixman_kernel_t reconstruct_x,
1116 pixman_kernel_t reconstruct_y,
1117 pixman_kernel_t sample_x,
1118 pixman_kernel_t sample_y,
1119 int subsample_bits_x,
1120 int subsample_bits_y);
1121
1122
1123PIXMAN_API
1124pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op,
1125 pixman_image_t *image,
1126 const pixman_color_t *color,
1127 int n_rects,
1128 const pixman_rectangle16_t *rects);
1129
1130PIXMAN_API
1131pixman_bool_t pixman_image_fill_boxes (pixman_op_t op,
1132 pixman_image_t *dest,
1133 const pixman_color_t *color,
1134 int n_boxes,
1135 const pixman_box32_t *boxes);
1136
1137/* Composite */
1138PIXMAN_API
1139pixman_bool_t pixman_compute_composite_region (pixman_region16_t *region,
1140 pixman_image_t *src_image,
1141 pixman_image_t *mask_image,
1142 pixman_image_t *dest_image,
1143 int16_t src_x,
1144 int16_t src_y,
1145 int16_t mask_x,
1146 int16_t mask_y,
1147 int16_t dest_x,
1148 int16_t dest_y,
1149 uint16_t width,
1150 uint16_t height);
1151
1152PIXMAN_API
1153void pixman_image_composite (pixman_op_t op,
1154 pixman_image_t *src,
1155 pixman_image_t *mask,
1156 pixman_image_t *dest,
1157 int16_t src_x,
1158 int16_t src_y,
1159 int16_t mask_x,
1160 int16_t mask_y,
1161 int16_t dest_x,
1162 int16_t dest_y,
1163 uint16_t width,
1164 uint16_t height);
1165
1166PIXMAN_API
1167void pixman_image_composite32 (pixman_op_t op,
1168 pixman_image_t *src,
1169 pixman_image_t *mask,
1170 pixman_image_t *dest,
1171 int32_t src_x,
1172 int32_t src_y,
1173 int32_t mask_x,
1174 int32_t mask_y,
1175 int32_t dest_x,
1176 int32_t dest_y,
1177 int32_t width,
1178 int32_t height);
1179
1180/* Executive Summary: This function is a no-op that only exists
1181 * for historical reasons.
1182 *
1183 * There used to be a bug in the X server where it would rely on
1184 * out-of-bounds accesses when it was asked to composite with a
1185 * window as the source. It would create a pixman image pointing
1186 * to some bogus position in memory, but then set a clip region
1187 * to the position where the actual bits were.
1188 *
1189 * Due to a bug in old versions of pixman, where it would not clip
1190 * against the image bounds when a clip region was set, this would
1191 * actually work. So when the pixman bug was fixed, a workaround was
1192 * added to allow certain out-of-bound accesses. This function disabled
1193 * those workarounds.
1194 *
1195 * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this
1196 * function is a no-op.
1197 */
1198PIXMAN_API
1199void pixman_disable_out_of_bounds_workaround (void);
1200
1201/*
1202 * Glyphs
1203 */
1204typedef struct pixman_glyph_cache_t pixman_glyph_cache_t;
1205typedef struct
1206{
1207 int x, y;
1208 const void *glyph;
1209} pixman_glyph_t;
1210
1211PIXMAN_API
1212pixman_glyph_cache_t *pixman_glyph_cache_create (void);
1213
1214PIXMAN_API
1215void pixman_glyph_cache_destroy (pixman_glyph_cache_t *cache);
1216
1217PIXMAN_API
1218void pixman_glyph_cache_freeze (pixman_glyph_cache_t *cache);
1219
1220PIXMAN_API
1221void pixman_glyph_cache_thaw (pixman_glyph_cache_t *cache);
1222
1223PIXMAN_API
1224const void * pixman_glyph_cache_lookup (pixman_glyph_cache_t *cache,
1225 void *font_key,
1226 void *glyph_key);
1227
1228PIXMAN_API
1229const void * pixman_glyph_cache_insert (pixman_glyph_cache_t *cache,
1230 void *font_key,
1231 void *glyph_key,
1232 int origin_x,
1233 int origin_y,
1234 pixman_image_t *glyph_image);
1235
1236PIXMAN_API
1237void pixman_glyph_cache_remove (pixman_glyph_cache_t *cache,
1238 void *font_key,
1239 void *glyph_key);
1240
1241PIXMAN_API
1242void pixman_glyph_get_extents (pixman_glyph_cache_t *cache,
1243 int n_glyphs,
1244 pixman_glyph_t *glyphs,
1245 pixman_box32_t *extents);
1246
1247PIXMAN_API
1248pixman_format_code_t pixman_glyph_get_mask_format (pixman_glyph_cache_t *cache,
1249 int n_glyphs,
1250 const pixman_glyph_t *glyphs);
1251
1252PIXMAN_API
1253void pixman_composite_glyphs (pixman_op_t op,
1254 pixman_image_t *src,
1255 pixman_image_t *dest,
1256 pixman_format_code_t mask_format,
1257 int32_t src_x,
1258 int32_t src_y,
1259 int32_t mask_x,
1260 int32_t mask_y,
1261 int32_t dest_x,
1262 int32_t dest_y,
1263 int32_t width,
1264 int32_t height,
1265 pixman_glyph_cache_t *cache,
1266 int n_glyphs,
1267 const pixman_glyph_t *glyphs);
1268
1269PIXMAN_API
1270void pixman_composite_glyphs_no_mask (pixman_op_t op,
1271 pixman_image_t *src,
1272 pixman_image_t *dest,
1273 int32_t src_x,
1274 int32_t src_y,
1275 int32_t dest_x,
1276 int32_t dest_y,
1277 pixman_glyph_cache_t *cache,
1278 int n_glyphs,
1279 const pixman_glyph_t *glyphs);
1280
1281/*
1282 * Trapezoids
1283 */
1284typedef struct pixman_edge pixman_edge_t;
1285typedef struct pixman_trapezoid pixman_trapezoid_t;
1286typedef struct pixman_trap pixman_trap_t;
1287typedef struct pixman_span_fix pixman_span_fix_t;
1288typedef struct pixman_triangle pixman_triangle_t;
1289
1290/*
1291 * An edge structure. This represents a single polygon edge
1292 * and can be quickly stepped across small or large gaps in the
1293 * sample grid
1294 */
1295struct pixman_edge
1296{
1297 pixman_fixed_t x;
1298 pixman_fixed_t e;
1299 pixman_fixed_t stepx;
1300 pixman_fixed_t signdx;
1301 pixman_fixed_t dy;
1302 pixman_fixed_t dx;
1303
1304 pixman_fixed_t stepx_small;
1305 pixman_fixed_t stepx_big;
1306 pixman_fixed_t dx_small;
1307 pixman_fixed_t dx_big;
1308};
1309
1310struct pixman_trapezoid
1311{
1312 pixman_fixed_t top, bottom;
1313 pixman_line_fixed_t left, right;
1314};
1315
1316struct pixman_triangle
1317{
1318 pixman_point_fixed_t p1, p2, p3;
1319};
1320
1321/* whether 't' is a well defined not obviously empty trapezoid */
1322#define pixman_trapezoid_valid(t) \
1323 ((t)->left.p1.y != (t)->left.p2.y && \
1324 (t)->right.p1.y != (t)->right.p2.y && \
1325 ((t)->bottom > (t)->top))
1326
1327struct pixman_span_fix
1328{
1329 pixman_fixed_t l, r, y;
1330};
1331
1332struct pixman_trap
1333{
1334 pixman_span_fix_t top, bot;
1335};
1336
1337PIXMAN_API
1338pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y,
1339 int bpp);
1340
1341PIXMAN_API
1342pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y,
1343 int bpp);
1344
1345PIXMAN_API
1346void pixman_edge_step (pixman_edge_t *e,
1347 int n);
1348
1349PIXMAN_API
1350void pixman_edge_init (pixman_edge_t *e,
1351 int bpp,
1352 pixman_fixed_t y_start,
1353 pixman_fixed_t x_top,
1354 pixman_fixed_t y_top,
1355 pixman_fixed_t x_bot,
1356 pixman_fixed_t y_bot);
1357
1358PIXMAN_API
1359void pixman_line_fixed_edge_init (pixman_edge_t *e,
1360 int bpp,
1361 pixman_fixed_t y,
1362 const pixman_line_fixed_t *line,
1363 int x_off,
1364 int y_off);
1365
1366PIXMAN_API
1367void pixman_rasterize_edges (pixman_image_t *image,
1368 pixman_edge_t *l,
1369 pixman_edge_t *r,
1370 pixman_fixed_t t,
1371 pixman_fixed_t b);
1372
1373PIXMAN_API
1374void pixman_add_traps (pixman_image_t *image,
1375 int16_t x_off,
1376 int16_t y_off,
1377 int ntrap,
1378 const pixman_trap_t *traps);
1379
1380PIXMAN_API
1381void pixman_add_trapezoids (pixman_image_t *image,
1382 int16_t x_off,
1383 int y_off,
1384 int ntraps,
1385 const pixman_trapezoid_t *traps);
1386
1387PIXMAN_API
1388void pixman_rasterize_trapezoid (pixman_image_t *image,
1389 const pixman_trapezoid_t *trap,
1390 int x_off,
1391 int y_off);
1392
1393PIXMAN_API
1394void pixman_composite_trapezoids (pixman_op_t op,
1395 pixman_image_t * src,
1396 pixman_image_t * dst,
1397 pixman_format_code_t mask_format,
1398 int x_src,
1399 int y_src,
1400 int x_dst,
1401 int y_dst,
1402 int n_traps,
1403 const pixman_trapezoid_t * traps);
1404
1405PIXMAN_API
1406void pixman_composite_triangles (pixman_op_t op,
1407 pixman_image_t * src,
1408 pixman_image_t * dst,
1409 pixman_format_code_t mask_format,
1410 int x_src,
1411 int y_src,
1412 int x_dst,
1413 int y_dst,
1414 int n_tris,
1415 const pixman_triangle_t * tris);
1416
1417PIXMAN_API
1418void pixman_add_triangles (pixman_image_t *image,
1419 int32_t x_off,
1420 int32_t y_off,
1421 int n_tris,
1422 const pixman_triangle_t *tris);
1423
1424PIXMAN_END_DECLS
1425
1426#endif /* PIXMAN_H__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette