1 /* cairo - a vector graphics library with display and print output
2 *
3 * Copyright © 2002 University of Southern California
4 * Copyright © 2005 Red Hat, Inc.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it either under the terms of the GNU Lesser General Public
8 * License version 2.1 as published by the Free Software Foundation
9 * (the "LGPL") or, at your option, under the terms of the Mozilla
10 * Public License Version 1.1 (the "MPL"). If you do not alter this
11 * notice, a recipient may use your version of this file under either
12 * the MPL or the LGPL.
13 *
14 * You should have received a copy of the LGPL along with this library
15 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
17 * You should have received a copy of the MPL along with this library
18 * in the file COPYING-MPL-1.1
19 *
20 * The contents of this file are subject to the Mozilla Public License
21 * Version 1.1 (the "License"); you may not use this file except in
22 * compliance with the License. You may obtain a copy of the License at
23 * http://www.mozilla.org/MPL/
24 *
25 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
26 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
27 * the specific language governing rights and limitations.
28 *
29 * The Original Code is the cairo graphics library.
30 *
31 * The Initial Developer of the Original Code is University of Southern
32 * California.
33 *
34 * Contributor(s):
35 * Carl D. Worth <cworth@cworth.org>
36 */
37
38 /*
39 * These definitions are solely for use by the implementation of cairo
40 * and constitute no kind of standard. If you need any of these
41 * functions, please drop me a note. Either the library needs new
42 * functionality, or there's a way to do what you need using the
43 * existing published interfaces. cworth@cworth.org
44 */
45
46 #ifndef _CAIROINT_H_
47 #define _CAIROINT_H_
48
49 #if HAVE_CONFIG_H
50 #include "config.h"
51 #endif
52
53 #ifdef _MSC_VER
54 #define cairo_public __declspec(dllexport)
55 #endif
56
57 #include <assert.h>
58 #include <stdlib.h>
59 #include <string.h>
60 #include <stdarg.h>
61 #include <stddef.h>
62
63 #ifdef _MSC_VER
64 #define _USE_MATH_DEFINES
65 #endif
66 #include <math.h>
67 #include <limits.h>
68 #include <stdio.h>
69
70 #include "cairo.h"
71 #include <pixman.h>
72
73 #include "cairo-compiler-private.h"
74
75 #if CAIRO_HAS_PS_SURFACE || \
76 CAIRO_HAS_PDF_SURFACE || \
77 CAIRO_HAS_SVG_SURFACE || \
78 CAIRO_HAS_WIN32_SURFACE
79 #define CAIRO_HAS_FONT_SUBSET 1
80 #endif
81
82 #if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_FONT_SUBSET
83 #define CAIRO_HAS_PDF_OPERATORS 1
84 #endif
85
86 CAIRO_BEGIN_DECLS
87
88 #if _WIN32 && !_WIN32_WCE /* Permissions on WinCE? No worries! */
89 cairo_private FILE *
90 _cairo_win32_tmpfile (void);
91 #define tmpfile() _cairo_win32_tmpfile()
92 #endif
93
94 #undef MIN
95 #define MIN(a, b) ((a) < (b) ? (a) : (b))
96
97 #undef MAX
98 #define MAX(a, b) ((a) > (b) ? (a) : (b))
99
100 #ifndef FALSE
101 #define FALSE 0
102 #endif
103
104 #ifndef TRUE
105 #define TRUE 1
106 #endif
107
108 #ifndef M_PI
109 #define M_PI 3.14159265358979323846
110 #endif
111
112 #ifndef NDEBUG
113 #undef assert
114 #define assert(expr) \
115 do { if (!(expr)) fprintf(stderr, "Assertion failed at %s:%d: %s\n", \
116 __FILE__, __LINE__, #expr); } while (0)
117 #endif
118
119 #ifndef M_SQRT2
120 #define M_SQRT2 1.41421356237309504880
121 #endif
122
123 #ifndef M_SQRT1_2
124 #define M_SQRT1_2 0.707106781186547524400844362104849039
125 #endif
126
127 #undef ARRAY_LENGTH
128 #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
129
130 #undef STRINGIFY
131 #undef STRINGIFY_ARG
132 #define STRINGIFY(macro_or_string) STRINGIFY_ARG (macro_or_string)
133 #define STRINGIFY_ARG(contents) #contents
134
135 #if defined (__GNUC__)
136 #define cairo_container_of(ptr, type, member) ({ \
137 const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
138 (type *) ((char *) mptr__ - offsetof (type, member)); \
139 })
140 #else
141 #define cairo_container_of(ptr, type, member) \
142 ((type *)((char *) (ptr) - (char *) &((type *)0)->member))
143 #endif
144
145
146 #define ASSERT_NOT_REACHED \
147 do { \
148 assert (!"reached"); \
149 } while (0)
150 #define COMPILE_TIME_ASSERT1(condition, line) \
151 typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1]
152 #define COMPILE_TIME_ASSERT0(condition, line) COMPILE_TIME_ASSERT1(condition, line)
153 #define COMPILE_TIME_ASSERT(condition) COMPILE_TIME_ASSERT0(condition, __LINE__)
154
155 #define CAIRO_ALPHA_IS_CLEAR(alpha) ((alpha) <= ((double)0x00ff / (double)0xffff))
156 #define CAIRO_ALPHA_SHORT_IS_CLEAR(alpha) ((alpha) <= 0x00ff)
157
158 #define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff))
159 #define CAIRO_ALPHA_SHORT_IS_OPAQUE(alpha) ((alpha) >= 0xff00)
160 #define CAIRO_ALPHA_IS_ZERO(alpha) ((alpha) <= 0.0)
161
162 #define CAIRO_COLOR_IS_CLEAR(color) CAIRO_ALPHA_SHORT_IS_CLEAR ((color)->alpha_short)
163 #define CAIRO_COLOR_IS_OPAQUE(color) CAIRO_ALPHA_SHORT_IS_OPAQUE ((color)->alpha_short)
164
165 /* Reverse the bits in a byte with 7 operations (no 64-bit):
166 * Devised by Sean Anderson, July 13, 2001.
167 * Source: http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
168 */
169 #define CAIRO_BITSWAP8(c) ((((c) * 0x0802LU & 0x22110LU) | ((c) * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16)
170
171 /* Return the number of 1 bits in mask.
172 *
173 * GCC 3.4 supports a "population count" builtin, which on many targets is
174 * implemented with a single instruction. There is a fallback definition
175 * in libgcc in case a target does not have one, which should be just as
176 * good as the open-coded solution below, (which is "HACKMEM 169").
177 */
178 static inline int cairo_const
_cairo_popcount(uint32_t mask)179 _cairo_popcount (uint32_t mask)
180 {
181 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
182 return __builtin_popcount (mask);
183 #else
184 register int y;
185
186 y = (mask >> 1) &033333333333;
187 y = mask - y - ((y >>1) & 033333333333);
188 return (((y + (y >> 3)) & 030707070707) % 077);
189 #endif
190 }
191
192 #ifdef WORDS_BIGENDIAN
193 #define CAIRO_BITSWAP8_IF_LITTLE_ENDIAN(c) (c)
194 #else
195 #define CAIRO_BITSWAP8_IF_LITTLE_ENDIAN(c) CAIRO_BITSWAP8(c)
196 #endif
197
198 #ifdef WORDS_BIGENDIAN
199
200 #define cpu_to_be16(v) (v)
201 #define be16_to_cpu(v) (v)
202 #define cpu_to_be32(v) (v)
203 #define be32_to_cpu(v) (v)
204
205 #else
206
207 static inline uint16_t cairo_const
cpu_to_be16(uint16_t v)208 cpu_to_be16(uint16_t v)
209 {
210 return (v << 8) | (v >> 8);
211 }
212
213 static inline uint16_t cairo_const
be16_to_cpu(uint16_t v)214 be16_to_cpu(uint16_t v)
215 {
216 return cpu_to_be16 (v);
217 }
218
219 static inline uint32_t cairo_const
cpu_to_be32(uint32_t v)220 cpu_to_be32(uint32_t v)
221 {
222 return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
223 }
224
225 static inline uint32_t cairo_const
be32_to_cpu(uint32_t v)226 be32_to_cpu(uint32_t v)
227 {
228 return cpu_to_be32 (v);
229 }
230
231 #endif
232
233
234 /* The glibc versions of ispace() and isdigit() are slow in UTF-8 locales.
235 */
236
237 static inline int cairo_const
_cairo_isspace(int c)238 _cairo_isspace (int c)
239 {
240 return (c == 0x20 || (c >= 0x09 && c <= 0x0d));
241 }
242
243 static inline int cairo_const
_cairo_isdigit(int c)244 _cairo_isdigit (int c)
245 {
246 return (c >= '0' && c <= '9');
247 }
248
249 #include "cairo-types-private.h"
250 #include "cairo-cache-private.h"
251 #include "cairo-reference-count-private.h"
252 #include "cairo-spans-private.h"
253
254 cairo_private void
255 _cairo_box_from_doubles (cairo_box_t *box,
256 double *x1, double *y1,
257 double *x2, double *y2);
258
259 cairo_private void
260 _cairo_box_to_doubles (const cairo_box_t *box,
261 double *x1, double *y1,
262 double *x2, double *y2);
263
264 cairo_private void
265 _cairo_box_from_rectangle (cairo_box_t *box,
266 const cairo_rectangle_int_t *rectangle);
267
268 cairo_private cairo_bool_t
269 _cairo_rectangle_contains (const cairo_rectangle_int_t *containing_rectangle,
270 const cairo_rectangle_int_t *contained_rectangle);
271
272 cairo_private void
273 _cairo_box_round_to_rectangle (const cairo_box_t *box,
274 cairo_rectangle_int_t *rectangle);
275
276 cairo_private void
277 _cairo_boxes_get_extents (const cairo_box_t *boxes,
278 int num_boxes,
279 cairo_box_t *extents);
280
281 static inline void
_cairo_unbounded_rectangle_init(cairo_rectangle_int_t * rect)282 _cairo_unbounded_rectangle_init (cairo_rectangle_int_t *rect)
283 {
284 rect->x = CAIRO_RECT_INT_MIN;
285 rect->y = CAIRO_RECT_INT_MIN;
286 rect->width = CAIRO_RECT_INT_MAX - CAIRO_RECT_INT_MIN;
287 rect->height = CAIRO_RECT_INT_MAX - CAIRO_RECT_INT_MIN;
288 }
289
290 cairo_private cairo_bool_t
291 _cairo_rectangle_intersect (cairo_rectangle_int_t *dst,
292 const cairo_rectangle_int_t *src);
293
294 cairo_private cairo_bool_t
295 _cairo_box_intersects_line_segment (cairo_box_t *box,
296 cairo_line_t *line) cairo_pure;
297
298 cairo_private cairo_bool_t
299 _cairo_box_contains_point (cairo_box_t *box,
300 const cairo_point_t *point) cairo_pure;
301
302 /* cairo-array.c structures and functions */
303
304 cairo_private void
305 _cairo_array_init (cairo_array_t *array, int element_size);
306
307 cairo_private void
308 _cairo_array_init_snapshot (cairo_array_t *array,
309 const cairo_array_t *other);
310
311 cairo_private void
312 _cairo_array_fini (cairo_array_t *array);
313
314 cairo_private cairo_status_t
315 _cairo_array_grow_by (cairo_array_t *array, unsigned int additional);
316
317 cairo_private void
318 _cairo_array_truncate (cairo_array_t *array, unsigned int num_elements);
319
320 cairo_private cairo_status_t
321 _cairo_array_append (cairo_array_t *array, const void *element);
322
323 cairo_private cairo_status_t
324 _cairo_array_append_multiple (cairo_array_t *array,
325 const void *elements,
326 int num_elements);
327
328 cairo_private cairo_status_t
329 _cairo_array_allocate (cairo_array_t *array,
330 unsigned int num_elements,
331 void **elements);
332
333 cairo_private void *
334 _cairo_array_index (cairo_array_t *array, unsigned int index);
335
336 cairo_private void
337 _cairo_array_copy_element (cairo_array_t *array, int index, void *dst);
338
339 cairo_private int
340 _cairo_array_num_elements (cairo_array_t *array);
341
342 cairo_private int
343 _cairo_array_size (cairo_array_t *array);
344
345 typedef struct {
346 const cairo_user_data_key_t *key;
347 void *user_data;
348 cairo_destroy_func_t destroy;
349 } cairo_user_data_slot_t;
350
351 cairo_private void
352 _cairo_user_data_array_init (cairo_user_data_array_t *array);
353
354 cairo_private void
355 _cairo_user_data_array_fini (cairo_user_data_array_t *array);
356
357 cairo_private void *
358 _cairo_user_data_array_get_data (cairo_user_data_array_t *array,
359 const cairo_user_data_key_t *key);
360
361 cairo_private cairo_status_t
362 _cairo_user_data_array_set_data (cairo_user_data_array_t *array,
363 const cairo_user_data_key_t *key,
364 void *user_data,
365 cairo_destroy_func_t destroy);
366
367 cairo_private cairo_status_t
368 _cairo_user_data_array_copy (cairo_user_data_array_t *dst,
369 cairo_user_data_array_t *src);
370
371 cairo_private void
372 _cairo_user_data_array_foreach (cairo_user_data_array_t *array,
373 void (*func) (const void *key,
374 void *elt,
375 void *closure),
376 void *closure);
377
378 #define _CAIRO_HASH_INIT_VALUE 5381
379
380 cairo_private unsigned long
381 _cairo_hash_string (const char *c);
382
383 cairo_private unsigned long
384 _cairo_hash_bytes (unsigned long hash,
385 const void *bytes,
386 unsigned int length);
387
388 #define _cairo_scaled_glyph_index(g) ((g)->hash_entry.hash)
389 #define _cairo_scaled_glyph_set_index(g, i) ((g)->hash_entry.hash = (i))
390
391 #include "cairo-scaled-font-private.h"
392
393 struct _cairo_font_face {
394 /* hash_entry must be first */
395 cairo_hash_entry_t hash_entry;
396 cairo_status_t status;
397 cairo_reference_count_t ref_count;
398 cairo_user_data_array_t user_data;
399 const cairo_font_face_backend_t *backend;
400 };
401
402 cairo_private void
403 _cairo_reset_static_data (void);
404
405 cairo_private void
406 _cairo_toy_font_face_reset_static_data (void);
407
408 cairo_private void
409 _cairo_ft_font_reset_static_data (void);
410
411 cairo_private void
412 _cairo_win32_font_reset_static_data (void);
413
414 /* the font backend interface */
415
416 struct _cairo_unscaled_font_backend {
417 void (*destroy) (void *unscaled_font);
418 };
419
420 /* #cairo_toy_font_face_t - simple family/slant/weight font faces used for
421 * the built-in font API
422 */
423
424 typedef struct _cairo_toy_font_face {
425 cairo_font_face_t base;
426 const char *family;
427 cairo_bool_t owns_family;
428 cairo_font_slant_t slant;
429 cairo_font_weight_t weight;
430
431 cairo_font_face_t *impl_face; /* The non-toy font face this actually uses */
432 } cairo_toy_font_face_t;
433
434 typedef enum _cairo_scaled_glyph_info {
435 CAIRO_SCALED_GLYPH_INFO_METRICS = (1 << 0),
436 CAIRO_SCALED_GLYPH_INFO_SURFACE = (1 << 1),
437 CAIRO_SCALED_GLYPH_INFO_PATH = (1 << 2),
438 CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE = (1 << 3)
439 } cairo_scaled_glyph_info_t;
440
441 typedef struct _cairo_scaled_font_subset {
442 cairo_scaled_font_t *scaled_font;
443 unsigned int font_id;
444 unsigned int subset_id;
445
446 /* Index of glyphs array is subset_glyph_index.
447 * Value of glyphs array is scaled_font_glyph_index.
448 */
449 unsigned long *glyphs;
450 unsigned long *to_unicode;
451 char **utf8;
452 char **glyph_names;
453 unsigned int num_glyphs;
454 cairo_bool_t is_composite;
455 cairo_bool_t is_scaled;
456 } cairo_scaled_font_subset_t;
457
458 struct _cairo_scaled_font_backend {
459 cairo_font_type_t type;
460
461 void
462 (*fini) (void *scaled_font);
463
464 cairo_warn cairo_int_status_t
465 (*scaled_glyph_init) (void *scaled_font,
466 cairo_scaled_glyph_t *scaled_glyph,
467 cairo_scaled_glyph_info_t info);
468
469 /* A backend only needs to implement this or ucs4_to_index(), not
470 * both. This allows the backend to do something more sophisticated
471 * then just converting characters one by one.
472 */
473 cairo_warn cairo_int_status_t
474 (*text_to_glyphs) (void *scaled_font,
475 double x,
476 double y,
477 const char *utf8,
478 int utf8_len,
479 cairo_glyph_t **glyphs,
480 int *num_glyphs,
481 cairo_text_cluster_t **clusters,
482 int *num_clusters,
483 cairo_text_cluster_flags_t *cluster_flags);
484
485 unsigned long
486 (*ucs4_to_index) (void *scaled_font,
487 uint32_t ucs4);
488 cairo_warn cairo_int_status_t
489 (*show_glyphs) (void *scaled_font,
490 cairo_operator_t op,
491 const cairo_pattern_t *pattern,
492 cairo_surface_t *surface,
493 int source_x,
494 int source_y,
495 int dest_x,
496 int dest_y,
497 unsigned int width,
498 unsigned int height,
499 cairo_glyph_t *glyphs,
500 int num_glyphs,
501 cairo_region_t *clip_region,
502 int *remaining_glyphs);
503
504 cairo_warn cairo_int_status_t
505 (*load_truetype_table)(void *scaled_font,
506 unsigned long tag,
507 long offset,
508 unsigned char *buffer,
509 unsigned long *length);
510
511 /* ucs4 is set to -1 if the unicode character could not be found
512 * for the glyph */
513 cairo_warn cairo_int_status_t
514 (*index_to_ucs4)(void *scaled_font,
515 unsigned long index,
516 uint32_t *ucs4);
517 };
518
519 struct _cairo_font_face_backend {
520 cairo_font_type_t type;
521
522 cairo_warn cairo_status_t
523 (*create_for_toy) (cairo_toy_font_face_t *toy_face,
524 cairo_font_face_t **font_face);
525
526 /* The destroy() function is allowed to resurrect the font face
527 * by re-referencing. This is needed for the FreeType backend.
528 */
529 void
530 (*destroy) (void *font_face);
531
532 cairo_warn cairo_status_t
533 (*scaled_font_create) (void *font_face,
534 const cairo_matrix_t *font_matrix,
535 const cairo_matrix_t *ctm,
536 const cairo_font_options_t *options,
537 cairo_scaled_font_t **scaled_font);
538
539 cairo_font_face_t *
540 (*get_implementation) (void *font_face,
541 const cairo_matrix_t *font_matrix,
542 const cairo_matrix_t *ctm,
543 const cairo_font_options_t *options);
544 };
545
546 extern const cairo_private struct _cairo_font_face_backend _cairo_user_font_face_backend;
547
548 /* concrete font backends */
549 #if CAIRO_HAS_FT_FONT
550
551 extern const cairo_private struct _cairo_font_face_backend _cairo_ft_font_face_backend;
552
553 #endif
554
555 #if CAIRO_HAS_WIN32_FONT
556
557 extern const cairo_private struct _cairo_font_face_backend _cairo_win32_font_face_backend;
558
559 #endif
560
561 #if CAIRO_HAS_DWRITE_FONT
562
563 extern const cairo_private struct _cairo_font_face_backend _cairo_dwrite_font_face_backend;
564
565 #endif
566
567 #if CAIRO_HAS_QUARTZ_FONT
568
569 extern const cairo_private struct _cairo_font_face_backend _cairo_quartz_font_face_backend;
570
571 #endif
572
573 struct _cairo_surface_backend {
574 cairo_surface_type_t type;
575
576 cairo_surface_t *
577 (*create_similar) (void *surface,
578 cairo_content_t content,
579 int width,
580 int height);
581
582 cairo_warn cairo_status_t
583 (*finish) (void *surface);
584
585 cairo_warn cairo_status_t
586 (*acquire_source_image) (void *abstract_surface,
587 cairo_image_surface_t **image_out,
588 void **image_extra);
589
590 void
591 (*release_source_image) (void *abstract_surface,
592 cairo_image_surface_t *image,
593 void *image_extra);
594
595 cairo_warn cairo_status_t
596 (*acquire_dest_image) (void *abstract_surface,
597 cairo_rectangle_int_t *interest_rect,
598 cairo_image_surface_t **image_out,
599 cairo_rectangle_int_t *image_rect,
600 void **image_extra);
601
602 void
603 (*release_dest_image) (void *abstract_surface,
604 cairo_rectangle_int_t *interest_rect,
605 cairo_image_surface_t *image,
606 cairo_rectangle_int_t *image_rect,
607 void *image_extra);
608
609 /* Create a new surface (@clone_out) with the following
610 * characteristics:
611 *
612 * 1. It is as compatible as possible with @surface (in terms of
613 * efficiency)
614 *
615 * 2. It has the same contents as @src within the given rectangle.
616 *
617 * 3. The offset of the similar surface with respect to the original
618 * surface is returned in the clone_offset vector.
619 * - if you clone the entire surface, this vector is zero.
620 * - if you clone (src_x, src_y)x(w, h) the vector is (src_x, src_y);
621 */
622 cairo_warn cairo_status_t
623 (*clone_similar) (void *surface,
624 cairo_surface_t *src,
625 int src_x,
626 int src_y,
627 int width,
628 int height,
629 int *clone_offset_x,
630 int *clone_offset_y,
631 cairo_surface_t **clone_out);
632
633 /* XXX remove to a separate cairo_surface_compositor_t */
634 /* XXX: dst should be the first argument for consistency */
635 cairo_warn cairo_int_status_t
636 (*composite) (cairo_operator_t op,
637 const cairo_pattern_t *src,
638 const cairo_pattern_t *mask,
639 void *dst,
640 int src_x,
641 int src_y,
642 int mask_x,
643 int mask_y,
644 int dst_x,
645 int dst_y,
646 unsigned int width,
647 unsigned int height,
648 cairo_region_t *clip_region);
649
650 cairo_warn cairo_int_status_t
651 (*fill_rectangles) (void *surface,
652 cairo_operator_t op,
653 const cairo_color_t *color,
654 cairo_rectangle_int_t *rects,
655 int num_rects);
656
657 /* XXX: dst should be the first argument for consistency */
658 cairo_warn cairo_int_status_t
659 (*composite_trapezoids) (cairo_operator_t op,
660 const cairo_pattern_t *pattern,
661 void *dst,
662 cairo_antialias_t antialias,
663 int src_x,
664 int src_y,
665 int dst_x,
666 int dst_y,
667 unsigned int width,
668 unsigned int height,
669 cairo_trapezoid_t *traps,
670 int num_traps,
671 cairo_region_t *region);
672
673 cairo_warn cairo_span_renderer_t *
674 (*create_span_renderer) (cairo_operator_t op,
675 const cairo_pattern_t *pattern,
676 void *dst,
677 cairo_antialias_t antialias,
678 const cairo_composite_rectangles_t *rects,
679 cairo_region_t *clip_region);
680
681 cairo_warn cairo_bool_t
682 (*check_span_renderer) (cairo_operator_t op,
683 const cairo_pattern_t *pattern,
684 void *dst,
685 cairo_antialias_t antialias);
686
687 cairo_warn cairo_int_status_t
688 (*copy_page) (void *surface);
689
690 cairo_warn cairo_int_status_t
691 (*show_page) (void *surface);
692
693 /* Get the extents of the current surface. For many surface types
694 * this will be as simple as { x=0, y=0, width=surface->width,
695 * height=surface->height}.
696 *
697 * If this function is not implemented, or if it returns
698 * FALSE the surface is considered to be
699 * boundless and infinite bounds are used for it.
700 */
701 cairo_warn cairo_bool_t
702 (*get_extents) (void *surface,
703 cairo_rectangle_int_t *extents);
704
705 /*
706 * This is an optional entry to let the surface manage its own glyph
707 * resources. If null, render against this surface, using image
708 * surfaces as glyphs.
709 */
710 cairo_warn cairo_int_status_t
711 (*old_show_glyphs) (cairo_scaled_font_t *font,
712 cairo_operator_t op,
713 const cairo_pattern_t *pattern,
714 void *surface,
715 int source_x,
716 int source_y,
717 int dest_x,
718 int dest_y,
719 unsigned int width,
720 unsigned int height,
721 cairo_glyph_t *glyphs,
722 int num_glyphs,
723 cairo_region_t *clip_region);
724
725 void
726 (*get_font_options) (void *surface,
727 cairo_font_options_t *options);
728
729 cairo_warn cairo_status_t
730 (*flush) (void *surface);
731
732 cairo_warn cairo_status_t
733 (*mark_dirty_rectangle) (void *surface,
734 int x,
735 int y,
736 int width,
737 int height);
738
739 void
740 (*scaled_font_fini) (cairo_scaled_font_t *scaled_font);
741
742 void
743 (*scaled_glyph_fini) (cairo_scaled_glyph_t *scaled_glyph,
744 cairo_scaled_font_t *scaled_font);
745
746 /* OK, I'm starting over somewhat by defining the 5 top-level
747 * drawing operators for the surface backend here with consistent
748 * naming and argument-order conventions. */
749 cairo_warn cairo_int_status_t
750 (*paint) (void *surface,
751 cairo_operator_t op,
752 const cairo_pattern_t *source,
753 cairo_clip_t *clip);
754
755 cairo_warn cairo_int_status_t
756 (*mask) (void *surface,
757 cairo_operator_t op,
758 const cairo_pattern_t *source,
759 const cairo_pattern_t *mask,
760 cairo_clip_t *clip);
761
762 cairo_warn cairo_int_status_t
763 (*stroke) (void *surface,
764 cairo_operator_t op,
765 const cairo_pattern_t *source,
766 cairo_path_fixed_t *path,
767 const cairo_stroke_style_t *style,
768 const cairo_matrix_t *ctm,
769 const cairo_matrix_t *ctm_inverse,
770 double tolerance,
771 cairo_antialias_t antialias,
772 cairo_clip_t *clip);
773
774 cairo_warn cairo_int_status_t
775 (*fill) (void *surface,
776 cairo_operator_t op,
777 const cairo_pattern_t *source,
778 cairo_path_fixed_t *path,
779 cairo_fill_rule_t fill_rule,
780 double tolerance,
781 cairo_antialias_t antialias,
782 cairo_clip_t *clip);
783
784 cairo_warn cairo_int_status_t
785 (*show_glyphs) (void *surface,
786 cairo_operator_t op,
787 const cairo_pattern_t *source,
788 cairo_glyph_t *glyphs,
789 int num_glyphs,
790 cairo_scaled_font_t *scaled_font,
791 cairo_clip_t *clip,
792 int *remaining_glyphs);
793
794 cairo_surface_t *
795 (*snapshot) (void *surface);
796
797 cairo_bool_t
798 (*is_similar) (void *surface_a,
799 void *surface_b);
800
801 cairo_warn cairo_int_status_t
802 (*fill_stroke) (void *surface,
803 cairo_operator_t fill_op,
804 const cairo_pattern_t *fill_source,
805 cairo_fill_rule_t fill_rule,
806 double fill_tolerance,
807 cairo_antialias_t fill_antialias,
808 cairo_path_fixed_t *path,
809 cairo_operator_t stroke_op,
810 const cairo_pattern_t *stroke_source,
811 const cairo_stroke_style_t *stroke_style,
812 const cairo_matrix_t *stroke_ctm,
813 const cairo_matrix_t *stroke_ctm_inverse,
814 double stroke_tolerance,
815 cairo_antialias_t stroke_antialias,
816 cairo_clip_t *clip);
817
818 cairo_surface_t *
819 (*create_solid_pattern_surface)
820 (void *surface,
821 const cairo_solid_pattern_t *solid_pattern);
822
823 cairo_bool_t
824 (*can_repaint_solid_pattern_surface)
825 (void *surface,
826 const cairo_solid_pattern_t *solid_pattern);
827
828 cairo_bool_t
829 (*has_show_text_glyphs) (void *surface);
830
831 cairo_warn cairo_int_status_t
832 (*show_text_glyphs) (void *surface,
833 cairo_operator_t op,
834 const cairo_pattern_t *source,
835 const char *utf8,
836 int utf8_len,
837 cairo_glyph_t *glyphs,
838 int num_glyphs,
839 const cairo_text_cluster_t *clusters,
840 int num_clusters,
841 cairo_text_cluster_flags_t cluster_flags,
842 cairo_scaled_font_t *scaled_font,
843 cairo_clip_t *clip);
844 };
845
846 #include "cairo-surface-private.h"
847
848 struct _cairo_image_surface {
849 cairo_surface_t base;
850
851 pixman_format_code_t pixman_format;
852 cairo_format_t format;
853 unsigned char *data;
854
855 int width;
856 int height;
857 int stride;
858 int depth;
859
860 pixman_image_t *pixman_image;
861
862 unsigned owns_data : 1;
863 unsigned transparency : 2;
864 };
865
866 extern const cairo_private cairo_surface_backend_t _cairo_image_surface_backend;
867
868 #define CAIRO_EXTEND_SURFACE_DEFAULT CAIRO_EXTEND_NONE
869 #define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_PAD
870 #define CAIRO_FILTER_DEFAULT CAIRO_FILTER_GOOD
871
872 extern const cairo_private cairo_solid_pattern_t _cairo_pattern_clear;
873 extern const cairo_private cairo_solid_pattern_t _cairo_pattern_black;
874 extern const cairo_private cairo_solid_pattern_t _cairo_pattern_white;
875
876 typedef struct _cairo_surface_attributes {
877 cairo_matrix_t matrix;
878 cairo_extend_t extend;
879 cairo_filter_t filter;
880 cairo_bool_t has_component_alpha;
881 int x_offset;
882 int y_offset;
883 void *extra;
884 } cairo_surface_attributes_t;
885
886 typedef struct _cairo_traps {
887 cairo_status_t status;
888
889 const cairo_box_t *limits;
890 int num_limits;
891
892 unsigned int maybe_region : 1; /* hint: 0 implies that it cannot be */
893 unsigned int has_intersections : 1;
894 unsigned int is_rectilinear : 1;
895 unsigned int is_rectangular : 1;
896
897 int num_traps;
898 int traps_size;
899 cairo_trapezoid_t *traps;
900 cairo_trapezoid_t traps_embedded[16];
901 } cairo_traps_t;
902
903 #define CAIRO_FONT_SLANT_DEFAULT CAIRO_FONT_SLANT_NORMAL
904 #define CAIRO_FONT_WEIGHT_DEFAULT CAIRO_FONT_WEIGHT_NORMAL
905
906 #define CAIRO_WIN32_FONT_FAMILY_DEFAULT "Arial"
907 #define CAIRO_QUARTZ_FONT_FAMILY_DEFAULT "Helvetica"
908 #define CAIRO_FT_FONT_FAMILY_DEFAULT ""
909 #define CAIRO_USER_FONT_FAMILY_DEFAULT "@cairo:"
910
911 #if CAIRO_HAS_DWRITE_FONT
912
913 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_WIN32_FONT_FAMILY_DEFAULT
914 #define CAIRO_FONT_FACE_BACKEND_DEFAULT &_cairo_dwrite_font_face_backend
915
916 #elif CAIRO_HAS_WIN32_FONT
917
918 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_WIN32_FONT_FAMILY_DEFAULT
919 #define CAIRO_FONT_FACE_BACKEND_DEFAULT &_cairo_win32_font_face_backend
920
921 #elif CAIRO_HAS_QUARTZ_FONT
922
923 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_QUARTZ_FONT_FAMILY_DEFAULT
924 #define CAIRO_FONT_FACE_BACKEND_DEFAULT &_cairo_quartz_font_face_backend
925
926 #elif CAIRO_HAS_FT_FONT
927
928 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
929 #define CAIRO_FONT_FACE_BACKEND_DEFAULT &_cairo_ft_font_face_backend
930
931 #else
932
933 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
934 #define CAIRO_FONT_FACE_BACKEND_DEFAULT &_cairo_user_font_face_backend
935
936 #endif
937
938 #define CAIRO_GSTATE_OPERATOR_DEFAULT CAIRO_OPERATOR_OVER
939 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
940 // Skia uses a tolerance of 0.5 we'll use something more
941 // tolerant for now
942 #define CAIRO_GSTATE_TOLERANCE_DEFAULT 0.3
943 #else
944 #define CAIRO_GSTATE_TOLERANCE_DEFAULT 0.1
945 #endif
946 #define CAIRO_GSTATE_FILL_RULE_DEFAULT CAIRO_FILL_RULE_WINDING
947 #define CAIRO_GSTATE_LINE_WIDTH_DEFAULT 2.0
948 #define CAIRO_GSTATE_LINE_CAP_DEFAULT CAIRO_LINE_CAP_BUTT
949 #define CAIRO_GSTATE_LINE_JOIN_DEFAULT CAIRO_LINE_JOIN_MITER
950 #define CAIRO_GSTATE_MITER_LIMIT_DEFAULT 10.0
951 #define CAIRO_GSTATE_DEFAULT_FONT_SIZE 10.0
952
953 #define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
954 #define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
955
956 typedef struct _cairo_stroke_face {
957 cairo_point_t ccw;
958 cairo_point_t point;
959 cairo_point_t cw;
960 cairo_slope_t dev_vector;
961 cairo_point_double_t usr_vector;
962 } cairo_stroke_face_t;
963
964 /* cairo.c */
965
966 static inline double cairo_const
_cairo_restrict_value(double value,double min,double max)967 _cairo_restrict_value (double value, double min, double max)
968 {
969 if (value < min)
970 return min;
971 else if (value > max)
972 return max;
973 else
974 return value;
975 }
976
977 /* C99 round() rounds to the nearest integral value with halfway cases rounded
978 * away from 0. _cairo_round rounds halfway cases toward negative infinity.
979 * This matches the rounding behaviour of _cairo_lround. */
980 static inline double cairo_const
_cairo_round(double r)981 _cairo_round (double r)
982 {
983 return floor (r + .5);
984 }
985
986 #if DISABLE_SOME_FLOATING_POINT || __STDC_VERSION__ < 199901L
987 cairo_private int
988 _cairo_lround (double d) cairo_const;
989 #else
990 #define _cairo_lround lround
991 #endif
992
993 cairo_private uint16_t
994 _cairo_half_from_float (float f) cairo_const;
995
996 cairo_private cairo_bool_t
997 _cairo_operator_bounded_by_mask (cairo_operator_t op) cairo_const;
998
999 cairo_private cairo_bool_t
1000 _cairo_operator_bounded_by_source (cairo_operator_t op) cairo_const;
1001
1002 enum {
1003 CAIRO_OPERATOR_BOUND_BY_MASK = 1 << 1,
1004 CAIRO_OPERATOR_BOUND_BY_SOURCE = 1 << 2,
1005 };
1006
1007 cairo_private uint32_t
1008 _cairo_operator_bounded_by_either (cairo_operator_t op) cairo_const;
1009 /* cairo-color.c */
1010 cairo_private const cairo_color_t *
1011 _cairo_stock_color (cairo_stock_t stock) cairo_pure;
1012
1013 #define CAIRO_COLOR_WHITE _cairo_stock_color (CAIRO_STOCK_WHITE)
1014 #define CAIRO_COLOR_BLACK _cairo_stock_color (CAIRO_STOCK_BLACK)
1015 #define CAIRO_COLOR_TRANSPARENT _cairo_stock_color (CAIRO_STOCK_TRANSPARENT)
1016
1017 cairo_private uint16_t
1018 _cairo_color_double_to_short (double d) cairo_const;
1019
1020 cairo_private void
1021 _cairo_color_init (cairo_color_t *color);
1022
1023 cairo_private void
1024 _cairo_color_init_rgb (cairo_color_t *color,
1025 double red, double green, double blue);
1026
1027 cairo_private void
1028 _cairo_color_init_rgba (cairo_color_t *color,
1029 double red, double green, double blue,
1030 double alpha);
1031
1032 cairo_private void
1033 _cairo_color_multiply_alpha (cairo_color_t *color,
1034 double alpha);
1035
1036 cairo_private void
1037 _cairo_color_get_rgba (cairo_color_t *color,
1038 double *red,
1039 double *green,
1040 double *blue,
1041 double *alpha);
1042
1043 cairo_private void
1044 _cairo_color_get_rgba_premultiplied (cairo_color_t *color,
1045 double *red,
1046 double *green,
1047 double *blue,
1048 double *alpha);
1049
1050 cairo_private cairo_bool_t
1051 _cairo_color_equal (const cairo_color_t *color_a,
1052 const cairo_color_t *color_b) cairo_pure;
1053
1054 cairo_private cairo_bool_t
1055 _cairo_color_stop_equal (const cairo_color_stop_t *color_a,
1056 const cairo_color_stop_t *color_b) cairo_pure;
1057
1058 cairo_private cairo_content_t
1059 _cairo_color_get_content (const cairo_color_t *color) cairo_pure;
1060
1061 /* cairo-font-face.c */
1062
1063 extern const cairo_private cairo_font_face_t _cairo_font_face_nil;
1064
1065 cairo_private void
1066 _cairo_font_face_init (cairo_font_face_t *font_face,
1067 const cairo_font_face_backend_t *backend);
1068
1069 cairo_private cairo_status_t
1070 _cairo_font_face_set_error (cairo_font_face_t *font_face,
1071 cairo_status_t status);
1072
1073 cairo_private void
1074 _cairo_unscaled_font_init (cairo_unscaled_font_t *font,
1075 const cairo_unscaled_font_backend_t *backend);
1076
1077 cairo_private_no_warn cairo_unscaled_font_t *
1078 _cairo_unscaled_font_reference (cairo_unscaled_font_t *font);
1079
1080 cairo_private void
1081 _cairo_unscaled_font_destroy (cairo_unscaled_font_t *font);
1082
1083 /* cairo-font-face-twin.c */
1084
1085 cairo_private cairo_font_face_t *
1086 _cairo_font_face_twin_create_fallback (void);
1087
1088 cairo_private cairo_status_t
1089 _cairo_font_face_twin_create_for_toy (cairo_toy_font_face_t *toy_face,
1090 cairo_font_face_t **font_face);
1091
1092 /* cairo-font-face-twin-data.c */
1093
1094 extern const cairo_private int8_t _cairo_twin_outlines[];
1095 extern const cairo_private uint16_t _cairo_twin_charmap[128];
1096
1097 /* cairo-font-options.c */
1098
1099 cairo_private void
1100 _cairo_font_options_init_default (cairo_font_options_t *options);
1101
1102 cairo_private void
1103 _cairo_font_options_init_copy (cairo_font_options_t *options,
1104 const cairo_font_options_t *other);
1105
1106 cairo_private void
1107 _cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
1108 cairo_lcd_filter_t lcd_filter);
1109
1110 cairo_private cairo_lcd_filter_t
1111 _cairo_font_options_get_lcd_filter (const cairo_font_options_t *options);
1112
1113 cairo_private void
1114 _cairo_font_options_set_round_glyph_positions (cairo_font_options_t *options,
1115 cairo_round_glyph_positions_t round);
1116
1117 cairo_private cairo_round_glyph_positions_t
1118 _cairo_font_options_get_round_glyph_positions (const cairo_font_options_t *options);
1119
1120 /* cairo-hull.c */
1121 cairo_private cairo_status_t
1122 _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
1123
1124 /* cairo-lzw.c */
1125 cairo_private unsigned char *
1126 _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out);
1127
1128 /* cairo-misc.c */
1129 cairo_private cairo_status_t
1130 _cairo_validate_text_clusters (const char *utf8,
1131 int utf8_len,
1132 const cairo_glyph_t *glyphs,
1133 int num_glyphs,
1134 const cairo_text_cluster_t *clusters,
1135 int num_clusters,
1136 cairo_text_cluster_flags_t cluster_flags);
1137
1138 cairo_private cairo_status_t
1139 _cairo_intern_string (const char **str_inout, int len);
1140
1141 cairo_private void
1142 _cairo_intern_string_reset_static_data (void);
1143
1144 /* cairo-path-fixed.c */
1145 cairo_private cairo_path_fixed_t *
1146 _cairo_path_fixed_create (void);
1147
1148 cairo_private void
1149 _cairo_path_fixed_init (cairo_path_fixed_t *path);
1150
1151 cairo_private cairo_status_t
1152 _cairo_path_fixed_init_copy (cairo_path_fixed_t *path,
1153 const cairo_path_fixed_t *other);
1154
1155 cairo_private cairo_bool_t
1156 _cairo_path_fixed_is_equal (const cairo_path_fixed_t *path,
1157 const cairo_path_fixed_t *other);
1158
1159 cairo_private void
1160 _cairo_path_fixed_fini (cairo_path_fixed_t *path);
1161
1162 cairo_private void
1163 _cairo_path_fixed_destroy (cairo_path_fixed_t *path);
1164
1165 cairo_private cairo_status_t
1166 _cairo_path_fixed_move_to (cairo_path_fixed_t *path,
1167 cairo_fixed_t x,
1168 cairo_fixed_t y);
1169
1170 cairo_private void
1171 _cairo_path_fixed_new_sub_path (cairo_path_fixed_t *path);
1172
1173 cairo_private cairo_status_t
1174 _cairo_path_fixed_rel_move_to (cairo_path_fixed_t *path,
1175 cairo_fixed_t dx,
1176 cairo_fixed_t dy);
1177
1178 cairo_private cairo_status_t
1179 _cairo_path_fixed_line_to (cairo_path_fixed_t *path,
1180 cairo_fixed_t x,
1181 cairo_fixed_t y);
1182
1183 cairo_private cairo_status_t
1184 _cairo_path_fixed_rel_line_to (cairo_path_fixed_t *path,
1185 cairo_fixed_t dx,
1186 cairo_fixed_t dy);
1187
1188 cairo_private cairo_status_t
1189 _cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
1190 cairo_fixed_t x0, cairo_fixed_t y0,
1191 cairo_fixed_t x1, cairo_fixed_t y1,
1192 cairo_fixed_t x2, cairo_fixed_t y2);
1193
1194 cairo_private cairo_status_t
1195 _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
1196 cairo_fixed_t dx0, cairo_fixed_t dy0,
1197 cairo_fixed_t dx1, cairo_fixed_t dy1,
1198 cairo_fixed_t dx2, cairo_fixed_t dy2);
1199
1200 cairo_private cairo_status_t
1201 _cairo_path_fixed_close_path (cairo_path_fixed_t *path);
1202
1203 cairo_private cairo_bool_t
1204 _cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
1205 cairo_fixed_t *x,
1206 cairo_fixed_t *y);
1207
1208 typedef cairo_status_t
1209 (cairo_path_fixed_move_to_func_t) (void *closure,
1210 const cairo_point_t *point);
1211
1212 typedef cairo_status_t
1213 (cairo_path_fixed_line_to_func_t) (void *closure,
1214 const cairo_point_t *point);
1215
1216 typedef cairo_status_t
1217 (cairo_path_fixed_curve_to_func_t) (void *closure,
1218 const cairo_point_t *p0,
1219 const cairo_point_t *p1,
1220 const cairo_point_t *p2);
1221
1222 typedef cairo_status_t
1223 (cairo_path_fixed_close_path_func_t) (void *closure);
1224
1225 cairo_private cairo_status_t
1226 _cairo_path_fixed_interpret (const cairo_path_fixed_t *path,
1227 cairo_direction_t dir,
1228 cairo_path_fixed_move_to_func_t *move_to,
1229 cairo_path_fixed_line_to_func_t *line_to,
1230 cairo_path_fixed_curve_to_func_t *curve_to,
1231 cairo_path_fixed_close_path_func_t *close_path,
1232 void *closure);
1233
1234 cairo_private cairo_status_t
1235 _cairo_path_fixed_interpret_flat (const cairo_path_fixed_t *path,
1236 cairo_direction_t dir,
1237 cairo_path_fixed_move_to_func_t *move_to,
1238 cairo_path_fixed_line_to_func_t *line_to,
1239 cairo_path_fixed_close_path_func_t *close_path,
1240 void *closure,
1241 double tolerance);
1242
1243 cairo_private cairo_bool_t
1244 _cairo_path_fixed_extents (const cairo_path_fixed_t *path,
1245 cairo_box_t *box);
1246
1247 cairo_private void
1248 _cairo_path_fixed_approximate_clip_extents (const cairo_path_fixed_t *path,
1249 cairo_rectangle_int_t *extents);
1250
1251 cairo_private void
1252 _cairo_path_fixed_approximate_fill_extents (const cairo_path_fixed_t *path,
1253 cairo_rectangle_int_t *extents);
1254
1255 cairo_private void
1256 _cairo_path_fixed_fill_extents (const cairo_path_fixed_t *path,
1257 cairo_fill_rule_t fill_rule,
1258 double tolerance,
1259 cairo_rectangle_int_t *extents);
1260
1261 cairo_private void
1262 _cairo_path_fixed_approximate_stroke_extents (const cairo_path_fixed_t *path,
1263 const cairo_stroke_style_t *style,
1264 const cairo_matrix_t *ctm,
1265 cairo_rectangle_int_t *extents);
1266
1267 cairo_private cairo_status_t
1268 _cairo_path_fixed_stroke_extents (const cairo_path_fixed_t *path,
1269 const cairo_stroke_style_t *style,
1270 const cairo_matrix_t *ctm,
1271 const cairo_matrix_t *ctm_inverse,
1272 double tolerance,
1273 cairo_rectangle_int_t *extents);
1274
1275 cairo_private void
1276 _cairo_path_fixed_transform (cairo_path_fixed_t *path,
1277 const cairo_matrix_t *matrix);
1278
1279 cairo_private cairo_bool_t
1280 _cairo_path_fixed_is_box (const cairo_path_fixed_t *path,
1281 cairo_box_t *box);
1282
1283 cairo_private cairo_bool_t
1284 _cairo_path_fixed_is_rectangle (const cairo_path_fixed_t *path,
1285 cairo_box_t *box);
1286
1287 /* cairo-path-in-fill.c */
1288 cairo_private cairo_bool_t
1289 _cairo_path_fixed_in_fill (const cairo_path_fixed_t *path,
1290 cairo_fill_rule_t fill_rule,
1291 double tolerance,
1292 double x,
1293 double y);
1294
1295 /* cairo-path-fill.c */
1296 cairo_private cairo_status_t
1297 _cairo_path_fixed_fill_to_polygon (const cairo_path_fixed_t *path,
1298 double tolerance,
1299 cairo_polygon_t *polygon);
1300
1301 cairo_private cairo_int_status_t
1302 _cairo_path_fixed_fill_rectilinear_to_traps (const cairo_path_fixed_t *path,
1303 cairo_fill_rule_t fill_rule,
1304 cairo_traps_t *traps);
1305
1306 cairo_private cairo_status_t
1307 _cairo_path_fixed_fill_rectilinear_to_boxes (const cairo_path_fixed_t *path,
1308 cairo_fill_rule_t fill_rule,
1309 cairo_boxes_t *boxes);
1310
1311 cairo_private cairo_region_t *
1312 _cairo_path_fixed_fill_rectilinear_to_region (const cairo_path_fixed_t *path,
1313 cairo_fill_rule_t fill_rule,
1314 const cairo_rectangle_int_t *extents);
1315
1316 cairo_private cairo_status_t
1317 _cairo_path_fixed_fill_to_traps (const cairo_path_fixed_t *path,
1318 cairo_fill_rule_t fill_rule,
1319 double tolerance,
1320 cairo_traps_t *traps);
1321
1322 /* cairo-path-stroke.c */
1323 cairo_private cairo_status_t
1324 _cairo_path_fixed_stroke_to_polygon (const cairo_path_fixed_t *path,
1325 const cairo_stroke_style_t *stroke_style,
1326 const cairo_matrix_t *ctm,
1327 const cairo_matrix_t *ctm_inverse,
1328 double tolerance,
1329 cairo_polygon_t *polygon);
1330
1331 cairo_private cairo_int_status_t
1332 _cairo_path_fixed_stroke_rectilinear_to_traps (const cairo_path_fixed_t *path,
1333 const cairo_stroke_style_t *stroke_style,
1334 const cairo_matrix_t *ctm,
1335 cairo_traps_t *traps);
1336
1337 cairo_private cairo_int_status_t
1338 _cairo_path_fixed_stroke_rectilinear_to_boxes (const cairo_path_fixed_t *path,
1339 const cairo_stroke_style_t *stroke_style,
1340 const cairo_matrix_t *ctm,
1341 cairo_boxes_t *boxes);
1342
1343 cairo_private cairo_status_t
1344 _cairo_path_fixed_stroke_to_traps (const cairo_path_fixed_t *path,
1345 const cairo_stroke_style_t *stroke_style,
1346 const cairo_matrix_t *ctm,
1347 const cairo_matrix_t *ctm_inverse,
1348 double tolerance,
1349 cairo_traps_t *traps);
1350
1351 cairo_private cairo_status_t
1352 _cairo_path_fixed_stroke_to_shaper (cairo_path_fixed_t *path,
1353 const cairo_stroke_style_t *stroke_style,
1354 const cairo_matrix_t *ctm,
1355 const cairo_matrix_t *ctm_inverse,
1356 double tolerance,
1357 cairo_status_t (*add_triangle) (void *closure,
1358 const cairo_point_t triangle[3]),
1359 cairo_status_t (*add_triangle_fan) (void *closure,
1360 const cairo_point_t *midpt,
1361 const cairo_point_t *points,
1362 int npoints),
1363 cairo_status_t (*add_quad) (void *closure,
1364 const cairo_point_t quad[4]),
1365 void *closure);
1366
1367 /* cairo-scaled-font.c */
1368
1369 cairo_private void
1370 _cairo_scaled_font_freeze_cache (cairo_scaled_font_t *scaled_font);
1371
1372 cairo_private void
1373 _cairo_scaled_font_thaw_cache (cairo_scaled_font_t *scaled_font);
1374
1375 cairo_private void
1376 _cairo_scaled_font_reset_cache (cairo_scaled_font_t *scaled_font);
1377
1378 cairo_private cairo_status_t
1379 _cairo_scaled_font_set_error (cairo_scaled_font_t *scaled_font,
1380 cairo_status_t status);
1381
1382 cairo_private cairo_scaled_font_t *
1383 _cairo_scaled_font_create_in_error (cairo_status_t status);
1384
1385 cairo_private void
1386 _cairo_scaled_font_reset_static_data (void);
1387
1388 cairo_private cairo_status_t
1389 _cairo_scaled_font_register_placeholder_and_unlock_font_map (cairo_scaled_font_t *scaled_font);
1390
1391 cairo_private void
1392 _cairo_scaled_font_unregister_placeholder_and_lock_font_map (cairo_scaled_font_t *scaled_font);
1393
1394 cairo_private cairo_status_t
1395 _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
1396 cairo_font_face_t *font_face,
1397 const cairo_matrix_t *font_matrix,
1398 const cairo_matrix_t *ctm,
1399 const cairo_font_options_t *options,
1400 const cairo_scaled_font_backend_t *backend);
1401
1402 cairo_private cairo_status_t
1403 _cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
1404 cairo_font_extents_t *fs_metrics);
1405
1406 /* This should only be called on an error path by a scaled_font constructor */
1407 cairo_private void
1408 _cairo_scaled_font_fini (cairo_scaled_font_t *scaled_font);
1409
1410 cairo_private cairo_status_t
1411 _cairo_scaled_font_font_extents (cairo_scaled_font_t *scaled_font,
1412 cairo_font_extents_t *extents);
1413
1414 cairo_private cairo_status_t
1415 _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
1416 const cairo_glyph_t *glyphs,
1417 int num_glyphs,
1418 cairo_rectangle_int_t *extents,
1419 cairo_bool_t *overlap);
1420
1421 cairo_private void
1422 _cairo_scaled_font_glyph_approximate_extents (cairo_scaled_font_t *scaled_font,
1423 const cairo_glyph_t *glyphs,
1424 int num_glyphs,
1425 cairo_rectangle_int_t *extents);
1426
1427 cairo_private cairo_status_t
1428 _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
1429 cairo_operator_t op,
1430 const cairo_pattern_t *source,
1431 cairo_surface_t *surface,
1432 int source_x,
1433 int source_y,
1434 int dest_x,
1435 int dest_y,
1436 unsigned int width,
1437 unsigned int height,
1438 cairo_glyph_t *glyphs,
1439 int num_glyphs,
1440 cairo_region_t *clip_region);
1441
1442 cairo_private cairo_status_t
1443 _cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
1444 const cairo_glyph_t *glyphs,
1445 int num_glyphs,
1446 cairo_path_fixed_t *path);
1447
1448 cairo_private void
1449 _cairo_scaled_glyph_set_metrics (cairo_scaled_glyph_t *scaled_glyph,
1450 cairo_scaled_font_t *scaled_font,
1451 cairo_text_extents_t *fs_metrics);
1452
1453 cairo_private void
1454 _cairo_scaled_glyph_set_surface (cairo_scaled_glyph_t *scaled_glyph,
1455 cairo_scaled_font_t *scaled_font,
1456 cairo_image_surface_t *surface);
1457
1458 cairo_private void
1459 _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
1460 cairo_scaled_font_t *scaled_font,
1461 cairo_path_fixed_t *path);
1462
1463 cairo_private void
1464 _cairo_scaled_glyph_set_recording_surface (cairo_scaled_glyph_t *scaled_glyph,
1465 cairo_scaled_font_t *scaled_font,
1466 cairo_surface_t *recording_surface);
1467
1468 cairo_private cairo_int_status_t
1469 _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
1470 unsigned long index,
1471 cairo_scaled_glyph_info_t info,
1472 cairo_scaled_glyph_t **scaled_glyph_ret);
1473
1474 cairo_private double
1475 _cairo_scaled_font_get_max_scale (cairo_scaled_font_t *scaled_font);
1476
1477 cairo_private void
1478 _cairo_scaled_font_map_destroy (void);
1479
1480 /* cairo-stroke-style.c */
1481
1482 cairo_private void
1483 _cairo_stroke_style_init (cairo_stroke_style_t *style);
1484
1485 cairo_private cairo_status_t
1486 _cairo_stroke_style_init_copy (cairo_stroke_style_t *style,
1487 const cairo_stroke_style_t *other);
1488
1489 cairo_private void
1490 _cairo_stroke_style_fini (cairo_stroke_style_t *style);
1491
1492 cairo_private void
1493 _cairo_stroke_style_max_distance_from_path (const cairo_stroke_style_t *style,
1494 const cairo_matrix_t *ctm,
1495 double *dx, double *dy);
1496
1497 cairo_private double
1498 _cairo_stroke_style_dash_period (const cairo_stroke_style_t *style);
1499
1500 cairo_private double
1501 _cairo_stroke_style_dash_stroked (const cairo_stroke_style_t *style);
1502
1503 cairo_private cairo_bool_t
1504 _cairo_stroke_style_dash_can_approximate (const cairo_stroke_style_t *style,
1505 const cairo_matrix_t *ctm,
1506 double tolerance);
1507
1508 cairo_private void
1509 _cairo_stroke_style_dash_approximate (const cairo_stroke_style_t *style,
1510 const cairo_matrix_t *ctm,
1511 double tolerance,
1512 double *dash_offset,
1513 double *dashes,
1514 unsigned int *num_dashes);
1515
1516
1517 /* cairo-surface.c */
1518
1519 cairo_private cairo_surface_t *
1520 _cairo_surface_create_in_error (cairo_status_t status);
1521
1522 cairo_private cairo_status_t
1523 _cairo_surface_copy_mime_data (cairo_surface_t *dst,
1524 cairo_surface_t *src);
1525
1526 cairo_private cairo_status_t
1527 _cairo_surface_set_error (cairo_surface_t *surface,
1528 cairo_status_t status);
1529
1530 cairo_private void
1531 _cairo_surface_set_resolution (cairo_surface_t *surface,
1532 double x_res,
1533 double y_res);
1534
1535 cairo_private cairo_surface_t *
1536 _cairo_surface_create_similar_scratch (cairo_surface_t *other,
1537 cairo_content_t content,
1538 int width,
1539 int height);
1540
1541 cairo_private cairo_surface_t *
1542 _cairo_surface_create_similar_solid (cairo_surface_t *other,
1543 cairo_content_t content,
1544 int width,
1545 int height,
1546 const cairo_color_t *color,
1547 cairo_bool_t allow_fallback);
1548
1549 cairo_private cairo_surface_t *
1550 _cairo_surface_create_solid_pattern_surface (cairo_surface_t *other,
1551 const cairo_solid_pattern_t *solid_pattern);
1552
1553 cairo_private cairo_int_status_t
1554 _cairo_surface_repaint_solid_pattern_surface (cairo_surface_t *other,
1555 cairo_surface_t *solid_surface,
1556 const cairo_solid_pattern_t *solid_pattern);
1557
1558 cairo_private void
1559 _cairo_surface_init (cairo_surface_t *surface,
1560 const cairo_surface_backend_t *backend,
1561 cairo_device_t *device,
1562 cairo_content_t content);
1563
1564 cairo_private void
1565 _cairo_surface_set_font_options (cairo_surface_t *surface,
1566 cairo_font_options_t *options);
1567
1568 cairo_private cairo_status_t
1569 _cairo_surface_composite (cairo_operator_t op,
1570 const cairo_pattern_t *src,
1571 const cairo_pattern_t *mask,
1572 cairo_surface_t *dst,
1573 int src_x,
1574 int src_y,
1575 int mask_x,
1576 int mask_y,
1577 int dst_x,
1578 int dst_y,
1579 unsigned int width,
1580 unsigned int height,
1581 cairo_region_t *clip_region);
1582
1583 cairo_private cairo_status_t
1584 _cairo_surface_fill_rectangle (cairo_surface_t *surface,
1585 cairo_operator_t op,
1586 const cairo_color_t *color,
1587 int x,
1588 int y,
1589 int width,
1590 int height);
1591
1592 cairo_private cairo_status_t
1593 _cairo_surface_fill_region (cairo_surface_t *surface,
1594 cairo_operator_t op,
1595 const cairo_color_t *color,
1596 cairo_region_t *region);
1597
1598 cairo_private cairo_status_t
1599 _cairo_surface_fill_rectangles (cairo_surface_t *surface,
1600 cairo_operator_t op,
1601 const cairo_color_t *color,
1602 cairo_rectangle_int_t *rects,
1603 int num_rects);
1604
1605 cairo_private cairo_status_t
1606 _cairo_surface_paint (cairo_surface_t *surface,
1607 cairo_operator_t op,
1608 const cairo_pattern_t *source,
1609 cairo_clip_t *clip);
1610
1611 cairo_private cairo_status_t
1612 _cairo_surface_mask (cairo_surface_t *surface,
1613 cairo_operator_t op,
1614 const cairo_pattern_t *source,
1615 const cairo_pattern_t *mask,
1616 cairo_clip_t *clip);
1617
1618 cairo_private cairo_status_t
1619 _cairo_surface_fill_stroke (cairo_surface_t *surface,
1620 cairo_operator_t fill_op,
1621 const cairo_pattern_t *fill_source,
1622 cairo_fill_rule_t fill_rule,
1623 double fill_tolerance,
1624 cairo_antialias_t fill_antialias,
1625 cairo_path_fixed_t *path,
1626 cairo_operator_t stroke_op,
1627 const cairo_pattern_t *stroke_source,
1628 const cairo_stroke_style_t *stroke_style,
1629 const cairo_matrix_t *stroke_ctm,
1630 const cairo_matrix_t *stroke_ctm_inverse,
1631 double stroke_tolerance,
1632 cairo_antialias_t stroke_antialias,
1633 cairo_clip_t *clip);
1634
1635 cairo_private cairo_status_t
1636 _cairo_surface_stroke (cairo_surface_t *surface,
1637 cairo_operator_t op,
1638 const cairo_pattern_t *source,
1639 cairo_path_fixed_t *path,
1640 const cairo_stroke_style_t *style,
1641 const cairo_matrix_t *ctm,
1642 const cairo_matrix_t *ctm_inverse,
1643 double tolerance,
1644 cairo_antialias_t antialias,
1645 cairo_clip_t *clip);
1646
1647 cairo_private cairo_status_t
1648 _cairo_surface_fill (cairo_surface_t *surface,
1649 cairo_operator_t op,
1650 const cairo_pattern_t *source,
1651 cairo_path_fixed_t *path,
1652 cairo_fill_rule_t fill_rule,
1653 double tolerance,
1654 cairo_antialias_t antialias,
1655 cairo_clip_t *clip);
1656
1657 cairo_private cairo_status_t
1658 _cairo_surface_show_text_glyphs (cairo_surface_t *surface,
1659 cairo_operator_t op,
1660 const cairo_pattern_t *source,
1661 const char *utf8,
1662 int utf8_len,
1663 cairo_glyph_t *glyphs,
1664 int num_glyphs,
1665 const cairo_text_cluster_t *clusters,
1666 int num_clusters,
1667 cairo_text_cluster_flags_t cluster_flags,
1668 cairo_scaled_font_t *scaled_font,
1669 cairo_clip_t *clip);
1670
1671 cairo_private cairo_status_t
1672 _cairo_surface_paint_extents (cairo_surface_t *surface,
1673 cairo_operator_t op,
1674 const cairo_pattern_t *source,
1675 cairo_clip_t *clip,
1676 cairo_rectangle_int_t *extents);
1677
1678 cairo_private cairo_status_t
1679 _cairo_surface_mask_extents (cairo_surface_t *surface,
1680 cairo_operator_t op,
1681 const cairo_pattern_t *source,
1682 const cairo_pattern_t *mask,
1683 cairo_clip_t *clip,
1684 cairo_rectangle_int_t *extents);
1685
1686 cairo_private cairo_status_t
1687 _cairo_surface_stroke_extents (cairo_surface_t *surface,
1688 cairo_operator_t op,
1689 const cairo_pattern_t *source,
1690 cairo_path_fixed_t *path,
1691 const cairo_stroke_style_t *style,
1692 const cairo_matrix_t *ctm,
1693 const cairo_matrix_t *ctm_inverse,
1694 double tolerance,
1695 cairo_antialias_t antialias,
1696 cairo_clip_t *clip,
1697 cairo_rectangle_int_t *extents);
1698
1699 cairo_private cairo_status_t
1700 _cairo_surface_fill_extents (cairo_surface_t *surface,
1701 cairo_operator_t op,
1702 const cairo_pattern_t *source,
1703 cairo_path_fixed_t *path,
1704 cairo_fill_rule_t fill_rule,
1705 double tolerance,
1706 cairo_antialias_t antialias,
1707 cairo_clip_t *clip,
1708 cairo_rectangle_int_t *extents);
1709
1710 cairo_private cairo_status_t
1711 _cairo_surface_glyphs_extents (cairo_surface_t *surface,
1712 cairo_operator_t op,
1713 const cairo_pattern_t *source,
1714 cairo_glyph_t *glyphs,
1715 int num_glyphs,
1716 cairo_scaled_font_t *scaled_font,
1717 cairo_clip_t *clip,
1718 cairo_rectangle_int_t *extents);
1719
1720 cairo_private cairo_status_t
1721 _cairo_surface_composite_trapezoids (cairo_operator_t op,
1722 const cairo_pattern_t *pattern,
1723 cairo_surface_t *dst,
1724 cairo_antialias_t antialias,
1725 int src_x,
1726 int src_y,
1727 int dst_x,
1728 int dst_y,
1729 unsigned int width,
1730 unsigned int height,
1731 cairo_trapezoid_t *traps,
1732 int ntraps,
1733 cairo_region_t *clip_region);
1734
1735 cairo_private cairo_span_renderer_t *
1736 _cairo_surface_create_span_renderer (cairo_operator_t op,
1737 const cairo_pattern_t *pattern,
1738 cairo_surface_t *dst,
1739 cairo_antialias_t antialias,
1740 const cairo_composite_rectangles_t *rects,
1741 cairo_region_t *clip_region);
1742
1743 cairo_private cairo_bool_t
1744 _cairo_surface_check_span_renderer (cairo_operator_t op,
1745 const cairo_pattern_t *pattern,
1746 cairo_surface_t *dst,
1747 cairo_antialias_t antialias);
1748
1749 cairo_private cairo_status_t
1750 _cairo_surface_acquire_source_image (cairo_surface_t *surface,
1751 cairo_image_surface_t **image_out,
1752 void **image_extra);
1753
1754 cairo_private void
1755 _cairo_surface_release_source_image (cairo_surface_t *surface,
1756 cairo_image_surface_t *image,
1757 void *image_extra);
1758
1759 cairo_private cairo_status_t
1760 _cairo_surface_acquire_dest_image (cairo_surface_t *surface,
1761 cairo_rectangle_int_t *interest_rect,
1762 cairo_image_surface_t **image_out,
1763 cairo_rectangle_int_t *image_rect,
1764 void **image_extra);
1765
1766 cairo_private void
1767 _cairo_surface_release_dest_image (cairo_surface_t *surface,
1768 cairo_rectangle_int_t *interest_rect,
1769 cairo_image_surface_t *image,
1770 cairo_rectangle_int_t *image_rect,
1771 void *image_extra);
1772
1773 cairo_private cairo_status_t
1774 _cairo_surface_clone_similar (cairo_surface_t *surface,
1775 cairo_surface_t *src,
1776 int src_x,
1777 int src_y,
1778 int width,
1779 int height,
1780 int *clone_offset_x,
1781 int *clone_offset_y,
1782 cairo_surface_t **clone_out);
1783
1784 cairo_private cairo_surface_t *
1785 _cairo_surface_snapshot (cairo_surface_t *surface);
1786
1787 cairo_private cairo_surface_t *
1788 _cairo_surface_has_snapshot (cairo_surface_t *surface,
1789 const cairo_surface_backend_t *backend);
1790
1791 cairo_private cairo_bool_t
1792 _cairo_surface_is_similar (cairo_surface_t *surface_a,
1793 cairo_surface_t *surface_b);
1794
1795 cairo_private cairo_bool_t
1796 _cairo_surface_get_extents (cairo_surface_t *surface,
1797 cairo_rectangle_int_t *extents);
1798
1799 cairo_private cairo_status_t
1800 _cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
1801 cairo_operator_t op,
1802 const cairo_pattern_t *pattern,
1803 cairo_surface_t *surface,
1804 int source_x,
1805 int source_y,
1806 int dest_x,
1807 int dest_y,
1808 unsigned int width,
1809 unsigned int height,
1810 cairo_glyph_t *glyphs,
1811 int num_glyphs,
1812 cairo_region_t *clip_region);
1813
1814 cairo_private cairo_status_t
1815 _cairo_surface_composite_fixup_unbounded (cairo_surface_t *dst,
1816 cairo_surface_attributes_t *src_attr,
1817 int src_width,
1818 int src_height,
1819 cairo_surface_attributes_t *mask_attr,
1820 int mask_width,
1821 int mask_height,
1822 int src_x,
1823 int src_y,
1824 int mask_x,
1825 int mask_y,
1826 int dst_x,
1827 int dst_y,
1828 unsigned int width,
1829 unsigned int height,
1830 cairo_region_t *clip_region);
1831
1832 cairo_private cairo_status_t
1833 _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst,
1834 cairo_surface_attributes_t *src_attr,
1835 int src_width,
1836 int src_height,
1837 int mask_width,
1838 int mask_height,
1839 int src_x,
1840 int src_y,
1841 int mask_x,
1842 int mask_y,
1843 int dst_x,
1844 int dst_y,
1845 unsigned int width,
1846 unsigned int height,
1847 cairo_region_t *clip_region);
1848
1849 cairo_private cairo_bool_t
1850 _cairo_surface_is_opaque (const cairo_surface_t *surface);
1851
1852 cairo_private int
1853 _cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface);
1854
1855 cairo_private void
1856 _cairo_surface_set_device_scale (cairo_surface_t *surface,
1857 double sx,
1858 double sy);
1859
1860 cairo_private cairo_bool_t
1861 _cairo_surface_has_device_transform (cairo_surface_t *surface) cairo_pure;
1862
1863 cairo_private void
1864 _cairo_surface_release_device_reference (cairo_surface_t *surface);
1865
1866 /* cairo-image-surface.c */
1867
1868 /* XXX: In cairo 1.2.0 we added a new %CAIRO_FORMAT_RGB16_565 but
1869 * neglected to adjust this macro. The net effect is that it's
1870 * impossible to externally create an image surface with this
1871 * format. This is perhaps a good thing since we also neglected to fix
1872 * up things like cairo_surface_write_to_png() for the new format
1873 * (-Wswitch-enum will tell you where). Is it obvious that format was
1874 * added in haste?
1875 *
1876 * The reason for the new format was to allow the xlib backend to be
1877 * used on X servers with a 565 visual. So the new format did its job
1878 * for that, even without being considered "valid" for the sake of
1879 * things like cairo_image_surface_create().
1880 *
1881 * Since 1.2.0 we ran into the same situtation with X servers with BGR
1882 * visuals. This time we invented #cairo_internal_format_t instead,
1883 * (see it for more discussion).
1884 *
1885 * The punchline is that %CAIRO_FORMAT_VALID must not conside any
1886 * internal format to be valid. Also we need to decide if the
1887 * RGB16_565 should be moved to instead be an internal format. If so,
1888 * this macro need not change for it. (We probably will need to leave
1889 * an RGB16_565 value in the header files for the sake of code that
1890 * might have that value in it.)
1891 *
1892 * If we do decide to start fully supporting RGB16_565 as an external
1893 * format, then %CAIRO_FORMAT_VALID needs to be adjusted to include
1894 * it. But that should not happen before all necessary code is fixed
1895 * to support it (at least cairo_surface_write_to_png() and a few spots
1896 * in cairo-xlib-surface.c--again see -Wswitch-enum).
1897 */
1898 #define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \
1899 (format) <= CAIRO_FORMAT_RGB16_565)
1900
1901 /* pixman-required stride alignment in bytes. */
1902 #define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
1903 #define CAIRO_STRIDE_FOR_WIDTH_BPP(w,bpp) \
1904 ((((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & -CAIRO_STRIDE_ALIGNMENT)
1905
1906 #define CAIRO_CONTENT_VALID(content) ((content) && \
1907 (((content) & ~(CAIRO_CONTENT_COLOR | \
1908 CAIRO_CONTENT_ALPHA | \
1909 CAIRO_CONTENT_COLOR_ALPHA))\
1910 == 0))
1911
1912 static inline cairo_bool_t
_cairo_valid_stride_alignment(int stride)1913 _cairo_valid_stride_alignment(int stride)
1914 {
1915 return !(stride & (CAIRO_STRIDE_ALIGNMENT-1));
1916 }
1917
1918 cairo_private int
1919 _cairo_format_bits_per_pixel (cairo_format_t format) cairo_const;
1920
1921 cairo_private cairo_format_t
1922 _cairo_format_from_content (cairo_content_t content) cairo_const;
1923
1924 cairo_private cairo_format_t
1925 _cairo_format_from_pixman_format (pixman_format_code_t pixman_format);
1926
1927 cairo_private cairo_content_t
1928 _cairo_content_from_format (cairo_format_t format) cairo_const;
1929
1930 cairo_private cairo_content_t
1931 _cairo_content_from_pixman_format (pixman_format_code_t pixman_format);
1932
1933 cairo_private cairo_surface_t *
1934 _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
1935 pixman_format_code_t pixman_format);
1936
1937 cairo_private pixman_format_code_t
1938 _cairo_format_to_pixman_format_code (cairo_format_t format);
1939
1940 cairo_private cairo_bool_t
1941 _pixman_format_from_masks (cairo_format_masks_t *masks,
1942 pixman_format_code_t *format_ret);
1943
1944 cairo_private cairo_bool_t
1945 _pixman_format_to_masks (pixman_format_code_t pixman_format,
1946 cairo_format_masks_t *masks);
1947
1948 cairo_private void
1949 _cairo_image_reset_static_data (void);
1950
1951 cairo_private cairo_surface_t *
1952 _cairo_image_surface_create_with_pixman_format (unsigned char *data,
1953 pixman_format_code_t pixman_format,
1954 int width,
1955 int height,
1956 int stride);
1957
1958 cairo_private cairo_surface_t *
1959 _cairo_image_surface_create_with_content (cairo_content_t content,
1960 int width,
1961 int height);
1962
1963 cairo_private void
1964 _cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface);
1965
1966 cairo_private cairo_image_surface_t *
1967 _cairo_image_surface_coerce (cairo_image_surface_t *surface);
1968
1969 cairo_private cairo_image_surface_t *
1970 _cairo_image_surface_coerce_to_format (cairo_image_surface_t *surface,
1971 cairo_format_t format);
1972
1973 cairo_private void
1974 _cairo_image_surface_span_render_row (int y,
1975 const cairo_half_open_span_t *spans,
1976 unsigned num_spans,
1977 uint8_t *data,
1978 uint32_t stride);
1979
1980 cairo_private cairo_image_transparency_t
1981 _cairo_image_analyze_transparency (cairo_image_surface_t *image);
1982
1983 cairo_private cairo_bool_t
1984 _cairo_surface_is_image (const cairo_surface_t *surface) cairo_pure;
1985
1986 cairo_private cairo_bool_t
1987 _cairo_surface_is_recording (const cairo_surface_t *surface) cairo_pure;
1988
1989 /* cairo-pen.c */
1990 cairo_private cairo_status_t
1991 _cairo_pen_init (cairo_pen_t *pen,
1992 double radius,
1993 double tolerance,
1994 const cairo_matrix_t *ctm);
1995
1996 cairo_private void
1997 _cairo_pen_init_empty (cairo_pen_t *pen);
1998
1999 cairo_private cairo_status_t
2000 _cairo_pen_init_copy (cairo_pen_t *pen, const cairo_pen_t *other);
2001
2002 cairo_private void
2003 _cairo_pen_fini (cairo_pen_t *pen);
2004
2005 cairo_private cairo_status_t
2006 _cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points);
2007
2008 cairo_private cairo_status_t
2009 _cairo_pen_add_points_for_slopes (cairo_pen_t *pen,
2010 cairo_point_t *a,
2011 cairo_point_t *b,
2012 cairo_point_t *c,
2013 cairo_point_t *d);
2014
2015 cairo_private int
2016 _cairo_pen_find_active_cw_vertex_index (const cairo_pen_t *pen,
2017 const cairo_slope_t *slope);
2018
2019 cairo_private int
2020 _cairo_pen_find_active_ccw_vertex_index (const cairo_pen_t *pen,
2021 const cairo_slope_t *slope);
2022
2023 /* cairo-polygon.c */
2024 cairo_private void
2025 _cairo_polygon_init (cairo_polygon_t *polygon);
2026
2027 cairo_private void
2028 _cairo_polygon_limit (cairo_polygon_t *polygon,
2029 const cairo_box_t *boxes,
2030 int num_boxes);
2031
2032 cairo_private void
2033 _cairo_polygon_fini (cairo_polygon_t *polygon);
2034
2035 cairo_private cairo_status_t
2036 _cairo_polygon_add_line (cairo_polygon_t *polygon,
2037 const cairo_line_t *line,
2038 int top, int bottom,
2039 int dir);
2040
2041 cairo_private cairo_status_t
2042 _cairo_polygon_add_external_edge (void *polygon,
2043 const cairo_point_t *p1,
2044 const cairo_point_t *p2);
2045
2046 cairo_private cairo_status_t
2047 _cairo_polygon_move_to (cairo_polygon_t *polygon,
2048 const cairo_point_t *point);
2049
2050 cairo_private cairo_status_t
2051 _cairo_polygon_line_to (cairo_polygon_t *polygon,
2052 const cairo_point_t *point);
2053
2054 cairo_private cairo_status_t
2055 _cairo_polygon_close (cairo_polygon_t *polygon);
2056
2057 #define _cairo_polygon_status(P) ((cairo_polygon_t *) (P))->status
2058
2059 /* cairo-spline.c */
2060 cairo_private cairo_bool_t
2061 _cairo_spline_init (cairo_spline_t *spline,
2062 cairo_spline_add_point_func_t add_point_func,
2063 void *closure,
2064 const cairo_point_t *a, const cairo_point_t *b,
2065 const cairo_point_t *c, const cairo_point_t *d);
2066
2067 cairo_private cairo_status_t
2068 _cairo_spline_decompose (cairo_spline_t *spline, double tolerance);
2069
2070 cairo_private cairo_status_t
2071 _cairo_spline_bound (cairo_spline_add_point_func_t add_point_func,
2072 void *closure,
2073 const cairo_point_t *p0, const cairo_point_t *p1,
2074 const cairo_point_t *p2, const cairo_point_t *p3);
2075
2076 /* cairo-matrix.c */
2077 cairo_private void
2078 _cairo_matrix_get_affine (const cairo_matrix_t *matrix,
2079 double *xx, double *yx,
2080 double *xy, double *yy,
2081 double *x0, double *y0);
2082
2083 cairo_private void
2084 _cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
2085 double *x1, double *y1,
2086 double *x2, double *y2,
2087 cairo_bool_t *is_tight);
2088
2089 cairo_private void
2090 _cairo_matrix_transform_bounding_box_fixed (const cairo_matrix_t *matrix,
2091 cairo_box_t *bbox,
2092 cairo_bool_t *is_tight);
2093
2094 cairo_private cairo_bool_t
2095 _cairo_matrix_is_invertible (const cairo_matrix_t *matrix) cairo_pure;
2096
2097 cairo_private cairo_bool_t
2098 _cairo_matrix_is_scale_0 (const cairo_matrix_t *matrix) cairo_pure;
2099
2100 cairo_private double
2101 _cairo_matrix_compute_determinant (const cairo_matrix_t *matrix) cairo_pure;
2102
2103 cairo_private cairo_status_t
2104 _cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
2105 double *sx, double *sy, int x_major);
2106
2107 cairo_private cairo_bool_t
2108 _cairo_matrix_is_identity (const cairo_matrix_t *matrix) cairo_pure;
2109
2110 cairo_private cairo_bool_t
2111 _cairo_matrix_is_translation (const cairo_matrix_t *matrix) cairo_pure;
2112
2113 cairo_private cairo_bool_t
2114 _cairo_matrix_is_integer_translation(const cairo_matrix_t *matrix,
2115 int *itx, int *ity);
2116
2117 cairo_private cairo_bool_t
2118 _cairo_matrix_has_unity_scale (const cairo_matrix_t *matrix);
2119
2120 cairo_private cairo_bool_t
2121 _cairo_matrix_is_pixel_exact (const cairo_matrix_t *matrix) cairo_pure;
2122
2123 cairo_private void
2124 _cairo_matrix_transformed_circle_axes (const cairo_matrix_t *matrix,
2125 double radius,
2126 double *major,
2127 double *minor);
2128
2129 cairo_private double
2130 _cairo_matrix_transformed_circle_major_axis (const cairo_matrix_t *matrix,
2131 double radius) cairo_pure;
2132
2133 cairo_private void
2134 _cairo_matrix_to_pixman_matrix (const cairo_matrix_t *matrix,
2135 pixman_transform_t *pixman_transform,
2136 double xc,
2137 double yc);
2138
2139 /* cairo-traps.c */
2140 cairo_private void
2141 _cairo_traps_init (cairo_traps_t *traps);
2142
2143 cairo_private void
2144 _cairo_traps_limit (cairo_traps_t *traps,
2145 const cairo_box_t *boxes,
2146 int num_boxes);
2147
2148 cairo_private cairo_status_t
2149 _cairo_traps_init_boxes (cairo_traps_t *traps,
2150 const cairo_boxes_t *boxes);
2151
2152 cairo_private void
2153 _cairo_traps_clear (cairo_traps_t *traps);
2154
2155 cairo_private void
2156 _cairo_traps_fini (cairo_traps_t *traps);
2157
2158 #define _cairo_traps_status(T) (T)->status
2159
2160 cairo_private void
2161 _cairo_traps_translate (cairo_traps_t *traps, int x, int y);
2162
2163 cairo_private cairo_status_t
2164 _cairo_traps_tessellate_rectangle (cairo_traps_t *traps,
2165 const cairo_point_t *top_left,
2166 const cairo_point_t *bottom_right);
2167
2168 cairo_private void
2169 _cairo_traps_add_trap (cairo_traps_t *traps,
2170 cairo_fixed_t top, cairo_fixed_t bottom,
2171 cairo_line_t *left, cairo_line_t *right);
2172
2173 cairo_private cairo_status_t
2174 _cairo_bentley_ottmann_tessellate_rectilinear_polygon (cairo_traps_t *traps,
2175 const cairo_polygon_t *polygon,
2176 cairo_fill_rule_t fill_rule);
2177
2178 cairo_private cairo_status_t
2179 _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps,
2180 const cairo_polygon_t *polygon,
2181 cairo_fill_rule_t fill_rule);
2182
2183 cairo_private cairo_status_t
2184 _cairo_bentley_ottmann_tessellate_traps (cairo_traps_t *traps,
2185 cairo_fill_rule_t fill_rule);
2186
2187 cairo_private cairo_status_t
2188 _cairo_bentley_ottmann_tessellate_rectangular_traps (cairo_traps_t *traps,
2189 cairo_fill_rule_t fill_rule);
2190
2191 cairo_private cairo_status_t
2192 _cairo_bentley_ottmann_tessellate_boxes (const cairo_boxes_t *in,
2193 cairo_fill_rule_t fill_rule,
2194 cairo_boxes_t *out);
2195
2196 cairo_private cairo_status_t
2197 _cairo_bentley_ottmann_tessellate_rectilinear_traps (cairo_traps_t *traps,
2198 cairo_fill_rule_t fill_rule);
2199
2200 cairo_private cairo_status_t
2201 _cairo_bentley_ottmann_tessellate_rectilinear_polygon_to_boxes (const cairo_polygon_t *polygon,
2202 cairo_fill_rule_t fill_rule,
2203 cairo_boxes_t *boxes);
2204
2205 cairo_private int
2206 _cairo_traps_contain (const cairo_traps_t *traps,
2207 double x, double y);
2208
2209 cairo_private void
2210 _cairo_traps_extents (const cairo_traps_t *traps,
2211 cairo_box_t *extents);
2212
2213 cairo_private cairo_int_status_t
2214 _cairo_traps_extract_region (cairo_traps_t *traps,
2215 cairo_region_t **region);
2216
2217 cairo_private cairo_status_t
2218 _cairo_traps_path (const cairo_traps_t *traps,
2219 cairo_path_fixed_t *path);
2220
2221 cairo_private void
2222 _cairo_trapezoid_array_translate_and_scale (cairo_trapezoid_t *offset_traps,
2223 cairo_trapezoid_t *src_traps,
2224 int num_traps,
2225 double tx, double ty,
2226 double sx, double sy);
2227
2228 /* cairo-pattern.c */
2229
2230 cairo_private cairo_pattern_t *
2231 _cairo_pattern_create_in_error (cairo_status_t status);
2232
2233 cairo_private cairo_status_t
2234 _cairo_pattern_create_copy (cairo_pattern_t **pattern,
2235 const cairo_pattern_t *other);
2236
2237 cairo_private cairo_status_t
2238 _cairo_pattern_init_copy (cairo_pattern_t *pattern,
2239 const cairo_pattern_t *other);
2240
2241 cairo_private void
2242 _cairo_pattern_init_static_copy (cairo_pattern_t *pattern,
2243 const cairo_pattern_t *other);
2244
2245 cairo_private cairo_status_t
2246 _cairo_pattern_init_snapshot (cairo_pattern_t *pattern,
2247 const cairo_pattern_t *other);
2248
2249 cairo_private void
2250 _cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
2251 const cairo_color_t *color);
2252
2253 cairo_private void
2254 _cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern,
2255 cairo_surface_t *surface);
2256
2257 cairo_private void
2258 _cairo_pattern_init_linear (cairo_linear_pattern_t *pattern,
2259 double x0, double y0, double x1, double y1);
2260
2261 cairo_private void
2262 _cairo_pattern_init_radial (cairo_radial_pattern_t *pattern,
2263 double cx0, double cy0, double radius0,
2264 double cx1, double cy1, double radius1);
2265
2266 cairo_private void
2267 _cairo_pattern_fini (cairo_pattern_t *pattern);
2268
2269 cairo_private cairo_pattern_t *
2270 _cairo_pattern_create_solid (const cairo_color_t *color);
2271
2272 cairo_private void
2273 _cairo_pattern_transform (cairo_pattern_t *pattern,
2274 const cairo_matrix_t *ctm_inverse);
2275
2276 cairo_private cairo_bool_t
2277 _cairo_gradient_pattern_is_solid (const cairo_gradient_pattern_t *gradient,
2278 const cairo_rectangle_int_t *extents,
2279 cairo_color_t *color);
2280
2281 cairo_private cairo_bool_t
2282 _cairo_pattern_is_opaque_solid (const cairo_pattern_t *pattern);
2283
2284 cairo_private cairo_bool_t
2285 _cairo_pattern_is_opaque (const cairo_pattern_t *pattern,
2286 const cairo_rectangle_int_t *extents);
2287
2288 cairo_private cairo_bool_t
2289 _cairo_pattern_is_clear (const cairo_pattern_t *pattern);
2290
2291 cairo_private_no_warn cairo_filter_t
2292 _cairo_pattern_analyze_filter (const cairo_pattern_t *pattern,
2293 double *pad_out);
2294
2295 enum {
2296 CAIRO_PATTERN_ACQUIRE_NONE = 0x0,
2297 CAIRO_PATTERN_ACQUIRE_NO_REFLECT = 0x1
2298 };
2299 cairo_private cairo_int_status_t
2300 _cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
2301 cairo_surface_t *dst,
2302 int x,
2303 int y,
2304 unsigned int width,
2305 unsigned int height,
2306 unsigned int flags,
2307 cairo_surface_t **surface_out,
2308 cairo_surface_attributes_t *attributes);
2309
2310 cairo_private void
2311 _cairo_pattern_release_surface (const cairo_pattern_t *pattern,
2312 cairo_surface_t *surface,
2313 cairo_surface_attributes_t *attributes);
2314
2315 cairo_private cairo_int_status_t
2316 _cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
2317 const cairo_pattern_t *mask,
2318 cairo_surface_t *dst,
2319 int src_x,
2320 int src_y,
2321 int mask_x,
2322 int mask_y,
2323 unsigned int width,
2324 unsigned int height,
2325 unsigned int flags,
2326 cairo_surface_t **src_out,
2327 cairo_surface_t **mask_out,
2328 cairo_surface_attributes_t *src_attributes,
2329 cairo_surface_attributes_t *mask_attributes);
2330
2331 cairo_private void
2332 _cairo_pattern_get_extents (const cairo_pattern_t *pattern,
2333 cairo_rectangle_int_t *extents);
2334
2335 cairo_private unsigned long
2336 _cairo_pattern_hash (const cairo_pattern_t *pattern);
2337
2338 cairo_private unsigned long
2339 _cairo_linear_pattern_hash (unsigned long hash,
2340 const cairo_linear_pattern_t *linear);
2341
2342 cairo_private unsigned long
2343 _cairo_radial_pattern_hash (unsigned long hash,
2344 const cairo_radial_pattern_t *radial);
2345
2346 cairo_private cairo_bool_t
2347 _cairo_linear_pattern_equal (const cairo_linear_pattern_t *a,
2348 const cairo_linear_pattern_t *b);
2349
2350 cairo_private unsigned long
2351 _cairo_pattern_size (const cairo_pattern_t *pattern);
2352
2353 cairo_private cairo_bool_t
2354 _cairo_radial_pattern_equal (const cairo_radial_pattern_t *a,
2355 const cairo_radial_pattern_t *b);
2356
2357 cairo_private cairo_bool_t
2358 _cairo_pattern_equal (const cairo_pattern_t *a,
2359 const cairo_pattern_t *b);
2360
2361 cairo_private void
2362 _cairo_pattern_reset_static_data (void);
2363
2364 #if CAIRO_HAS_DRM_SURFACE
2365
2366 cairo_private void
2367 _cairo_drm_device_reset_static_data (void);
2368
2369 #endif
2370
2371 cairo_private void
2372 _cairo_clip_reset_static_data (void);
2373
2374 /* cairo-unicode.c */
2375
2376 cairo_private int
2377 _cairo_utf8_get_char_validated (const char *p,
2378 uint32_t *unicode);
2379
2380 cairo_private cairo_status_t
2381 _cairo_utf8_to_ucs4 (const char *str,
2382 int len,
2383 uint32_t **result,
2384 int *items_written);
2385
2386 cairo_private int
2387 _cairo_ucs4_to_utf8 (uint32_t unicode,
2388 char *utf8);
2389
2390 #if CAIRO_HAS_WIN32_FONT || CAIRO_HAS_QUARTZ_FONT || CAIRO_HAS_PDF_OPERATORS || CAIRO_HAS_DW_FONT
2391 # define CAIRO_HAS_UTF8_TO_UTF16 1
2392 #endif
2393 #if CAIRO_HAS_UTF8_TO_UTF16
2394 cairo_private cairo_status_t
2395 _cairo_utf8_to_utf16 (const char *str,
2396 int len,
2397 uint16_t **result,
2398 int *items_written);
2399 #endif
2400
2401 /* cairo-observer.c */
2402
2403 cairo_private void
2404 _cairo_observers_notify (cairo_list_t *observers, void *arg);
2405
2406 /* Avoid unnecessary PLT entries. */
2407 slim_hidden_proto (cairo_clip_preserve);
2408 slim_hidden_proto (cairo_close_path);
2409 slim_hidden_proto (cairo_create);
2410 slim_hidden_proto (cairo_curve_to);
2411 slim_hidden_proto (cairo_destroy);
2412 slim_hidden_proto (cairo_fill_preserve);
2413 slim_hidden_proto (cairo_font_face_destroy);
2414 slim_hidden_proto (cairo_font_face_get_user_data);
2415 slim_hidden_proto_no_warn (cairo_font_face_reference);
2416 slim_hidden_proto (cairo_font_face_set_user_data);
2417 slim_hidden_proto (cairo_font_options_equal);
2418 slim_hidden_proto (cairo_font_options_hash);
2419 slim_hidden_proto (cairo_font_options_merge);
2420 slim_hidden_proto (cairo_font_options_set_antialias);
2421 slim_hidden_proto (cairo_font_options_set_hint_metrics);
2422 slim_hidden_proto (cairo_font_options_set_hint_style);
2423 slim_hidden_proto (cairo_font_options_set_subpixel_order);
2424 slim_hidden_proto (cairo_font_options_status);
2425 slim_hidden_proto (cairo_format_stride_for_width);
2426 slim_hidden_proto (cairo_get_current_point);
2427 slim_hidden_proto (cairo_get_line_width);
2428 slim_hidden_proto (cairo_get_matrix);
2429 slim_hidden_proto (cairo_get_target);
2430 slim_hidden_proto (cairo_get_tolerance);
2431 slim_hidden_proto (cairo_glyph_allocate);
2432 slim_hidden_proto (cairo_glyph_free);
2433 slim_hidden_proto (cairo_image_surface_create);
2434 slim_hidden_proto (cairo_image_surface_create_for_data);
2435 slim_hidden_proto (cairo_image_surface_get_data);
2436 slim_hidden_proto (cairo_image_surface_get_format);
2437 slim_hidden_proto (cairo_image_surface_get_height);
2438 slim_hidden_proto (cairo_image_surface_get_stride);
2439 slim_hidden_proto (cairo_image_surface_get_width);
2440 slim_hidden_proto (cairo_line_to);
2441 slim_hidden_proto (cairo_mask);
2442 slim_hidden_proto (cairo_matrix_init);
2443 slim_hidden_proto (cairo_matrix_init_identity);
2444 slim_hidden_proto (cairo_matrix_init_rotate);
2445 slim_hidden_proto (cairo_matrix_init_scale);
2446 slim_hidden_proto (cairo_matrix_init_translate);
2447 slim_hidden_proto (cairo_matrix_invert);
2448 slim_hidden_proto (cairo_matrix_multiply);
2449 slim_hidden_proto (cairo_matrix_scale);
2450 slim_hidden_proto (cairo_matrix_transform_distance);
2451 slim_hidden_proto (cairo_matrix_transform_point);
2452 slim_hidden_proto (cairo_matrix_translate);
2453 slim_hidden_proto (cairo_move_to);
2454 slim_hidden_proto (cairo_new_path);
2455 slim_hidden_proto (cairo_paint);
2456 slim_hidden_proto (cairo_pattern_create_for_surface);
2457 slim_hidden_proto (cairo_pattern_create_rgb);
2458 slim_hidden_proto (cairo_pattern_create_rgba);
2459 slim_hidden_proto (cairo_pattern_destroy);
2460 slim_hidden_proto (cairo_pattern_get_extend);
2461 slim_hidden_proto_no_warn (cairo_pattern_reference);
2462 slim_hidden_proto (cairo_pattern_set_matrix);
2463 slim_hidden_proto (cairo_pop_group);
2464 slim_hidden_proto (cairo_push_group_with_content);
2465 slim_hidden_proto (cairo_rel_line_to);
2466 slim_hidden_proto (cairo_restore);
2467 slim_hidden_proto (cairo_save);
2468 slim_hidden_proto (cairo_scale);
2469 slim_hidden_proto (cairo_scaled_font_create);
2470 slim_hidden_proto (cairo_scaled_font_destroy);
2471 slim_hidden_proto (cairo_scaled_font_extents);
2472 slim_hidden_proto (cairo_scaled_font_get_ctm);
2473 slim_hidden_proto (cairo_scaled_font_get_font_face);
2474 slim_hidden_proto (cairo_scaled_font_get_font_matrix);
2475 slim_hidden_proto (cairo_scaled_font_get_font_options);
2476 slim_hidden_proto (cairo_scaled_font_get_hint_metrics);
2477 slim_hidden_proto (cairo_scaled_font_glyph_extents);
2478 slim_hidden_proto_no_warn (cairo_scaled_font_reference);
2479 slim_hidden_proto (cairo_scaled_font_status);
2480 slim_hidden_proto (cairo_scaled_font_get_user_data);
2481 slim_hidden_proto (cairo_scaled_font_set_user_data);
2482 slim_hidden_proto (cairo_scaled_font_text_to_glyphs);
2483 slim_hidden_proto (cairo_set_font_options);
2484 slim_hidden_proto (cairo_set_font_size);
2485 slim_hidden_proto (cairo_set_line_cap);
2486 slim_hidden_proto (cairo_set_line_join);
2487 slim_hidden_proto (cairo_set_line_width);
2488 slim_hidden_proto (cairo_set_matrix);
2489 slim_hidden_proto (cairo_set_operator);
2490 slim_hidden_proto (cairo_set_source);
2491 slim_hidden_proto (cairo_set_source_rgb);
2492 slim_hidden_proto (cairo_set_source_surface);
2493 slim_hidden_proto (cairo_set_tolerance);
2494 slim_hidden_proto (cairo_status);
2495 slim_hidden_proto (cairo_stroke);
2496 slim_hidden_proto (cairo_stroke_preserve);
2497 slim_hidden_proto (cairo_surface_copy_page);
2498 slim_hidden_proto (cairo_surface_destroy);
2499 slim_hidden_proto (cairo_surface_finish);
2500 slim_hidden_proto (cairo_surface_flush);
2501 slim_hidden_proto (cairo_surface_get_content);
2502 slim_hidden_proto (cairo_surface_get_device_offset);
2503 slim_hidden_proto (cairo_surface_get_font_options);
2504 slim_hidden_proto (cairo_surface_get_mime_data);
2505 slim_hidden_proto (cairo_surface_get_type);
2506 slim_hidden_proto (cairo_surface_has_show_text_glyphs);
2507 slim_hidden_proto (cairo_surface_set_subpixel_antialiasing);
2508 slim_hidden_proto (cairo_surface_get_subpixel_antialiasing);
2509 slim_hidden_proto (cairo_surface_mark_dirty);
2510 slim_hidden_proto (cairo_surface_mark_dirty_rectangle);
2511 slim_hidden_proto_no_warn (cairo_surface_reference);
2512 slim_hidden_proto (cairo_surface_set_device_offset);
2513 slim_hidden_proto (cairo_surface_set_fallback_resolution);
2514 slim_hidden_proto (cairo_surface_set_mime_data);
2515 slim_hidden_proto (cairo_surface_show_page);
2516 slim_hidden_proto (cairo_surface_status);
2517 slim_hidden_proto (cairo_text_cluster_allocate);
2518 slim_hidden_proto (cairo_text_cluster_free);
2519 slim_hidden_proto (cairo_toy_font_face_create);
2520 slim_hidden_proto (cairo_toy_font_face_get_slant);
2521 slim_hidden_proto (cairo_toy_font_face_get_weight);
2522 slim_hidden_proto (cairo_translate);
2523 slim_hidden_proto (cairo_transform);
2524 slim_hidden_proto (cairo_user_font_face_create);
2525 slim_hidden_proto (cairo_user_font_face_set_init_func);
2526 slim_hidden_proto (cairo_user_font_face_set_render_glyph_func);
2527 slim_hidden_proto (cairo_user_font_face_set_unicode_to_glyph_func);
2528 slim_hidden_proto (cairo_user_to_device);
2529 slim_hidden_proto (cairo_user_to_device_distance);
2530 slim_hidden_proto (cairo_version_string);
2531 slim_hidden_proto (cairo_region_create);
2532 slim_hidden_proto (cairo_region_create_rectangle);
2533 slim_hidden_proto (cairo_region_create_rectangles);
2534 slim_hidden_proto (cairo_region_copy);
2535 slim_hidden_proto (cairo_region_reference);
2536 slim_hidden_proto (cairo_region_destroy);
2537 slim_hidden_proto (cairo_region_equal);
2538 slim_hidden_proto (cairo_region_status);
2539 slim_hidden_proto (cairo_region_get_extents);
2540 slim_hidden_proto (cairo_region_num_rectangles);
2541 slim_hidden_proto (cairo_region_get_rectangle);
2542 slim_hidden_proto (cairo_region_is_empty);
2543 slim_hidden_proto (cairo_region_contains_rectangle);
2544 slim_hidden_proto (cairo_region_contains_point);
2545 slim_hidden_proto (cairo_region_translate);
2546 slim_hidden_proto (cairo_region_subtract);
2547 slim_hidden_proto (cairo_region_subtract_rectangle);
2548 slim_hidden_proto (cairo_region_intersect);
2549 slim_hidden_proto (cairo_region_intersect_rectangle);
2550 slim_hidden_proto (cairo_region_union);
2551 slim_hidden_proto (cairo_region_union_rectangle);
2552 slim_hidden_proto (cairo_region_xor);
2553 slim_hidden_proto (cairo_region_xor_rectangle);
2554
2555 #if CAIRO_HAS_PNG_FUNCTIONS
2556
2557 slim_hidden_proto (cairo_surface_write_to_png_stream);
2558
2559 #endif
2560
2561 cairo_private_no_warn cairo_filter_t
2562 _cairo_pattern_analyze_filter (const cairo_pattern_t *pattern,
2563 double *pad_out);
2564
2565 CAIRO_END_DECLS
2566
2567 #include "cairo-mutex-private.h"
2568 #include "cairo-fixed-private.h"
2569 #include "cairo-wideint-private.h"
2570 #include "cairo-malloc-private.h"
2571 #include "cairo-hash-private.h"
2572
2573 #if HAVE_VALGRIND
2574 #include <memcheck.h>
2575
2576 #define VG(x) x
2577
2578 cairo_private void
2579 _cairo_debug_check_image_surface_is_defined (const cairo_surface_t *surface);
2580
2581 #else
2582
2583 #define VG(x)
2584 #define _cairo_debug_check_image_surface_is_defined(X)
2585
2586 #endif
2587
2588 cairo_private void
2589 _cairo_debug_print_path (FILE *stream, cairo_path_fixed_t *path);
2590
2591 cairo_private void
2592 _cairo_debug_print_clip (FILE *stream, cairo_clip_t *clip);
2593
2594 #endif
2595