in class/System.Windows/System.Windows/:
[moon.git] / cairo / src / cairoint.h
blobfccb2ff2efd4013353b9e3330fb188e426db640a
1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2002 University of Southern California
4 * Copyright © 2005 Red Hat, Inc.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * You should have received a copy of the MPL along with this library
18 * in the file COPYING-MPL-1.1
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/
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.
29 * The Original Code is the cairo graphics library.
31 * The Initial Developer of the Original Code is University of Southern
32 * California.
34 * Contributor(s):
35 * Carl D. Worth <cworth@cworth.org>
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
46 #ifndef _CAIROINT_H_
47 #define _CAIROINT_H_
49 #include "cairo-embed.h"
51 #if HAVE_CONFIG_H
52 #include "config.h"
53 #endif
55 #ifdef _MSC_VER
56 #define cairo_public __declspec(dllexport)
57 #endif
59 #include <assert.h>
60 #include <stdlib.h>
61 #include <string.h>
62 #include <stdarg.h>
63 #include <stddef.h>
65 #ifdef _MSC_VER
66 #define _USE_MATH_DEFINES
67 #endif
68 #include <math.h>
69 #include <limits.h>
70 #include <stdio.h>
72 #include "cairo.h"
73 #include <pixman.h>
75 #include "cairo-compiler-private.h"
77 #if CAIRO_HAS_PS_SURFACE || \
78 CAIRO_HAS_PDF_SURFACE || \
79 CAIRO_HAS_SVG_SURFACE || \
80 CAIRO_HAS_WIN32_SURFACE
81 #define CAIRO_HAS_FONT_SUBSET 1
82 #endif
84 #if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE
85 #define CAIRO_HAS_PDF_OPERATORS 1
86 #endif
88 CAIRO_BEGIN_DECLS
90 #ifdef _WIN32
91 cairo_private FILE *
92 _cairo_win32_tmpfile (void);
93 #define tmpfile() _cairo_win32_tmpfile()
94 #endif
96 #undef MIN
97 #define MIN(a, b) ((a) < (b) ? (a) : (b))
99 #undef MAX
100 #define MAX(a, b) ((a) > (b) ? (a) : (b))
102 #ifndef FALSE
103 #define FALSE 0
104 #endif
106 #ifndef TRUE
107 #define TRUE 1
108 #endif
110 #ifndef M_PI
111 #define M_PI 3.14159265358979323846
112 #endif
114 #ifndef M_SQRT2
115 #define M_SQRT2 1.41421356237309504880
116 #endif
118 #ifndef M_SQRT1_2
119 #define M_SQRT1_2 0.707106781186547524400844362104849039
120 #endif
122 #undef ARRAY_LENGTH
123 #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
126 /* This has to be updated whenever #cairo_status_t is extended. That's
127 * a bit of a pain, but it should be easy to always catch as long as
128 * one adds a new test case to test a trigger of the new status value.
130 #define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_INVALID_WEIGHT
132 #ifdef __GNUC__
133 #define cairo_container_of(ptr, type, member) ({ \
134 const typeof(((type *) 0)->member) *mptr__ = (ptr); \
135 (type *) ((char *) mptr__ - offsetof (type, member)); \
137 #else
138 #define cairo_container_of(ptr, type, member) \
139 (type *)((char *) (ptr) - (char *) &((type *)0)->member)
140 #endif
143 /* Size in bytes of buffer to use off the stack per functions.
144 * Mostly used by text functions. For larger allocations, they'll
145 * malloc(). */
146 #ifndef CAIRO_STACK_BUFFER_SIZE
147 #define CAIRO_STACK_BUFFER_SIZE (512 * sizeof (int))
148 #endif
150 #define CAIRO_STACK_ARRAY_LENGTH(T) (CAIRO_STACK_BUFFER_SIZE / sizeof(T))
152 #define ASSERT_NOT_REACHED \
153 do { \
154 static const int NOT_REACHED = 0; \
155 assert (NOT_REACHED); \
156 } while (0)
157 #define COMPILE_TIME_ASSERT1(condition, line) \
158 typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1];
159 #define COMPILE_TIME_ASSERT0(condition, line) COMPILE_TIME_ASSERT1(condition, line)
160 #define COMPILE_TIME_ASSERT(condition) COMPILE_TIME_ASSERT0(condition, __LINE__)
162 #define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff))
163 #define CAIRO_ALPHA_SHORT_IS_OPAQUE(alpha) ((alpha) >= 0xff00)
164 #define CAIRO_ALPHA_IS_ZERO(alpha) ((alpha) <= 0.0)
166 #define CAIRO_COLOR_IS_OPAQUE(color) CAIRO_ALPHA_SHORT_IS_OPAQUE ((color)->alpha_short)
168 /* Reverse the bits in a byte with 7 operations (no 64-bit):
169 * Devised by Sean Anderson, July 13, 2001.
170 * Source: http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
172 #define CAIRO_BITSWAP8(c) ((((c) * 0x0802LU & 0x22110LU) | ((c) * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16)
174 /* Return the number of 1 bits in mask.
176 * GCC 3.4 supports a "population count" builtin, which on many targets is
177 * implemented with a single instruction. There is a fallback definition
178 * in libgcc in case a target does not have one, which should be just as
179 * good as the open-coded solution below, (which is "HACKMEM 169").
181 static inline int
182 _cairo_popcount (uint32_t mask)
184 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
185 return __builtin_popcount (mask);
186 #else
187 register int y;
189 y = (mask >> 1) &033333333333;
190 y = mask - y - ((y >>1) & 033333333333);
191 return (((y + (y >> 3)) & 030707070707) % 077);
192 #endif
195 #ifdef WORDS_BIGENDIAN
196 #define CAIRO_BITSWAP8_IF_LITTLE_ENDIAN(c) (c)
197 #else
198 #define CAIRO_BITSWAP8_IF_LITTLE_ENDIAN(c) CAIRO_BITSWAP8(c)
199 #endif
201 #ifdef WORDS_BIGENDIAN
203 #define cpu_to_be16(v) (v)
204 #define be16_to_cpu(v) (v)
205 #define cpu_to_be32(v) (v)
206 #define be32_to_cpu(v) (v)
208 #else
210 static inline uint16_t
211 cpu_to_be16(uint16_t v)
213 return (v << 8) | (v >> 8);
216 static inline uint16_t
217 be16_to_cpu(uint16_t v)
219 return cpu_to_be16 (v);
222 static inline uint32_t
223 cpu_to_be32(uint32_t v)
225 return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
228 static inline uint32_t
229 be32_to_cpu(uint32_t v)
231 return cpu_to_be32 (v);
234 #endif
236 #include "cairo-types-private.h"
237 #include "cairo-cache-private.h"
238 #include "cairo-reference-count-private.h"
240 cairo_private void
241 _cairo_box_from_doubles (cairo_box_t *box,
242 double *x1, double *y1,
243 double *x2, double *y2);
245 cairo_private void
246 _cairo_box_to_doubles (const cairo_box_t *box,
247 double *x1, double *y1,
248 double *x2, double *y2);
250 cairo_private void
251 _cairo_box_from_rectangle (cairo_box_t *box,
252 const cairo_rectangle_int_t *rectangle);
254 cairo_private void
255 _cairo_box_round_to_rectangle (const cairo_box_t *box,
256 cairo_rectangle_int_t *rectangle);
258 cairo_private cairo_bool_t
259 _cairo_rectangle_intersect (cairo_rectangle_int_t *dst,
260 const cairo_rectangle_int_t *src);
262 cairo_private cairo_bool_t
263 _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line);
265 cairo_private cairo_bool_t
266 _cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point);
268 /* cairo-array.c structures and functions */
270 cairo_private void
271 _cairo_array_init (cairo_array_t *array, int element_size);
273 cairo_private void
274 _cairo_array_init_snapshot (cairo_array_t *array,
275 const cairo_array_t *other);
277 cairo_private void
278 _cairo_array_fini (cairo_array_t *array);
280 cairo_private cairo_status_t
281 _cairo_array_grow_by (cairo_array_t *array, unsigned int additional);
283 cairo_private void
284 _cairo_array_truncate (cairo_array_t *array, unsigned int num_elements);
286 cairo_private cairo_status_t
287 _cairo_array_append (cairo_array_t *array, const void *element);
289 cairo_private cairo_status_t
290 _cairo_array_append_multiple (cairo_array_t *array,
291 const void *elements,
292 int num_elements);
294 cairo_private cairo_status_t
295 _cairo_array_allocate (cairo_array_t *array,
296 unsigned int num_elements,
297 void **elements);
299 cairo_private void *
300 _cairo_array_index (cairo_array_t *array, unsigned int index);
302 cairo_private void
303 _cairo_array_copy_element (cairo_array_t *array, int index, void *dst);
305 cairo_private int
306 _cairo_array_num_elements (cairo_array_t *array);
308 cairo_private int
309 _cairo_array_size (cairo_array_t *array);
311 cairo_private void
312 _cairo_user_data_array_init (cairo_user_data_array_t *array);
314 cairo_private void
315 _cairo_user_data_array_fini (cairo_user_data_array_t *array);
317 cairo_private void *
318 _cairo_user_data_array_get_data (cairo_user_data_array_t *array,
319 const cairo_user_data_key_t *key);
321 cairo_private cairo_status_t
322 _cairo_user_data_array_set_data (cairo_user_data_array_t *array,
323 const cairo_user_data_key_t *key,
324 void *user_data,
325 cairo_destroy_func_t destroy);
327 cairo_private unsigned long
328 _cairo_hash_string (const char *c);
331 * A #cairo_unscaled_font_t is just an opaque handle we use in the
332 * glyph cache.
334 typedef struct _cairo_unscaled_font {
335 cairo_hash_entry_t hash_entry;
336 cairo_reference_count_t ref_count;
337 const cairo_unscaled_font_backend_t *backend;
338 } cairo_unscaled_font_t;
340 typedef struct _cairo_scaled_glyph {
341 cairo_cache_entry_t cache_entry; /* hash is glyph index */
342 cairo_scaled_font_t *scaled_font; /* font the glyph lives in */
343 cairo_text_extents_t metrics; /* user-space metrics */
344 cairo_box_t bbox; /* device-space bounds */
345 int16_t x_advance; /* device-space rounded X advance */
346 int16_t y_advance; /* device-space rounded Y advance */
347 cairo_image_surface_t *surface; /* device-space image */
348 cairo_path_fixed_t *path; /* device-space outline */
349 cairo_surface_t *meta_surface; /* device-space meta-surface */
350 void *surface_private; /* for the surface backend */
351 } cairo_scaled_glyph_t;
353 #define _cairo_scaled_glyph_index(g) ((g)->cache_entry.hash)
354 #define _cairo_scaled_glyph_set_index(g,i) ((g)->cache_entry.hash = (i))
356 #include "cairo-scaled-font-private.h"
358 struct _cairo_font_face {
359 /* hash_entry must be first */
360 cairo_hash_entry_t hash_entry;
361 cairo_status_t status;
362 cairo_reference_count_t ref_count;
363 cairo_user_data_array_t user_data;
364 const cairo_font_face_backend_t *backend;
367 cairo_private void
368 _cairo_font_face_reset_static_data (void);
370 cairo_private void
371 _cairo_ft_font_reset_static_data (void);
373 /* the font backend interface */
375 struct _cairo_unscaled_font_backend {
376 void (*destroy) (void *unscaled_font);
379 /* #cairo_toy_font_face_t - simple family/slant/weight font faces used for
380 * the built-in font API
383 typedef struct _cairo_toy_font_face {
384 cairo_font_face_t base;
385 const char *family;
386 cairo_bool_t owns_family;
387 cairo_font_slant_t slant;
388 cairo_font_weight_t weight;
389 } cairo_toy_font_face_t;
391 typedef enum _cairo_scaled_glyph_info {
392 CAIRO_SCALED_GLYPH_INFO_METRICS = (1 << 0),
393 CAIRO_SCALED_GLYPH_INFO_SURFACE = (1 << 1),
394 CAIRO_SCALED_GLYPH_INFO_PATH = (1 << 2),
395 CAIRO_SCALED_GLYPH_INFO_META_SURFACE = (1 << 3)
396 } cairo_scaled_glyph_info_t;
398 typedef struct _cairo_scaled_font_subset {
399 cairo_scaled_font_t *scaled_font;
400 unsigned int font_id;
401 unsigned int subset_id;
403 /* Index of glyphs array is subset_glyph_index.
404 * Value of glyphs array is scaled_font_glyph_index.
406 unsigned long *glyphs;
407 unsigned long *to_unicode;
408 char **utf8;
409 char **glyph_names;
410 unsigned int num_glyphs;
411 cairo_bool_t is_composite;
412 } cairo_scaled_font_subset_t;
414 struct _cairo_scaled_font_backend {
415 cairo_font_type_t type;
417 cairo_warn cairo_status_t
418 (*get_implementation) (cairo_toy_font_face_t *toy_face,
419 cairo_font_face_t **font_face);
421 cairo_warn cairo_status_t
422 (*create_toy) (cairo_toy_font_face_t *toy_face,
423 const cairo_matrix_t *font_matrix,
424 const cairo_matrix_t *ctm,
425 const cairo_font_options_t *options,
426 cairo_scaled_font_t **scaled_font);
428 void
429 (*fini) (void *scaled_font);
431 cairo_warn cairo_int_status_t
432 (*scaled_glyph_init) (void *scaled_font,
433 cairo_scaled_glyph_t *scaled_glyph,
434 cairo_scaled_glyph_info_t info);
436 /* A backend only needs to implement this or ucs4_to_index(), not
437 * both. This allows the backend to do something more sophisticated
438 * then just converting characters one by one.
440 cairo_warn cairo_int_status_t
441 (*text_to_glyphs) (void *scaled_font,
442 double x,
443 double y,
444 const char *utf8,
445 int utf8_len,
446 cairo_glyph_t **glyphs,
447 int *num_glyphs,
448 cairo_text_cluster_t **clusters,
449 int *num_clusters,
450 cairo_text_cluster_flags_t *cluster_flags);
452 unsigned long
453 (*ucs4_to_index) (void *scaled_font,
454 uint32_t ucs4);
455 cairo_warn cairo_int_status_t
456 (*show_glyphs) (void *scaled_font,
457 cairo_operator_t op,
458 cairo_pattern_t *pattern,
459 cairo_surface_t *surface,
460 int source_x,
461 int source_y,
462 int dest_x,
463 int dest_y,
464 unsigned int width,
465 unsigned int height,
466 cairo_glyph_t *glyphs,
467 int num_glyphs,
468 int *remaining_glyphs);
470 cairo_warn cairo_int_status_t
471 (*load_truetype_table)(void *scaled_font,
472 unsigned long tag,
473 long offset,
474 unsigned char *buffer,
475 unsigned long *length);
477 /* returns -1 if the unicode character could not be found for the glyph */
478 cairo_warn cairo_int_status_t
479 (*index_to_ucs4)(void *scaled_font,
480 unsigned long index,
481 uint32_t *ucs4);
484 struct _cairo_font_face_backend {
485 cairo_font_type_t type;
487 /* The destroy() function is allowed to resurrect the font face
488 * by re-referencing. This is needed for the FreeType backend.
490 void
491 (*destroy) (void *font_face);
493 cairo_warn cairo_status_t
494 (*get_implementation) (void *font_face,
495 cairo_font_face_t **font_face_out);
497 cairo_warn cairo_status_t
498 (*scaled_font_create) (void *font_face,
499 const cairo_matrix_t *font_matrix,
500 const cairo_matrix_t *ctm,
501 const cairo_font_options_t *options,
502 cairo_scaled_font_t **scaled_font);
505 extern const cairo_private struct _cairo_scaled_font_backend _cairo_user_scaled_font_backend;
507 /* concrete font backends */
508 #if CAIRO_HAS_FT_FONT
510 extern const cairo_private struct _cairo_scaled_font_backend _cairo_ft_scaled_font_backend;
512 #endif
514 #if CAIRO_HAS_WIN32_FONT
516 extern const cairo_private struct _cairo_scaled_font_backend _cairo_win32_scaled_font_backend;
518 #endif
520 #if CAIRO_HAS_QUARTZ_FONT
522 extern const cairo_private struct _cairo_scaled_font_backend _cairo_quartz_scaled_font_backend;
524 #endif
526 struct _cairo_surface_backend {
527 cairo_surface_type_t type;
529 cairo_surface_t *
530 (*create_similar) (void *surface,
531 cairo_content_t content,
532 int width,
533 int height);
535 cairo_warn cairo_status_t
536 (*finish) (void *surface);
538 cairo_warn cairo_status_t
539 (*acquire_source_image) (void *abstract_surface,
540 cairo_image_surface_t **image_out,
541 void **image_extra);
543 void
544 (*release_source_image) (void *abstract_surface,
545 cairo_image_surface_t *image,
546 void *image_extra);
548 cairo_warn cairo_status_t
549 (*acquire_dest_image) (void *abstract_surface,
550 cairo_rectangle_int_t *interest_rect,
551 cairo_image_surface_t **image_out,
552 cairo_rectangle_int_t *image_rect,
553 void **image_extra);
555 void
556 (*release_dest_image) (void *abstract_surface,
557 cairo_rectangle_int_t *interest_rect,
558 cairo_image_surface_t *image,
559 cairo_rectangle_int_t *image_rect,
560 void *image_extra);
562 /* Create a new surface (@clone_out) with the following
563 * characteristics:
565 * 1. It is as compatible as possible with @surface (in terms of
566 * efficiency)
568 * 2. It has the same contents as @src within the given rectangle.
570 * 3. The offset of the similar surface with respect to the original
571 * surface is returned in the clone_offset vector.
572 * - if you clone the entire surface, this vector is zero.
573 * - if you clone (src_x, src_y)x(w, h) the vector is (src_x, src_y);
575 cairo_warn cairo_status_t
576 (*clone_similar) (void *surface,
577 cairo_surface_t *src,
578 int src_x,
579 int src_y,
580 int width,
581 int height,
582 int *clone_offset_x,
583 int *clone_offset_y,
584 cairo_surface_t **clone_out);
586 /* XXX: dst should be the first argument for consistency */
587 cairo_warn cairo_int_status_t
588 (*composite) (cairo_operator_t op,
589 cairo_pattern_t *src,
590 cairo_pattern_t *mask,
591 void *dst,
592 int src_x,
593 int src_y,
594 int mask_x,
595 int mask_y,
596 int dst_x,
597 int dst_y,
598 unsigned int width,
599 unsigned int height);
601 cairo_warn cairo_int_status_t
602 (*fill_rectangles) (void *surface,
603 cairo_operator_t op,
604 const cairo_color_t *color,
605 cairo_rectangle_int_t *rects,
606 int num_rects);
608 /* XXX: dst should be the first argument for consistency */
609 cairo_warn cairo_int_status_t
610 (*composite_trapezoids) (cairo_operator_t op,
611 cairo_pattern_t *pattern,
612 void *dst,
613 cairo_antialias_t antialias,
614 int src_x,
615 int src_y,
616 int dst_x,
617 int dst_y,
618 unsigned int width,
619 unsigned int height,
620 cairo_trapezoid_t *traps,
621 int num_traps);
623 cairo_warn cairo_int_status_t
624 (*copy_page) (void *surface);
626 cairo_warn cairo_int_status_t
627 (*show_page) (void *surface);
629 /* Set given region as the clip region for the surface, replacing
630 * any previously set clip region. Passing in a NULL region will
631 * clear the surface clip region.
633 * The surface is expected to store the clip region and clip all
634 * following drawing operations against it until the clip region
635 * is cleared of replaced by another clip region.
637 * Cairo will call this function whenever a clip path can be
638 * represented as a device pixel aligned set of rectangles. When
639 * this is not possible, cairo will use mask surfaces for
640 * clipping.
642 cairo_warn cairo_int_status_t
643 (*set_clip_region) (void *surface,
644 cairo_region_t *region);
646 /* Intersect the given path against the clip path currently set in
647 * the surface, using the given fill_rule and tolerance, and set
648 * the result as the new clipping path for the surface. Passing
649 * in a NULL path will clear the surface clipping path.
651 * The surface is expected to store the resulting clip path and
652 * clip all following drawing operations against it until the clip
653 * path cleared or intersected with a new path.
655 * If a surface implements this function, set_clip_region() will
656 * never be called and should not be implemented. If this
657 * function is not implemented cairo will use set_clip_region()
658 * (if available) and mask surfaces for clipping.
660 cairo_warn cairo_int_status_t
661 (*intersect_clip_path) (void *dst,
662 cairo_path_fixed_t *path,
663 cairo_fill_rule_t fill_rule,
664 double tolerance,
665 cairo_antialias_t antialias);
667 /* Get the extents of the current surface. For many surface types
668 * this will be as simple as { x=0, y=0, width=surface->width,
669 * height=surface->height}.
671 * This function need not take account of any clipping from
672 * set_clip_region since the generic version of set_clip_region
673 * saves those, and the generic get_clip_extents will only call
674 * into the specific surface->get_extents if there is no current
675 * clip.
677 * If this function is not implemented, or if it returns
678 * %CAIRO_INT_STATUS_UNSUPPORTED, the surface is considered to be
679 * boundless and inifnite bounds are used for it.
681 cairo_warn cairo_int_status_t
682 (*get_extents) (void *surface,
683 cairo_rectangle_int_t *extents);
686 * This is an optional entry to let the surface manage its own glyph
687 * resources. If null, render against this surface, using image
688 * surfaces as glyphs.
690 cairo_warn cairo_int_status_t
691 (*old_show_glyphs) (cairo_scaled_font_t *font,
692 cairo_operator_t op,
693 cairo_pattern_t *pattern,
694 void *surface,
695 int source_x,
696 int source_y,
697 int dest_x,
698 int dest_y,
699 unsigned int width,
700 unsigned int height,
701 cairo_glyph_t *glyphs,
702 int num_glyphs);
704 void
705 (*get_font_options) (void *surface,
706 cairo_font_options_t *options);
708 cairo_warn cairo_status_t
709 (*flush) (void *surface);
711 cairo_warn cairo_status_t
712 (*mark_dirty_rectangle) (void *surface,
713 int x,
714 int y,
715 int width,
716 int height);
718 void
719 (*scaled_font_fini) (cairo_scaled_font_t *scaled_font);
721 void
722 (*scaled_glyph_fini) (cairo_scaled_glyph_t *scaled_glyph,
723 cairo_scaled_font_t *scaled_font);
725 /* OK, I'm starting over somewhat by defining the 5 top-level
726 * drawing operators for the surface backend here with consistent
727 * naming and argument-order conventions. */
728 cairo_warn cairo_int_status_t
729 (*paint) (void *surface,
730 cairo_operator_t op,
731 cairo_pattern_t *source);
733 cairo_warn cairo_int_status_t
734 (*mask) (void *surface,
735 cairo_operator_t op,
736 cairo_pattern_t *source,
737 cairo_pattern_t *mask);
739 cairo_warn cairo_int_status_t
740 (*stroke) (void *surface,
741 cairo_operator_t op,
742 cairo_pattern_t *source,
743 cairo_path_fixed_t *path,
744 cairo_stroke_style_t *style,
745 cairo_matrix_t *ctm,
746 cairo_matrix_t *ctm_inverse,
747 double tolerance,
748 cairo_antialias_t antialias);
750 cairo_warn cairo_int_status_t
751 (*fill) (void *surface,
752 cairo_operator_t op,
753 cairo_pattern_t *source,
754 cairo_path_fixed_t *path,
755 cairo_fill_rule_t fill_rule,
756 double tolerance,
757 cairo_antialias_t antialias);
759 cairo_warn cairo_int_status_t
760 (*show_glyphs) (void *surface,
761 cairo_operator_t op,
762 cairo_pattern_t *source,
763 cairo_glyph_t *glyphs,
764 int num_glyphs,
765 cairo_scaled_font_t *scaled_font,
766 int *remaining_glyphs);
768 cairo_surface_t *
769 (*snapshot) (void *surface);
771 cairo_bool_t
772 (*is_similar) (void *surface_a,
773 void *surface_b,
774 cairo_content_t content);
776 cairo_warn cairo_status_t
777 (*reset) (void *surface);
779 cairo_warn cairo_int_status_t
780 (*fill_stroke) (void *surface,
781 cairo_operator_t fill_op,
782 cairo_pattern_t *fill_source,
783 cairo_fill_rule_t fill_rule,
784 double fill_tolerance,
785 cairo_antialias_t fill_antialias,
786 cairo_path_fixed_t *path,
787 cairo_operator_t stroke_op,
788 cairo_pattern_t *stroke_source,
789 cairo_stroke_style_t *stroke_style,
790 cairo_matrix_t *stroke_ctm,
791 cairo_matrix_t *stroke_ctm_inverse,
792 double stroke_tolerance,
793 cairo_antialias_t stroke_antialias);
795 cairo_surface_t *
796 (*create_solid_pattern_surface)
797 (void *surface,
798 cairo_solid_pattern_t *solid_pattern);
800 cairo_bool_t
801 (*has_show_text_glyphs) (void *surface);
803 cairo_warn cairo_int_status_t
804 (*show_text_glyphs) (void *surface,
805 cairo_operator_t op,
806 cairo_pattern_t *source,
807 const char *utf8,
808 int utf8_len,
809 cairo_glyph_t *glyphs,
810 int num_glyphs,
811 const cairo_text_cluster_t *clusters,
812 int num_clusters,
813 cairo_text_cluster_flags_t cluster_flags,
814 cairo_scaled_font_t *scaled_font);
817 #include "cairo-surface-private.h"
819 struct _cairo_image_surface {
820 cairo_surface_t base;
822 pixman_format_code_t pixman_format;
823 cairo_format_t format;
824 unsigned char *data;
825 cairo_bool_t owns_data;
826 cairo_bool_t has_clip;
827 cairo_image_transparency_t transparency;
829 int width;
830 int height;
831 int stride;
832 int depth;
834 pixman_image_t *pixman_image;
837 extern const cairo_private cairo_surface_backend_t _cairo_image_surface_backend;
839 #define CAIRO_EXTEND_SURFACE_DEFAULT CAIRO_EXTEND_NONE
840 #define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_PAD
841 #define CAIRO_FILTER_DEFAULT CAIRO_FILTER_GOOD
843 struct _cairo_pattern {
844 cairo_pattern_type_t type;
845 cairo_reference_count_t ref_count;
846 cairo_status_t status;
847 cairo_user_data_array_t user_data;
849 cairo_matrix_t matrix;
850 cairo_filter_t filter;
851 cairo_extend_t extend;
854 struct _cairo_solid_pattern {
855 cairo_pattern_t base;
856 cairo_color_t color;
857 cairo_content_t content;
860 extern const cairo_private cairo_solid_pattern_t _cairo_pattern_nil;
861 extern const cairo_private cairo_solid_pattern_t _cairo_pattern_none;
863 typedef struct _cairo_surface_pattern {
864 cairo_pattern_t base;
866 cairo_surface_t *surface;
867 } cairo_surface_pattern_t;
869 typedef struct _cairo_gradient_stop {
870 double offset;
871 cairo_color_t color;
872 } cairo_gradient_stop_t;
874 typedef struct _cairo_gradient_pattern {
875 cairo_pattern_t base;
877 unsigned int n_stops;
878 unsigned int stops_size;
879 cairo_gradient_stop_t *stops;
880 cairo_gradient_stop_t stops_embedded[2];
881 } cairo_gradient_pattern_t;
883 typedef struct _cairo_linear_pattern {
884 cairo_gradient_pattern_t base;
886 cairo_point_t p1;
887 cairo_point_t p2;
888 } cairo_linear_pattern_t;
890 typedef struct _cairo_radial_pattern {
891 cairo_gradient_pattern_t base;
893 cairo_point_t c1;
894 cairo_fixed_t r1;
895 cairo_point_t c2;
896 cairo_fixed_t r2;
897 } cairo_radial_pattern_t;
899 typedef union {
900 cairo_gradient_pattern_t base;
902 cairo_linear_pattern_t linear;
903 cairo_radial_pattern_t radial;
904 } cairo_gradient_pattern_union_t;
906 typedef union {
907 cairo_pattern_t base;
909 cairo_solid_pattern_t solid;
910 cairo_surface_pattern_t surface;
911 cairo_gradient_pattern_union_t gradient;
912 } cairo_pattern_union_t;
914 typedef struct _cairo_surface_attributes {
915 cairo_matrix_t matrix;
916 cairo_extend_t extend;
917 cairo_filter_t filter;
918 int x_offset;
919 int y_offset;
920 cairo_bool_t acquired;
921 void *extra;
922 } cairo_surface_attributes_t;
924 typedef struct _cairo_traps {
925 cairo_status_t status;
927 cairo_box_t extents;
929 int num_traps;
930 int traps_size;
931 cairo_trapezoid_t *traps;
932 cairo_trapezoid_t traps_embedded[1];
934 cairo_bool_t has_limits;
935 cairo_box_t limits;
936 } cairo_traps_t;
938 #define CAIRO_FONT_SLANT_DEFAULT CAIRO_FONT_SLANT_NORMAL
939 #define CAIRO_FONT_WEIGHT_DEFAULT CAIRO_FONT_WEIGHT_NORMAL
941 #define CAIRO_WIN32_FONT_FAMILY_DEFAULT "Arial"
942 #define CAIRO_QUARTZ_FONT_FAMILY_DEFAULT "Helvetica"
943 #define CAIRO_FT_FONT_FAMILY_DEFAULT ""
945 #if CAIRO_HAS_WIN32_FONT
947 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_WIN32_FONT_FAMILY_DEFAULT
948 #define CAIRO_SCALED_FONT_BACKEND_DEFAULT &_cairo_win32_scaled_font_backend
950 #elif CAIRO_HAS_QUARTZ_FONT
952 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_QUARTZ_FONT_FAMILY_DEFAULT
953 #define CAIRO_SCALED_FONT_BACKEND_DEFAULT &_cairo_quartz_scaled_font_backend
955 #elif CAIRO_HAS_FT_FONT
957 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
958 #define CAIRO_SCALED_FONT_BACKEND_DEFAULT &_cairo_ft_scaled_font_backend
960 #else
962 #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
963 #define CAIRO_SCALED_FONT_BACKEND_DEFAULT &_cairo_user_scaled_font_backend
965 #endif
967 #define CAIRO_GSTATE_OPERATOR_DEFAULT CAIRO_OPERATOR_OVER
968 #define CAIRO_GSTATE_TOLERANCE_DEFAULT 0.1
969 #define CAIRO_GSTATE_FILL_RULE_DEFAULT CAIRO_FILL_RULE_WINDING
970 #define CAIRO_GSTATE_LINE_WIDTH_DEFAULT 2.0
971 #define CAIRO_GSTATE_LINE_CAP_DEFAULT CAIRO_LINE_CAP_BUTT
972 #define CAIRO_GSTATE_LINE_JOIN_DEFAULT CAIRO_LINE_JOIN_MITER
973 #define CAIRO_GSTATE_MITER_LIMIT_DEFAULT 10.0
974 #define CAIRO_GSTATE_DEFAULT_FONT_SIZE 10.0
976 #define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
977 #define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
979 typedef struct _cairo_stroke_face {
980 cairo_point_t ccw;
981 cairo_point_t point;
982 cairo_point_t cw;
983 cairo_slope_t dev_vector;
984 cairo_point_double_t usr_vector;
985 } cairo_stroke_face_t;
987 /* cairo.c */
988 cairo_private void
989 _cairo_restrict_value (double *value, double min, double max);
991 cairo_private int
992 _cairo_lround (double d);
994 /* cairo-gstate.c */
995 cairo_private cairo_status_t
996 _cairo_gstate_init (cairo_gstate_t *gstate,
997 cairo_surface_t *target);
999 cairo_private void
1000 _cairo_gstate_fini (cairo_gstate_t *gstate);
1002 cairo_private cairo_status_t
1003 _cairo_gstate_save (cairo_gstate_t **gstate, cairo_gstate_t **freelist);
1005 cairo_private cairo_status_t
1006 _cairo_gstate_restore (cairo_gstate_t **gstate, cairo_gstate_t **freelist);
1008 cairo_private cairo_bool_t
1009 _cairo_gstate_is_redirected (cairo_gstate_t *gstate);
1011 cairo_private cairo_status_t
1012 _cairo_gstate_redirect_target (cairo_gstate_t *gstate, cairo_surface_t *child);
1014 cairo_private cairo_surface_t *
1015 _cairo_gstate_get_target (cairo_gstate_t *gstate);
1017 cairo_private cairo_surface_t *
1018 _cairo_gstate_get_parent_target (cairo_gstate_t *gstate);
1020 cairo_private cairo_surface_t *
1021 _cairo_gstate_get_original_target (cairo_gstate_t *gstate);
1023 cairo_private cairo_clip_t *
1024 _cairo_gstate_get_clip (cairo_gstate_t *gstate);
1026 cairo_private cairo_status_t
1027 _cairo_gstate_set_source (cairo_gstate_t *gstate, cairo_pattern_t *source);
1029 cairo_private cairo_pattern_t *
1030 _cairo_gstate_get_source (cairo_gstate_t *gstate);
1032 cairo_private cairo_status_t
1033 _cairo_gstate_set_operator (cairo_gstate_t *gstate, cairo_operator_t op);
1035 cairo_private cairo_operator_t
1036 _cairo_gstate_get_operator (cairo_gstate_t *gstate);
1038 cairo_private cairo_status_t
1039 _cairo_gstate_set_tolerance (cairo_gstate_t *gstate, double tolerance);
1041 cairo_private double
1042 _cairo_gstate_get_tolerance (cairo_gstate_t *gstate);
1044 cairo_private cairo_status_t
1045 _cairo_gstate_set_fill_rule (cairo_gstate_t *gstate, cairo_fill_rule_t fill_rule);
1047 cairo_private cairo_fill_rule_t
1048 _cairo_gstate_get_fill_rule (cairo_gstate_t *gstate);
1050 cairo_private cairo_status_t
1051 _cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width);
1053 cairo_private double
1054 _cairo_gstate_get_line_width (cairo_gstate_t *gstate);
1056 cairo_private cairo_status_t
1057 _cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap);
1059 cairo_private cairo_line_cap_t
1060 _cairo_gstate_get_line_cap (cairo_gstate_t *gstate);
1062 cairo_private cairo_status_t
1063 _cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join);
1065 cairo_private cairo_line_join_t
1066 _cairo_gstate_get_line_join (cairo_gstate_t *gstate);
1068 cairo_private cairo_status_t
1069 _cairo_gstate_set_dash (cairo_gstate_t *gstate, const double *dash, int num_dashes, double offset);
1071 cairo_private void
1072 _cairo_gstate_get_dash (cairo_gstate_t *gstate, double *dash, int *num_dashes, double *offset);
1074 cairo_private cairo_status_t
1075 _cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit);
1077 cairo_private double
1078 _cairo_gstate_get_miter_limit (cairo_gstate_t *gstate);
1080 cairo_private void
1081 _cairo_gstate_get_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix);
1083 cairo_private cairo_status_t
1084 _cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty);
1086 cairo_private cairo_status_t
1087 _cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy);
1089 cairo_private cairo_status_t
1090 _cairo_gstate_rotate (cairo_gstate_t *gstate, double angle);
1092 cairo_private cairo_status_t
1093 _cairo_gstate_transform (cairo_gstate_t *gstate,
1094 const cairo_matrix_t *matrix);
1096 cairo_private cairo_status_t
1097 _cairo_gstate_set_matrix (cairo_gstate_t *gstate,
1098 const cairo_matrix_t *matrix);
1100 cairo_private void
1101 _cairo_gstate_identity_matrix (cairo_gstate_t *gstate);
1103 cairo_private void
1104 _cairo_gstate_user_to_device (cairo_gstate_t *gstate, double *x, double *y);
1106 cairo_private void
1107 _cairo_gstate_user_to_device_distance (cairo_gstate_t *gstate, double *dx, double *dy);
1109 cairo_private void
1110 _cairo_gstate_device_to_user (cairo_gstate_t *gstate, double *x, double *y);
1112 cairo_private void
1113 _cairo_gstate_device_to_user_distance (cairo_gstate_t *gstate, double *dx, double *dy);
1115 cairo_private void
1116 _cairo_gstate_user_to_backend (cairo_gstate_t *gstate, double *x, double *y);
1118 cairo_private void
1119 _cairo_gstate_backend_to_user (cairo_gstate_t *gstate, double *x, double *y);
1121 cairo_private void
1122 _cairo_gstate_backend_to_user_rectangle (cairo_gstate_t *gstate,
1123 double *x1, double *y1,
1124 double *x2, double *y2,
1125 cairo_bool_t *is_tight);
1127 cairo_private cairo_status_t
1128 _cairo_gstate_path_extents (cairo_gstate_t *gstate,
1129 cairo_path_fixed_t *path,
1130 double *x1, double *y1,
1131 double *x2, double *y2);
1133 cairo_private cairo_status_t
1134 _cairo_gstate_paint (cairo_gstate_t *gstate);
1136 cairo_private cairo_status_t
1137 _cairo_gstate_mask (cairo_gstate_t *gstate,
1138 cairo_pattern_t *mask);
1140 cairo_private cairo_status_t
1141 _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path);
1143 cairo_private cairo_status_t
1144 _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path);
1146 cairo_private cairo_status_t
1147 _cairo_gstate_copy_page (cairo_gstate_t *gstate);
1149 cairo_private cairo_status_t
1150 _cairo_gstate_show_page (cairo_gstate_t *gstate);
1152 cairo_private cairo_status_t
1153 _cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
1154 cairo_path_fixed_t *path,
1155 double *x1, double *y1,
1156 double *x2, double *y2);
1158 cairo_private cairo_status_t
1159 _cairo_gstate_fill_extents (cairo_gstate_t *gstate,
1160 cairo_path_fixed_t *path,
1161 double *x1, double *y1,
1162 double *x2, double *y2);
1164 cairo_private cairo_status_t
1165 _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
1166 cairo_path_fixed_t *path,
1167 double x,
1168 double y,
1169 cairo_bool_t *inside_ret);
1171 cairo_private cairo_status_t
1172 _cairo_gstate_in_fill (cairo_gstate_t *gstate,
1173 cairo_path_fixed_t *path,
1174 double x,
1175 double y,
1176 cairo_bool_t *inside_ret);
1178 cairo_private cairo_status_t
1179 _cairo_gstate_clip (cairo_gstate_t *gstate, cairo_path_fixed_t *path);
1181 cairo_private cairo_status_t
1182 _cairo_gstate_reset_clip (cairo_gstate_t *gstate);
1184 cairo_private cairo_status_t
1185 _cairo_gstate_clip_extents (cairo_gstate_t *gstate,
1186 double *x1,
1187 double *y1,
1188 double *x2,
1189 double *y2);
1191 cairo_private cairo_rectangle_list_t*
1192 _cairo_gstate_copy_clip_rectangle_list (cairo_gstate_t *gstate);
1194 cairo_private cairo_status_t
1195 _cairo_gstate_show_surface (cairo_gstate_t *gstate,
1196 cairo_surface_t *surface,
1197 double x,
1198 double y,
1199 double width,
1200 double height);
1202 cairo_private cairo_status_t
1203 _cairo_gstate_select_font_face (cairo_gstate_t *gstate,
1204 const char *family,
1205 cairo_font_slant_t slant,
1206 cairo_font_weight_t weight);
1208 cairo_private cairo_status_t
1209 _cairo_gstate_set_font_size (cairo_gstate_t *gstate,
1210 double size);
1212 cairo_private void
1213 _cairo_gstate_get_font_matrix (cairo_gstate_t *gstate,
1214 cairo_matrix_t *matrix);
1216 cairo_private cairo_status_t
1217 _cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
1218 const cairo_matrix_t *matrix);
1220 cairo_private void
1221 _cairo_gstate_get_font_options (cairo_gstate_t *gstate,
1222 cairo_font_options_t *options);
1224 cairo_private void
1225 _cairo_gstate_set_font_options (cairo_gstate_t *gstate,
1226 const cairo_font_options_t *options);
1228 cairo_private cairo_status_t
1229 _cairo_gstate_get_font_face (cairo_gstate_t *gstate,
1230 cairo_font_face_t **font_face);
1232 cairo_private cairo_status_t
1233 _cairo_gstate_get_scaled_font (cairo_gstate_t *gstate,
1234 cairo_scaled_font_t **scaled_font);
1236 cairo_private cairo_status_t
1237 _cairo_gstate_get_font_extents (cairo_gstate_t *gstate,
1238 cairo_font_extents_t *extents);
1240 cairo_private cairo_status_t
1241 _cairo_gstate_set_font_face (cairo_gstate_t *gstate,
1242 cairo_font_face_t *font_face);
1244 cairo_private cairo_status_t
1245 _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
1246 double x,
1247 double y,
1248 const char *utf8,
1249 int utf8_len,
1250 cairo_glyph_t **glyphs,
1251 int *num_glyphs,
1252 cairo_text_cluster_t **clusters,
1253 int *num_clusters,
1254 cairo_text_cluster_flags_t *cluster_flags);
1256 cairo_private cairo_status_t
1257 _cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
1258 const cairo_glyph_t *glyphs,
1259 int num_glyphs,
1260 cairo_text_extents_t *extents);
1262 cairo_private cairo_status_t
1263 _cairo_gstate_show_text_glyphs (cairo_gstate_t *gstate,
1264 const char *utf8,
1265 int utf8_len,
1266 const cairo_glyph_t *glyphs,
1267 int num_glyphs,
1268 const cairo_text_cluster_t *clusters,
1269 int num_clusters,
1270 cairo_text_cluster_flags_t cluster_flags);
1272 cairo_private cairo_status_t
1273 _cairo_gstate_glyph_path (cairo_gstate_t *gstate,
1274 const cairo_glyph_t *glyphs,
1275 int num_glyphs,
1276 cairo_path_fixed_t *path);
1278 cairo_private cairo_bool_t
1279 _cairo_operator_bounded_by_mask (cairo_operator_t op);
1281 cairo_private cairo_bool_t
1282 _cairo_operator_bounded_by_source (cairo_operator_t op);
1284 /* cairo-color.c */
1285 cairo_private const cairo_color_t *
1286 _cairo_stock_color (cairo_stock_t stock);
1288 #define CAIRO_COLOR_WHITE _cairo_stock_color (CAIRO_STOCK_WHITE)
1289 #define CAIRO_COLOR_BLACK _cairo_stock_color (CAIRO_STOCK_BLACK)
1290 #define CAIRO_COLOR_TRANSPARENT _cairo_stock_color (CAIRO_STOCK_TRANSPARENT)
1292 cairo_private uint16_t
1293 _cairo_color_double_to_short (double d);
1295 cairo_private void
1296 _cairo_color_init (cairo_color_t *color);
1298 cairo_private void
1299 _cairo_color_init_rgb (cairo_color_t *color,
1300 double red, double green, double blue);
1302 cairo_private void
1303 _cairo_color_init_rgba (cairo_color_t *color,
1304 double red, double green, double blue,
1305 double alpha);
1307 cairo_private void
1308 _cairo_color_multiply_alpha (cairo_color_t *color,
1309 double alpha);
1311 cairo_private void
1312 _cairo_color_get_rgba (cairo_color_t *color,
1313 double *red,
1314 double *green,
1315 double *blue,
1316 double *alpha);
1318 cairo_private void
1319 _cairo_color_get_rgba_premultiplied (cairo_color_t *color,
1320 double *red,
1321 double *green,
1322 double *blue,
1323 double *alpha);
1325 cairo_private cairo_bool_t
1326 _cairo_color_equal (const cairo_color_t *color_a,
1327 const cairo_color_t *color_b);
1329 /* cairo-font-face.c */
1331 extern const cairo_private cairo_toy_font_face_t _cairo_font_face_nil;
1333 cairo_private void
1334 _cairo_font_face_init (cairo_font_face_t *font_face,
1335 const cairo_font_face_backend_t *backend);
1337 cairo_private cairo_status_t
1338 _cairo_font_face_set_error (cairo_font_face_t *font_face,
1339 cairo_status_t status);
1341 cairo_private void
1342 _cairo_unscaled_font_init (cairo_unscaled_font_t *font,
1343 const cairo_unscaled_font_backend_t *backend);
1345 cairo_private_no_warn cairo_unscaled_font_t *
1346 _cairo_unscaled_font_reference (cairo_unscaled_font_t *font);
1348 cairo_private void
1349 _cairo_unscaled_font_destroy (cairo_unscaled_font_t *font);
1351 /* cairo-font-face-twin.c */
1353 cairo_private cairo_font_face_t *
1354 _cairo_font_face_twin_create (cairo_font_slant_t slant,
1355 cairo_font_weight_t weight);
1357 /* cairo-font-face-twin-data.c */
1359 extern const cairo_private int8_t _cairo_twin_outlines[];
1360 extern const cairo_private uint16_t _cairo_twin_charmap[128];
1362 /* cairo-font-options.c */
1364 cairo_private void
1365 _cairo_font_options_init_default (cairo_font_options_t *options);
1367 cairo_private void
1368 _cairo_font_options_init_copy (cairo_font_options_t *options,
1369 const cairo_font_options_t *other);
1371 /* cairo-hull.c */
1372 cairo_private cairo_status_t
1373 _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
1375 /* cairo-lzw.c */
1376 cairo_private unsigned char *
1377 _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out);
1379 /* cairo-misc.c */
1380 cairo_private cairo_status_t
1381 _cairo_validate_text_clusters (const char *utf8,
1382 int utf8_len,
1383 const cairo_glyph_t *glyphs,
1384 int num_glyphs,
1385 const cairo_text_cluster_t *clusters,
1386 int num_clusters,
1387 cairo_text_cluster_flags_t cluster_flags);
1389 /* cairo-path-fixed.c */
1390 cairo_private void
1391 _cairo_path_fixed_init (cairo_path_fixed_t *path);
1393 cairo_private cairo_status_t
1394 _cairo_path_fixed_init_copy (cairo_path_fixed_t *path,
1395 cairo_path_fixed_t *other);
1397 cairo_private cairo_bool_t
1398 _cairo_path_fixed_is_equal (cairo_path_fixed_t *path,
1399 cairo_path_fixed_t *other);
1401 cairo_private cairo_path_fixed_t *
1402 _cairo_path_fixed_create (void);
1404 cairo_private void
1405 _cairo_path_fixed_fini (cairo_path_fixed_t *path);
1407 cairo_private void
1408 _cairo_path_fixed_destroy (cairo_path_fixed_t *path);
1410 cairo_private cairo_status_t
1411 _cairo_path_fixed_move_to (cairo_path_fixed_t *path,
1412 cairo_fixed_t x,
1413 cairo_fixed_t y);
1415 cairo_private void
1416 _cairo_path_fixed_new_sub_path (cairo_path_fixed_t *path);
1418 cairo_private cairo_status_t
1419 _cairo_path_fixed_rel_move_to (cairo_path_fixed_t *path,
1420 cairo_fixed_t dx,
1421 cairo_fixed_t dy);
1423 cairo_private cairo_status_t
1424 _cairo_path_fixed_line_to (cairo_path_fixed_t *path,
1425 cairo_fixed_t x,
1426 cairo_fixed_t y);
1428 cairo_private cairo_status_t
1429 _cairo_path_fixed_rel_line_to (cairo_path_fixed_t *path,
1430 cairo_fixed_t dx,
1431 cairo_fixed_t dy);
1433 cairo_private cairo_status_t
1434 _cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
1435 cairo_fixed_t x0, cairo_fixed_t y0,
1436 cairo_fixed_t x1, cairo_fixed_t y1,
1437 cairo_fixed_t x2, cairo_fixed_t y2);
1439 cairo_private cairo_status_t
1440 _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
1441 cairo_fixed_t dx0, cairo_fixed_t dy0,
1442 cairo_fixed_t dx1, cairo_fixed_t dy1,
1443 cairo_fixed_t dx2, cairo_fixed_t dy2);
1445 cairo_private cairo_status_t
1446 _cairo_path_fixed_close_path (cairo_path_fixed_t *path);
1448 cairo_private cairo_bool_t
1449 _cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
1450 cairo_fixed_t *x,
1451 cairo_fixed_t *y);
1453 typedef cairo_status_t
1454 (cairo_path_fixed_move_to_func_t) (void *closure,
1455 cairo_point_t *point);
1457 typedef cairo_status_t
1458 (cairo_path_fixed_line_to_func_t) (void *closure,
1459 cairo_point_t *point);
1461 typedef cairo_status_t
1462 (cairo_path_fixed_curve_to_func_t) (void *closure,
1463 cairo_point_t *p0,
1464 cairo_point_t *p1,
1465 cairo_point_t *p2);
1467 typedef cairo_status_t
1468 (cairo_path_fixed_close_path_func_t) (void *closure);
1470 cairo_private cairo_status_t
1471 _cairo_path_fixed_interpret (const cairo_path_fixed_t *path,
1472 cairo_direction_t dir,
1473 cairo_path_fixed_move_to_func_t *move_to,
1474 cairo_path_fixed_line_to_func_t *line_to,
1475 cairo_path_fixed_curve_to_func_t *curve_to,
1476 cairo_path_fixed_close_path_func_t *close_path,
1477 void *closure);
1479 cairo_private cairo_status_t
1480 _cairo_path_fixed_interpret_flat (const cairo_path_fixed_t *path,
1481 cairo_direction_t dir,
1482 cairo_path_fixed_move_to_func_t *move_to,
1483 cairo_path_fixed_line_to_func_t *line_to,
1484 cairo_path_fixed_close_path_func_t *close_path,
1485 void *closure,
1486 double tolerance);
1488 cairo_private cairo_status_t
1489 _cairo_path_fixed_append (cairo_path_fixed_t *path,
1490 const cairo_path_fixed_t *other,
1491 cairo_direction_t dir);
1493 cairo_private cairo_status_t
1494 _cairo_path_fixed_bounds (cairo_path_fixed_t *path,
1495 double *x1, double *y1,
1496 double *x2, double *y2,
1497 double tolerance);
1499 cairo_private void
1500 _cairo_path_fixed_transform (cairo_path_fixed_t *path,
1501 cairo_matrix_t *matrix);
1503 cairo_private cairo_bool_t
1504 _cairo_path_fixed_is_empty (cairo_path_fixed_t *path);
1506 cairo_private cairo_bool_t
1507 _cairo_path_fixed_is_box (cairo_path_fixed_t *path,
1508 cairo_box_t *box);
1510 cairo_private cairo_bool_t
1511 _cairo_path_fixed_is_rectangle (cairo_path_fixed_t *path,
1512 cairo_box_t *box);
1514 /* cairo-path-fill.c */
1515 cairo_private cairo_status_t
1516 _cairo_path_fixed_fill_to_traps (cairo_path_fixed_t *path,
1517 cairo_fill_rule_t fill_rule,
1518 double tolerance,
1519 cairo_traps_t *traps);
1521 /* cairo-path-stroke.c */
1522 cairo_private cairo_status_t
1523 _cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path,
1524 cairo_stroke_style_t *stroke_style,
1525 cairo_matrix_t *ctm,
1526 cairo_matrix_t *ctm_inverse,
1527 double tolerance,
1528 cairo_traps_t *traps);
1530 /* cairo-scaled-font.c */
1532 cairo_private void
1533 _cairo_scaled_font_freeze_cache (cairo_scaled_font_t *scaled_font);
1535 cairo_private void
1536 _cairo_scaled_font_thaw_cache (cairo_scaled_font_t *scaled_font);
1538 cairo_private void
1539 _cairo_scaled_font_reset_cache (cairo_scaled_font_t *scaled_font);
1541 cairo_private cairo_status_t
1542 _cairo_scaled_font_set_error (cairo_scaled_font_t *scaled_font,
1543 cairo_status_t status);
1545 cairo_private cairo_scaled_font_t *
1546 _cairo_scaled_font_create_in_error (cairo_status_t status);
1548 cairo_private void
1549 _cairo_scaled_font_reset_static_data (void);
1551 cairo_private cairo_status_t
1552 _cairo_scaled_font_register_placeholder_and_unlock_font_map (cairo_scaled_font_t *scaled_font);
1554 cairo_private void
1555 _cairo_scaled_font_unregister_placeholder_and_lock_font_map (cairo_scaled_font_t *scaled_font);
1557 cairo_private cairo_status_t
1558 _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
1559 cairo_font_face_t *font_face,
1560 const cairo_matrix_t *font_matrix,
1561 const cairo_matrix_t *ctm,
1562 const cairo_font_options_t *options,
1563 const cairo_scaled_font_backend_t *backend);
1565 cairo_private cairo_status_t
1566 _cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
1567 cairo_font_extents_t *fs_metrics);
1569 /* This should only be called on an error path by a scaled_font constructor */
1570 cairo_private void
1571 _cairo_scaled_font_fini (cairo_scaled_font_t *scaled_font);
1573 cairo_private cairo_status_t
1574 _cairo_scaled_font_font_extents (cairo_scaled_font_t *scaled_font,
1575 cairo_font_extents_t *extents);
1577 cairo_private cairo_status_t
1578 _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
1579 const cairo_glyph_t *glyphs,
1580 int num_glyphs,
1581 cairo_rectangle_int_t *extents);
1583 cairo_private cairo_status_t
1584 _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
1585 cairo_operator_t op,
1586 cairo_pattern_t *source,
1587 cairo_surface_t *surface,
1588 int source_x,
1589 int source_y,
1590 int dest_x,
1591 int dest_y,
1592 unsigned int width,
1593 unsigned int height,
1594 cairo_glyph_t *glyphs,
1595 int num_glyphs);
1597 cairo_private cairo_status_t
1598 _cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
1599 const cairo_glyph_t *glyphs,
1600 int num_glyphs,
1601 cairo_path_fixed_t *path);
1603 cairo_private void
1604 _cairo_scaled_glyph_set_metrics (cairo_scaled_glyph_t *scaled_glyph,
1605 cairo_scaled_font_t *scaled_font,
1606 cairo_text_extents_t *fs_metrics);
1608 cairo_private void
1609 _cairo_scaled_glyph_set_surface (cairo_scaled_glyph_t *scaled_glyph,
1610 cairo_scaled_font_t *scaled_font,
1611 cairo_image_surface_t *surface);
1613 cairo_private void
1614 _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
1615 cairo_scaled_font_t *scaled_font,
1616 cairo_path_fixed_t *path);
1618 cairo_private void
1619 _cairo_scaled_glyph_set_meta_surface (cairo_scaled_glyph_t *scaled_glyph,
1620 cairo_scaled_font_t *scaled_font,
1621 cairo_surface_t *meta_surface);
1623 cairo_private cairo_int_status_t
1624 _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
1625 unsigned long index,
1626 cairo_scaled_glyph_info_t info,
1627 cairo_scaled_glyph_t **scaled_glyph_ret);
1629 cairo_private double
1630 _cairo_scaled_font_get_max_scale (cairo_scaled_font_t *scaled_font);
1632 cairo_private void
1633 _cairo_scaled_font_map_destroy (void);
1635 /* cairo-stroke-style.c */
1637 cairo_private void
1638 _cairo_stroke_style_init (cairo_stroke_style_t *style);
1640 cairo_private cairo_status_t
1641 _cairo_stroke_style_init_copy (cairo_stroke_style_t *style,
1642 cairo_stroke_style_t *other);
1644 cairo_private void
1645 _cairo_stroke_style_fini (cairo_stroke_style_t *style);
1647 cairo_private void
1648 _cairo_stroke_style_max_distance_from_path (const cairo_stroke_style_t *style,
1649 const cairo_matrix_t *ctm,
1650 double *dx, double *dy);
1652 /* cairo-surface.c */
1654 cairo_private cairo_surface_t *
1655 _cairo_surface_create_in_error (cairo_status_t status);
1657 cairo_private cairo_status_t
1658 _cairo_surface_set_error (cairo_surface_t *surface,
1659 cairo_status_t status);
1661 cairo_private void
1662 _cairo_surface_set_resolution (cairo_surface_t *surface,
1663 double x_res,
1664 double y_res);
1666 cairo_private cairo_surface_t *
1667 _cairo_surface_create_similar_scratch (cairo_surface_t *other,
1668 cairo_content_t content,
1669 int width,
1670 int height);
1672 cairo_private cairo_surface_t *
1673 _cairo_surface_create_similar_solid (cairo_surface_t *other,
1674 cairo_content_t content,
1675 int width,
1676 int height,
1677 const cairo_color_t *color);
1679 cairo_private cairo_surface_t *
1680 _cairo_surface_create_solid_pattern_surface (cairo_surface_t *other,
1681 cairo_solid_pattern_t *solid_pattern);
1683 cairo_private cairo_int_status_t
1684 _cairo_surface_repaint_solid_pattern_surface (cairo_surface_t *other,
1685 cairo_surface_t *solid_surface,
1686 cairo_solid_pattern_t *solid_pattern);
1688 cairo_private void
1689 _cairo_surface_init (cairo_surface_t *surface,
1690 const cairo_surface_backend_t *backend,
1691 cairo_content_t content);
1693 cairo_private void
1694 _cairo_surface_set_font_options (cairo_surface_t *surface,
1695 cairo_font_options_t *options);
1697 cairo_private cairo_clip_mode_t
1698 _cairo_surface_get_clip_mode (cairo_surface_t *surface);
1700 cairo_private cairo_status_t
1701 _cairo_surface_composite (cairo_operator_t op,
1702 cairo_pattern_t *src,
1703 cairo_pattern_t *mask,
1704 cairo_surface_t *dst,
1705 int src_x,
1706 int src_y,
1707 int mask_x,
1708 int mask_y,
1709 int dst_x,
1710 int dst_y,
1711 unsigned int width,
1712 unsigned int height);
1714 cairo_private cairo_status_t
1715 _cairo_surface_fill_rectangle (cairo_surface_t *surface,
1716 cairo_operator_t op,
1717 const cairo_color_t *color,
1718 int x,
1719 int y,
1720 int width,
1721 int height);
1723 cairo_private cairo_status_t
1724 _cairo_surface_fill_region (cairo_surface_t *surface,
1725 cairo_operator_t op,
1726 const cairo_color_t *color,
1727 cairo_region_t *region);
1729 cairo_private cairo_status_t
1730 _cairo_surface_fill_rectangles (cairo_surface_t *surface,
1731 cairo_operator_t op,
1732 const cairo_color_t *color,
1733 cairo_rectangle_int_t *rects,
1734 int num_rects);
1736 cairo_private cairo_status_t
1737 _cairo_surface_paint (cairo_surface_t *surface,
1738 cairo_operator_t op,
1739 cairo_pattern_t *source);
1741 cairo_private cairo_status_t
1742 _cairo_surface_mask (cairo_surface_t *surface,
1743 cairo_operator_t op,
1744 cairo_pattern_t *source,
1745 cairo_pattern_t *mask);
1747 cairo_private cairo_status_t
1748 _cairo_surface_fill_stroke (cairo_surface_t *surface,
1749 cairo_operator_t fill_op,
1750 cairo_pattern_t *fill_source,
1751 cairo_fill_rule_t fill_rule,
1752 double fill_tolerance,
1753 cairo_antialias_t fill_antialias,
1754 cairo_path_fixed_t *path,
1755 cairo_operator_t stroke_op,
1756 cairo_pattern_t *stroke_source,
1757 cairo_stroke_style_t *stroke_style,
1758 cairo_matrix_t *stroke_ctm,
1759 cairo_matrix_t *stroke_ctm_inverse,
1760 double stroke_tolerance,
1761 cairo_antialias_t stroke_antialias);
1763 cairo_private cairo_status_t
1764 _cairo_surface_stroke (cairo_surface_t *surface,
1765 cairo_operator_t op,
1766 cairo_pattern_t *source,
1767 cairo_path_fixed_t *path,
1768 cairo_stroke_style_t *style,
1769 cairo_matrix_t *ctm,
1770 cairo_matrix_t *ctm_inverse,
1771 double tolerance,
1772 cairo_antialias_t antialias);
1774 cairo_private cairo_status_t
1775 _cairo_surface_fill (cairo_surface_t *surface,
1776 cairo_operator_t op,
1777 cairo_pattern_t *source,
1778 cairo_path_fixed_t *path,
1779 cairo_fill_rule_t fill_rule,
1780 double tolerance,
1781 cairo_antialias_t antialias);
1783 cairo_private cairo_status_t
1784 _cairo_surface_show_text_glyphs (cairo_surface_t *surface,
1785 cairo_operator_t op,
1786 cairo_pattern_t *source,
1787 const char *utf8,
1788 int utf8_len,
1789 cairo_glyph_t *glyphs,
1790 int num_glyphs,
1791 const cairo_text_cluster_t *clusters,
1792 int num_clusters,
1793 cairo_text_cluster_flags_t cluster_flags,
1794 cairo_scaled_font_t *scaled_font);
1796 cairo_private cairo_status_t
1797 _cairo_surface_composite_trapezoids (cairo_operator_t op,
1798 cairo_pattern_t *pattern,
1799 cairo_surface_t *dst,
1800 cairo_antialias_t antialias,
1801 int src_x,
1802 int src_y,
1803 int dst_x,
1804 int dst_y,
1805 unsigned int width,
1806 unsigned int height,
1807 cairo_trapezoid_t *traps,
1808 int ntraps);
1810 cairo_private cairo_status_t
1811 _cairo_surface_acquire_source_image (cairo_surface_t *surface,
1812 cairo_image_surface_t **image_out,
1813 void **image_extra);
1815 cairo_private void
1816 _cairo_surface_release_source_image (cairo_surface_t *surface,
1817 cairo_image_surface_t *image,
1818 void *image_extra);
1820 cairo_private cairo_status_t
1821 _cairo_surface_acquire_dest_image (cairo_surface_t *surface,
1822 cairo_rectangle_int_t *interest_rect,
1823 cairo_image_surface_t **image_out,
1824 cairo_rectangle_int_t *image_rect,
1825 void **image_extra);
1827 cairo_private void
1828 _cairo_surface_release_dest_image (cairo_surface_t *surface,
1829 cairo_rectangle_int_t *interest_rect,
1830 cairo_image_surface_t *image,
1831 cairo_rectangle_int_t *image_rect,
1832 void *image_extra);
1834 cairo_private cairo_status_t
1835 _cairo_surface_clone_similar (cairo_surface_t *surface,
1836 cairo_surface_t *src,
1837 int src_x,
1838 int src_y,
1839 int width,
1840 int height,
1841 int *clone_offset_x,
1842 int *clone_offset_y,
1843 cairo_surface_t **clone_out);
1845 cairo_private cairo_surface_t *
1846 _cairo_surface_snapshot (cairo_surface_t *surface);
1848 cairo_private cairo_bool_t
1849 _cairo_surface_is_similar (cairo_surface_t *surface_a,
1850 cairo_surface_t *surface_b,
1851 cairo_content_t content);
1853 cairo_private cairo_status_t
1854 _cairo_surface_reset (cairo_surface_t *surface);
1856 cairo_private unsigned int
1857 _cairo_surface_get_current_clip_serial (cairo_surface_t *surface);
1859 cairo_private unsigned int
1860 _cairo_surface_allocate_clip_serial (cairo_surface_t *surface);
1862 cairo_private cairo_status_t
1863 _cairo_surface_reset_clip (cairo_surface_t *surface);
1865 cairo_private cairo_status_t
1866 _cairo_surface_set_clip_region (cairo_surface_t *surface,
1867 cairo_region_t *region,
1868 unsigned int serial);
1870 cairo_private cairo_int_status_t
1871 _cairo_surface_intersect_clip_path (cairo_surface_t *surface,
1872 cairo_path_fixed_t *path,
1873 cairo_fill_rule_t fill_rule,
1874 double tolerance,
1875 cairo_antialias_t antialias);
1877 cairo_private cairo_clip_t *
1878 _cairo_surface_get_clip (cairo_surface_t *surface);
1880 cairo_private cairo_status_t
1881 _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip);
1883 cairo_private cairo_int_status_t
1884 _cairo_surface_get_extents (cairo_surface_t *surface,
1885 cairo_rectangle_int_t *extents);
1887 cairo_private cairo_status_t
1888 _cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font,
1889 cairo_operator_t op,
1890 cairo_pattern_t *pattern,
1891 cairo_surface_t *surface,
1892 int source_x,
1893 int source_y,
1894 int dest_x,
1895 int dest_y,
1896 unsigned int width,
1897 unsigned int height,
1898 cairo_glyph_t *glyphs,
1899 int num_glyphs);
1901 cairo_private cairo_status_t
1902 _cairo_surface_composite_fixup_unbounded (cairo_surface_t *dst,
1903 cairo_surface_attributes_t *src_attr,
1904 int src_width,
1905 int src_height,
1906 cairo_surface_attributes_t *mask_attr,
1907 int mask_width,
1908 int mask_height,
1909 int src_x,
1910 int src_y,
1911 int mask_x,
1912 int mask_y,
1913 int dst_x,
1914 int dst_y,
1915 unsigned int width,
1916 unsigned int height);
1918 cairo_private cairo_status_t
1919 _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst,
1920 cairo_surface_attributes_t *src_attr,
1921 int src_width,
1922 int src_height,
1923 int mask_width,
1924 int mask_height,
1925 int src_x,
1926 int src_y,
1927 int mask_x,
1928 int mask_y,
1929 int dst_x,
1930 int dst_y,
1931 unsigned int width,
1932 unsigned int height);
1934 cairo_private cairo_bool_t
1935 _cairo_surface_is_opaque (const cairo_surface_t *surface);
1937 cairo_private void
1938 _cairo_surface_set_device_scale (cairo_surface_t *surface,
1939 double sx,
1940 double sy);
1942 cairo_private cairo_bool_t
1943 _cairo_surface_has_device_transform (cairo_surface_t *surface);
1945 /* cairo-image-surface.c */
1947 /* XXX: In cairo 1.2.0 we added a new %CAIRO_FORMAT_RGB16_565 but
1948 * neglected to adjust this macro. The net effect is that it's
1949 * impossible to externally create an image surface with this
1950 * format. This is perhaps a good thing since we also neglected to fix
1951 * up things like cairo_surface_write_to_png() for the new format
1952 * (-Wswitch-enum will tell you where). Is it obvious that format was
1953 * added in haste?
1955 * The reason for the new format was to allow the xlib backend to be
1956 * used on X servers with a 565 visual. So the new format did its job
1957 * for that, even without being considered "valid" for the sake of
1958 * things like cairo_image_surface_create().
1960 * Since 1.2.0 we ran into the same situtation with X servers with BGR
1961 * visuals. This time we invented #cairo_internal_format_t instead,
1962 * (see it for more discussion).
1964 * The punchline is that %CAIRO_FORMAT_VALID must not conside any
1965 * internal format to be valid. Also we need to decide if the
1966 * RGB16_565 should be moved to instead be an internal format. If so,
1967 * this macro need not change for it. (We probably will need to leave
1968 * an RGB16_565 value in the header files for the sake of code that
1969 * might have that value in it.)
1971 * If we do decide to start fully supporting RGB16_565 as an external
1972 * format, then %CAIRO_FORMAT_VALID needs to be adjusted to include
1973 * it. But that should not happen before all necessary code is fixed
1974 * to support it (at least cairo_surface_write_to_png() and a few spots
1975 * in cairo-xlib-surface.c--again see -Wswitch-enum).
1977 #define CAIRO_FORMAT_INVALID ((unsigned int) -1)
1978 #define CAIRO_FORMAT_VALID(format) ((format) <= CAIRO_FORMAT_A1)
1980 /* pixman-required stride alignment in bytes. */
1981 #define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
1982 #define CAIRO_STRIDE_FOR_WIDTH_BPP(w,bpp) \
1983 (((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & ~(CAIRO_STRIDE_ALIGNMENT-1)
1985 #define CAIRO_CONTENT_VALID(content) ((content) && \
1986 (((content) & ~(CAIRO_CONTENT_COLOR | \
1987 CAIRO_CONTENT_ALPHA | \
1988 CAIRO_CONTENT_COLOR_ALPHA))\
1989 == 0))
1991 cairo_private int
1992 _cairo_format_bits_per_pixel (cairo_format_t format);
1994 cairo_private cairo_format_t
1995 _cairo_format_from_content (cairo_content_t content);
1997 cairo_private cairo_content_t
1998 _cairo_content_from_format (cairo_format_t format);
2000 cairo_private cairo_surface_t *
2001 _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
2002 pixman_format_code_t pixman_format);
2004 cairo_private cairo_bool_t
2005 _pixman_format_from_masks (cairo_format_masks_t *masks,
2006 pixman_format_code_t *format_ret);
2008 cairo_private void
2009 _pixman_format_to_masks (pixman_format_code_t pixman_format,
2010 cairo_format_masks_t *masks);
2012 cairo_private cairo_surface_t *
2013 _cairo_image_surface_create_with_pixman_format (unsigned char *data,
2014 pixman_format_code_t pixman_format,
2015 int width,
2016 int height,
2017 int stride);
2019 cairo_private cairo_surface_t *
2020 _cairo_image_surface_create_with_masks (unsigned char *data,
2021 cairo_format_masks_t *format,
2022 int width,
2023 int height,
2024 int stride);
2026 cairo_private cairo_surface_t *
2027 _cairo_image_surface_create_with_content (cairo_content_t content,
2028 int width,
2029 int height);
2031 cairo_private cairo_surface_t *
2032 _cairo_image_surface_create_for_data_with_content (unsigned char *data,
2033 cairo_content_t content,
2034 int width,
2035 int height,
2036 int stride);
2038 cairo_private void
2039 _cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface);
2041 /* XXX: It's a nasty kludge that this appears here. Backend functions
2042 * like this should really be static. But we're doing this to work
2043 * around some general defects in the backend clipping interfaces,
2044 * (see some notes in test-paginated-surface.c).
2046 * I want to fix the real defects, but it's "hard" as they touch many
2047 * backends, so doing that will require synchronizing several backend
2048 * maintainers.
2050 cairo_private cairo_int_status_t
2051 _cairo_image_surface_set_clip_region (void *abstract_surface,
2052 cairo_region_t *region);
2054 cairo_private cairo_image_surface_t *
2055 _cairo_image_surface_clone (cairo_image_surface_t *surface,
2056 cairo_format_t format);
2058 cairo_private cairo_image_transparency_t
2059 _cairo_image_analyze_transparency (cairo_image_surface_t *image);
2061 cairo_private cairo_bool_t
2062 _cairo_surface_is_image (const cairo_surface_t *surface);
2064 cairo_private cairo_bool_t
2065 _cairo_surface_is_meta (const cairo_surface_t *surface);
2067 /* cairo-pen.c */
2068 cairo_private cairo_status_t
2069 _cairo_pen_init (cairo_pen_t *pen,
2070 double radius,
2071 double tolerance,
2072 cairo_matrix_t *ctm);
2074 cairo_private void
2075 _cairo_pen_init_empty (cairo_pen_t *pen);
2077 cairo_private cairo_status_t
2078 _cairo_pen_init_copy (cairo_pen_t *pen, cairo_pen_t *other);
2080 cairo_private void
2081 _cairo_pen_fini (cairo_pen_t *pen);
2083 cairo_private cairo_status_t
2084 _cairo_pen_add_points (cairo_pen_t *pen, cairo_point_t *point, int num_points);
2086 cairo_private cairo_status_t
2087 _cairo_pen_add_points_for_slopes (cairo_pen_t *pen,
2088 cairo_point_t *a,
2089 cairo_point_t *b,
2090 cairo_point_t *c,
2091 cairo_point_t *d);
2093 cairo_private void
2094 _cairo_pen_find_active_cw_vertex_index (cairo_pen_t *pen,
2095 cairo_slope_t *slope,
2096 int *active);
2098 cairo_private void
2099 _cairo_pen_find_active_ccw_vertex_index (cairo_pen_t *pen,
2100 cairo_slope_t *slope,
2101 int *active);
2103 cairo_private cairo_status_t
2104 _cairo_pen_stroke_spline (cairo_pen_t *pen,
2105 cairo_spline_t *spline,
2106 double tolerance,
2107 cairo_traps_t *traps);
2109 /* cairo-polygon.c */
2110 cairo_private void
2111 _cairo_polygon_init (cairo_polygon_t *polygon);
2113 cairo_private void
2114 _cairo_polygon_fini (cairo_polygon_t *polygon);
2116 cairo_private void
2117 _cairo_polygon_move_to (cairo_polygon_t *polygon,
2118 const cairo_point_t *point);
2120 cairo_private void
2121 _cairo_polygon_line_to (cairo_polygon_t *polygon,
2122 const cairo_point_t *point);
2124 cairo_private void
2125 _cairo_polygon_close (cairo_polygon_t *polygon);
2127 #define _cairo_polygon_status(P) (P)->status
2129 /* cairo-spline.c */
2130 cairo_private cairo_int_status_t
2131 _cairo_spline_init (cairo_spline_t *spline,
2132 const cairo_point_t *a,
2133 const cairo_point_t *b,
2134 const cairo_point_t *c,
2135 const cairo_point_t *d);
2137 cairo_private cairo_status_t
2138 _cairo_spline_decompose (cairo_spline_t *spline, double tolerance);
2140 cairo_private void
2141 _cairo_spline_fini (cairo_spline_t *spline);
2143 /* cairo-matrix.c */
2144 cairo_private void
2145 _cairo_matrix_get_affine (const cairo_matrix_t *matrix,
2146 double *xx, double *yx,
2147 double *xy, double *yy,
2148 double *x0, double *y0);
2150 cairo_private void
2151 _cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
2152 double *x1, double *y1,
2153 double *x2, double *y2,
2154 cairo_bool_t *is_tight);
2156 cairo_private void
2157 _cairo_matrix_transform_bounding_box_fixed (const cairo_matrix_t *matrix,
2158 cairo_box_t *bbox,
2159 cairo_bool_t *is_tight);
2161 cairo_private cairo_bool_t
2162 _cairo_matrix_is_invertible (const cairo_matrix_t *matrix);
2164 cairo_private double
2165 _cairo_matrix_compute_determinant (const cairo_matrix_t *matrix);
2167 cairo_private cairo_status_t
2168 _cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
2169 double *sx, double *sy, int x_major);
2171 cairo_private cairo_bool_t
2172 _cairo_matrix_is_identity (const cairo_matrix_t *matrix);
2174 cairo_private cairo_bool_t
2175 _cairo_matrix_is_translation (const cairo_matrix_t *matrix);
2177 cairo_private cairo_bool_t
2178 _cairo_matrix_is_integer_translation(const cairo_matrix_t *matrix,
2179 int *itx, int *ity);
2181 cairo_private cairo_bool_t
2182 _cairo_matrix_is_pixel_exact (const cairo_matrix_t *matrix);
2184 cairo_private double
2185 _cairo_matrix_transformed_circle_major_axis(cairo_matrix_t *matrix, double radius);
2187 cairo_private void
2188 _cairo_matrix_to_pixman_matrix (const cairo_matrix_t *matrix,
2189 pixman_transform_t *pixman_transform);
2191 /* cairo-traps.c */
2192 cairo_private void
2193 _cairo_traps_init (cairo_traps_t *traps);
2195 cairo_private void
2196 _cairo_traps_limit (cairo_traps_t *traps,
2197 cairo_box_t *limits);
2199 cairo_private cairo_bool_t
2200 _cairo_traps_get_limit (cairo_traps_t *traps,
2201 cairo_box_t *limits);
2203 cairo_private void
2204 _cairo_traps_init_box (cairo_traps_t *traps,
2205 const cairo_box_t *box);
2207 cairo_private void
2208 _cairo_traps_clear (cairo_traps_t *traps);
2210 cairo_private void
2211 _cairo_traps_fini (cairo_traps_t *traps);
2213 #define _cairo_traps_status(T) (T)->status
2215 cairo_private void
2216 _cairo_traps_translate (cairo_traps_t *traps, int x, int y);
2218 cairo_private cairo_status_t
2219 _cairo_traps_tessellate_triangle (cairo_traps_t *traps,
2220 const cairo_point_t t[3]);
2222 cairo_private cairo_status_t
2223 _cairo_traps_tessellate_convex_quad (cairo_traps_t *traps,
2224 const cairo_point_t q[4]);
2226 cairo_private cairo_status_t
2227 _cairo_traps_tessellate_rectangle (cairo_traps_t *traps,
2228 const cairo_point_t *top_left,
2229 const cairo_point_t *bottom_right);
2231 cairo_private void
2232 _cairo_traps_add_trap (cairo_traps_t *traps,
2233 cairo_fixed_t top, cairo_fixed_t bottom,
2234 cairo_line_t *left, cairo_line_t *right);
2236 cairo_private cairo_status_t
2237 _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps,
2238 const cairo_polygon_t *polygon,
2239 cairo_fill_rule_t fill_rule);
2241 cairo_private int
2242 _cairo_traps_contain (const cairo_traps_t *traps,
2243 double x, double y);
2245 cairo_private void
2246 _cairo_traps_extents (const cairo_traps_t *traps,
2247 cairo_box_t *extents);
2249 cairo_private cairo_int_status_t
2250 _cairo_traps_extract_region (const cairo_traps_t *tr,
2251 cairo_region_t *region);
2253 cairo_private cairo_status_t
2254 _cairo_traps_path (const cairo_traps_t *traps,
2255 cairo_path_fixed_t *path);
2257 cairo_private void
2258 _cairo_trapezoid_array_translate_and_scale (cairo_trapezoid_t *offset_traps,
2259 cairo_trapezoid_t *src_traps,
2260 int num_traps,
2261 double tx, double ty,
2262 double sx, double sy);
2264 /* cairo-slope.c */
2265 cairo_private void
2266 _cairo_slope_init (cairo_slope_t *slope,
2267 const cairo_point_t *a,
2268 const cairo_point_t *b);
2270 cairo_private int
2271 _cairo_slope_compare (const cairo_slope_t *a, const cairo_slope_t *b);
2273 /* cairo-pattern.c */
2275 cairo_private cairo_status_t
2276 _cairo_pattern_create_copy (cairo_pattern_t **pattern,
2277 const cairo_pattern_t *other);
2279 cairo_private cairo_status_t
2280 _cairo_pattern_init_copy (cairo_pattern_t *pattern,
2281 const cairo_pattern_t *other);
2283 cairo_private cairo_status_t
2284 _cairo_pattern_init_snapshot (cairo_pattern_t *pattern,
2285 const cairo_pattern_t *other);
2287 cairo_private void
2288 _cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
2289 const cairo_color_t *color,
2290 cairo_content_t content);
2292 cairo_private void
2293 _cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern,
2294 cairo_surface_t *surface);
2296 cairo_private void
2297 _cairo_pattern_init_linear (cairo_linear_pattern_t *pattern,
2298 double x0, double y0, double x1, double y1);
2300 cairo_private void
2301 _cairo_pattern_init_radial (cairo_radial_pattern_t *pattern,
2302 double cx0, double cy0, double radius0,
2303 double cx1, double cy1, double radius1);
2305 cairo_private void
2306 _cairo_pattern_fini (cairo_pattern_t *pattern);
2308 cairo_private cairo_pattern_t *
2309 _cairo_pattern_create_solid (const cairo_color_t *color,
2310 cairo_content_t content);
2312 cairo_private void
2313 _cairo_pattern_transform (cairo_pattern_t *pattern,
2314 const cairo_matrix_t *ctm_inverse);
2316 cairo_private cairo_bool_t
2317 _cairo_pattern_is_opaque_solid (const cairo_pattern_t *pattern);
2319 cairo_private cairo_bool_t
2320 _cairo_pattern_is_opaque (const cairo_pattern_t *abstract_pattern);
2322 cairo_private cairo_int_status_t
2323 _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
2324 cairo_surface_t *dst,
2325 int x,
2326 int y,
2327 unsigned int width,
2328 unsigned int height,
2329 cairo_surface_t **surface_out,
2330 cairo_surface_attributes_t *attributes);
2332 cairo_private void
2333 _cairo_pattern_release_surface (cairo_pattern_t *pattern,
2334 cairo_surface_t *surface,
2335 cairo_surface_attributes_t *attributes);
2337 cairo_private cairo_int_status_t
2338 _cairo_pattern_acquire_surfaces (cairo_pattern_t *src,
2339 cairo_pattern_t *mask,
2340 cairo_surface_t *dst,
2341 int src_x,
2342 int src_y,
2343 int mask_x,
2344 int mask_y,
2345 unsigned int width,
2346 unsigned int height,
2347 cairo_surface_t **src_out,
2348 cairo_surface_t **mask_out,
2349 cairo_surface_attributes_t *src_attributes,
2350 cairo_surface_attributes_t *mask_attributes);
2352 cairo_private cairo_status_t
2353 _cairo_pattern_get_extents (cairo_pattern_t *pattern,
2354 cairo_rectangle_int_t *extents);
2356 cairo_private void
2357 _cairo_pattern_reset_static_data (void);
2359 cairo_private cairo_status_t
2360 _cairo_gstate_set_antialias (cairo_gstate_t *gstate,
2361 cairo_antialias_t antialias);
2363 cairo_private cairo_antialias_t
2364 _cairo_gstate_get_antialias (cairo_gstate_t *gstate);
2366 /* cairo-region.c */
2368 #include "cairo-region-private.h"
2370 /* cairo-unicode.c */
2372 cairo_private int
2373 _cairo_utf8_get_char_validated (const char *p,
2374 uint32_t *unicode);
2376 cairo_private cairo_status_t
2377 _cairo_utf8_to_ucs4 (const char *str,
2378 int len,
2379 uint32_t **result,
2380 int *items_written);
2382 cairo_private int
2383 _cairo_ucs4_to_utf8 (uint32_t unicode,
2384 char *utf8);
2386 #if CAIRO_HAS_WIN32_FONT || CAIRO_HAS_QUARTZ_FONT || CAIRO_HAS_PDF_OPERATORS
2387 # define CAIRO_HAS_UTF8_TO_UTF16 1
2388 #endif
2389 #if CAIRO_HAS_UTF8_TO_UTF16
2390 cairo_private cairo_status_t
2391 _cairo_utf8_to_utf16 (const char *str,
2392 int len,
2393 uint16_t **result,
2394 int *items_written);
2395 #endif
2397 #define _cairo_status_is_error(status) \
2398 (status != CAIRO_STATUS_SUCCESS && status <= CAIRO_STATUS_LAST_STATUS)
2400 cairo_private cairo_status_t
2401 _cairo_error (cairo_status_t status);
2403 /* hide compiler warnings when discarding the return value */
2404 #define _cairo_error_throw(status) do { \
2405 cairo_status_t status__ = _cairo_error (status); \
2406 (void) status__; \
2407 } while (0)
2409 /* Avoid unnecessary PLT entries. */
2410 slim_hidden_proto (cairo_clip_preserve);
2411 slim_hidden_proto (cairo_close_path);
2412 slim_hidden_proto (cairo_create);
2413 slim_hidden_proto (cairo_curve_to);
2414 slim_hidden_proto (cairo_destroy);
2415 slim_hidden_proto (cairo_fill_preserve);
2416 slim_hidden_proto (cairo_font_face_destroy);
2417 slim_hidden_proto (cairo_font_face_get_user_data);
2418 slim_hidden_proto_no_warn (cairo_font_face_reference);
2419 slim_hidden_proto (cairo_font_face_set_user_data);
2420 slim_hidden_proto (cairo_font_options_equal);
2421 slim_hidden_proto (cairo_font_options_hash);
2422 slim_hidden_proto (cairo_font_options_merge);
2423 slim_hidden_proto (cairo_font_options_set_antialias);
2424 slim_hidden_proto (cairo_font_options_set_hint_metrics);
2425 slim_hidden_proto (cairo_font_options_set_hint_style);
2426 slim_hidden_proto (cairo_font_options_set_subpixel_order);
2427 slim_hidden_proto (cairo_font_options_status);
2428 slim_hidden_proto (cairo_get_current_point);
2429 slim_hidden_proto (cairo_get_line_width);
2430 slim_hidden_proto (cairo_get_matrix);
2431 slim_hidden_proto (cairo_get_target);
2432 slim_hidden_proto (cairo_get_tolerance);
2433 slim_hidden_proto (cairo_glyph_allocate);
2434 slim_hidden_proto (cairo_glyph_free);
2435 slim_hidden_proto (cairo_image_surface_create);
2436 slim_hidden_proto (cairo_image_surface_create_for_data);
2437 slim_hidden_proto (cairo_image_surface_get_data);
2438 slim_hidden_proto (cairo_image_surface_get_height);
2439 slim_hidden_proto (cairo_image_surface_get_stride);
2440 slim_hidden_proto (cairo_image_surface_get_width);
2441 slim_hidden_proto (cairo_format_stride_for_width);
2442 slim_hidden_proto (cairo_line_to);
2443 slim_hidden_proto (cairo_mask);
2444 slim_hidden_proto (cairo_matrix_init);
2445 slim_hidden_proto (cairo_matrix_init_identity);
2446 slim_hidden_proto (cairo_matrix_init_rotate);
2447 slim_hidden_proto (cairo_matrix_init_scale);
2448 slim_hidden_proto (cairo_matrix_init_translate);
2449 slim_hidden_proto (cairo_matrix_invert);
2450 slim_hidden_proto (cairo_matrix_multiply);
2451 slim_hidden_proto (cairo_matrix_scale);
2452 slim_hidden_proto (cairo_matrix_transform_distance);
2453 slim_hidden_proto (cairo_matrix_transform_point);
2454 slim_hidden_proto (cairo_matrix_translate);
2455 slim_hidden_proto (cairo_move_to);
2456 slim_hidden_proto (cairo_new_path);
2457 slim_hidden_proto (cairo_paint);
2458 slim_hidden_proto (cairo_path_extents);
2459 slim_hidden_proto (cairo_pattern_create_for_surface);
2460 slim_hidden_proto (cairo_pattern_create_rgb);
2461 slim_hidden_proto (cairo_pattern_create_rgba);
2462 slim_hidden_proto (cairo_pattern_destroy);
2463 slim_hidden_proto (cairo_pattern_get_extend);
2464 slim_hidden_proto (cairo_pattern_get_type);
2465 slim_hidden_proto_no_warn (cairo_pattern_reference);
2466 slim_hidden_proto (cairo_pattern_set_matrix);
2467 slim_hidden_proto (cairo_pattern_status);
2468 slim_hidden_proto (cairo_pop_group);
2469 slim_hidden_proto (cairo_pop_group_to_source);
2470 slim_hidden_proto (cairo_push_group);
2471 slim_hidden_proto (cairo_push_group_with_content);
2472 slim_hidden_proto (cairo_rel_line_to);
2473 slim_hidden_proto (cairo_restore);
2474 slim_hidden_proto (cairo_save);
2475 slim_hidden_proto (cairo_scale);
2476 slim_hidden_proto (cairo_scaled_font_create);
2477 slim_hidden_proto (cairo_scaled_font_destroy);
2478 slim_hidden_proto (cairo_scaled_font_extents);
2479 slim_hidden_proto (cairo_scaled_font_get_ctm);
2480 slim_hidden_proto (cairo_scaled_font_get_font_face);
2481 slim_hidden_proto (cairo_scaled_font_get_font_matrix);
2482 slim_hidden_proto (cairo_scaled_font_get_font_options);
2483 slim_hidden_proto (cairo_scaled_font_text_to_glyphs);
2484 slim_hidden_proto (cairo_scaled_font_glyph_extents);
2485 slim_hidden_proto_no_warn (cairo_scaled_font_reference);
2486 slim_hidden_proto (cairo_scaled_font_status);
2487 slim_hidden_proto (cairo_set_font_size);
2488 slim_hidden_proto (cairo_set_font_options);
2489 slim_hidden_proto (cairo_set_line_cap);
2490 slim_hidden_proto (cairo_set_line_join);
2491 slim_hidden_proto (cairo_set_line_width);
2492 slim_hidden_proto (cairo_set_matrix);
2493 slim_hidden_proto (cairo_set_operator);
2494 slim_hidden_proto (cairo_set_source);
2495 slim_hidden_proto (cairo_set_source);
2496 slim_hidden_proto (cairo_set_source_surface);
2497 slim_hidden_proto (cairo_status);
2498 slim_hidden_proto (cairo_stroke);
2499 slim_hidden_proto (cairo_stroke_preserve);
2500 slim_hidden_proto (cairo_surface_create_similar);
2501 slim_hidden_proto (cairo_surface_destroy);
2502 slim_hidden_proto (cairo_surface_finish);
2503 slim_hidden_proto (cairo_surface_flush);
2504 slim_hidden_proto (cairo_surface_get_content);
2505 slim_hidden_proto (cairo_surface_get_device_offset);
2506 slim_hidden_proto (cairo_surface_get_font_options);
2507 slim_hidden_proto (cairo_surface_get_type);
2508 slim_hidden_proto (cairo_surface_has_show_text_glyphs);
2509 slim_hidden_proto (cairo_surface_mark_dirty_rectangle);
2510 slim_hidden_proto_no_warn (cairo_surface_reference);
2511 slim_hidden_proto (cairo_surface_set_device_offset);
2512 slim_hidden_proto (cairo_surface_set_fallback_resolution);
2513 slim_hidden_proto (cairo_surface_copy_page);
2514 slim_hidden_proto (cairo_surface_show_page);
2515 slim_hidden_proto (cairo_surface_status);
2516 slim_hidden_proto (cairo_text_cluster_allocate);
2517 slim_hidden_proto (cairo_text_cluster_free);
2518 slim_hidden_proto (cairo_toy_font_face_create);
2519 slim_hidden_proto (cairo_toy_font_face_get_slant);
2520 slim_hidden_proto (cairo_toy_font_face_get_weight);
2521 slim_hidden_proto (cairo_user_font_face_create);
2522 slim_hidden_proto (cairo_user_font_face_set_init_func);
2523 slim_hidden_proto (cairo_user_font_face_set_render_glyph_func);
2524 slim_hidden_proto (cairo_user_font_face_set_unicode_to_glyph_func);
2525 slim_hidden_proto (cairo_version_string);
2527 #if CAIRO_HAS_PNG_FUNCTIONS
2529 slim_hidden_proto (cairo_surface_write_to_png_stream);
2531 #endif
2533 CAIRO_END_DECLS
2535 #include "cairo-mutex-private.h"
2536 #include "cairo-fixed-private.h"
2537 #include "cairo-wideint-private.h"
2538 #include "cairo-malloc-private.h"
2539 #include "cairo-hash-private.h"
2541 #endif