1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
|
#ifndef _PIXMAN_H_
#define _PIXMAN_H_
/* pixman.h - a merge of pixregion.h and ic.h */
/* from pixregion.h */
/***********************************************************
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* libic.h */
/*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#if HAVE_STDINT_H
# include <stdint.h>
#elif HAVE_INTTYPES_H
# include <inttypes.h>
#elif HAVE_SYS_INT_TYPES_H
# include <sys/int_types.h>
#elif defined(_MSC_VER)
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
# ifndef INT16_MIN
# define INT16_MIN (-32767-1)
# endif
# ifndef INT16_MAX
# define INT16_MAX (32767)
# endif
# ifndef UINT16_MAX
# define UINT16_MAX (65535)
# endif
# ifndef INT32_MIN
# define INT32_MIN (-2147483647-1)
# endif
# ifndef INT32_MAX
# define INT32_MAX (2147483647)
# endif
# ifndef UINT32_MAX
# define UINT32_MAX (0xffffffffU)
# endif
#else
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
#endif
#include "pixman-remap.h"
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun__)
#define pixman_private_no_warn __attribute__((__visibility__("hidden")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define pixman_private_no_warn __hidden
#else /* not gcc >= 3.3 and not Sun Studio >= 8 */
#define pixman_private_no_warn
#endif
#ifndef WARN_UNUSED_RESULT
#define WARN_UNUSED_RESULT
#endif
/* Add attribute(warn_unused_result) if supported */
#define pixman_warn WARN_UNUSED_RESULT
#define pixman_private pixman_private_no_warn pixman_warn
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/* pixregion.h */
typedef struct pixman_region16_data pixman_region16_data_t;
typedef struct pixman_box16 {
short x1, y1, x2, y2;
} pixman_box16_t;
typedef struct pixman_region16 {
pixman_box16_t extents;
pixman_region16_data_t *data;
} pixman_region16_t;
typedef enum {
PIXMAN_REGION_STATUS_FAILURE,
PIXMAN_REGION_STATUS_SUCCESS
} pixman_region_status_t;
/* creation/destruction */
pixman_private void
pixman_region_init(pixman_region16_t *region);
pixman_private void
pixman_region_init_rect(pixman_region16_t *region,
int x, int y, unsigned int width, unsigned int height);
pixman_private void
pixman_region_init_with_extents(pixman_region16_t *region, pixman_box16_t *extents);
pixman_private pixman_region_status_t
pixman_region_init_rects(pixman_region16_t *region, pixman_box16_t *boxes, int count);
pixman_private void
pixman_region_fini (pixman_region16_t *region);
/* manipulation */
pixman_private void
pixman_region_translate (pixman_region16_t *region, int x, int y);
pixman_private pixman_region_status_t
pixman_region_copy (pixman_region16_t *dest, pixman_region16_t *source);
pixman_private pixman_region_status_t
pixman_region_intersect (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2);
pixman_private pixman_region_status_t
pixman_region_union (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2);
pixman_private pixman_region_status_t
pixman_region_union_rect(pixman_region16_t *dest, pixman_region16_t *source,
int x, int y, unsigned int width, unsigned int height);
pixman_private pixman_region_status_t
pixman_region_subtract (pixman_region16_t *regD, pixman_region16_t *regM, pixman_region16_t *regS);
pixman_private pixman_region_status_t
pixman_region_inverse (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_box16_t *invRect);
/* XXX: Need to fix this so it doesn't depend on an X data structure
pixman_region16_t *
RectsTopixman_region16_t (int nrects, xRectanglePtr prect, int ctype);
*/
/* querying */
/* XXX: These should proably be combined: pixman_region_get_rects? */
pixman_private int
pixman_region_num_rects (pixman_region16_t *region);
pixman_private pixman_box16_t *
pixman_region_rects (pixman_region16_t *region);
/* XXX: Change to an enum */
#define rgnOUT 0
#define rgnIN 1
#define rgnPART 2
pixman_private int
pixman_region_contains_point (pixman_region16_t *region, int x, int y, pixman_box16_t *box);
pixman_private int
pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t, pixman_box16_t *prect);
pixman_private int
pixman_region_not_empty (pixman_region16_t *region);
pixman_private pixman_box16_t *
pixman_region_extents (pixman_region16_t *region);
/* mucking around */
/* WARNING: calling pixman_region_append may leave dest as an invalid
region. Follow-up with pixman_region_validate to fix it up. */
pixman_private pixman_region_status_t
pixman_region_append (pixman_region16_t *dest, pixman_region16_t *region);
pixman_private pixman_region_status_t
pixman_region_validate (pixman_region16_t *badreg, int *pOverlap);
/* Unclassified functionality
* XXX: Do all of these need to be exported?
*/
pixman_private void
pixman_region_reset (pixman_region16_t *region, pixman_box16_t *pBox);
pixman_private void
pixman_region_empty (pixman_region16_t *region);
/* ic.h */
/* icformat.c */
typedef enum pixman_operator {
PIXMAN_OPERATOR_CLEAR,
PIXMAN_OPERATOR_SRC,
PIXMAN_OPERATOR_DST,
PIXMAN_OPERATOR_OVER,
PIXMAN_OPERATOR_OVER_REVERSE,
PIXMAN_OPERATOR_IN,
PIXMAN_OPERATOR_IN_REVERSE,
PIXMAN_OPERATOR_OUT,
PIXMAN_OPERATOR_OUT_REVERSE,
PIXMAN_OPERATOR_ATOP,
PIXMAN_OPERATOR_ATOP_REVERSE,
PIXMAN_OPERATOR_XOR,
PIXMAN_OPERATOR_ADD,
PIXMAN_OPERATOR_SATURATE
} pixman_operator_t;
typedef enum pixman_format_name {
PIXMAN_FORMAT_NAME_ARGB32,
PIXMAN_FORMAT_NAME_RGB24,
PIXMAN_FORMAT_NAME_A8,
PIXMAN_FORMAT_NAME_A1,
PIXMAN_FORMAT_NAME_RGB16_565,
PIXMAN_FORMAT_NAME_ABGR32,
PIXMAN_FORMAT_NAME_BGR24
} pixman_format_name_t;
/* XXX: Is depth redundant here? */
typedef struct pixman_format {
int format_code;
int depth;
int red, redMask;
int green, greenMask;
int blue, blueMask;
int alpha, alphaMask;
} pixman_format_t;
pixman_private int
pixman_format_init (pixman_format_t *format, pixman_format_name_t name);
pixman_private void
pixman_format_init_masks (pixman_format_t *format,
int bpp,
int alpha_mask,
int red_mask,
int green_mask,
int blue_mask);
pixman_private void
pixman_format_get_masks (pixman_format_t *format,
unsigned int *bpp,
unsigned int *alpha_mask,
unsigned int *red_mask,
unsigned int *green_mask,
unsigned int *blue_mask);
/* icimage.c */
typedef struct pixman_image pixman_image_t;
pixman_private pixman_image_t *
pixman_image_create (pixman_format_t *format,
int width,
int height);
/*
* This single define controls the basic size of data manipulated
* by this software; it must be log2(sizeof (pixman_bits_t) * 8)
*/
/* We use a 32-bit size on all platforms, (even those with native 64
* bit types). This is consistent with the code currently in the X
* server, so it goes through much more well-tested code paths, (we
* saw rendering bugs when we tried IC_SHIFT==6 and uint64_t for
* pixman_bits_t on 64-bit platofrms). In addition, Keith says that
* his testing indicates that using 32-bits everywhere is a
* performance win in any case, (presumably due to 32-bit datapaths
* between the processor and the video card).
*/
#ifndef IC_SHIFT
#define IC_SHIFT 5
#define FB_SHIFT IC_SHIFT
typedef uint32_t pixman_bits_t;
#endif
pixman_private pixman_image_t *
pixman_image_create_for_data (pixman_bits_t *data,
pixman_format_t *format,
int width, int height,
int bpp, int stride);
pixman_private void
pixman_image_destroy (pixman_image_t *image);
pixman_private int
pixman_image_set_clip_region (pixman_image_t *image,
pixman_region16_t *region);
typedef int32_t pixman_fixed16_16_t;
typedef struct pixman_point_fixed {
pixman_fixed16_16_t x, y;
} pixman_point_fixed_t;
typedef struct pixman_line_fixed {
pixman_point_fixed_t p1, p2;
} pixman_line_fixed_t;
/* XXX: It's goofy that pixman_rectangle_t has integers while all the other
datatypes have fixed-point values. (Though by design,
pixman_fill_rectangles is designed to fill only whole pixels) */
typedef struct pixman_rectangle {
short x, y;
unsigned short width, height;
} pixman_rectangle_t;
typedef struct pixman_triangle {
pixman_point_fixed_t p1, p2, p3;
} pixman_triangle_t;
typedef struct pixman_trapezoid {
pixman_fixed16_16_t top, bottom;
pixman_line_fixed_t left, right;
} pixman_trapezoid_t;
typedef struct pixman_vector {
pixman_fixed16_16_t vector[3];
} pixman_vector_t;
typedef struct pixman_transform {
pixman_fixed16_16_t matrix[3][3];
} pixman_transform_t;
typedef struct pixman_color {
unsigned short red;
unsigned short green;
unsigned short blue;
unsigned short alpha;
} pixman_color_t;
typedef struct _pixman_gradient_stop {
pixman_fixed16_16_t x;
pixman_color_t color;
} pixman_gradient_stop_t;
typedef struct _pixman_circle {
pixman_fixed16_16_t x;
pixman_fixed16_16_t y;
pixman_fixed16_16_t radius;
} pixman_circle_t;
typedef struct pixman_linear_gradient {
pixman_point_fixed_t p1;
pixman_point_fixed_t p2;
} pixman_linear_gradient_t;
typedef struct pixman_radial_gradient {
pixman_circle_t c1;
pixman_circle_t c2;
} pixman_radial_gradient_t;
typedef enum {
PIXMAN_FILTER_FAST,
PIXMAN_FILTER_GOOD,
PIXMAN_FILTER_BEST,
PIXMAN_FILTER_NEAREST,
PIXMAN_FILTER_BILINEAR
} pixman_filter_t;
pixman_private void
pixman_image_set_component_alpha (pixman_image_t *image,
int component_alpha);
pixman_private int
pixman_image_set_transform (pixman_image_t *image,
pixman_transform_t *transform);
/* Don't blame me, blame XRender */
typedef enum {
PIXMAN_REPEAT_NONE,
PIXMAN_REPEAT_NORMAL,
PIXMAN_REPEAT_PAD,
PIXMAN_REPEAT_REFLECT
} pixman_repeat_t;
pixman_private void
pixman_image_set_repeat (pixman_image_t *image,
pixman_repeat_t repeat);
pixman_private void
pixman_image_set_filter (pixman_image_t *image,
pixman_filter_t filter);
pixman_private int
pixman_image_get_width (pixman_image_t *image);
pixman_private int
pixman_image_get_height (pixman_image_t *image);
pixman_private int
pixman_image_get_stride (pixman_image_t *image);
pixman_private int
pixman_image_get_depth (pixman_image_t *image);
pixman_private pixman_format_t *
pixman_image_get_format (pixman_image_t *image);
pixman_private pixman_bits_t *
pixman_image_get_data (pixman_image_t *image);
pixman_private pixman_image_t *
pixman_image_create_linear_gradient (const pixman_linear_gradient_t *gradient,
const pixman_gradient_stop_t *stops,
int n_stops);
pixman_private pixman_image_t *
pixman_image_create_radial_gradient (const pixman_radial_gradient_t *gradient,
const pixman_gradient_stop_t *stops,
int n_stops);
/* iccolor.c */
pixman_private void
pixman_color_to_pixel (const pixman_format_t *format,
const pixman_color_t *color,
pixman_bits_t *pixel);
pixman_private void
pixman_pixel_to_color (const pixman_format_t *format,
pixman_bits_t pixel,
pixman_color_t *color);
/* icrect.c */
pixman_private int
pixman_fill_rectangle (pixman_operator_t op,
pixman_image_t *dst,
const pixman_color_t *color,
int x,
int y,
unsigned int width,
unsigned int height);
pixman_private int
pixman_fill_rectangles (pixman_operator_t op,
pixman_image_t *dst,
const pixman_color_t *color,
const pixman_rectangle_t *rects,
int nRects);
/* ictrap.c */
pixman_private int
pixman_composite_trapezoids (pixman_operator_t op,
pixman_image_t *src,
pixman_image_t *dst,
int xSrc,
int ySrc,
const pixman_trapezoid_t *traps,
int ntrap);
pixman_private void
pixman_add_trapezoids (pixman_image_t *dst,
int x_off,
int y_off,
const pixman_trapezoid_t *traps,
int ntraps);
/* ictri.c */
pixman_private void
pixman_composite_triangles (pixman_operator_t op,
pixman_image_t *src,
pixman_image_t *dst,
int xSrc,
int ySrc,
const pixman_triangle_t *tris,
int ntris);
pixman_private void
pixman_composite_tri_strip (pixman_operator_t op,
pixman_image_t *src,
pixman_image_t *dst,
int xSrc,
int ySrc,
const pixman_point_fixed_t *points,
int npoints);
pixman_private void
pixman_composite_tri_fan (pixman_operator_t op,
pixman_image_t *src,
pixman_image_t *dst,
int xSrc,
int ySrc,
const pixman_point_fixed_t *points,
int npoints);
/* ic.c */
pixman_private void
pixman_composite (pixman_operator_t op,
pixman_image_t *iSrc,
pixman_image_t *iMask,
pixman_image_t *iDst,
int xSrc,
int ySrc,
int xMask,
int yMask,
int xDst,
int yDst,
int width,
int height);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif /* _PIXMAN_H_ */
|