Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/pixman-1/pixman.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /*********************************************************** | |
2 | |
3 Copyright 1987, 1998 The Open Group | |
4 | |
5 Permission to use, copy, modify, distribute, and sell this software and its | |
6 documentation for any purpose is hereby granted without fee, provided that | |
7 the above copyright notice appear in all copies and that both that | |
8 copyright notice and this permission notice appear in supporting | |
9 documentation. | |
10 | |
11 The above copyright notice and this permission notice shall be included in | |
12 all copies or substantial portions of the Software. | |
13 | |
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | |
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
20 | |
21 Except as contained in this notice, the name of The Open Group shall not be | |
22 used in advertising or otherwise to promote the sale, use or other dealings | |
23 in this Software without prior written authorization from The Open Group. | |
24 | |
25 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. | |
26 | |
27 All Rights Reserved | |
28 | |
29 Permission to use, copy, modify, and distribute this software and its | |
30 documentation for any purpose and without fee is hereby granted, | |
31 provided that the above copyright notice appear in all copies and that | |
32 both that copyright notice and this permission notice appear in | |
33 supporting documentation, and that the name of Digital not be | |
34 used in advertising or publicity pertaining to distribution of the | |
35 software without specific, written prior permission. | |
36 | |
37 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
38 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
39 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |
40 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
41 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
42 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
43 SOFTWARE. | |
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 | |
82 PIXMAN_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 | |
94 typedef __int8 int8_t; | |
95 typedef unsigned __int8 uint8_t; | |
96 typedef __int16 int16_t; | |
97 typedef unsigned __int16 uint16_t; | |
98 typedef __int32 int32_t; | |
99 typedef unsigned __int32 uint32_t; | |
100 typedef __int64 int64_t; | |
101 typedef 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 */ | |
113 typedef int pixman_bool_t; | |
114 | |
115 /* | |
116 * Fixpoint numbers | |
117 */ | |
118 typedef int64_t pixman_fixed_32_32_t; | |
119 typedef pixman_fixed_32_32_t pixman_fixed_48_16_t; | |
120 typedef uint32_t pixman_fixed_1_31_t; | |
121 typedef uint32_t pixman_fixed_1_16_t; | |
122 typedef int32_t pixman_fixed_16_16_t; | |
123 typedef 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 */ | |
144 typedef struct pixman_color pixman_color_t; | |
145 typedef struct pixman_point_fixed pixman_point_fixed_t; | |
146 typedef struct pixman_line_fixed pixman_line_fixed_t; | |
147 typedef struct pixman_vector pixman_vector_t; | |
148 typedef struct pixman_transform pixman_transform_t; | |
149 | |
150 struct pixman_color | |
151 { | |
152 uint16_t red; | |
153 uint16_t green; | |
154 uint16_t blue; | |
155 uint16_t alpha; | |
156 }; | |
157 | |
158 struct pixman_point_fixed | |
159 { | |
160 pixman_fixed_t x; | |
161 pixman_fixed_t y; | |
162 }; | |
163 | |
164 struct pixman_line_fixed | |
165 { | |
166 pixman_point_fixed_t p1, p2; | |
167 }; | |
168 | |
169 /* | |
170 * Fixed point matrices | |
171 */ | |
172 | |
173 struct pixman_vector | |
174 { | |
175 pixman_fixed_t vector[3]; | |
176 }; | |
177 | |
178 struct pixman_transform | |
179 { | |
180 pixman_fixed_t matrix[3][3]; | |
181 }; | |
182 | |
183 /* forward declaration (sorry) */ | |
184 struct pixman_box16; | |
185 typedef union pixman_image pixman_image_t; | |
186 | |
187 PIXMAN_API | |
188 void pixman_transform_init_identity (struct pixman_transform *matrix); | |
189 | |
190 PIXMAN_API | |
191 pixman_bool_t pixman_transform_point_3d (const struct pixman_transform *transform, | |
192 struct pixman_vector *vector); | |
193 | |
194 PIXMAN_API | |
195 pixman_bool_t pixman_transform_point (const struct pixman_transform *transform, | |
196 struct pixman_vector *vector); | |
197 | |
198 PIXMAN_API | |
199 pixman_bool_t pixman_transform_multiply (struct pixman_transform *dst, | |
200 const struct pixman_transform *l, | |
201 const struct pixman_transform *r); | |
202 | |
203 PIXMAN_API | |
204 void pixman_transform_init_scale (struct pixman_transform *t, | |
205 pixman_fixed_t sx, | |
206 pixman_fixed_t sy); | |
207 | |
208 PIXMAN_API | |
209 pixman_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 | |
214 PIXMAN_API | |
215 void pixman_transform_init_rotate (struct pixman_transform *t, | |
216 pixman_fixed_t cos, | |
217 pixman_fixed_t sin); | |
218 | |
219 PIXMAN_API | |
220 pixman_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 | |
225 PIXMAN_API | |
226 void pixman_transform_init_translate (struct pixman_transform *t, | |
227 pixman_fixed_t tx, | |
228 pixman_fixed_t ty); | |
229 | |
230 PIXMAN_API | |
231 pixman_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 | |
236 PIXMAN_API | |
237 pixman_bool_t pixman_transform_bounds (const struct pixman_transform *matrix, | |
238 struct pixman_box16 *b); | |
239 | |
240 PIXMAN_API | |
241 pixman_bool_t pixman_transform_invert (struct pixman_transform *dst, | |
242 const struct pixman_transform *src); | |
243 | |
244 PIXMAN_API | |
245 pixman_bool_t pixman_transform_is_identity (const struct pixman_transform *t); | |
246 | |
247 PIXMAN_API | |
248 pixman_bool_t pixman_transform_is_scale (const struct pixman_transform *t); | |
249 | |
250 PIXMAN_API | |
251 pixman_bool_t pixman_transform_is_int_translate (const struct pixman_transform *t); | |
252 | |
253 PIXMAN_API | |
254 pixman_bool_t pixman_transform_is_inverse (const struct pixman_transform *a, | |
255 const struct pixman_transform *b); | |
256 | |
257 /* | |
258 * Floating point matrices | |
259 */ | |
260 typedef struct pixman_f_transform pixman_f_transform_t; | |
261 typedef struct pixman_f_vector pixman_f_vector_t; | |
262 | |
263 struct pixman_f_vector | |
264 { | |
265 double v[3]; | |
266 }; | |
267 | |
268 struct pixman_f_transform | |
269 { | |
270 double m[3][3]; | |
271 }; | |
272 | |
273 | |
274 PIXMAN_API | |
275 pixman_bool_t pixman_transform_from_pixman_f_transform (struct pixman_transform *t, | |
276 const struct pixman_f_transform *ft); | |
277 | |
278 PIXMAN_API | |
279 void pixman_f_transform_from_pixman_transform (struct pixman_f_transform *ft, | |
280 const struct pixman_transform *t); | |
281 | |
282 PIXMAN_API | |
283 pixman_bool_t pixman_f_transform_invert (struct pixman_f_transform *dst, | |
284 const struct pixman_f_transform *src); | |
285 | |
286 PIXMAN_API | |
287 pixman_bool_t pixman_f_transform_point (const struct pixman_f_transform *t, | |
288 struct pixman_f_vector *v); | |
289 | |
290 PIXMAN_API | |
291 void pixman_f_transform_point_3d (const struct pixman_f_transform *t, | |
292 struct pixman_f_vector *v); | |
293 | |
294 PIXMAN_API | |
295 void pixman_f_transform_multiply (struct pixman_f_transform *dst, | |
296 const struct pixman_f_transform *l, | |
297 const struct pixman_f_transform *r); | |
298 | |
299 PIXMAN_API | |
300 void pixman_f_transform_init_scale (struct pixman_f_transform *t, | |
301 double sx, | |
302 double sy); | |
303 | |
304 PIXMAN_API | |
305 pixman_bool_t pixman_f_transform_scale (struct pixman_f_transform *forward, | |
306 struct pixman_f_transform *reverse, | |
307 double sx, | |
308 double sy); | |
309 | |
310 PIXMAN_API | |
311 void pixman_f_transform_init_rotate (struct pixman_f_transform *t, | |
312 double cos, | |
313 double sin); | |
314 | |
315 PIXMAN_API | |
316 pixman_bool_t pixman_f_transform_rotate (struct pixman_f_transform *forward, | |
317 struct pixman_f_transform *reverse, | |
318 double c, | |
319 double s); | |
320 | |
321 PIXMAN_API | |
322 void pixman_f_transform_init_translate (struct pixman_f_transform *t, | |
323 double tx, | |
324 double ty); | |
325 | |
326 PIXMAN_API | |
327 pixman_bool_t pixman_f_transform_translate (struct pixman_f_transform *forward, | |
328 struct pixman_f_transform *reverse, | |
329 double tx, | |
330 double ty); | |
331 | |
332 PIXMAN_API | |
333 pixman_bool_t pixman_f_transform_bounds (const struct pixman_f_transform *t, | |
334 struct pixman_box16 *b); | |
335 | |
336 PIXMAN_API | |
337 void pixman_f_transform_init_identity (struct pixman_f_transform *t); | |
338 | |
339 typedef enum | |
340 { | |
341 PIXMAN_REPEAT_NONE, | |
342 PIXMAN_REPEAT_NORMAL, | |
343 PIXMAN_REPEAT_PAD, | |
344 PIXMAN_REPEAT_REFLECT | |
345 } pixman_repeat_t; | |
346 | |
347 typedef 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 | |
357 typedef 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 | |
388 typedef 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 */ | |
457 typedef struct pixman_region16_data pixman_region16_data_t; | |
458 typedef struct pixman_box16 pixman_box16_t; | |
459 typedef struct pixman_rectangle16 pixman_rectangle16_t; | |
460 typedef struct pixman_region16 pixman_region16_t; | |
461 | |
462 struct pixman_region16_data { | |
463 long size; | |
464 long numRects; | |
465 /* pixman_box16_t rects[size]; in memory but not explicitly declared */ | |
466 }; | |
467 | |
468 struct pixman_rectangle16 | |
469 { | |
470 int16_t x, y; | |
471 uint16_t width, height; | |
472 }; | |
473 | |
474 struct pixman_box16 | |
475 { | |
476 int16_t x1, y1, x2, y2; | |
477 }; | |
478 | |
479 struct pixman_region16 | |
480 { | |
481 pixman_box16_t extents; | |
482 pixman_region16_data_t *data; | |
483 }; | |
484 | |
485 typedef 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 */ | |
495 PIXMAN_API | |
496 void 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 */ | |
501 PIXMAN_API | |
502 void pixman_region_init (pixman_region16_t *region); | |
503 | |
504 PIXMAN_API | |
505 void pixman_region_init_rect (pixman_region16_t *region, | |
506 int x, | |
507 int y, | |
508 unsigned int width, | |
509 unsigned int height); | |
510 | |
511 PIXMAN_API | |
512 pixman_bool_t pixman_region_init_rects (pixman_region16_t *region, | |
513 const pixman_box16_t *boxes, | |
514 int count); | |
515 | |
516 PIXMAN_API | |
517 void pixman_region_init_with_extents (pixman_region16_t *region, | |
518 const pixman_box16_t *extents); | |
519 | |
520 PIXMAN_API | |
521 void pixman_region_init_from_image (pixman_region16_t *region, | |
522 pixman_image_t *image); | |
523 | |
524 PIXMAN_API | |
525 void pixman_region_fini (pixman_region16_t *region); | |
526 | |
527 | |
528 /* manipulation */ | |
529 PIXMAN_API | |
530 void pixman_region_translate (pixman_region16_t *region, | |
531 int x, | |
532 int y); | |
533 | |
534 PIXMAN_API | |
535 pixman_bool_t pixman_region_copy (pixman_region16_t *dest, | |
536 const pixman_region16_t *source); | |
537 | |
538 PIXMAN_API | |
539 pixman_bool_t pixman_region_intersect (pixman_region16_t *new_reg, | |
540 const pixman_region16_t *reg1, | |
541 const pixman_region16_t *reg2); | |
542 | |
543 PIXMAN_API | |
544 pixman_bool_t pixman_region_union (pixman_region16_t *new_reg, | |
545 const pixman_region16_t *reg1, | |
546 const pixman_region16_t *reg2); | |
547 | |
548 PIXMAN_API | |
549 pixman_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 | |
556 PIXMAN_API | |
557 pixman_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 | |
564 PIXMAN_API | |
565 pixman_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 | |
569 PIXMAN_API | |
570 pixman_bool_t pixman_region_inverse (pixman_region16_t *new_reg, | |
571 const pixman_region16_t *reg1, | |
572 const pixman_box16_t *inv_rect); | |
573 | |
574 PIXMAN_API | |
575 pixman_bool_t pixman_region_contains_point (const pixman_region16_t *region, | |
576 int x, | |
577 int y, | |
578 pixman_box16_t *box); | |
579 | |
580 PIXMAN_API | |
581 pixman_region_overlap_t pixman_region_contains_rectangle (const pixman_region16_t *region, | |
582 const pixman_box16_t *prect); | |
583 | |
584 PIXMAN_API | |
585 pixman_bool_t pixman_region_empty (const pixman_region16_t *region); | |
586 | |
587 PIXMAN_API | |
588 pixman_bool_t pixman_region_not_empty (const pixman_region16_t *region); | |
589 | |
590 PIXMAN_API | |
591 pixman_box16_t * pixman_region_extents (const pixman_region16_t *region); | |
592 | |
593 PIXMAN_API | |
594 int pixman_region_n_rects (const pixman_region16_t *region); | |
595 | |
596 PIXMAN_API | |
597 pixman_box16_t * pixman_region_rectangles (const pixman_region16_t *region, | |
598 int *n_rects); | |
599 | |
600 PIXMAN_API | |
601 pixman_bool_t pixman_region_equal (const pixman_region16_t *region1, | |
602 const pixman_region16_t *region2); | |
603 | |
604 PIXMAN_API | |
605 pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region); | |
606 | |
607 PIXMAN_API | |
608 void pixman_region_reset (pixman_region16_t *region, | |
609 const pixman_box16_t *box); | |
610 | |
611 PIXMAN_API | |
612 void pixman_region_clear (pixman_region16_t *region); | |
613 /* | |
614 * 32 bit regions | |
615 */ | |
616 typedef struct pixman_region32_data pixman_region32_data_t; | |
617 typedef struct pixman_box32 pixman_box32_t; | |
618 typedef struct pixman_rectangle32 pixman_rectangle32_t; | |
619 typedef struct pixman_region32 pixman_region32_t; | |
620 | |
621 struct pixman_region32_data { | |
622 long size; | |
623 long numRects; | |
624 /* pixman_box32_t rects[size]; in memory but not explicitly declared */ | |
625 }; | |
626 | |
627 struct pixman_rectangle32 | |
628 { | |
629 int32_t x, y; | |
630 uint32_t width, height; | |
631 }; | |
632 | |
633 struct pixman_box32 | |
634 { | |
635 int32_t x1, y1, x2, y2; | |
636 }; | |
637 | |
638 struct pixman_region32 | |
639 { | |
640 pixman_box32_t extents; | |
641 pixman_region32_data_t *data; | |
642 }; | |
643 | |
644 /* creation/destruction */ | |
645 PIXMAN_API | |
646 void pixman_region32_init (pixman_region32_t *region); | |
647 | |
648 PIXMAN_API | |
649 void pixman_region32_init_rect (pixman_region32_t *region, | |
650 int x, | |
651 int y, | |
652 unsigned int width, | |
653 unsigned int height); | |
654 | |
655 PIXMAN_API | |
656 pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region, | |
657 const pixman_box32_t *boxes, | |
658 int count); | |
659 | |
660 PIXMAN_API | |
661 void pixman_region32_init_with_extents (pixman_region32_t *region, | |
662 const pixman_box32_t *extents); | |
663 | |
664 PIXMAN_API | |
665 void pixman_region32_init_from_image (pixman_region32_t *region, | |
666 pixman_image_t *image); | |
667 | |
668 PIXMAN_API | |
669 void pixman_region32_fini (pixman_region32_t *region); | |
670 | |
671 | |
672 /* manipulation */ | |
673 PIXMAN_API | |
674 void pixman_region32_translate (pixman_region32_t *region, | |
675 int x, | |
676 int y); | |
677 | |
678 PIXMAN_API | |
679 pixman_bool_t pixman_region32_copy (pixman_region32_t *dest, | |
680 const pixman_region32_t *source); | |
681 | |
682 PIXMAN_API | |
683 pixman_bool_t pixman_region32_intersect (pixman_region32_t *new_reg, | |
684 const pixman_region32_t *reg1, | |
685 const pixman_region32_t *reg2); | |
686 | |
687 PIXMAN_API | |
688 pixman_bool_t pixman_region32_union (pixman_region32_t *new_reg, | |
689 const pixman_region32_t *reg1, | |
690 const pixman_region32_t *reg2); | |
691 | |
692 PIXMAN_API | |
693 pixman_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 | |
700 PIXMAN_API | |
701 pixman_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 | |
708 PIXMAN_API | |
709 pixman_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 | |
713 PIXMAN_API | |
714 pixman_bool_t pixman_region32_inverse (pixman_region32_t *new_reg, | |
715 const pixman_region32_t *reg1, | |
716 const pixman_box32_t *inv_rect); | |
717 | |
718 PIXMAN_API | |
719 pixman_bool_t pixman_region32_contains_point (const pixman_region32_t *region, | |
720 int x, | |
721 int y, | |
722 pixman_box32_t *box); | |
723 | |
724 PIXMAN_API | |
725 pixman_region_overlap_t pixman_region32_contains_rectangle (const pixman_region32_t *region, | |
726 const pixman_box32_t *prect); | |
727 | |
728 PIXMAN_API | |
729 pixman_bool_t pixman_region32_empty (const pixman_region32_t *region); | |
730 | |
731 PIXMAN_API | |
732 pixman_bool_t pixman_region32_not_empty (const pixman_region32_t *region); | |
733 | |
734 PIXMAN_API | |
735 pixman_box32_t * pixman_region32_extents (const pixman_region32_t *region); | |
736 | |
737 PIXMAN_API | |
738 int pixman_region32_n_rects (const pixman_region32_t *region); | |
739 | |
740 PIXMAN_API | |
741 pixman_box32_t * pixman_region32_rectangles (const pixman_region32_t *region, | |
742 int *n_rects); | |
743 | |
744 PIXMAN_API | |
745 pixman_bool_t pixman_region32_equal (const pixman_region32_t *region1, | |
746 const pixman_region32_t *region2); | |
747 | |
748 PIXMAN_API | |
749 pixman_bool_t pixman_region32_selfcheck (pixman_region32_t *region); | |
750 | |
751 PIXMAN_API | |
752 void pixman_region32_reset (pixman_region32_t *region, | |
753 const pixman_box32_t *box); | |
754 | |
755 PIXMAN_API | |
756 void pixman_region32_clear (pixman_region32_t *region); | |
757 | |
758 | |
759 /* Copy / Fill / Misc */ | |
760 PIXMAN_API | |
761 pixman_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 | |
774 PIXMAN_API | |
775 pixman_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 | |
785 PIXMAN_API | |
786 int pixman_version (void); | |
787 | |
788 PIXMAN_API | |
789 const char* pixman_version_string (void); | |
790 | |
791 /* | |
792 * Images | |
793 */ | |
794 typedef struct pixman_indexed pixman_indexed_t; | |
795 typedef struct pixman_gradient_stop pixman_gradient_stop_t; | |
796 | |
797 typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size); | |
798 typedef void (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size); | |
799 | |
800 typedef void (* pixman_image_destroy_func_t) (pixman_image_t *image, void *data); | |
801 | |
802 struct 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 | |
810 typedef uint8_t pixman_index_type; | |
811 #endif | |
812 | |
813 struct 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 | |
877 typedef 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. */ | |
955 PIXMAN_API | |
956 pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format); | |
957 | |
958 PIXMAN_API | |
959 pixman_bool_t pixman_format_supported_source (pixman_format_code_t format); | |
960 | |
961 /* Constructors */ | |
962 PIXMAN_API | |
963 pixman_image_t *pixman_image_create_solid_fill (const pixman_color_t *color); | |
964 | |
965 PIXMAN_API | |
966 pixman_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 | |
971 PIXMAN_API | |
972 pixman_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 | |
979 PIXMAN_API | |
980 pixman_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 | |
985 PIXMAN_API | |
986 pixman_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 | |
992 PIXMAN_API | |
993 pixman_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 */ | |
1000 PIXMAN_API | |
1001 pixman_image_t *pixman_image_ref (pixman_image_t *image); | |
1002 | |
1003 PIXMAN_API | |
1004 pixman_bool_t pixman_image_unref (pixman_image_t *image); | |
1005 | |
1006 | |
1007 PIXMAN_API | |
1008 void pixman_image_set_destroy_function (pixman_image_t *image, | |
1009 pixman_image_destroy_func_t function, | |
1010 void *data); | |
1011 | |
1012 PIXMAN_API | |
1013 void * pixman_image_get_destroy_data (pixman_image_t *image); | |
1014 | |
1015 /* Set properties */ | |
1016 PIXMAN_API | |
1017 pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image, | |
1018 const pixman_region16_t *region); | |
1019 | |
1020 PIXMAN_API | |
1021 pixman_bool_t pixman_image_set_clip_region32 (pixman_image_t *image, | |
1022 const pixman_region32_t *region); | |
1023 | |
1024 PIXMAN_API | |
1025 void pixman_image_set_has_client_clip (pixman_image_t *image, | |
1026 pixman_bool_t clien_clip); | |
1027 | |
1028 PIXMAN_API | |
1029 pixman_bool_t pixman_image_set_transform (pixman_image_t *image, | |
1030 const pixman_transform_t *transform); | |
1031 | |
1032 PIXMAN_API | |
1033 void pixman_image_set_repeat (pixman_image_t *image, | |
1034 pixman_repeat_t repeat); | |
1035 | |
1036 PIXMAN_API | |
1037 void pixman_image_set_dither (pixman_image_t *image, | |
1038 pixman_dither_t dither); | |
1039 | |
1040 PIXMAN_API | |
1041 void pixman_image_set_dither_offset (pixman_image_t *image, | |
1042 int offset_x, | |
1043 int offset_y); | |
1044 | |
1045 PIXMAN_API | |
1046 pixman_bool_t pixman_image_set_filter (pixman_image_t *image, | |
1047 pixman_filter_t filter, | |
1048 const pixman_fixed_t *filter_params, | |
1049 int n_filter_params); | |
1050 | |
1051 PIXMAN_API | |
1052 void pixman_image_set_source_clipping (pixman_image_t *image, | |
1053 pixman_bool_t source_clipping); | |
1054 | |
1055 PIXMAN_API | |
1056 void pixman_image_set_alpha_map (pixman_image_t *image, | |
1057 pixman_image_t *alpha_map, | |
1058 int16_t x, | |
1059 int16_t y); | |
1060 | |
1061 PIXMAN_API | |
1062 void pixman_image_set_component_alpha (pixman_image_t *image, | |
1063 pixman_bool_t component_alpha); | |
1064 | |
1065 PIXMAN_API | |
1066 pixman_bool_t pixman_image_get_component_alpha (pixman_image_t *image); | |
1067 | |
1068 PIXMAN_API | |
1069 void pixman_image_set_accessors (pixman_image_t *image, | |
1070 pixman_read_memory_func_t read_func, | |
1071 pixman_write_memory_func_t write_func); | |
1072 | |
1073 PIXMAN_API | |
1074 void pixman_image_set_indexed (pixman_image_t *image, | |
1075 const pixman_indexed_t *indexed); | |
1076 | |
1077 PIXMAN_API | |
1078 uint32_t *pixman_image_get_data (pixman_image_t *image); | |
1079 | |
1080 PIXMAN_API | |
1081 int pixman_image_get_width (pixman_image_t *image); | |
1082 | |
1083 PIXMAN_API | |
1084 int pixman_image_get_height (pixman_image_t *image); | |
1085 | |
1086 PIXMAN_API | |
1087 int pixman_image_get_stride (pixman_image_t *image); /* in bytes */ | |
1088 | |
1089 PIXMAN_API | |
1090 int pixman_image_get_depth (pixman_image_t *image); | |
1091 | |
1092 PIXMAN_API | |
1093 pixman_format_code_t pixman_image_get_format (pixman_image_t *image); | |
1094 | |
1095 typedef enum | |
1096 { | |
1097 PIXMAN_KERNEL_IMPULSE, | |
1098 PIXMAN_KERNEL_BOX, | |
1099 PIXMAN_KERNEL_LINEAR, | |
1100 PIXMAN_KERNEL_CUBIC, | |
1101 PIXMAN_KERNEL_GAUSSIAN, | |
1102 PIXMAN_KERNEL_LANCZOS2, | |
1103 PIXMAN_KERNEL_LANCZOS3, | |
1104 PIXMAN_KERNEL_LANCZOS3_STRETCHED /* Jim Blinn's 'nice' filter */ | |
1105 } pixman_kernel_t; | |
1106 | |
1107 /* Create the parameter list for a SEPARABLE_CONVOLUTION filter | |
1108 * with the given kernels and scale parameters. | |
1109 */ | |
1110 PIXMAN_API | |
1111 pixman_fixed_t * | |
1112 pixman_filter_create_separable_convolution (int *n_values, | |
1113 pixman_fixed_t scale_x, | |
1114 pixman_fixed_t scale_y, | |
1115 pixman_kernel_t reconstruct_x, | |
1116 pixman_kernel_t reconstruct_y, | |
1117 pixman_kernel_t sample_x, | |
1118 pixman_kernel_t sample_y, | |
1119 int subsample_bits_x, | |
1120 int subsample_bits_y); | |
1121 | |
1122 | |
1123 PIXMAN_API | |
1124 pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op, | |
1125 pixman_image_t *image, | |
1126 const pixman_color_t *color, | |
1127 int n_rects, | |
1128 const pixman_rectangle16_t *rects); | |
1129 | |
1130 PIXMAN_API | |
1131 pixman_bool_t pixman_image_fill_boxes (pixman_op_t op, | |
1132 pixman_image_t *dest, | |
1133 const pixman_color_t *color, | |
1134 int n_boxes, | |
1135 const pixman_box32_t *boxes); | |
1136 | |
1137 /* Composite */ | |
1138 PIXMAN_API | |
1139 pixman_bool_t pixman_compute_composite_region (pixman_region16_t *region, | |
1140 pixman_image_t *src_image, | |
1141 pixman_image_t *mask_image, | |
1142 pixman_image_t *dest_image, | |
1143 int16_t src_x, | |
1144 int16_t src_y, | |
1145 int16_t mask_x, | |
1146 int16_t mask_y, | |
1147 int16_t dest_x, | |
1148 int16_t dest_y, | |
1149 uint16_t width, | |
1150 uint16_t height); | |
1151 | |
1152 PIXMAN_API | |
1153 void pixman_image_composite (pixman_op_t op, | |
1154 pixman_image_t *src, | |
1155 pixman_image_t *mask, | |
1156 pixman_image_t *dest, | |
1157 int16_t src_x, | |
1158 int16_t src_y, | |
1159 int16_t mask_x, | |
1160 int16_t mask_y, | |
1161 int16_t dest_x, | |
1162 int16_t dest_y, | |
1163 uint16_t width, | |
1164 uint16_t height); | |
1165 | |
1166 PIXMAN_API | |
1167 void pixman_image_composite32 (pixman_op_t op, | |
1168 pixman_image_t *src, | |
1169 pixman_image_t *mask, | |
1170 pixman_image_t *dest, | |
1171 int32_t src_x, | |
1172 int32_t src_y, | |
1173 int32_t mask_x, | |
1174 int32_t mask_y, | |
1175 int32_t dest_x, | |
1176 int32_t dest_y, | |
1177 int32_t width, | |
1178 int32_t height); | |
1179 | |
1180 /* Executive Summary: This function is a no-op that only exists | |
1181 * for historical reasons. | |
1182 * | |
1183 * There used to be a bug in the X server where it would rely on | |
1184 * out-of-bounds accesses when it was asked to composite with a | |
1185 * window as the source. It would create a pixman image pointing | |
1186 * to some bogus position in memory, but then set a clip region | |
1187 * to the position where the actual bits were. | |
1188 * | |
1189 * Due to a bug in old versions of pixman, where it would not clip | |
1190 * against the image bounds when a clip region was set, this would | |
1191 * actually work. So when the pixman bug was fixed, a workaround was | |
1192 * added to allow certain out-of-bound accesses. This function disabled | |
1193 * those workarounds. | |
1194 * | |
1195 * Since 0.21.2, pixman doesn't do these workarounds anymore, so now this | |
1196 * function is a no-op. | |
1197 */ | |
1198 PIXMAN_API | |
1199 void pixman_disable_out_of_bounds_workaround (void); | |
1200 | |
1201 /* | |
1202 * Glyphs | |
1203 */ | |
1204 typedef struct pixman_glyph_cache_t pixman_glyph_cache_t; | |
1205 typedef struct | |
1206 { | |
1207 int x, y; | |
1208 const void *glyph; | |
1209 } pixman_glyph_t; | |
1210 | |
1211 PIXMAN_API | |
1212 pixman_glyph_cache_t *pixman_glyph_cache_create (void); | |
1213 | |
1214 PIXMAN_API | |
1215 void pixman_glyph_cache_destroy (pixman_glyph_cache_t *cache); | |
1216 | |
1217 PIXMAN_API | |
1218 void pixman_glyph_cache_freeze (pixman_glyph_cache_t *cache); | |
1219 | |
1220 PIXMAN_API | |
1221 void pixman_glyph_cache_thaw (pixman_glyph_cache_t *cache); | |
1222 | |
1223 PIXMAN_API | |
1224 const void * pixman_glyph_cache_lookup (pixman_glyph_cache_t *cache, | |
1225 void *font_key, | |
1226 void *glyph_key); | |
1227 | |
1228 PIXMAN_API | |
1229 const void * pixman_glyph_cache_insert (pixman_glyph_cache_t *cache, | |
1230 void *font_key, | |
1231 void *glyph_key, | |
1232 int origin_x, | |
1233 int origin_y, | |
1234 pixman_image_t *glyph_image); | |
1235 | |
1236 PIXMAN_API | |
1237 void pixman_glyph_cache_remove (pixman_glyph_cache_t *cache, | |
1238 void *font_key, | |
1239 void *glyph_key); | |
1240 | |
1241 PIXMAN_API | |
1242 void pixman_glyph_get_extents (pixman_glyph_cache_t *cache, | |
1243 int n_glyphs, | |
1244 pixman_glyph_t *glyphs, | |
1245 pixman_box32_t *extents); | |
1246 | |
1247 PIXMAN_API | |
1248 pixman_format_code_t pixman_glyph_get_mask_format (pixman_glyph_cache_t *cache, | |
1249 int n_glyphs, | |
1250 const pixman_glyph_t *glyphs); | |
1251 | |
1252 PIXMAN_API | |
1253 void pixman_composite_glyphs (pixman_op_t op, | |
1254 pixman_image_t *src, | |
1255 pixman_image_t *dest, | |
1256 pixman_format_code_t mask_format, | |
1257 int32_t src_x, | |
1258 int32_t src_y, | |
1259 int32_t mask_x, | |
1260 int32_t mask_y, | |
1261 int32_t dest_x, | |
1262 int32_t dest_y, | |
1263 int32_t width, | |
1264 int32_t height, | |
1265 pixman_glyph_cache_t *cache, | |
1266 int n_glyphs, | |
1267 const pixman_glyph_t *glyphs); | |
1268 | |
1269 PIXMAN_API | |
1270 void pixman_composite_glyphs_no_mask (pixman_op_t op, | |
1271 pixman_image_t *src, | |
1272 pixman_image_t *dest, | |
1273 int32_t src_x, | |
1274 int32_t src_y, | |
1275 int32_t dest_x, | |
1276 int32_t dest_y, | |
1277 pixman_glyph_cache_t *cache, | |
1278 int n_glyphs, | |
1279 const pixman_glyph_t *glyphs); | |
1280 | |
1281 /* | |
1282 * Trapezoids | |
1283 */ | |
1284 typedef struct pixman_edge pixman_edge_t; | |
1285 typedef struct pixman_trapezoid pixman_trapezoid_t; | |
1286 typedef struct pixman_trap pixman_trap_t; | |
1287 typedef struct pixman_span_fix pixman_span_fix_t; | |
1288 typedef struct pixman_triangle pixman_triangle_t; | |
1289 | |
1290 /* | |
1291 * An edge structure. This represents a single polygon edge | |
1292 * and can be quickly stepped across small or large gaps in the | |
1293 * sample grid | |
1294 */ | |
1295 struct pixman_edge | |
1296 { | |
1297 pixman_fixed_t x; | |
1298 pixman_fixed_t e; | |
1299 pixman_fixed_t stepx; | |
1300 pixman_fixed_t signdx; | |
1301 pixman_fixed_t dy; | |
1302 pixman_fixed_t dx; | |
1303 | |
1304 pixman_fixed_t stepx_small; | |
1305 pixman_fixed_t stepx_big; | |
1306 pixman_fixed_t dx_small; | |
1307 pixman_fixed_t dx_big; | |
1308 }; | |
1309 | |
1310 struct pixman_trapezoid | |
1311 { | |
1312 pixman_fixed_t top, bottom; | |
1313 pixman_line_fixed_t left, right; | |
1314 }; | |
1315 | |
1316 struct pixman_triangle | |
1317 { | |
1318 pixman_point_fixed_t p1, p2, p3; | |
1319 }; | |
1320 | |
1321 /* whether 't' is a well defined not obviously empty trapezoid */ | |
1322 #define pixman_trapezoid_valid(t) \ | |
1323 ((t)->left.p1.y != (t)->left.p2.y && \ | |
1324 (t)->right.p1.y != (t)->right.p2.y && \ | |
1325 ((t)->bottom > (t)->top)) | |
1326 | |
1327 struct pixman_span_fix | |
1328 { | |
1329 pixman_fixed_t l, r, y; | |
1330 }; | |
1331 | |
1332 struct pixman_trap | |
1333 { | |
1334 pixman_span_fix_t top, bot; | |
1335 }; | |
1336 | |
1337 PIXMAN_API | |
1338 pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y, | |
1339 int bpp); | |
1340 | |
1341 PIXMAN_API | |
1342 pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y, | |
1343 int bpp); | |
1344 | |
1345 PIXMAN_API | |
1346 void pixman_edge_step (pixman_edge_t *e, | |
1347 int n); | |
1348 | |
1349 PIXMAN_API | |
1350 void pixman_edge_init (pixman_edge_t *e, | |
1351 int bpp, | |
1352 pixman_fixed_t y_start, | |
1353 pixman_fixed_t x_top, | |
1354 pixman_fixed_t y_top, | |
1355 pixman_fixed_t x_bot, | |
1356 pixman_fixed_t y_bot); | |
1357 | |
1358 PIXMAN_API | |
1359 void pixman_line_fixed_edge_init (pixman_edge_t *e, | |
1360 int bpp, | |
1361 pixman_fixed_t y, | |
1362 const pixman_line_fixed_t *line, | |
1363 int x_off, | |
1364 int y_off); | |
1365 | |
1366 PIXMAN_API | |
1367 void pixman_rasterize_edges (pixman_image_t *image, | |
1368 pixman_edge_t *l, | |
1369 pixman_edge_t *r, | |
1370 pixman_fixed_t t, | |
1371 pixman_fixed_t b); | |
1372 | |
1373 PIXMAN_API | |
1374 void pixman_add_traps (pixman_image_t *image, | |
1375 int16_t x_off, | |
1376 int16_t y_off, | |
1377 int ntrap, | |
1378 const pixman_trap_t *traps); | |
1379 | |
1380 PIXMAN_API | |
1381 void pixman_add_trapezoids (pixman_image_t *image, | |
1382 int16_t x_off, | |
1383 int y_off, | |
1384 int ntraps, | |
1385 const pixman_trapezoid_t *traps); | |
1386 | |
1387 PIXMAN_API | |
1388 void pixman_rasterize_trapezoid (pixman_image_t *image, | |
1389 const pixman_trapezoid_t *trap, | |
1390 int x_off, | |
1391 int y_off); | |
1392 | |
1393 PIXMAN_API | |
1394 void pixman_composite_trapezoids (pixman_op_t op, | |
1395 pixman_image_t * src, | |
1396 pixman_image_t * dst, | |
1397 pixman_format_code_t mask_format, | |
1398 int x_src, | |
1399 int y_src, | |
1400 int x_dst, | |
1401 int y_dst, | |
1402 int n_traps, | |
1403 const pixman_trapezoid_t * traps); | |
1404 | |
1405 PIXMAN_API | |
1406 void pixman_composite_triangles (pixman_op_t op, | |
1407 pixman_image_t * src, | |
1408 pixman_image_t * dst, | |
1409 pixman_format_code_t mask_format, | |
1410 int x_src, | |
1411 int y_src, | |
1412 int x_dst, | |
1413 int y_dst, | |
1414 int n_tris, | |
1415 const pixman_triangle_t * tris); | |
1416 | |
1417 PIXMAN_API | |
1418 void pixman_add_triangles (pixman_image_t *image, | |
1419 int32_t x_off, | |
1420 int32_t y_off, | |
1421 int n_tris, | |
1422 const pixman_triangle_t *tris); | |
1423 | |
1424 PIXMAN_END_DECLS | |
1425 | |
1426 #endif /* PIXMAN_H__ */ |