summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2990
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in8
-rw-r--r--NEWS406
-rw-r--r--TODO201
-rw-r--r--aclocal.m4493
-rw-r--r--config.h.in3
-rwxr-xr-xconfig.sub6
-rwxr-xr-xconfigure1590
-rw-r--r--configure.in154
-rwxr-xr-xdepcomp75
-rw-r--r--doc/Makefile.in7
-rw-r--r--doc/public/Makefile.am20
-rw-r--r--doc/public/Makefile.in52
-rw-r--r--doc/public/cairo-docs.xml12
-rw-r--r--doc/public/cairo-sections.txt263
-rw-r--r--doc/public/html/bindings-errors.html127
-rw-r--r--doc/public/html/bindings-fonts.html60
-rw-r--r--doc/public/html/bindings-memory.html130
-rw-r--r--doc/public/html/bindings-overloading.html128
-rw-r--r--doc/public/html/bindings-path.html123
-rw-r--r--doc/public/html/bindings-patterns.html64
-rw-r--r--doc/public/html/bindings-return-values.html126
-rw-r--r--doc/public/html/bindings-streams.html99
-rw-r--r--doc/public/html/bindings-surfaces.html99
-rw-r--r--doc/public/html/cairo-ATSUI-Fonts.html66
-rw-r--r--doc/public/html/cairo-Fonts.html590
-rw-r--r--doc/public/html/cairo-FreeType-Fonts.html283
-rw-r--r--doc/public/html/cairo-Glitz-backend.html95
-rw-r--r--doc/public/html/cairo-Microsoft-Windows-Backend.html269
-rw-r--r--doc/public/html/cairo-PDF-Backend.html245
-rw-r--r--doc/public/html/cairo-PNG-Backend.html254
-rw-r--r--doc/public/html/cairo-PS-Backend.html249
-rw-r--r--doc/public/html/cairo-Quartz-Backend.html117
-rw-r--r--doc/public/html/cairo-XCB-Backend.html236
-rw-r--r--doc/public/html/cairo-XLib-Backend.html254
-rw-r--r--doc/public/html/cairo-cairo-matrix-t.html729
-rw-r--r--doc/public/html/cairo-cairo-pattern-t.html680
-rw-r--r--doc/public/html/cairo-cairo-surface-t.html446
-rw-r--r--doc/public/html/cairo-cairo-t.html4710
-rw-r--r--doc/public/html/cairo.devhelp184
-rw-r--r--doc/public/html/index.html84
-rw-r--r--doc/public/html/index.sgml169
-rw-r--r--doc/public/html/ix01.html426
-rw-r--r--doc/public/html/language-bindings.html82
-rw-r--r--doc/public/html/pt01.html35
-rw-r--r--doc/public/html/pt02.html35
-rw-r--r--doc/public/language-bindings.xml726
-rw-r--r--doc/public/tmpl/cairo-atsui.sgml8
-rw-r--r--doc/public/tmpl/cairo-font.sgml140
-rw-r--r--doc/public/tmpl/cairo-ft.sgml26
-rw-r--r--doc/public/tmpl/cairo-glitz.sgml8
-rw-r--r--doc/public/tmpl/cairo-matrix.sgml69
-rw-r--r--doc/public/tmpl/cairo-pattern.sgml31
-rw-r--r--doc/public/tmpl/cairo-pdf.sgml36
-rw-r--r--doc/public/tmpl/cairo-png.sgml41
-rw-r--r--doc/public/tmpl/cairo-ps.sgml36
-rw-r--r--doc/public/tmpl/cairo-quartz.sgml10
-rw-r--r--doc/public/tmpl/cairo-surface.sgml42
-rw-r--r--doc/public/tmpl/cairo-unused.sgml153
-rw-r--r--doc/public/tmpl/cairo-win32.sgml64
-rw-r--r--doc/public/tmpl/cairo-xcb-xrender.sgml32
-rw-r--r--doc/public/tmpl/cairo-xcb.sgml34
-rw-r--r--doc/public/tmpl/cairo-xlib-xrender.sgml32
-rw-r--r--doc/public/tmpl/cairo-xlib.sgml29
-rw-r--r--doc/public/tmpl/cairo.sgml369
-rw-r--r--doc/public/xml/cairo-atsui.xml15
-rw-r--r--doc/public/xml/cairo-font.xml419
-rw-r--r--doc/public/xml/cairo-ft.xml136
-rw-r--r--doc/public/xml/cairo-glitz.xml18
-rw-r--r--doc/public/xml/cairo-matrix.xml291
-rw-r--r--doc/public/xml/cairo-pattern.xml91
-rw-r--r--doc/public/xml/cairo-pdf.xml89
-rw-r--r--doc/public/xml/cairo-png.xml125
-rw-r--r--doc/public/xml/cairo-ps.xml104
-rw-r--r--doc/public/xml/cairo-quartz.xml28
-rw-r--r--doc/public/xml/cairo-surface.xml182
-rw-r--r--doc/public/xml/cairo-win3.xml181
-rw-r--r--doc/public/xml/cairo-win32.xml100
-rw-r--r--doc/public/xml/cairo-xcb-xrender.xml92
-rw-r--r--doc/public/xml/cairo-xcb.xml108
-rw-r--r--doc/public/xml/cairo-xlib-xrender.xml92
-rw-r--r--doc/public/xml/cairo-xlib.xml123
-rw-r--r--doc/public/xml/cairo.xml1767
-rw-r--r--gtk-doc.make26
-rwxr-xr-xinstall-sh476
-rw-r--r--ltmain.sh503
-rwxr-xr-xmissing127
-rw-r--r--src/Makefile.am85
-rw-r--r--src/Makefile.in230
-rw-r--r--src/cairo-arc-private.h57
-rw-r--r--src/cairo-arc.c296
-rw-r--r--src/cairo-array.c273
-rw-r--r--src/cairo-atsui-font.c691
-rw-r--r--src/cairo-atsui.h8
-rw-r--r--src/cairo-cache.c (renamed from src/cairo_cache.c)45
-rw-r--r--src/cairo-color.c163
-rw-r--r--src/cairo-features.h22
-rw-r--r--src/cairo-features.h.in24
-rw-r--r--src/cairo-fixed.c (renamed from src/cairo_fixed.c)0
-rw-r--r--src/cairo-font.c1217
-rw-r--r--src/cairo-ft-font.c (renamed from src/cairo_ft_font.c)968
-rw-r--r--src/cairo-ft-private.h4
-rw-r--r--src/cairo-ft.h24
-rw-r--r--src/cairo-glitz-surface.c (renamed from src/cairo_glitz_surface.c)1129
-rw-r--r--src/cairo-glitz.h9
-rw-r--r--src/cairo-gstate-private.h115
-rw-r--r--src/cairo-gstate.c2266
-rw-r--r--src/cairo-hull.c (renamed from src/cairo_hull.c)0
-rw-r--r--src/cairo-image-surface.c (renamed from src/cairo_image_surface.c)156
-rw-r--r--src/cairo-matrix.c (renamed from src/cairo_matrix.c)501
-rw-r--r--src/cairo-output-stream.c285
-rw-r--r--src/cairo-path-bounds.c (renamed from src/cairo_path_bounds.c)16
-rw-r--r--src/cairo-path-data-private.h56
-rw-r--r--src/cairo-path-data.c517
-rw-r--r--src/cairo-path-fill.c (renamed from src/cairo_path_fill.c)20
-rw-r--r--src/cairo-path-fixed-private.h74
-rw-r--r--src/cairo-path-stroke.c (renamed from src/cairo_path_stroke.c)34
-rw-r--r--src/cairo-path.c532
-rw-r--r--src/cairo-pattern.c (renamed from src/cairo_pattern.c)624
-rw-r--r--src/cairo-pdf-surface.c (renamed from src/cairo_pdf_surface.c)1263
-rw-r--r--src/cairo-pdf.h33
-rw-r--r--src/cairo-pen.c (renamed from src/cairo_pen.c)6
-rw-r--r--src/cairo-png.c469
-rw-r--r--src/cairo-polygon.c (renamed from src/cairo_polygon.c)0
-rw-r--r--src/cairo-private.h52
-rw-r--r--src/cairo-ps-surface.c (renamed from src/cairo_ps_surface.c)325
-rw-r--r--src/cairo-ps.h32
-rw-r--r--src/cairo-quartz-surface.c257
-rw-r--r--src/cairo-quartz.h11
-rw-r--r--src/cairo-slope.c (renamed from src/cairo_slope.c)0
-rw-r--r--src/cairo-spline.c (renamed from src/cairo_spline.c)16
-rw-r--r--src/cairo-surface.c (renamed from src/cairo_surface.c)609
-rw-r--r--src/cairo-traps.c (renamed from src/cairo_traps.c)99
-rw-r--r--src/cairo-unicode.c (renamed from src/cairo_unicode.c)28
-rw-r--r--src/cairo-wideint.c (renamed from src/cairo_wideint.c)6
-rw-r--r--src/cairo-wideint.h12
-rw-r--r--src/cairo-win32-font.c (renamed from src/cairo_win32_font.c)634
-rw-r--r--src/cairo-win32-surface.c (renamed from src/cairo_win32_surface.c)272
-rw-r--r--src/cairo-win32.h26
-rw-r--r--src/cairo-xcb-surface.c (renamed from src/cairo_xcb_surface.c)636
-rw-r--r--src/cairo-xcb-xrender.h62
-rw-r--r--src/cairo-xcb.h27
-rw-r--r--src/cairo-xlib-surface.c (renamed from src/cairo_xlib_surface.c)1137
-rw-r--r--src/cairo-xlib-test.h (renamed from src/cairo-png.h)27
-rw-r--r--src/cairo-xlib-xrender.h (renamed from src/cairo_color.c)69
-rw-r--r--src/cairo-xlib.h43
-rw-r--r--src/cairo.c2050
-rw-r--r--src/cairo.h875
-rw-r--r--src/cairo_array.c134
-rw-r--r--src/cairo_atsui_font.c807
-rw-r--r--src/cairo_font.c476
-rw-r--r--src/cairo_gstate.c2566
-rw-r--r--src/cairo_path.c495
-rw-r--r--src/cairo_png_surface.c425
-rw-r--r--src/cairo_quartz_surface.c392
-rw-r--r--src/cairoint.h1166
-rw-r--r--test/Makefile.am220
-rw-r--r--test/Makefile.in642
-rw-r--r--test/buffer-diff.c150
-rw-r--r--test/buffer-diff.h (renamed from test/buffer_diff.h)22
-rw-r--r--test/buffer_diff.c73
-rw-r--r--test/cairo-test.c579
-rw-r--r--test/cairo-test.h (renamed from test/cairo_test.h)12
-rw-r--r--test/cairo_test.c247
-rw-r--r--test/clip-nesting-ref.pngbin0 -> 1050 bytes
-rw-r--r--test/clip-nesting.c98
-rw-r--r--test/clip-twice-ref.pngbin0 -> 1191 bytes
-rw-r--r--test/clip-twice.c (renamed from test/clip_twice.c)17
-rw-r--r--test/clip_twice-ref.pngbin751 -> 0 bytes
-rw-r--r--test/coverage-ref.pngbin44324 -> 0 bytes
-rw-r--r--test/create-for-png-ref.png (renamed from test/move_to_show_surface-ref.png)bin100 -> 100 bytes
-rw-r--r--test/create-for-png.c69
-rw-r--r--test/fill-and-stroke-ref.pngbin0 -> 279 bytes
-rw-r--r--test/fill-and-stroke.c63
-rw-r--r--test/fill-rule-ref.png (renamed from test/fill_rule-ref.png)bin1979 -> 1979 bytes
-rw-r--r--test/fill-rule.c (renamed from test/fill_rule.c)10
-rw-r--r--test/filter-nearest-offset-ref.pngbin0 -> 254 bytes
-rw-r--r--test/filter-nearest-offset.c107
-rw-r--r--test/get-and-set.c142
-rw-r--r--test/gradient-alpha-ref.pngbin0 -> 153 bytes
-rw-r--r--test/gradient-alpha.c61
-rw-r--r--test/imagediff.c8
-rw-r--r--test/leaky-polygon-ref.png (renamed from test/leaky_polygon-ref.png)bin255 -> 255 bytes
-rw-r--r--test/leaky-polygon.c (renamed from test/leaky_polygon.c)8
-rw-r--r--test/line-width-ref.png (renamed from test/line_width-ref.png)bin171 -> 171 bytes
-rw-r--r--test/line-width.c (renamed from test/line_width.c)10
-rw-r--r--test/linear-gradient-ref.png (renamed from test/linear_gradient-ref.png)bin12724 -> 12724 bytes
-rw-r--r--test/linear-gradient.c (renamed from test/linear_gradient.c)42
-rw-r--r--test/mask-ref.pngbin0 -> 87846 bytes
-rw-r--r--test/mask.c246
-rw-r--r--test/move-to-show-surface-ref.pngbin0 -> 100 bytes
-rw-r--r--test/move-to-show-surface.c (renamed from test/move_to_show_surface.c)30
-rw-r--r--test/paint-ref.pngbin0 -> 116 bytes
-rw-r--r--test/paint-with-alpha-ref.pngbin0 -> 164 bytes
-rw-r--r--test/paint-with-alpha.c64
-rw-r--r--test/paint.c53
-rw-r--r--test/path-data-ref.pngbin0 -> 387 bytes
-rw-r--r--test/path-data.c184
-rw-r--r--test/pdf-clip.c134
-rw-r--r--test/pdf-surface.c115
-rw-r--r--test/pixman-rotate-ref.png (renamed from test/pixman_rotate-ref.png)bin260 -> 260 bytes
-rw-r--r--test/pixman-rotate.c76
-rw-r--r--test/pixman_rotate.c78
-rw-r--r--test/ps-surface.c115
-rw-r--r--test/read-png.c (renamed from test/read_png.c)35
-rw-r--r--test/read-png.h (renamed from test/read_png.h)0
-rw-r--r--test/rel-path-ref.pngbin0 -> 212 bytes
-rw-r--r--test/rel-path.c56
-rw-r--r--test/scale-source-surface-paint-ref.pngbin0 -> 147 bytes
-rw-r--r--test/scale-source-surface-paint.c64
-rw-r--r--test/select-font-no-show-text.c64
-rw-r--r--test/self-copy-ref.pngbin0 -> 291 bytes
-rw-r--r--test/self-copy.c89
-rw-r--r--test/self-intersecting-ref.pngbin0 -> 242 bytes
-rw-r--r--test/self-intersecting.c89
-rw-r--r--test/set-source-ref.pngbin0 -> 120 bytes
-rw-r--r--test/set-source.c87
-rw-r--r--test/source-clip-ref.pngbin0 -> 180 bytes
-rw-r--r--test/source-clip.c84
-rw-r--r--test/source-surface-scale-paint-ref.pngbin0 -> 147 bytes
-rw-r--r--test/source-surface-scale-paint.c64
-rw-r--r--test/surface-finish-twice.c74
-rw-r--r--test/surface-pattern-ref.pngbin0 -> 194 bytes
-rw-r--r--test/surface-pattern.c74
-rw-r--r--test/text-cache-crash.c (renamed from test/text_cache_crash.c)26
-rw-r--r--test/text-rotate.c (renamed from test/text_rotate.c)25
-rw-r--r--test/transforms-ref.pngbin0 -> 302 bytes
-rw-r--r--test/transforms.c111
-rw-r--r--test/translate-show-surface-ref.pngbin0 -> 100 bytes
-rw-r--r--test/translate-show-surface.c83
-rw-r--r--test/trap-clip-ref.pngbin0 -> 71701 bytes
-rw-r--r--test/trap-clip.c (renamed from test/coverage.c)158
-rw-r--r--test/user-data.c82
-rw-r--r--test/write-png.c (renamed from test/write_png.c)4
-rw-r--r--test/write-png.h (renamed from test/write_png.h)2
-rw-r--r--test/xlib-surface.c269
-rw-r--r--test/xmalloc.c5
-rw-r--r--test/xmalloc.h2
239 files changed, 39342 insertions, 16313 deletions
diff --git a/ChangeLog b/ChangeLog
index abf671a..90daddb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,2993 @@
+2005-06-20 Carl Worth <cworth@cworth.org>
+
+ * Makefile.am: Force distcheck to enable gtk-doc.
+
+2005-06-20 Carl Worth <cworth@cworth.org>
+
+ * NEWS: Added notes for snapshot 0.5.1
+
+ * configure.in: Increment CAIRO_VERSION to 0.5.1
+
+2005-06-20 Owen Taylor <otaylor@redhat.com>
+
+ Workaround for https://bugs.freedesktop.org/show_bug.cgi?id=3566
+
+ * src/cairo-xlib-surface.c: Detect servers with a bug in
+ repeating surfaces by checking vendor string and version.
+
+ * src/cairo-xlib-surface.c: For such surfaces either fall back to
+ an implementation with the core protocol or fall back to the image
+ backend.
+
+ * src/cairo-xlib-surface.c: Save clip rects when setting a
+ clip region on a surface so that we set the right clip for the
+ surface's GC if we create it later.
+
+2005-06-20 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-matrix.c: (_cairo_matrix_is_integer_translation):
+ Make out parameters optional. Style cleanup.
+
+2005-06-20 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-pattern.c: (_cairo_pattern_is_opaque_solid): Abstract
+ CAIRO_ALPHA_IS_OPAQUE out for general internal use.
+
+ * src/cairo.c: (cairo_paint_with_alpha): Optimize to defer to
+ cairo_paint if the alpha value is actually opaque.
+
+2005-06-20 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo-private.h:
+ * src/cairo.c: (_cairo_error), (cairo_create): Rip out
+ cairo_set_error_notfiy function as it is clear that it is not the
+ right approach.
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/error-notify.c: Remove error-notify test.
+
+2005-06-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xcb-surface.c (_get_image_surface): Remove references
+ to repeat and matrix fields that no longer exist.
+
+2005-06-17 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-xcb-surface.c (_get_image_surface)
+ * src/cairo-xlib-surface.c (_get_image_surface): Fix
+ width/height typo.
+
+2005-06-17 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-glitz-surface.c: (_cairo_glitz_surface_get_image):
+ * src/cairo-pattern.c: (cairo_pattern_create_for_surface):
+ * src/cairo-pdf-surface.c: (_cairo_pdf_surface_composite_pdf):
+ * src/cairo-surface.c: (_cairo_surface_init):
+ * src/cairo-xlib-surface.c: (_get_image_surface):
+ * src/cairoint.h: Remove matrix, filter and repeat from the
+ cairo_surface_t struct.
+
+2005-06-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c: (cairo_reference), (cairo_destroy): cairo_reference
+ and cairo_destroy shouldn't behave differently when cr->status
+ indicates an error. Fix this bug that just slipped back in.
+
+ * src/cairo.c: (cairo_restore): Remove useless conditional return
+ at the end of a void function.
+
+ * src/cairo.c: (cairo_get_source), (cairo_get_font_face),
+ (cairo_text_extents), (cairo_show_text), (cairo_text_path):
+ Fix so that after calling _cairo_error the most that any cairo
+ entry function ever does is return a previously computed value.
+
+2005-06-17 Kristian Høgsberg <krh@redhat.com>
+
+ * TODO: Remove the path clipping entry from the list.
+
+2005-06-16 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-private.h: Reorder fields of cairo_private_t to match
+ initialization order.
+
+ * src/cairo.c: (_cairo_error): Call error_notify callback if set.
+ (cairo_create): Initialize error_notify callback to NULL.
+ (cairo_set_error_notify): New function to allow the user to set
+ an error notify callback.
+
+ * src/cairo.h: New cairo_set_error_notify prototye.
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/error-notify.c: (toggle_status), (do_test), (main): New
+ test for cairo_set_error_notify.
+
+2005-06-15 Carl Worth <cworth@cworth.org>
+
+ * TODO: Add CAIRO_STATUS_DESTROYED to TODO list.
+
+ * ROADMAP: Note progress on consistent error handling.
+
+ * src/cairo-surface.c: Fix typo in documentation comment for
+ _cairo_surface_get_current_clip_serial.
+
+2005-06-15 Owen Taylor <otaylor@redhat.com>
+
+ * doc/public/Makefile.am (MKTMPL_OPTIONS): Remove --only-section-tmpl;
+ it doesn't really work currently :-(.
+
+2005-06-15 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-gstate.c (_cairo_gstate_clip_and_composite_trapezoids):
+ Use a clip region when rendering a non-solid pattern through
+ a rectangular path ... trapezoid rasterization is just too slow
+ to use that path when we aren't forced to do so.
+
+2005-06-15 Carl Worth <cworth@cworth.org>
+
+ * test/cairo-test.c: Track removal of cairo_status_string.
+ (cairo_test_for_target): And add missing parenthesis.
+
+2005-06-15 Carl Worth <cworth@cworth.org>
+
+ * TODO: Add cairo_finish to TODO list. Note that
+ cairo_satus_string has now been removed.
+
+2005-06-15 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo.c: Remove cairo_status_string function which can now
+ be replaced by:
+
+ cairo_status_to_string (cairo_status (cr));
+
+ This allows consistent handling of status values for things like
+ cairo_pattern_status where there is now
+ cairo_pattern_status_string function.
+
+2005-06-13 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c: (_cairo_error): Add _cairo_error so we have a
+ single function which all errors can pass through. This allows the
+ user to set a breakpoint on error and will allow us to augment
+ error handling later as necessary.
+
+ * src/cairo.c: (cairo_create), (cairo_reference),
+ (cairo_destroy), (cairo_save), (cairo_restore),
+ (cairo_set_operator), (cairo_set_source_rgb),
+ (cairo_set_source_rgba), (cairo_set_source_surface),
+ (cairo_set_source), (cairo_get_source), (cairo_set_tolerance),
+ (cairo_set_fill_rule), (cairo_set_line_width),
+ (cairo_set_line_cap), (cairo_set_line_join), (cairo_set_dash),
+ (cairo_set_miter_limit), (cairo_translate), (cairo_scale),
+ (cairo_rotate), (cairo_transform), (cairo_set_matrix),
+ (cairo_identity_matrix), (cairo_user_to_device),
+ (cairo_user_to_device_distance), (cairo_device_to_user),
+ (cairo_device_to_user_distance), (cairo_new_path), (cairo_move_to),
+ (cairo_line_to), (cairo_curve_to), (cairo_arc),
+ (cairo_arc_negative), (cairo_rel_move_to), (cairo_rel_line_to),
+ (cairo_rel_curve_to), (cairo_rectangle), (cairo_close_path),
+ (cairo_paint), (cairo_paint_with_alpha), (cairo_mask),
+ (cairo_mask_surface), (cairo_stroke_preserve),
+ (cairo_fill_preserve), (cairo_copy_page), (cairo_show_page),
+ (cairo_in_stroke), (cairo_in_fill), (cairo_stroke_extents),
+ (cairo_fill_extents), (cairo_clip_preserve), (cairo_reset_clip),
+ (cairo_select_font_face), (cairo_get_font_face),
+ (cairo_font_extents), (cairo_set_font_face), (cairo_set_font_size),
+ (cairo_set_font_matrix), (cairo_get_font_matrix),
+ (cairo_text_extents), (cairo_glyph_extents), (cairo_show_text),
+ (cairo_show_glyphs), (cairo_text_path), (cairo_glyph_path),
+ (cairo_get_operator), (cairo_get_tolerance),
+ (cairo_get_current_point), (cairo_get_fill_rule),
+ (cairo_get_line_width), (cairo_get_line_cap),
+ (cairo_get_line_join), (cairo_get_miter_limit), (cairo_get_matrix),
+ (cairo_get_target), (cairo_copy_path), (cairo_copy_path_flat),
+ (cairo_append_path), (cairo_status): Make all assignements to
+ cr->status go through the new _cairo_error function. Remove
+ CAIRO_CHECK_SANITY macro.
+
+2005-06-15 Carl Worth <cworth@cworth.org>
+
+ * doc/public/cairo-sections.txt: Remove cairo-atsui section since
+ cairo-atsui.h is currently empty.
+ Add cairo_path_data_type_t and cairo_path_data_t.
+
+ * test/.cvsignore: Add pdf-clip and pdf-clip.pdf.
+
+2005-06-14 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-gstate-private.h:
+ * src/cairo-gstate.c: (_cairo_gstate_init),
+ (_cairo_gstate_init_copy), (_cairo_gstate_fini),
+ (_cairo_gstate_set_clip), (_composite_trap_region),
+ (_cairo_gstate_fill), (_cairo_gstate_reset_clip),
+ (_cairo_gstate_intersect_clip_path), (_cairo_clip_path_reference),
+ (_cairo_clip_path_destroy), (_cairo_gstate_intersect_clip_region),
+ (_cairo_gstate_intersect_clip_mask), (_cairo_gstate_clip):
+ * src/cairo-pdf-surface.c:
+ (_cairo_pdf_surface_create_for_document),
+ (_cairo_pdf_path_move_to), (_cairo_pdf_path_line_to),
+ (_cairo_pdf_path_close_path), (_cairo_pdf_surface_fill_path),
+ (_cairo_pdf_surface_intersect_clip_path),
+ (_cairo_pdf_document_add_page):
+ * src/cairo-surface.c: (_cairo_surface_get_clip_mode),
+ (_cairo_surface_fill_path), (_cairo_surface_reset_clip),
+ (_cairo_surface_set_clip_path_recursive),
+ (_cairo_surface_set_clip_path):
+ * src/cairoint.h: Implement path clipping and refactor
+ _cairo_gstate_clip() out in three different functions
+ corresponding to the three different clipping modes.
+
+ * src/cairo-glitz-surface.c:
+ * src/cairo-ps-surface.c:
+ * src/cairo-win32-surface.c:
+ * src/cairo-xcb-surface.c:
+ * src/cairo-xlib-surface.c:
+ * src/cairo-image-surface.c:
+ * src/cairo-quartz-surface.c: Add NULL pointers for
+ intersect_clip_path.
+
+ * test/Makefile.am:
+ * test/pdf-clip.c: New test case to exercise PDF clipping code.
+
+2005-06-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-glitz-surface.c: (_cairo_glitz_surface_create_similar),
+ (_cairo_glitz_surface_clone_similar),
+ (_cairo_glitz_pattern_acquire_surface),
+ (_cairo_glitz_surface_composite_trapezoids):
+ * src/cairo-image-surface.c: (_cairo_image_surface_create_similar):
+ * src/cairo-pdf-surface.c: (_cairo_pdf_surface_create_similar):
+ * src/cairo-ps-surface.c: (_cairo_ps_surface_create_similar):
+ * src/cairo-quartz-surface.c:
+ (_cairo_quartz_surface_create_similar):
+ * src/cairo-surface.c: (_cairo_surface_create_similar_scratch),
+ (_cairo_surface_create_similar_solid):
+ * src/cairo-win32-surface.c: (_cairo_win32_surface_create_similar),
+ (_cairo_win32_surface_get_subimage):
+ * src/cairo-xcb-surface.c: (_cairo_xcb_surface_create_similar),
+ (_cairo_xcb_surface_clone_similar):
+ * src/cairo-xlib-surface.c: (_cairo_xlib_surface_create_similar),
+ (_cairo_xlib_surface_clone_similar):
+ * src/cairoint.h: Remove Boolean 'drawable' parameter from the
+ create_similar surface backend function since nothing anywhere is
+ actually using this parameter.
+
+2005-06-14 T Rowley <tim.rowley@gmail.com>
+
+ * src/cairo-win32-font.c: Correct extents for text with a general
+ tranform.
+
+2005-06-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Remove comment suggesting ambiguity of whether
+ cairo_get_target references the surface, (we decided as part of
+ the API shakeup that cairo functions returning pointers to
+ internal objects do not automatically take a reference).
+
+2005-06-13 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-pattern.c: (_cairo_pattern_create_in_error): Add new
+ _cairo_pattern_create_in_error.
+
+ * src/cairo.c: (cairo_get_source): Propagate error values from
+ cr->status to pattern->status.
+
+2005-06-13 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c (_cairo_set_source_solid),
+ (cairo_set_source_surface), (cairo_mask_surface): No longer need
+ to check for NULL after creating a pattern.
+
+ * src/cairo.c (cairo_set_source), (cairo_mask): Propagate status
+ errors from pattern->status to cr->status.
+
+ Originally 2005-05-08 Owen Taylor <otaylor@redhat.com>:
+
+ * src/cairo-pattern.c src/cairoint.h: If allocation of pattern
+ objects fails, return special static nil pattern objects.
+
+ * src/cairo-pattern.c: If adding a color stop fails to allocate
+ memory, set pattern->status. (And fix a memory leak.) Make public
+ functions return when pattern->status is set, (and no longer
+ return a cairo_status_t).
+
+ * src/cairo-pattern.c src/cairo.h doc/public/cairo-sections.txt:
+ Add cairo_pattern_status()
+
+ * src/cairo-gstate.c: Check the status of gstate->source and
+ of mask patterns passed in.
+
+2005-06-13 Carl Worth <cworth@cworth.org>
+
+ Originally 2005-05-08 Owen Taylor <otaylor@redhat.com>:
+
+ * src/cairo.c (cairo_create): If cairo_create() fails, return
+ a special static object, cairo_nil.
+
+ * src/cairo.c (cairo_reference): Don't return early if
+ cr->status is set. cr->status should not affect reference
+ counting.
+
+ * src/cairo.c: (cairo_reference), (cairo_destroy): Ignore any
+ magic object with a reference count of -1.
+
+2005-06-13 Carl Worth <cworth@cworth.org>
+
+ Originally 2005-06-02 Carl Worth <cworth@cworth.org>:
+
+ * src/cairo.h: Add a status field to cairo_path_t.
+
+ * src/cairo.c:
+ (cairo_copy_path), (cairo_copy_path_flat): Add documentation for
+ the new approach for handling errors in these functions---always
+ returning a valid pointer with at least a status.
+ (cairo_append_path): Propagate path status errors to the
+ context. Add note to documentation on initializing path->status.
+
+ * src/cairo-path-data-private.h: Add missing cairo_private
+ qualifier to a couple functions.
+
+ * src/cairo-path-data.c: (_cairo_path_data_create_real): Track new
+ status field in cairo_path_t.
+ (cairo_path_destroy): Don't destroy cairo_path_nil. Add
+ documentation.
+ (_cairo_path_data_create):
+ (_cairo_path_data_create_flat):
+ (_cairo_path_data_append_to_context): Add documentation.
+ (_cairo_path_data_create_in_error): New function to create a
+ placeholder cairo_path_t just to propagate a cairo_status_t error.
+
+2005-06-11 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-gstate.c: (_cairo_gstate_init,
+ _cairo_gstate_init_copy, _cairo_gstate_fini): Make these functions
+ static, which allows slightly less awkward error handling within
+ them.
+
+2005-06-10 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h: Provide font-backend-specific macros for
+ FONT_FAMILY_DEFAULT. Change CAIRO_FT_FONT_FAMILY_DEFAULT from
+ "serif" to "" to allow the actual default to come from the
+ system/user configuration.
+
+2005-06-10 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Pull the enum out from inside cairo_path_data_t and
+ give it a name of cairo_path_data_type_t. This allows C++ programs
+ to see the enum values. It also allows variables to be declared of
+ this type for manually constructing a cairo_path_t.
+
+2005-06-10 Carl Worth <cworth@cworth.org>
+
+ * ROADMAP: Add 'consistent error handling' to 1.0 roadmap. (This
+ isn't new, we just forgot to list it here before).
+
+ * TODO: Big cleanup to remove finished items. Also, split the file
+ up to separate TODO items that affect the API from items that do
+ not.
+
+2005-06-10 Carl Worth <cworth@cworth.org>
+
+ Originally: 2005-06-09 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-pdf-surface.c: (_cairo_pdf_surface_show_page):
+ * src/cairo-xcb-surface.c:
+ (_cairo_xcb_surface_acquire_source_image),
+ (_cairo_xcb_surface_acquire_dest_image):
+ * src/cairo-xlib-surface.c:
+ (_cairo_xlib_surface_acquire_source_image),
+ (_cairo_xlib_surface_acquire_dest_image): Rework occurrences
+ of 'if (status == CAIRO_STATUS_SUCCESS)' to use 'if (status)'
+ instead where trivial.
+
+2005-06-10 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-font.c:
+ * src/cairo-ft-font.c:
+ * src/cairo-glitz-surface.c:
+ * src/cairo-gstate.c:
+ * src/cairo-image-surface.c:
+ * src/cairo-pattern.c:
+ * src/cairo-pdf-surface.c:
+ * src/cairo-png.c:
+ * src/cairo-surface.c:
+ * src/cairo-win32-font.c:
+ * src/cairo-win32-surface.c:
+ * src/cairo-xcb-surface.c:
+ * src/cairo-xlib-surface.c: Remove STATUS_OK macro which was not
+ being used universally.
+
+2005-06-09 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Remove trailing comma from enum values which gcc
+ 4.0 does not want to see (Luis Villa). Closes bug #3502.
+
+2005-06-09 Owen Taylor <otaylor@redhat.com>
+
+ * test/Makefile.am (INCLUDES): Add
+ -I$(top_builddir)/src for cairo-features.h (Tomasz Cholewo)
+
+2005-06-07 Keith Packard <keithp@keithp.com>
+
+ * src/cairo-pdf-surface.c: (_cairo_pdf_surface_show_glyphs):
+ Font matrix was output incorrectly; the implicit mirror-in-y
+ transformation was not computed correctly, missing a negation
+ of the 'xy' component.
+
+2005-06-02 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-gstate.c (_cairo_gstate_clip): When clipping, update
+ the clip surface to a new surface the size of the intersection of
+ the old clip surface and the extents of the new clip path.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-font.c: (cairo_font_face_reference),
+ (cairo_font_face_destroy), (_cairo_simple_font_face_destroy),
+ (_cairo_unscaled_font_reference), (_cairo_unscaled_font_destroy),
+ (cairo_scaled_font_reference), (cairo_scaled_font_destroy):
+ * src/cairo-ft-font.c: (_ft_font_cache_destroy_cache),
+ (_cairo_ft_unscaled_font_destroy), (_ft_font_face_destroy):
+ * src/cairo-glitz-surface.c: (_cairo_glitz_area_destroy):
+ * src/cairo-path-data.c: (cairo_path_destroy):
+ * src/cairo-pdf-surface.c: (cairo_pdf_font_destroy),
+ (cairo_pdf_ft_font_destroy):
+ * src/cairo-win32-font.c: (_cairo_win32_scaled_font_destroy):
+ Allow NULL as a valid value for several objects. That is, calling
+ reference or destroy on these objects will simply do nothing,
+ successfully.
+
+ * src/cairo-atsui-font.c: (_cairo_atsui_font_destroy_font): Remove
+ extra whitespace.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-cache.c: (_cairo_cache_init), (_cairo_cache_destroy):
+ Remove unused cache->refcount and _cairo_cache_reference().
+
+ * src/cairo-cache.c: (_cairo_cache_destroy): Remove gratuitous
+ nesting as recommended in CODING_STYLE.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-array.c: (_cairo_user_data_array_fini):
+ * src/cairo-font.c: (cairo_font_face_destroy):
+ * src/cairo-surface.c: (cairo_surface_destroy): Fix name of
+ _cairo_user_data_array_destroy to be _cairo_user_data_array_fini.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-glitz-surface.c:
+ (_cairo_glitz_glyph_cache_create_entry),
+ (_cairo_glitz_glyph_cache_destroy_entry),
+ (_cairo_glitz_glyph_cache_destroy_cache),
+ (_cairo_glitz_surface_show_glyphs): Rename functions to match the
+ naming scheme used by cairo-cache.c and all other users of
+ it. Though it's quite likely that glitz had this right and now
+ everything could be changed to match it instead. I'll save that
+ for some day when we're cleaning up the cache code.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * CODING_STYLE: Fix spelling errors.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * CODING_STYLE: Fix Freudian unwrapped line in paragraph
+ describing why long lines should be wrapped.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * CODING_STYLE: Add CODING_STYLE document to standardize on some
+ style issues.
+
+ * src/cairo-atsui-font.c:
+ * src/cairo-cache.c:
+ * src/cairo-ft-font.c:
+ * src/cairo-glitz-surface.c:
+ * src/cairo-gstate.c:
+ * src/cairo-matrix.c:
+ * src/cairo-pattern.c:
+ * src/cairo-pdf-surface.c:
+ * src/cairo-spline.c:
+ * src/cairo-wideint.c:
+ * src/cairo-win32-font.c:
+ * src/cairo-xlib-surface.c: Standardize brace handling around all
+ else clauses according to new CODING_STYLE guidelines.
+
+2005-06-03 Kristian Høgsberg <krh@redhat.com>
+
+ Patch from Tomasz Cholewo <cholewo@ieee-cis.org>:
+
+ * src/cairo-pdf-surface.c: (cairo_pdf_ft_font_write_head_table),
+ (cairo_pdf_ft_font_generate): Store the index of the checksum
+ instead of a pointer to the location.
+
+2005-06-03 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-gstate.c:
+ * src/cairo.c: (_cairo_set_source_solid), (cairo_set_source_rgb),
+ (cairo_set_source_rgba): Move internal convenience up from
+ _cairo_gstate_set_source_solid to _cairo_set_source_solid so that
+ all set_source functions flow through cairo_set_source.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c: (_cairo_gstate_init): Remove obsolete
+ _cairo_gstate_set_target_surface, folding its contents into
+ _cairo_gstate_init, most of which disappears due to constant
+ folding. Ensure that gstate->next is initialized even if
+ _cairo_pattern_create_solid fails.
+
+ * src/cairo-xcb-surface.c: Remove unused
+ _cairo_xcb_surface_set_clip_region.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-font.c:
+ * src/cairo-ft-font.c:
+ * src/cairo-glitz-surface.c:
+ * src/cairo-gstate.c:
+ * src/cairo-image-surface.c:
+ * src/cairo-pattern.c:
+ * src/cairo-pdf-surface.c:
+ * src/cairo-png.c:
+ * src/cairo-surface.c:
+ * src/cairo-win32-font.c:
+ * src/cairo-win32-surface.c:
+ * src/cairo-xcb-surface.c:
+ * src/cairo-xlib-surface.c: Rename CAIRO_OK to STATUS_OK. No
+ intended changes in functionality.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate-private.h:
+ * src/cairo-gstate.c: Rename gstate->surface to gstate->target. No
+ intended changes in functionality.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate-private.h:
+ * src/cairo-gstate.c: (_cairo_gstate_init): Remove unused fields
+ from cairo_gstate_t, (font_family, font_slant,
+ font_weight). Reorder fields to match between declaration and
+ initialization and to put the most problematic fields (surface and
+ source) at the end. No intended changes in functionality.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * test/Makefile.am (XFAIL_TESTS): Add self-intersecting to the
+ list of expected failures.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/self-intersecting-ref.png:
+ * test/self-intersecting.c: (draw), (main): Add self-intersecting
+ test which demonstrates the long-standing bug with stroking
+ self-intersecting paths.
+
+2005-06-01 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c (_cairo_gstate_get_clip_extents): Fix bug in
+ converting box to rectangle that left clip_rect.height
+ uninitialized, (leading to unpredictable, intermittent test
+ failures).
+
+2005-05-31 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo.c: (cairo_status_to_string), (cairo_status_string):
+ Add new function cairo_status_to_string an reimplement
+ cairo_status_string in terms of the new function.
+
+2005-05-27 Olivier Andrieu <oliv__a@users.sourceforge.net>
+
+ * src/cairo-path-data.c (_cpdc_curve_to_flatten),
+ (_cpdp_curve_to_flatten) : Fix memory leak
+
+2005-05-26 Keith Packard <keithp@keithp.com>
+
+ reviewed by: krh, otaylor, cworth
+
+ Replace nesting-only surface clipping with gstate contained
+ serial-number tracked clipping sets that are loaded into the surface
+ on demand just before each rendering operation. This permits
+ multiple cairo_t contexts to reference a surface without
+ regard to ordering of operations among the contexts.
+
+ Also in this patch is a change to the xlib surface that
+ creates two separate Pictures, one for source and one for
+ destination operands which separates the source clipping
+ from destination clipping. Cairo now specifies that sources
+ are never clipped by any clipping applied to them as destinations.
+
+ * src/cairoint.h:
+ * src/cairo-gstate-private.h:
+ Move cairo_clip_t (renamed from cairo_clip_rec_t) from cairoint.h
+ to cairo-gstate-private.h. Eliminate stack of clip state
+ from surfaces. Add new surface clipping API.
+
+ * src/cairo-gstate.c: (_cairo_gstate_init),
+ (_cairo_gstate_init_copy), (_cairo_gstate_fini),
+ (_cairo_gstate_has_surface_clip), (_cairo_gstate_set_clip),
+ (_cairo_gstate_get_clip_extents),
+ (_cairo_gstate_set_target_surface), (_cairo_gstate_paint),
+ (_cairo_gstate_combine_clip_surface),
+ (_cairo_gstate_intersect_clip), (_get_mask_extents),
+ (_cairo_gstate_mask), (_cairo_gstate_stroke),
+ (_clip_and_compute_extents_arbitrary), (_composite_trap_region),
+ (_cairo_gstate_fill), (_cairo_gstate_reset_clip),
+ (_cairo_gstate_clip), (_cairo_gstate_show_glyphs):
+ Manage clip objects entirely within the gstate, loading
+ the whole thing into the surface just before drawing.
+
+ * src/cairo-pattern.c:
+ (_cairo_pattern_acquire_surface_for_gradient),
+ (_cairo_pattern_acquire_surface_for_solid),
+ (_cairo_pattern_acquire_surface_for_surface),
+ (_cairo_pattern_acquire_surface), (_cairo_pattern_release_surface):
+ Source surfaces need not have clipping modified as the
+ surface interface now specifies that source surfaces are always
+ unclipped.
+
+ * src/cairo-surface.c: (_cairo_surface_init),
+ (cairo_surface_finish), (_cairo_surface_clone_similar),
+ (_cairo_surface_get_current_clip_serial),
+ (_cairo_surface_allocate_clip_serial), (_cairo_surface_reset_clip),
+ (_cairo_surface_can_clip_region), (_cairo_surface_set_clip_region),
+ (_cairo_surface_can_clip_path), (_cairo_surface_clip_path),
+ (_cairo_surface_get_extents):
+ Eliminate nested clipping contexts, leaving clip management
+ entirely to the gstate. Create new clip API for the gstate
+ which uses per-surface serial numbers to match gstate clipping
+ against current surface clipping values.
+
+ Surfaces no longer track clipping regions at all, so the
+ old _cairo_surface_get_clip_extents has been replaced with
+ _cairo_surface_get_extents. For PDF/PS surfaces, this
+ function is expected to return a rectangle covering the
+ entire fixed point coordinate space to leave rendering
+ unclipped by the surface.
+
+ * src/cairo-xcb-surface.c:
+ Region clipping capability is now signalled by a non-NULL
+ function pointer in set_clip_region.
+
+ * src/cairo-xlib-surface.c: (_cairo_xlib_surface_finish),
+ (_cairo_xlib_surface_ensure_src_picture),
+ (_cairo_xlib_surface_ensure_dst_picture),
+ (_cairo_xlib_surface_set_matrix), (_cairo_xlib_surface_set_filter),
+ (_cairo_xlib_surface_set_repeat),
+ (_cairo_xlib_surface_set_attributes),
+ (_cairo_xlib_surface_composite),
+ (_cairo_xlib_surface_fill_rectangles),
+ (_cairo_xlib_surface_composite_trapezoids),
+ (_cairo_xlib_surface_set_clip_region),
+ (_cairo_xlib_surface_create_internal),
+ (_cairo_xlib_surface_show_glyphs32),
+ (_cairo_xlib_surface_show_glyphs16),
+ (_cairo_xlib_surface_show_glyphs8),
+ (_cairo_xlib_surface_show_glyphs):
+ Each surface now contains two Pictures, one for source
+ and one for destination operands so that source operands
+ are never clipped by destination clipping.
+
+ * src/cairo.h:
+ * src/cairo.c: (cairo_status_string):
+ CAIRO_STATUS_BAD_NESTING removed
+
+ * test/Makefile.am:
+ * test/self-copy.c: (main):
+ self-copy now passes (Xlib only, until libpixman changes land)
+
+2005-05-26 Olivier Andrieu <oliv__a@users.sourceforge.net>
+
+ * src/cairo.c: trivial doc fixes.
+
+2005-05-24 Carl Worth <cworth@cworth.org>
+
+ * gtk-doc.make: Re-synch with latest from gtk-doc CVS tree.
+
+ * doc/public/Makefile.am (MKTMPL_OPTIONS): Add --only-section-tmpl
+ option so that changes to inline documentation does not lead to
+ churn in the .sgml template files.
+
+ * doc/public/tmpl/cairo-font.sgml:
+ * doc/public/tmpl/cairo-ft.sgml:
+ * doc/public/tmpl/cairo-glitz.sgml:
+ * doc/public/tmpl/cairo-matrix.sgml:
+ * doc/public/tmpl/cairo-pattern.sgml:
+ * doc/public/tmpl/cairo-pdf.sgml:
+ * doc/public/tmpl/cairo-png.sgml:
+ * doc/public/tmpl/cairo-ps.sgml:
+ * doc/public/tmpl/cairo-quartz.sgml:
+ * doc/public/tmpl/cairo-surface.sgml:
+ * doc/public/tmpl/cairo-xcb.sgml:
+ * doc/public/tmpl/cairo-xlib.sgml:
+ * doc/public/tmpl/cairo.sgml: Commit new templates now that
+ gtk-doc has ripped all the inline portions out.
+
+ * doc/public/tmpl/cairo-win32.sgml:
+ * doc/public/tmpl/cairo-xcb-xrender.sgml:
+ * doc/public/tmpl/cairo-xlib-xrender.sgml: New template files
+ added for new sections.
+
+ * doc/public/cairo-sections.txt: Update to match current API.
+
+ * src/cairo-xcb.h: Make parameter names match those in the .c file
+ and its documentation.
+
+2005-05-22 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c (cairo_create): Protect less-than and greater-than
+ symbols in documentation string.
+
+ * TODO: Not that a patch has been submitted for consistent error
+ handling.
+
+ * src/cairo.c: Fix documentation string for cairo_create so that
+ it might actualyl appear in the manual.
+
+2005-05-18 Carl Worth <cworth@cworth.org>
+
+ * configure.in: Add -head to CAIRO_VERSION after tagging with
+ SNAPSHOT_0_5_0.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * PORTING_GUIDE: Added porting guide to help with transition to
+ cairo 0.5 API.
+
+ * NEWS: Added notes for snapshot 0.5.0
+
+ * configure.in: Increment CAIRO_VERSION to 0.5.0
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xcb-surface.c: (_get_image_surface),
+ (_cairo_xcb_surface_create_internal): Bring up to date with
+ Keith's latest improvements to cairo-xlib-surface.c: Add some
+ comments about how and why masks are computed. Generalize
+ overflow detection in mask computation. Expand on pixman format
+ conversion comment. Fix the broken visual->format case.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ Two fixes from Kristian Høgsberg:
+
+ * src/cairo-output-stream.c: (_cairo_output_stream_create),
+ (_cairo_output_stream_destroy),
+ (_cairo_output_stream_create_for_file): Fix to close the file if
+ we opened it.
+
+ * src/cairo-pdf-surface.c: (_cairo_pdf_document_finish): Grab the
+ status from out of the stream _before_ we destroy the stream.
+
+2005-05-17 Keith Packard <keithp@keithp.com>
+
+ * src/cairo-xlib-surface.c: (_get_image_surface):
+ Add some comments about how and why masks are computed.
+ Generalize overflow detection in mask computation.
+ Expand on pixman format conversion comment.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xcb-surface.c:
+ * src/cairo-xlib-surface.c: Fix documentation to not mention
+ set_size for the _for_bitmap functions.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * util/cairo-api-update: Remove #ifdef munging since we once again
+ support either #if or #ifdef.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * RELEASING: Update instructions to match output of 'make
+ distcheck'
+
+ * src/Makefile.am:
+ * test/Makefile.am: Add private headers and flesh out CLEANFILES
+ so that 'make distcheck' actually passes.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Add a few more REPLACED_BY and DEPRECATED_BY
+ definitions.
+
+ * util/cairo-api-update: Add some helpful warnings.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/Makefile.am (libcairo_xlib_headers): Add
+ cairo-xlib-xrender.h which was missed from an earlier commit.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/Makefile.am:
+ * src/cairo-xcb.h:
+ * src/cairo-xcb-xrender.h:
+ * src/cairo-xcb-surface.c:
+ (cairo_xcb_surface_create),
+ (cairo_xcb_surface_create_for_bitmap),
+ (cairo_xcb_surface_create_with_xrender_format): Update cairo-xcb.h
+ to provide the same style of interface as cairo-xlib.h.
+
+ * test/cairo-test.c: Update to match new cairo_xcb_surface_t
+ create functions.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xlib-surface.c (_get_image_surface): Avoid shifting
+ 32-bit quanity by 32 bits, which is undefined behavior.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ Rework of cairo_xlib_surface create functions by Keith Packard:
+
+ * src/cairo-xlib-xrender.h:
+ Add cairo_xlib_surface_create_with_render_format.
+
+ * src/cairo-xlib.h:
+ * src/cairo-xlib-surface.c:
+ (cairo_xlib_surface_create),
+ (cairo_xlib_surface_create_for_bitmap): Reduce Xlib constructors
+ down to two simple forms. Add width, height to constructors and
+ eliminate any synchronous size queries from the implementation.
+
+ * test/cairo-test.c: (create_xlib_surface):
+ * test/xlib-surface.c: (do_test): Update to match new
+ cairo_xlib_surface_t create functions.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-output-stream.c: Remove destroy_closure from
+ cairo_output_stream_t interface.
+
+ * src/cairo-pdf.h:
+ * src/cairo-pdf-surface.c: Remove destroy_closure argument from
+ cairo_pdf_surface_create_for_stream. Rename width,height to
+ width_in_points, height_in_points for better clarity.
+
+ * src/cairo-ps.h:
+ * src/cairo-ps-surface.c: Brush a bunch of dust off of the PS
+ backend and bring it up to date with the latest API conventions
+ from the PDF backend. These include: accepting a filename rather
+ than a FILE in the primary constructor, providing a stream-based
+ interface for more flexibility, and accepting a surface size in
+ device-space units (points) rather than inches.
+
+ * test/pdf-surface.c: (main): Make it a little more clear that the
+ width and height being passed around are in units of points.
+
+ * test/ps-surface.c: (main): Update to the latest cairo-ps.h
+ changes as described above. Notice how much more sane things
+ become now that the surface size is described in device-space
+ units.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/ps-surface.c: (draw), (main): Add simple test for ps
+ surface backend (modeled after pdf-surface.c).
+
+ * test/pdf-surface.c: (main): Add print message telling user to
+ examine resulting file.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * test/pdf-surface.c: (draw), (main): Update PDF test case to make
+ sure we're actually getting the right paper size, image scaling
+ etc. And it should now be easier to see if cairo is happy by manually
+ viewing the resulting PDF file.
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xlib-test.h: Fix to include cairo-xlib.h, (which also
+ fixes test/xlib-surface.c).
+
+2005-05-17 Carl Worth <cworth@cworth.org>
+
+ * test/pdf-surface.c: (main): Update to the latest PDF surface API
+ changes: use filename not FILE* and use surface dimension in
+ points, not inches.
+
+2005-05-16 Keith Packard <keithp@keithp.com>
+
+ * src/cairo-pattern.c: (_cairo_pattern_shader_init):
+ Initialize op->stops[0].scale = 0.
+
+ This scale value is used only when computing gradient values
+ before the defined range, in which case stop 0 is used for both
+ ends of the interpolation, making the value of 'scale' not
+ actually matter, except that valgrind notices we're using
+ an undefined value.
+
+2005-05-16 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am: Remove quarter-over test name accidentally
+ added to Makefile.
+
+2005-05-16 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-pdf-surface.c (cairo_pdf_surface_create):
+ * src/cairo-output-stream.c
+ (_cairo_output_stream_create_for_file): Take a filename instead of
+ a FILE pointer.
+
+2005-05-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xcb.h:
+ * src/cairo-xcb-surface.c: (_cairo_xcb_surface_create_similar),
+ (_cairo_xcb_surface_finish), (_cairo_xcb_surface_get_size),
+ (_bits_per_pixel), (_bytes_per_line), (_get_image_surface),
+ (_draw_image_surface), (_cairo_xcb_surface_get_extents),
+ (_cairo_surface_is_xcb), (_cairo_xcb_surface_create_internal),
+ (cairo_xcb_surface_create_for_pixmap),
+ (cairo_xcb_surface_create_for_pixmap_with_visual),
+ (cairo_xcb_surface_create_for_window_with_visual),
+ (cairo_xcb_surface_set_size):
+ Brush the dust off the XCB backend and get it compiling and
+ working again. This patch makes the XCB surface API match that of
+ the Xlib surface API as of yesterday. But, it's already stale as
+ the Xlib API changed again. So we'll need one more revision of the
+ XCB backend before the next snapshot.
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/cairo-test.c: (create_xcb_surface), (cleanup_xcb):
+ * test/cairo-test.h: Add support for testing of the xcb backend as
+ well.
+
+2005-05-14 Carl Worth <cworth@cworth.org>
+
+ * test/cairo-test.c: (cairo_test_real):
+ * test/pdf-surface.c: (main):
+ * test/xlib-surface.c: (do_test), (main): Cleanup output a bit,
+ move verbose messages to test-specific log file.
+
+2005-05-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xlib-surface.c: (cairo_xlib_surface_create_with_visual):
+ Fix the last commit so it actually compiles now.
+
+2005-05-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xlib-surface.c: (cairo_test_xlib_disable_render),
+ (cairo_xlib_surface_create_with_visual)
+
+ * test/.cvsignore: Fix a few documentation typos in the recent
+ xlib surface rework.
+
+2005-05-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-atsui.h:
+ * src/cairo-ft.h:
+ * src/cairo-glitz.h:
+ * src/cairo-pdf.h:
+ * src/cairo-ps.h:
+ * src/cairo-quartz.h:
+ * src/cairo-win32.h:
+ * src/cairo-xcb.h:
+ * src/cairo-xlib.h: Add an #error if cairo-foo.h is included when
+ cairo was compiled without support for the foo backend.
+
+2005-05-14 Carl Worth <cworth@cworth.org>
+
+ * test/pdf-surface.c (main): Update for change in
+ cairo_pdf_surface_create which no longer accepts DPI values.
+
+2005-05-13 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-xlib-surface.c src/cairo-xlib.h
+ doc/public/cairo-sections.txt: Drop the _for_pixmap() and
+ _for_window() out of the create functions and use some lazy
+ cleverness to sniff the information out as needed.
+
+ * src/cairo-xlib-surface.c src/cairo-xlib-test.h Makefile.am:
+ add cairo_test_xlib_disable_render() to turn off RENDER
+ for tests.
+
+ * test/xlib-surface.c: Test various different types of
+ Xlib surface creation.
+
+ * src/cairo-xlib.h: Remove left-over include of Xrender.h.
+
+2005-05-13 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-pdf-surface.c (_cairo_pdf_document_open_stream): Make
+ this a varg function and use the new
+ _cairo_output_stream_vprintf() function to format extra dict
+ contents.
+
+ * src/cairo-output-stream.c (_cairo_output_stream_vprintf):
+ Reimplement the printf logic so we can special case formatting of
+ doubles to be locale independent and trim trailing zeros.
+
+ * src/cairo-pdf-surface.c: Rename
+ cairo_pdf_surface_create_for_callback() to
+ cairo_pdf_surface_create_for_stream(), and change PDF constructors
+ to take width and height as points and move PPI setting to
+ cairo_pdf_surface_set_ppi()
+
+2005-05-13 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-xlib-surface.c (_cairo_xlib_surface_create_internal): Fix
+ misplaced goto.
+
+2005-05-12 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo-image-surface.c: (_cairo_image_surface_create_with_masks):
+ Fix image->data to be unsigned
+
+ * src/cairo-glitz-surface.c: (_cairo_glitz_surface_get_image):
+ * src/cairo-image-surface.c:
+ (_cairo_image_surface_create_for_pixman_image),
+ * src/cairo-xlib-surface.c: (_get_image_surface),
+ (_draw_image_surface), (_xlib_glyphset_cache_create_entry):
+ Track change in signedness of data member/parameter.
+
+2005-05-12 Carl Worth <cworth@cworth.org>
+
+ Update xcb backend to compile after recent API changes:
+
+ * src/cairo-xcb-surface.c: (_cairo_xcb_surface_finish):
+ Fix missing return value.
+ (_cairo_xcb_surface_acquire_source_image): Remove calls to
+ non-existent cairo_surface functions.
+ (_cairo_xcb_surface_set_matrix): Update for new matrix member names.
+ (_cairo_xcb_surface_get_extents): Fix typo.
+
+2005-05-12 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/paint-with-alpha-ref.png:
+ * test/paint-with-alpha.c: (draw), (main): Add new test for bug in
+ cairo_paint_with_alpha not transforming the source.
+
+ * src/cairo-gstate.c: (_cairo_gstate_mask): Use a transformed copy
+ of the source just like we do in all the other calls to
+ cairo_surface_composite. Fixes the bug tested by
+ test/paint-with-alpha.
+
+2005-05-12 Keith Packard <keithp@keithp.com>
+
+ reviewed by: otaylor
+
+ * src/cairo-gstate.c: (_get_mask_extents):
+ _get_mask_extents creates a pixman region but
+ neglects to destroy it.
+
+2005-05-11 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-win32-surface.c (categorize_solid_dest_operator):
+ Handle more cases by assuming no-super-luminescent colors.
+
+2005-05-11 T Rowley <tim.rowley@gmail.com>
+
+ * src/cairo-atsui-font.c:
+ * src/cairo-atsui.h:
+ * src/cairo-quartz-surface.c: Revive quartz backend.
+
+2005-05-11 David Reveman <davidr@novell.com>
+
+ * src/cairo-glitz-surface.c (_cairo_glitz_surface_fill_rectangles):
+ Set fill type repeat on source surface.
+ (_cairo_glitz_surface_show_glyphs): Add missing cairo operator to
+ glitz operator conversion.
+ (_cairo_glitz_surface_show_glyphs): Only render glyphs with non zero
+ size.
+
+2005-05-11 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-surface.c (_fallback_fill_rectangles):
+ Fix bounding box computation.
+
+ * src/cairo-win32-surface.c: Patch from Tor Lillqvist
+ to make things compile and work again.
+
+ * test/cairo-test.c (create_win32_surface): Don't
+ #error because there is no win32 test, it isn't useful.
+ Just skip it.
+
+ * src/cairo-win32-font.c: Fix up matrix constness.
+
+ * test/Makefile.am (TESTS): Skip the pdf-surface test
+ if we don't have the PDF backend.
+
+ * src/cairo-win32-surface.c (categorize_solid_dest_operator):
+ Optimize fill_rectangles for all cases where the destination
+ ends up a solid color.
+
+2005-05-11 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-xlib-surface.c src/cairo-xlib.h: Remove leftover
+ cairo_xlib_surface_create().
+
+2005-05-10 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.c src/cairo-path-data.c src/cairo-path-data-private.h:
+ Pass the gstate to _cairo_path_data_create[_flat] and use
+ _cairo_gstate_backend_to_user() so as to properly handle
+ the surface device offset.
+
+2005-05-10 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-arc.c (_cairo_arc_path_negative): Don't use return
+ when calling a void function (thanks to Damien Carbery
+ <damien.carbery@sun.com>). Closes bug #3134.
+
+2005-05-10 Carl Worth <cworth@cworth.org>
+
+ * test/cairo-test.c:
+ * test/cairo-test.h: Removing mucking around with stderr and add a
+ cairo_test_log function instead.
+
+ * test/buffer-diff.c:
+ * test/create-for-png.c:
+ * test/pdf-surface.c:
+ * test/read-png.c:
+ * test/trap-clip.c:
+ * test/xmalloc.c: Switch all error messages from
+ fprintf(stderr,...) to cairo_test_log(...).
+
+2005-05-10 Carl Worth <cworth@cworth.org>
+
+ * configure.in: Fix URLs for glitz and xlibs, (thanks to Jason
+ Dorje Short <jdorje@users.sf.net>).
+
+2005-05-10 Carl Worth <cworth@cworth.org>
+
+ * configure.in: Update to current canonical URL for XCB.
+
+2005-05-10 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-wideint.h: Don't guess and make our own definitions
+ for uint8_t, etc. Just error out if we can't find a suitable
+ header file.
+
+ * src/cairo-png.c: (unpremultiply_data), (premultiply_data):
+ * test/read-png.c: (premultiply_data): Fix to use fixed-size type
+ so that this code works when sizeof(unsigned long) != 32. Thanks
+ to Manish Singh.
+
+2005-05-10 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c: (_cairo_gstate_get_font_matrix):
+ * src/cairo.c: (cairo_get_font_matrix):
+ * src/cairo.h:
+ * src/cairoint.h: Fix cairo_get_font_matrix to actually use its
+ out-parameter. And change the return type to void.
+
+2005-05-09 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-ft-font.c (_cairo_ft_unscaled_font_create_glyph):
+ Get the glyphslot point *after* we get the FT_Face. (Robert O'Callahan)
+
+2005-05-09 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h (cairo_current_target_surface): Fix deprecation
+ macro to point to the right function, (thanks to John Ellson).
+
+2005-05-09 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-font.c: (_cairo_simple_font_face_create_font),
+ (cairo_scaled_font_create), (_cairo_scaled_font_init):
+ * src/cairo-ft-font.c: (_ft_scaled_font_create),
+ (_cairo_ft_scaled_font_create), (_ft_font_face_create_font):
+ * src/cairo-gstate.c: (_cairo_gstate_transform),
+ (_cairo_gstate_set_matrix), (_cairo_gstate_set_font_matrix):
+ * src/cairo-image-surface.c: (_cairo_image_surface_set_matrix):
+ * src/cairo-matrix.c: (_cairo_matrix_get_affine),
+ (cairo_matrix_transform_distance), (cairo_matrix_transform_point),
+ (_cairo_matrix_transform_bounding_box),
+ (_cairo_matrix_compute_determinant),
+ (_cairo_matrix_compute_eigen_values),
+ (_cairo_matrix_compute_scale_factors),
+ (_cairo_matrix_is_integer_translation):
+ * src/cairo-pattern.c: (cairo_pattern_set_matrix),
+ (_cairo_pattern_transform):
+ * src/cairo.c: (cairo_transform), (cairo_set_matrix),
+ (cairo_set_font_matrix):
+ * src/cairo.h:
+ * src/cairoint.h: Push cairo_matrix_t const-correctness down
+ through the entire implmentation, (expanding on preliminary work
+ by Robert O'Callahan <rocallahan@novell.com>)
+
+2005-05-09 Carl Worth <cworth@cworth.org>
+
+ * configure.in:
+ * src/cairo-features.h.in: Change cairo-features again so that
+ either #if or #ifdef will work to test any feature.
+
+2005-05-07 Owen Taylor <otaylor@redhat.com>
+
+ * doc/public/language-bindings.xml doc/public/cairo-doc.xml
+ doc/public/Makefile.am: Document suggested conventions and
+ techniques for many aspects of creating a language binding
+ for Cairo.
+
+2005-05-07 Owen Taylor <otaylor@redhat.com>
+
+ * doc/public/cairo-sections.txt: Update.
+
+2005-05-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h (cairo_set_alpha): Point to both
+ cairo_set_source_rgba and cairo_paint_with_alpha in deprecation of
+ cairo_set_alpha.
+
+2005-05-07 Carl Worth <cworth@cworth.org>
+
+ * util/cairo-api-update: Make idempotent substitutions that extend
+ old names:
+
+ cairo_select_font -> cairo_select_font_face
+ cairo_pattern_add_color_stop -> cairo_pattern_add_color_stop_rgba
+
+ by only substituting if the old name is not immediately followed
+ by an underscore.
+
+ Tweak the substitution slightly to allow the script to be run on
+ the cairo source itself, (eg. avoid changing the REPLACED_BY and
+ DEPRECATED_BY macros that must mention the old names).
+
+2005-05-07 Carl Worth <cworth@cworth.org>
+
+ * configure.in:
+
+ * src/cairo-features.h.in: Change definitions of everything in
+ cairo-features.h to prefer #if over #ifdef.
+
+ * src/cairo-atsui.h:
+ * src/cairo-cache.c:
+ * src/cairo-ft-private.h:
+ * src/cairo-ft.h:
+ * src/cairo-glitz.h:
+ * src/cairo-pdf.h:
+ * src/cairo-ps.h:
+ * src/cairo-quartz.h:
+ * src/cairo-win32.h:
+ * src/cairo-xcb.h:
+ * src/cairo-xlib.h:
+ * src/cairo.c:
+ * src/cairo.h:
+ * src/cairoint.h:
+ * test/cairo-test.c: Track #ifdef -> #if changes.
+
+ * util/cairo-api-update: Add support to automatically change all
+ #ifdef CAIRO_HAS to #if CAIRO_HAS.
+
+2005-05-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c:
+ * src/cairo-pattern.c:
+ * src/cairo.c:
+ * src/cairo.h:
+ * src/cairoint.h: Remove deprecated cairo_get_rgb_color that was
+ accidentally missed in the recent purge of deprecated functions.
+
+2005-05-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-xcb-surface.c (_render_operator):
+ * src/cairo-win32-surface.c (_cairo_win32_surface_composite)
+ (_cairo_win32_surface_fill_rectangles): Update to track new
+ CAIRO_OPERATOR names.
+
+ * test/select-font-no-show-text.c:
+ * src/cairo-surface.c (cairo_surface_set_user_data): Fix
+ documentation to refer to functions by their current names.
+
+ * src/cairo-gstate.c (_cairo_gstate_begin_group): Update to track
+ latest API (in currently unused function).
+
+2005-05-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-glitz-surface.c (_cairo_glitz_surface_show_glyphs):
+ Fix return type from cairo_status_t to cairo_int_status_t.
+
+2005-05-06 Carl Worth <cworth@cworth.org>
+
+ * ROADMAP: Note that cairo_mask, and "just eliminate a bunch of
+ functions are now done".
+
+ * TODO: Note that all backwards-compatible and
+ backwards-incompatible cahnges for the API Shakeup are now
+ done. Sort "new functionality" of API Shakeup into its own
+ category.
+
+2005-05-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c:
+ * src/cairo.h: Eliminate the following deprecated functions from
+ cairo's interface:
+
+ cairo_copy
+ cairo_get_path
+ cairo_get_path_flat
+ cairo_matrix_create
+ cairo_matrix_destroy
+ cairo_matrix_copy
+ cairo_matrix_get_affine
+ cairo_surface_set_repeat
+ cairo_surface_set_matrix
+ cairo_surface_get_matrix
+ cairo_surface_set_filter
+ cairo_surface_get_filter
+
+ Also, eliminate all support for compiling against, or running with
+ old, deprecated names for functions.
+
+ * src/cairo-ft-font.c: (_compute_transform):
+ * src/cairo-gstate.c:
+ * src/cairo-image-surface.c: (cairo_image_surface_create_for_data):
+ * src/cairo-matrix.c: (_cairo_matrix_get_affine),
+ (_cairo_matrix_compute_adjoint),
+ (_cairo_matrix_is_integer_translation):
+ * src/cairo-pattern.c: (cairo_pattern_add_color_stop_rgba),
+ (cairo_pattern_set_matrix), (cairo_pattern_get_matrix),
+ (_cairo_image_data_set_linear), (_cairo_linear_pattern_classify),
+ (_cairo_image_data_set_radial):
+ * src/cairo-pdf-surface.c: (_cairo_pdf_surface_composite_image),
+ (_cairo_pdf_surface_composite_pdf), (emit_surface_pattern),
+ (emit_linear_pattern), (emit_radial_pattern):
+ * src/cairo-surface.c:
+ * src/cairo-xlib-surface.c:
+ (_cairo_xlib_surface_acquire_source_image),
+ (cairo_xlib_surface_create):
+ * src/cairo.c: (cairo_set_source_rgba), (cairo_set_source),
+ (cairo_get_source), (cairo_transform), (cairo_identity_matrix),
+ (cairo_user_to_device), (cairo_user_to_device_distance),
+ (cairo_device_to_user), (cairo_device_to_user_distance),
+ (cairo_reset_clip), (cairo_select_font_face), (cairo_font_extents),
+ (cairo_set_font_size), (cairo_get_operator), (cairo_get_rgb_color),
+ (cairo_get_tolerance), (cairo_get_fill_rule),
+ (cairo_get_line_width), (cairo_get_line_cap),
+ (cairo_get_line_join), (cairo_get_miter_limit), (cairo_get_matrix),
+ (cairo_get_target), (cairo_status), (cairo_status_string):
+ * src/cairoint.h:
+ * test/cairo-test.c: (cairo_test_create_png_pattern):
+ * test/gradient-alpha.c: (draw):
+ * test/mask.c: (set_gradient_pattern), (set_image_pattern):
+ * test/move-to-show-surface.c: (draw):
+ * test/select-font-no-show-text.c: (draw):
+ * test/set-source.c: (draw):
+ * test/text-cache-crash.c: (draw):
+ * test/text-rotate.c: (draw):
+ * test/transforms.c: (draw_L_shape):
+ * test/translate-show-surface.c: (draw):
+ * test/trap-clip.c: (set_gradient_pattern), (set_image_pattern):
+ * util/cairo-api-update:
+
+ Deal with all of the removals.
+
+2005-05-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-glitz-surface.c: (_glitz_operator),
+ (_cairo_glitz_surface_fill_rectangles):
+ * src/cairo-gstate.c: (_cairo_gstate_mask):
+ * src/cairo-image-surface.c: (_pixman_operator),
+ (_cairo_image_surface_composite_trapezoids):
+ * src/cairo-ps-surface.c: (_cairo_ps_surface_erase),
+ (_cairo_ps_surface_copy_page):
+ * src/cairo-surface.c: (_cairo_surface_create_similar_solid):
+ * src/cairo-xlib-surface.c: (_render_operator):
+ * src/cairo.h:
+ * test/cairo-test.c: (cairo_test_for_target):
+ * test/mask.c: (mask_polygon), (draw):
+
+ Rename and re-order the cairo_operator_t enum to names that
+ abbreviate less and are easier to understand,
+ (eg. CAIRO_OPERATOR_DEST_OVER instead of
+ CAIRO_OPEERATOR_OVER_REVERSE).
+
+2005-05-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c: (cairo_create), (cairo_save), (cairo_get_target):
+ * src/cairo.h:
+ * src/cairoint.h:
+ * src/cairo-gstate.c: (_cairo_gstate_create), (_cairo_gstate_init),
+ (_cairo_gstate_get_target):
+ * src/cairo-glitz.h:
+ * src/cairo-pdf.h:
+ * src/cairo-ps.h:
+ * src/cairo-quartz-surface.c:
+ * src/cairo-quartz.h:
+ * src/cairo-surface.c: (_cairo_surface_begin):
+ * src/cairo-win32.h:
+ * src/cairo-xcb.h:
+ * src/cairo-xlib.h: Remove cairo_set_target_surface and all other
+ backend-specific cairo_set_target functions. Require a
+ cairo_surface_t* to call cairo_create.
+
+ * test/cairo-test.c: (create_image_surface), (cleanup_image),
+ (create_glitz_surface), (cleanup_glitz), (create_quartz_surface),
+ (cleanup_quartz), (create_win32_surface), (cleanup_win32),
+ (create_xcb_surface), (cleanup_xcb), (create_xlib_surface),
+ (cleanup_xlib), (cairo_test_for_target), (cairo_test_real):
+
+ Port to use new cairo_create interface.
+
+ * test/clip-nesting.c: (draw):
+ * test/mask.c: (mask_polygon), (draw):
+ * test/path-data.c: (main):
+ * test/pdf-surface.c: (main):
+ * test/pixman-rotate.c: (draw):
+ * test/scale-source-surface-paint.c: (draw):
+ * test/self-copy.c: (draw):
+ * test/source-clip.c: (draw):
+ * test/source-surface-scale-paint.c: (draw):
+ * test/surface-pattern.c: (draw):
+
+ Rewrite all tests that were using cairo_set_target_surface to
+ instead create a temporary cairo_t, (eventually to be replaced
+ with cairo_begin_group).
+
+2005-05-05 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.[ch] doc/public/cairo-sections.txt: Add
+ cairo_paint_with_alpha().
+
+ * src/cairo-pattern.c (_cairo_pattern_acquire_surfaces): Fix
+ segfault when mask == NULL.
+
+ * test/mask.c test/mask-ref.png: Add testing of cairo_paint_with_alpha().
+
+ * test/coverage.c test/coverage-ref.png: Remove ... it's not testing
+ anything that mask doesn't test better.
+
+2005-05-04 David Reveman <davidr@novell.com>
+
+ * src/cairo-glitz-surface.c: Add glyph caching to glitz backend.
+
+2005-05-03 Kristian Høgsberg <krh@redhat.com>
+
+ Fills as paths patch originally by Owen Taylor.
+
+ * src/cairo-path.c: (_cairo_path_fixed_rel_move_to),
+ (_cairo_path_fixed_line_to), (_cairo_path_fixed_rel_line_to),
+ (_cairo_path_fixed_curve_to), (_cairo_path_fixed_rel_curve_to):
+ Make sure we have a current point for the relative path operators.
+
+ * src/cairoint.h:
+ * src/cairo-gstate.c: (_cairo_gstate_fill):
+ * src/cairo-surface.c: (_cairo_surface_fill_path): Add fill_path
+ backend method.
+
+ * src/cairo-pdf-surface.c: (_cairo_pdf_document_close_stream),
+ (emit_image_data), (emit_surface_pattern),
+ (_cairo_pdf_path_move_to), (_cairo_pdf_path_line_to),
+ (_cairo_pdf_path_curve_to), (_cairo_pdf_path_close_path),
+ (_cairo_pdf_surface_fill_path): Implement fill_path in the PDF
+ backend.
+
+2005-05-03 Carl Worth <cworth@cworth.org>
+
+ Originally 2005-04-20 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo.c: Remove cairo_show_surface. Add new
+ cairo_set_source_surface.
+
+ * src/cairo-gstate.c: Remove _cairo_gstate_show_surface.
+
+ * test/create-for-png.c: (draw):
+ * test/pixman-rotate.c: (draw):
+ * test/move-to-show-surface.c: (draw):
+ * test/translate-show-surface.c: (draw): Replace calls to
+ cairo_show_surface with cairo_set_source_surface; cairo_paint.
+
+ * test/cairo-test.c: (cairo_test_real): Fix messages to prefer -
+ over _.
+
+ * src/cairo-png.c: (cairo_surface_write_to_png): Fix
+ documentation.
+
+ * test/filter-nearest-offset-ref.png:
+ * test/filter-nearest-offset.c:
+ * test/scale-source-surface-paint-ref.png:
+ * test/scale-source-surface-paint.c:
+ * test/source-surface-scale-paint-ref.png:
+ * test/source-surface-scale-paint.c: Three new tests to exercise
+ set_source_surface more completely, (two of these are expected
+ failures dues to outstanding bugs).
+
+2005-05-03 Carl Worth <cworth@cworth.org>
+
+ * TODO: Add suggestion for copy-on-write regions to fix clip
+ region problems.
+
+ * src/Makefile.am (install-data-local): Fix check for old headers
+ to respect DESTDIR, (to work better when cross-compiling, etc.).
+ Thanks to Luke-Jr <luke-jr@utopios.org>.
+
+2005-05-02 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-ft-font.c (_cairo_ft_scaled_font_font_extents): Changes the
+ sign of extents->descent to match win32 backend and the conventional
+ convention.
+
+ * src/cairo.h: Document cairo_font_extents_t.
+
+2005-04-28 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-surface.c src/cairoint.h: Add _cairo_surface_begin/end
+ to save and restore the clip state of a surface. Copy and store
+ clip regions set on a surface so that we can save and restore them.
+
+ * src/cairo.[ch]: Add a CAIRO_STATUS_BAD_NESTING error
+ for interleaved use of two cairo_t's on the same surface. Also,
+ add a skeleton doc comment for cairo_status_t.
+
+ * src/cairo.c src/cairo-gstate.c src/cairoint.h: Use
+ _cairo_surface_begin/end to replace
+ _cairo_gstate_restore_external_state.
+
+ * src/cairo-gstate.c: Use _cairo_surface_begin/end to save the
+ state of a surface when we start drawing at it and restore it
+ at the end. Check that the save level of the surface is what
+ we expect on drawing operations and fail with CAIRO_STATUS_BAD_NESTING
+ otherwise.
+
+ * src/cairo-pattern.c src/cairoint.h (_cairo_pattern_acquire_surface_for_surface)
+ (_cairo_pattern_release_surface): Surround use of pattern->surface
+ with _cairo_surface->begin/end so we don't clip surfaces used as
+ sources.
+
+ * test/clip-nesting.c test/Makefile.am: Test of destinatin
+ clipping with the nested creation of cairo_t's for the same
+ context.
+
+ * test/source-clip.c test/Makefile.am: Test that clipping on
+ a source as a destination doesn't affect use of it as a source.
+
+ * test/self-copy.c: XFAIL test for copying from a surface as
+ a source to itself as a destination with a clip.
+
+2005-05-02 Keith Packard <keithp@keithp.com>
+
+ reviewed by: cworth
+
+ * src/cairo-path.c: (_cairo_path_fixed_rel_curve_to):
+ Use correct arguments to compute absolute positions.
+
+ * test/Makefile.am:
+ * test/rel-path-ref.png:
+ * test/rel-path.c: (draw), (main):
+ Test cairo_rel_move_to, cairo_rel_line_to and cairo_rel_curve_to
+
+2005-05-02 Owen Taylor <otaylor@redhat.com>
+
+ * test/Makefile.am (EXTRA_DIST): mask-ref.png, not
+ mask.png. (Pointed out by Carl)
+
+2005-05-02 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.[ch] src/cairo-gstate.c: Add cairo_mask()
+ and cairo_mask_surface().
+
+ * test/maks.c tests/Makefile.am tests/mask-ref.png: Add a
+ comprehensive tests for cairo_mask().
+
+ * docs/public/cairo-sections.txt: Updated
+
+2005-05-02 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-gstate.c (_cairo_gstate_glyph_path): Also call
+ _cairo_gstate_ensure_font() for this function.
+
+2005-04-28 Owen Taylor <otaylor@redhat.com>
+
+ * TODO, ROADMAP: Add a item about reworking cairo_format_t.
+
+2005-04-28 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/cairo-test.c: (cairo_test_for_target): Replace annoying _
+ in output image filenames with - for better consistency.
+
+2005-04-27 Carl Worth <cworth@cworth.org>
+
+ * test/cairo-test.c: (set_xlib_target), (cleanup_xlib_target):
+ Use 1 instead of 0 for width and height to avoid BadValue errors
+ from XCreatePixmap.
+
+2005-04-27 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/buffer-diff.c: (xunlink), (buffer_diff), (image_diff):
+ * test/buffer-diff.h:
+ * test/cairo-test.c: (set_image_target), (cleanup_image_target),
+ (set_glitz_target), (cleanup_glitz_target), (set_quartz_target),
+ (cleanup_quartz_target), (set_win32_target),
+ (cleanup_win32_target), (set_xcb_target), (cleanup_xcb_target),
+ (set_xlib_target), (cleanup_xlib_target), (cairo_test_for_target),
+ (cairo_test_real), (cairo_test_expect_failure), (cairo_test):
+ * test/cairo-test.h:
+ * test/read-png.c: (read_png_argb32):
+ * test/xmalloc.h: Add support for testing multiple backends,
+ courtesy of cairo_surface_write_to_png. Currently, only image and
+ xlib backends are fullk hooked-up, but other backends should be
+ quite easy to add for anyone skilled in the appropriate art.
+
+2005-04-27 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-traps.c src/cairoint.h (_cairo_traps_init_box):
+ New function to create a single trapezoid box.
+
+ * src/cairo.c src/cairo-gstate.c src/cairoint.h: Move
+ the implementation of cairo_paint() into cairo-gstate.c
+ for a better fix for the problem with backend/user coordinate
+ confusion. Also no longer clear the current path on
+ cairo_paint().
+
+2005-04-26 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c (cairo_paint): Build rectangle with an identity
+ matrix in place so that the entire target surface will be filled
+ even when there is a transformation in place.
+
+2005-04-26 Owen Taylor <otaylor@redhat.com>
+
+ * doc/public/cairo-sections.txt: Updated.
+
+ * src/cairo-png.c src/cairo.h: Fix up some doc build issues.
+
+2005-04-26 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/paint-ref.png:
+ * test/paint.c: (draw), (main): Add test to demonstrate bug in
+ cairo_paint when under a non-identity transformation.
+
+2005-04-26 Carl Worth <cworth@cworth.org>
+
+ * ROADMAP:
+ * TODO: Note that cairo_paint and cairo_clip/fill/stroke_preserve
+ are all done now.
+
+2005-04-26 Carl Worth <cworth@cworth.org>
+
+ Originally: 2005-04-19 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Add cairo_stroke_preserve, cairo_fill_preserve,
+ and cairo_clip_preserve.
+
+ * src/cairoint.h:
+ * src/cairo-gstate-private.h:
+ * src/cairo-gstate.c: Rip the path out of cairo_gstate_t.
+
+ * src/cairo-private.h: Add path to cairo_t.
+
+ * src/cairo.c: Bring in most of the path code that used to live in
+ cairo-gstate.c
+
+ * src/Makefile.am:
+ * src/cairo-arc-private.h:
+ * src/cairo-arc.c: Move arc generation code into its own file.
+
+ * src/cairo-path-data-private.h:
+ * src/cairo-path-data.c: Accept path+ctm_inverse+tolerance instead
+ of gstate. Absorb flattening and device space->user space
+ conversion that used to be in _cairo_gstate_intepret_path.
+
+ * src/cairo-path.c: Prefer cairo_fixed_t parameters over
+ ciaro_point_t for cross-file interfaces.
+
+ * src/cairo-ft-font.c: Track changes in _cairo_path_fixed
+ interfaces.
+
+ * test/fill-and-stroke.c: (draw): Port to use cairo_fill_preserve
+ rather than cairo_save/cairo_restore which no longer work for
+ saving the path.
+
+ * test/get-and-set.c: (settings_set), (settings_get),
+ (settings_equal): Remove get and set of current point since it is
+ no longer affected by cairo_save and cairo_restore. Add get and
+ set testing for cairo_matrix_t.
+
+2005-04-26 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/cairo-test.h:
+ * test/pdf-surface.c: (main): Add very simple test to generate PDF
+ output, (no automated verification yet).
+
+ * test/cairo-test.c: (cairo_test):
+ * test/create-for-png.c: (draw):
+ * test/pixman-rotate.c: Track PNG interface changes, (no more
+ include of cairo-png.h, cairo_surface_write_png renamed to
+ cairo_surface_write_to_png).
+
+2005-04-26 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-png.h: Prototypes moved to cairo.h, this file removed.
+
+ * src/cairo-png.c (cairo_surface_write_to_png_stream): Renamed
+ from cairo_surface_write_png_to_stream() for consistency.
+ (cairo_surface_write_to_png): Renamed from
+ cairo_surface_write_png() for consistency.
+
+2005-04-25 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-png.c (cairo_surface_write_png): Factor out bulk of
+ the code into a new callback based function, write_png(). Call it
+ with a stdio write callback.
+ (cairo_surface_write_png_to_stream): New function to write a
+ surface to a PNG stream.
+ (cairo_image_surface_create_from_png): Likewise, move most of the
+ code to read_png(), clean up error handling and reduce this
+ function to calling read_png() with a stdio based read function.
+ (cairo_image_surface_create_from_png_stream): New function to
+ create an image surface from a PNG stream.
+
+ * src/cairo-image-surface.c (cairo_image_surface_get_width)
+ (cairo_image_surface_get_height): New functions to get widht and
+ height of an image surface.
+
+ * src/cairo.h: Add new prototype and error codes.
+
+ * test/create-for-png.c (draw): Adjust to new PNG API.
+
+2005-04-25 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-win32-surface.c (cairo_win32_surface_create): Initialize
+ the saved_dc_bitmap field here as well ... not strictly needed,
+ but cleaner. (Reported by Peter Arsoff)
+
+2005-04-23 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-gstate.c (_composite_trap_region): Finalize the
+ correct pattern.
+
+2005-04-22 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-png.c (cairo_image_surface_create_for_png): Only check
+ PNG signature if we read all the bytes. Don't fclose() the FILE
+ argument (Steve Chaplin <stevech1097@yahoo.com.au>).
+
+ Rename to cairo_image_surface_create_for_png() to
+ cairo_image_surface_create_from_png() and change FILE arguments
+ for this function and cairo_surface_write_png() to be a filename
+ argument instead.
+
+2005-04-21 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-surface.c (_cairo_surface_set_clip_region): Handle
+ backends that don't have a set_clip_region implementation (PDF).
+
+2005-04-19 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c: (cairo_paint):
+ * src/cairo.h: Add new cairo_paint function.
+
+ * src/cairoint.h: Add new get_extents function to the surface
+ backend interface.
+
+ * src/cairo-gstate.c: (_cairo_gstate_get_clip_extents): Add
+ function to query current clip_extents.
+
+ * src/cairo-glitz-surface.c: (_cairo_glitz_surface_get_extents):
+ * src/cairo-image-surface.c: (_cairo_image_surface_get_extents),
+ (_cairo_image_abstract_surface_get_extents):
+ * src/cairo-pdf-surface.c: (_cairo_pdf_surface_get_extents):
+ * src/cairo-ps-surface.c: (_cairo_ps_surface_get_extents):
+ * src/cairo-quartz-surface.c: (_cairo_quartz_surface_get_extents):
+ * src/cairo-win32-surface.c: (_cairo_win32_get_extents):
+ * src/cairo-xcb-surface.c: (_cairo_xcb_surface_get_extents):
+ * src/cairo-xlib-surface.c: (_cairo_xlib_surface_get_extents):
+ Implement the new get_extents function for each backend.
+
+ * src/cairo-surface.c: (_cairo_surface_init),
+ (_cairo_surface_set_clip_region),
+ (_cairo_surface_get_clip_extents): Save the clip extents from
+ set_clip_region and implement _cairo_surface_get_clip_extents.
+
+ * src/cairo-xlib-surface.c: (_cairo_xlib_surface_get_size),
+ (_get_image_surface): Abstract away the evil XGetGeometry
+ roundtrip in _cairo_xlib_surface_get_size.
+
+ * test/gradient-alpha.c: (draw):
+ * test/linear-gradient.c: (draw): Rewrite a couple of tests to
+ call cairo_paint.
+
+2005-04-19 Carl Worth <cworth@cworth.org>
+
+ * TODO: Update API Shakeup chart to indicate that cairo_paint and
+ cairo_fill_preserve patches have been sent.
+
+2005-04-19 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/surface-pattern-ref.png:
+ * test/surface-pattern.c: (draw), (main): Add a test of a
+ repeating surface pattern.
+
+2005-04-18 Carl Worth <cworth@cworth.org>
+
+ * ROADMAP: Mark a couple of items that are now complete.
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/fill-and-stroke-ref.png:
+ * test/fill-and-stroke.c: (draw), (main): Add test case that fills
+ and strokes the same shapes, (in preparation for testing
+ cairo_fill_preserve patch).
+
+2005-04-14 Carl Worth <cworth@cworth.org>
+
+ * TODO: Update API Shakeup chart to indicate that cairo_set_source
+ is done.
+
+2005-04-14 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo.c: Rename, add, and delete:
+
+ cairo_set_pattern -> cairo_set_source
+ cairo_get_pattern -> cairo_get_source
+ cairo_set_rgb_color -> cairo_set_source_rgb
+ -> cairo_set_source_rgba
+ cairo_set_alpha ->
+ cairo_get_alpha ->
+
+ Note that we'll likely want to add cairo_set_source_surface.
+
+ * src/cairo-color.c: Add _cairo_stock_color helper function.
+ Improve some interfaces:
+
+ _cairo_color_init _cairo_color_init_rgb
+ _cairo_color_set_rgb -> _cairo_color_init_rgba
+ _cairo_color_set_alpha _cairo_color_multiply_alpha
+
+ _cairo_color_get_rgb -> _cairo_color_get_rbga
+ _cairo_color_get_rgba_premultiplied
+
+ * src/cairoint.h: Add cairo_stock_t and some helper macros:
+
+ CAIRO_COLOR_WHITE
+ CAIRO_COLOR_BLACK
+ CAIRO_COLOR_TRANSPARENT
+
+ Fix cairo_pattern_t by eliminating pattern->alpha.
+ Fix cairo_solid_pattern_t to use cairo_color_t rather than three
+ doubles.
+
+ * src/cairo-glitz-surface.c:
+ (_cairo_glitz_pattern_acquire_surface),
+ (_cairo_glitz_pattern_acquire_surfaces),
+ (_cairo_glitz_surface_composite_trapezoids): Track removal of
+ pattern->alpha, simplifying the code considerably
+
+ * src/cairo-gstate-private.h:
+
+ * src/cairo-gstate.c: Track _cairo_color interface changes. Remove
+ gstate->alpha. Propagate down set_source renamings.
+
+ * src/cairo.h:
+ * src/cairo-pattern.c: Rename:
+
+ cairo_pattern_add_color_stop -> cairo_pattern_add_color_stop_rgba
+
+ and add:
+
+ cairo_pattern_add_color_stop_rgb
+
+ Remove pattern->alpha, simplifying the code considerably.
+
+ * src/cairo-pdf-surface.c:
+ * src/cairo-ps-surface.c: Track pattern and color interface
+ changes.
+
+ * src/cairo-surface.c: Add const where appropriate on
+ cairo_color_t*.
+
+ * src/cairo-xlib-surface.c: (_cairo_surface_is_xlib): Add private
+ type inspection predicate.
+ (cairo_xlib_surface_set_size): Add check for surface type
+ mismatch, (no useful error reporting yet, though).
+
+ * test/Makefile.am: Note coverage as en expected failure.
+
+ * test/cairo-test.c: (cairo_test_expect_failure): Improve line
+ wrap on expected failure messages.
+
+ * test/clip-twice.c:
+ * test/coverage.c:
+ * test/fill-rule.c:
+ * test/line-width.c:
+ * test/linear-gradient.c:
+ * test/pixman-rotate.c:
+ * test/set-source.c:
+ * test/text-rotate.c:
+ * test/trap-clip.c: Port all tests to new cairo_set_source
+ interfaces.
+
+2005-04-14 Carl Worth <cworth@cworth.org>
+
+ * test/gradient-alpha-ref.png:
+ * test/gradient-alpha.c: (draw): Make gradient change color in
+ addition to just changing alpha in order to highlight distinction
+ between interpolating in premultiplied vs. non-premultiplied
+ space.
+
+2005-04-14 Carl Worth <cworth@cworth.org>
+
+ * test/Makefile.am: Improve instructions for when to add a test to
+ the XFAIL list.
+
+ * test/cairo-test.c: (cairo_test_expect_failure):
+ * test/cairo-test.h:
+ * test/pixman-rotate.c: (main):
+ * test/text-rotate.c: (main): Print explanations for expected
+ failures.
+
+2005-04-14 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/gradient-alpha-ref.png:
+ * test/gradient-alpha.c: (draw), (main): Add gradient-alpha test
+ in preparation for upcoming cairo_set_source patch.
+
+2005-04-14 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/set-source-ref.png:
+ * test/set-source.c: (draw), (main): Add set-source test in
+ preparation for upcoming cairo_set_source patch.
+
+2005-04-14 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-font.c (_cairo_simple_font_face_destroy): Remove
+ a stray free() (#3029, Carl Worth)
+
+ * test/select-font-no-show-text.c: Note that the bug is fixed.
+
+2005-04-13 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-image-surface.c:
+ (_cairo_image_abstract_surface_finish): Set freed pointer to NULL.
+
+ * src/cairo-surface.c: (cairo_surface_finish): Fix to actually set
+ surface->finished when done. Closes bug #2950 as documented in
+ test/surface-finish-twice.c.
+
+ * test/surface-finish-twice.c: Note that this bug is fixed.
+
+2005-04-13 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/surface-finish-twice.c: (draw), (main): Add new test to
+ exercise crash when calling cairo_surface_finish twice on the same
+ surface.
+
+2005-04-13 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/select-font-no-show-text.c: (draw), (main): Add new
+ set-surface-no-show-text test.
+
+ * test/cairo-test.c: (cairo_test): Be sure to call cairo_destroy
+ even if the image size is 0,0 so that we can test bugs triggered
+ during cleanup.
+
+2005-04-13 Carl Worth <cworth@cworth.org>
+
+ * test/coverage-ref.png:
+ * test/coverage.c: (draw_funcs), (draw): Temporarily remove all
+ text from this test case until we come up with an approach for
+ drawing the same text with different freetype configurations.
+
+2005-04-13 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-traps.c (_cairo_traps_extract_region): Work around
+ a pair of bugs elsewhere (denegerate trapezoids from tesellator,
+ pixman_region_union_rect() failing on width/height zero rectangles)
+
+2005-04-13 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairoint.h src/cairo-traps.c: Add _cairo_traps_extract_region
+ for converting trapezoids into a pixman region.
+
+ * src/cairo-gstate.c (cairo_clip): Represent all rectangular
+ pixel-aligned regions as regions, not just single rectangles.
+
+ * src/cairo-gstate.c (_cairo_gstate_clip_and_composite_trapezoid):
+ Split into manageable pieces, optimize rectangular pixel-
+ aligned regions by using _cairo_surface_fill_rectangles()
+ or _cairo_surface_set_clip_region() as appropriate.
+
+ * tests/trap-clip.c tests/trap-clip-ref.png tests/Makefile.am:
+ Add a test for trapezoids clipping.
+
+ * doc/public/cairo-docs.xml: Add an index.
+
+2005-04-12 Carl Worth <cworth@cworth.org>
+
+ * test/translate-show-surface.c: Note that bug is now fixed.
+
+2005-04-12 Carl Worth <cworth@cworth.org>
+
+ * autogen.sh: Replace errant use of aclocal with $ACLOCAL, as
+ reported by Martin Hedenfalk. Closes bug #3000.
+
+2005-04-12 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-pattern.c:
+ * src/cairo-surface.c: (_cairo_surface_init): Default to
+ CAIRO_FILTER_GOOD rather than CAIRO_FILTER_BEST.
+
+ * src/cairo-pattern.c:
+ (_cairo_pattern_acquire_surface_for_surface): Optimize to use
+ CAIRO_FILTER_NEAREST when the pattern matrix is an integer
+ translation.
+
+2005-04-12 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-pattern.c:
+ (_cairo_pattern_acquire_surface_for_surface):
+ * src/cairo-surface.c: (_cairo_surface_init): Use
+ CAIRO_FILTER_BEST by default rather than CAIRO_FILTER_NEAREST.
+
+2005-04-12 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c (_cairo_gstate_show_surface): Offset the src
+ pattern by (0,0)->CTM. This fixes test/translate-show-surface.
+
+ * src/cairo-glitz-surface.c
+ (_cairo_glitz_surface_composite_trapezoids): Use unsigned cahr* to
+ match new prototype for cairo_image_surface_create_for_data.
+
+2005-04-11 Carl Worth <cworth@cworth.org>
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/translate-show-surface-ref.png:
+ * test/translate-show-surface.c: (draw), (main): Add new test
+ demonstrating bug in the sequence: cairo_translate;
+ cairo_show_surface.
+
+2005-04-11 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c (cairo_select_font_face): Add deprecation alias from
+ cairo_scale_font to cairo_set_font_size.
+
+2005-04-11 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c (cairo_select_font_face): Add deprecation alias from
+ cairo_select_font to cairo_select_font_face.
+
+2005-04-11 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.h doc/public/cairo-sections.txt
+ src/cairo-matrix.c: Update.
+
+ * doc/public/cairo-docs.xml: Include cairo-font.xml
+
+2005-04-08 Carl Worth <cworth@cworth.org>
+
+ * src/cairoint.h:
+ * src/cairo.h: Move include of pixman.h from cairo.h to cairoint.h
+ since libpixman isn't part of cairo's public interface.
+
+ * test/move-to-show-surface.c (draw): Use unsigned long rather
+ than uint32_t since we no longer have pixman.h setting that type
+ up for us.
+
+ * src/cairo-font.c (cairo_font_face_destroy): Remove unused
+ variable user_data_copy.
+
+2005-04-08 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.h src/cairo-font.c src/cairoint.h
+ doc/public/cairo-sections.txt:
+ Add cairo_font_face_set/get_user_data().
+
+ * src/cairo-array.c src/cairoint.h src/cairo-surface.c:
+ Refactor user data code from cairo-surface.c into
+ cairo_user_data_array_t.
+
+ * src/cairo-font.c (cairo_font_face_destroy,
+ (cairo_scaled_font_destroy, _cairo_unscaled_font_destroy):
+ Switch these types to be like cairo_surface_t where the
+ generic code frees the wrapper object.
+
+ * src/cairo-atsui-font.c src/cairo-ft-font.c
+ src/cairo-win32-font.c: Fix up for the above changes.
+
+ * src/cairo-ft-font.c (_cairo_ft_unscaled_font_destroy,
+ _ft_font_face_destroy): Implement a complicated mutual-referencing
+ scheme to make sure that a face from cairo_ft_font_face_create_for_ft_face()
+ is freed only when the FT_Face is no longer needed.
+
+ * src/cairo-ft-font.c (cairo_ft_font_face_create_for_ft_face):
+ Update the docs to describe how to figure out when the FT_Face
+ can be freed.
+
+ * src/cairo-ft-font.c: Fix refcount leaks when creating fonts.
+
+ * src/cairo-pdf-surface.c (cairo_pdf_ft_font_create): Remove
+ excess call to _cairo_unscaled_font_reference().
+
+ * src/cairo-gstate.c (_cairo_gstate_set_font_face): Remove
+ stray initialization of font matrix to the identity.
+
+ * src/cairo-array.c (_cairo_user_data_array_set_data) test/user-data.c:
+ Fix a bug when setting/unsetting a key with a free key slot before it,
+ add that to the test case.
+
+ * src/cairo-array.c (_cairo_user_data_array_set_data):
+ Don't append an element when user_data is NULL.
+
+2005-04-08 Dave Beckett <Dave.Beckett@bristol.ac.uk>
+
+ * src/cairo-glitz-surface.c (_cairo_glitz_surface_set_matrix):
+ Update to track changes to cairo_matrix_t interface.
+
+2005-04-08 Carl Worth <cworth@cworth.org>
+
+ * ROADMAP: Add ROADMAP file with an initial stab at 1.0 items.
+
+2005-04-08 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c:
+ (_cairo_gstate_transform), (_cairo_gstate_set_matrix),
+ (_cairo_gstate_interpret_path): Eliminate internal use of
+ deprecated cairo_matrix_copy.
+
+ * src/cairo-gstate.c: (_cairo_gstate_get_matrix),
+ * src/cairo-matrix.c: (cairo_matrix_copy):
+ * src/cairo.c: (cairo_get_matrix):
+ * src/cairo.h:
+ * src/cairoint.h: Change cairo_get_matrix to accept a pointer to
+ the return value cairo_matrix_t rather than returning the value
+ directly.
+
+2005-04-08 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-matrix.c (cairo_matrix_init_identity): Don't try to
+ return a value (even a void value) from a void function. Closes
+ bug #2931.
+
+2005-04-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-wideint.h: Remove broken code for defining
+ uint64_t.
+
+2005-04-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-surface.c: (_cairo_surface_release_source_image),
+ (_cairo_surface_release_dest_image),
+ (_cairo_surface_clone_similar), (_cairo_surface_composite),
+ (_cairo_surface_fill_rectangles),
+ (_cairo_surface_composite_trapezoids), (_cairo_surface_copy_page),
+ (_cairo_surface_show_page), (_cairo_surface_show_glyphs):
+
+ Change to allow NULL backend function pointers to indicate
+ unsupported functions.
+
+ * src/cairo-glitz-surface.c:
+ * src/cairo-image-surface.c:
+ * src/cairo-pdf-surface.c:
+ * src/cairo-ps-surface.c:
+ * src/cairo-quartz-surface.c:
+ * src/cairo-win32-surface.c:
+ * src/cairo-xcb-surface.c:
+ * src/cairo-xlib-surface.c: Eliminate stub functions and replace
+ with NULL in surface backend table.
+
+2005-04-07 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.[ch] src/cairoint.h src/cairo-gstate.c
+ docs/public/cairo-sections.txt:
+ cairo_select_font() => cairo_select_font_face()
+ cairo_scale_font() => cairo_set_font_size()
+ cairo_transform_font() => cairo_set_font_matrix()
+ Add cairo_get_font_matrix(). Make cairo_set_font_face()
+ not reset the font matrix. Default the font matrix
+ to SCALE(10). Document cairo_select_font_face().
+
+ * test/coverage.c (draw) test/text-cache-crash.c (draw)
+ test/text-rotate.c (draw): Use cairo_set_font_size().
+
+ * src/cairo-font.c src/cairo.h: Fix up some parameter
+ names for docs.
+
+2005-04-07 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-win32-font.c: Fix various compilation errors.
+
+2005-04-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c:
+ * src/cairo-png.c:
+ * src/cairo-win32-font.c:
+ * src/cairo-win32-surface.c:
+ * src/cairo-win32.h:
+ * src/cairoint.h: Minor changes to header file inclusion
+ recommended by Oleg Smolsky for better portability to MSVC.
+
+2005-04-07 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-png.c (PNG_SIG_SIZE): Use a preprocessor macro to get
+ a literal value in the array size declaration, (for better
+ portability to lame compilers that can't deal with a const int
+ variable for the array size). Reported by Oleg Smolsky.
+ (PNG_SIG_SIZE): Fix typo.
+
+2005-04-07 Carl Worth <cworth@cworth.org>
+
+ * configure.in:
+ * src/cairo-wideint.h:
+ * src/cairoint.h: Use configure-time checks for stdint.h
+ vs. inttypes.h vs. sys/int_types.h rather than ad-hoc
+ system-specific macros. Also define these types manually none of
+ these header are available. (Thanks to Jason Dorje Short
+ <jdorje@users.sf.net>).
+
+2005-04-07 Carl Worth <cworth@cworth.org>
+
+ * test/imagediff.c (main): Fix to return non-zero status on error.
+
+2005-04-06 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.h src/cairo-gstate.c src/cairo-font.c: Add
+ a cairo_font_face_t type to hold a description of a font
+ face. Replace cairo_set_font() with cairo_set_font_face().
+
+ * src/cairoint.h src/cairo-font.c src/cairo-gstate.c: Add
+ "cairo_simple_font_face" for family/weight/slant and use
+ it to implement font naming for the toy API.
+
+ * src/cairo-ft.h src/cairo-ft-font.c cairo-win32.h
+ cairo-win32-font.c: Switch the FreeType and Win32 backends
+ over to using cairo_font_face_t.
+
+ * src/cairo.h src/cairo-font.c src/cairo-ft-font.c
+ src/cairo-win32-font.c: Pass in font matrix and CTM separately
+ rather than as a composite scale when creating fonts; allows
+ removing font_matrix argument to metrics functions.
+
+ * src/cairoint.h src/cairo-font.c src/cairo-ft-font.c
+ src/cairo-win32-font.c: Remove cairo_font_scale_t type,
+ just use cairo_matrix_t and ignore translations.
+
+ * src/cairo-ft.h src/cairo-ft-font.c: Remove
+ cairo_ft_font_get_pattern() -- it can't work for all FreeType
+ backend fonts and doesn't seem particularly useful.
+
+ * src/cairo.[ch]: Rename cairo_font_get_extents() to
+ cairo_font_extents()
+
+ * doc/public/cairo-sections.txt: Update, split font functions
+ into a separate section.
+
+ * src/cairo-ft-font.c (_ft_unscaled_font_get_for_pattern): Fix
+ locking order problem.
+
+ * src/cairo-font.c: Add caches for simple font faces and from
+ cairo_font_face_t to cairo_scaled_font_t.
+
+ * src/cairo.h src/cairoint.h src/cairo-font.c src/cairo-win32-font.c
+ src/cairo-ft-font.c src/cairo-gstate.c src/cairo-gstate-private.h:
+ Rename cairo_font_t to cairo_scaled_font_t.
+
+2005-04-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Rework the cairo_matrix_t interface in several ways.
+ Expose a struct for cairo_matrix_t.
+
+ Add new function to return current matrix:
+ cairo_get_matrix
+
+ Deprecate the following functions (in documentation):
+ cairo_matrix_create
+ cairo_matrix_destroy
+ cairo_matrix_get_affine
+
+ Rename:
+ cairo_matrix_set_affine -> cairo_matrix_init
+ cairo_matrix_set_identity -> cairo_matrix_init_identity
+
+ Add other new matrix initialization functions:
+ cairo_matrix_init_translate
+ cairo_matrix_init_scale
+ cairo_matrix_init_rotate
+
+ Change return type of almost all cairo_matrix functions from
+ cairo_status_t to void.
+
+ * src/cairo-atsui-font.c:
+ * src/cairo-ft-font.c:
+ * src/cairo-gstate.c:
+ * src/cairo-image-surface.c:
+ * src/cairo-matrix.c:
+ * src/cairo-pattern.c:
+ * src/cairo-pdf-surface.c:
+ * src/cairo-pen.c:
+ * src/cairo-surface.c:
+ * src/cairo-win32-font.c:
+ * src/cairo-xlib-surface.c:
+ * src/cairo.c:
+ * src/cairoint.h: Track changes to cairo_matrix_t interface.
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/transforms-ref.png:
+ * test/transforms.c: Add a test case showing the same path drawn
+ under various transforms, (including skews set directly by
+ initializing a cairo_matrix_t).
+
+2005-04-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Make handling of unsigned char* vs. char*
+ consistent. Change all parameters that are actual string data from
+ unsigned char* to char* (cairo_text_extents, cairo_show_text,
+ cairo_text_path). Change all data buffers from char* to unsigned
+ char* (cairo_write_func_t).
+
+ * src/cairo-gstate.c: (_cairo_gstate_text_to_glyphs):
+ * src/cairo-ft-font.c: (_cairo_ft_font_text_to_glyphs):
+ * src/cairo-font.c: (_cairo_font_text_to_glyphs):
+ * src/cairo-atsui-font.c: (_cairo_atsui_font_text_to_glyphs):
+ * src/cairoint.h:
+ * src/cairo.c: (cairo_text_extents), (cairo_show_text),
+ (cairo_text_path): Track changes from unsigned char* to
+ char*. Convert to unsigned only at the internal interface to
+ unicode processing.
+
+ * test/move-to-show-surface.c: (draw):
+ * src/cairo-output-stream.c: (_cairo_output_stream_printf),
+ (stdio_write): Track change from char* to unsigned char*.
+
+2005-04-06 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-cache.c (_cairo_cache_init): Fix reversed arguments in
+ call to calloc.
+
+2005-04-04 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h (cairo_set_target_image,
+ cairo_image_surface_create_for_data):
+ * src/cairo.c: (cairo_set_target_image): Change type of data
+ parameter from char* to unsigned char*.
+
+ * src/cairo-ft-font.c: (_cairo_ft_font_create_glyph):
+ * src/cairo-image-surface.c: (cairo_image_surface_create_for_data):
+ * src/cairo-pattern.c:
+ (_cairo_pattern_acquire_surface_for_gradient):
+ * test/buffer-diff.c: (buffer_diff):
+ * test/buffer-diff.h:
+ * test/write-png.c: (write_png_argb32):
+ * test/write-png.h: Propagate the unsigned char* change down the
+ stack.
+
+ * src/cairo-xlib-surface.c: (_get_image_surface): Add cast since
+ XImage uses char* rather than unsigned char*.
+
+ * src/cairo-png.c: (cairo_image_surface_create_for_png): Fix
+ memory leak of image data.
+
+ * test/cairo-test.c: (cairo_test), (cairo_test_create_png_pattern):
+ * test/cairo-test.h: Switch to use cairo_surface_write_png rather
+ than a custom write_png_argb32.
+
+ * test/.cvsignore:
+ * test/Makefile.am:
+ * test/create-for-png-ref.png:
+ * test/create-for-png.c: (draw), (main): Add test to exercise the
+ cairo_image_surface_create_for_png function.
+
+2005-04-04 Carl Worth <cworth@cworth.org>
+
+ * TODO: Remove items for PNG backend removal and trapezoid
+ reasterization re-implementation since they have been completed.
+
+2005-04-04 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c:
+ * src/cairo.h: Drop cairo_default_matrix since it is now always
+ identical to cairo_identity_matrix.
+
+ * src/cairo-gstate-private.h:
+ * src/cairo-gstate.c: (_cairo_gstate_init),
+ (_cairo_gstate_set_target_surface): Remove gstate->pixels_per
+ inch. Change default matrix to always be the identity matrix.
+
+ * src/cairo-glitz-surface.c:
+ * src/cairo-image-surface.c:
+ * src/cairo-pdf-surface.c:
+ * src/cairo-ps-surface.c:
+ * src/cairo-quartz-surface.c:
+ * src/cairo-surface.c:
+ * src/cairo-win32-surface.c:
+ * src/cairo-xcb-surface.c:
+ * src/cairo-xlib-surface.c:
+ * src/cairoint.h: Drop pixels_per_inch function from surface
+ backend interface as it is no longer needed.
+
+2005-04-02 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate.c: (_cairo_gstate_show_surface): Use the
+ current point to offset just the destination, not the source and
+ destination. With this fix, cairo_show_surface should work with
+ the current point at places other than the origin.
+
+ * test/Makefile.am: Move move-to-show-surface off the expected
+ failure list.
+
+ * test/move-to-show-surface.c: Add comment indicating that bug is
+ resolved.
+
+ * test/testsvg: Don't use diff to compare images, just imagediff.
+
+2005-04-02 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h:
+ * src/cairo.c: (cairo_set_target_image), (cairo_text_extents),
+ (cairo_show_text), (cairo_text_path):
+ * src/cairo-image-surface.c: (cairo_image_surface_create_for_data):
+ * src/cairo-gstate.c: (_cairo_gstate_text_to_glyphs):
+ * src/cairo-font.c: (_cairo_font_create): Style and indentation
+ fixes.
+
+ * src/cairo-ft-font.c: (_cairo_ft_font_create): Add (unsigned
+ char*) cast to quiet new gcc-4 warnings.
+
+ * src/cairo-ft-font.c: (_cairo_ft_font_glyph_extents): Initialize
+ variables to quiet new gcc-4 warnings.
+
+ * src/cairo-pdf-surface.c: (cairo_pdf_ft_font_write_generic_table),
+ (cairo_pdf_ft_font_write_glyf_table):
+ * src/cairo-png.c: (cairo_surface_write_png),
+ (cairo_image_surface_create_for_png):
+ * src/cairo-xlib-surface.c: (_get_image_surface):
+ * src/cairo-ps-surface.c: (_cairo_ps_surface_copy_page):
+ Use unsigned char* as expected by freetype, libpng, Xlib, and zlib.
+
+ * src/cairoint.h:
+ * src/cairo-unicode.c: (_utf8_get_char), (_utf8_get_char_extended),
+ (_cairo_utf8_to_ucs4), (_cairo_utf8_to_utf16): Propagate unsigned
+ char* down from cairo_text_extents.
+
+2005-04-01 Carl Worth <cworth@cworth.org>
+
+ * TODO: Update API shakeup chart.
+
+ * src/cairo.h:
+ * src/cairo.c: (cairo_set_target_image_no_data): Add a standin for
+ the function that should be cairo_set_target_image which should
+ then have some other name. We can straighten that mess out when we
+ eliminate the set_target functions. Add deprecation alias for
+ cairo_current_pattern.
+
+ * src/cairoint.h:
+ * src/cairo-image-surface.c:
+ * src/cairo-surface.c: Deprecate cairo_surface_create_for_image in
+ favor of cairo_image_surface_create_for_data.
+
+2005-03-31 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo.c (cairo_set_target_png): Remove this function now
+ that the PNG backend is gone.
+
+2005-03-30 Carl Worth <cworth@cworth.org>
+
+ * configure.in: Fix typo I had introduced into Jason's patch that
+ made configure fail.
+
+2005-03-30 Carl Worth <cworth@cworth.org>
+
+ A few fixes courtesy of Jason Dorje Short <jdorje@users.sf.net>:
+
+ * configure.in: Disable PS backend if zlib is not found.
+
+ * src/cairo-win32-font.c: (_cairo_win32_font_glyph_path): Fix
+ mistyped parameter.
+
+ * src/cairo-win32-surface.c: (_cairo_win32_surface_finish): Fix
+ missing return value.
+
+2005-03-30 T Rowley <tim.rowley@gmail.com>
+
+ * src/cairo-gstate.c (_cairo_gstate_stroke_extents): call
+ _cairo_pen_init so that the result takes into account the caps.
+
+2005-03-29 T Rowley <tim.rowley@gmail.com>
+
+ * src/cairo-xlib.h: include Xlib.h to fix solaris build bustage.
+
+2005-03-29 T Rowley <tim.rowley@gmail.com>
+
+ * src/cairo-wideint.h: add preprocessor tests for stdint.h/inttypes.h
+
+ * src/cairoint.h: add preprocessor tests for stdint.h/inttypes.h
+
+2005-03-29 T Rowley <tim.rowley@gmail.com>
+
+ * configure.in: re-enable quartz backend
+
+ * src/cairo-quartz-surface.c: update to compilable/workable version
+
+ * src/cairo-atsui-font.c: update to compilable/workable version
+
+2005-03-29 Carl Worth <cworth@cworth.org>
+
+ * test/Makefile.am:
+ * test/*_*.c: More _/- renames in the test directory.
+
+2005-03-28 Carl Worth <cworth@cworth.org>
+
+ * src/Makefile.am:
+ * src/cairo_*.c: Renamed a bunch of files to use - rather than _
+ as a separator. Copy happened in the master repository to preserve
+ history, so this is just a big remove.
+
+2005-03-28 Carl Worth <cworth@cworth.org>
+
+ * TODO: Sorted API shakeup chart.
+
+2005-03-28 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo-png.c (cairo_image_surface_write_png)
+ (cairo_image_surface_create_from_png): New PNG utility functions.
+
+ * src/cairo_pdf_surface.c, src/cairo-pdf.h: Reverse the naming of
+ the pdf constructors so the callback based ones have the long
+ names.
+
+2005-03-25 Jamey Sharp <jamey@minilop.net>
+
+ * src/cairo-xcb.h:
+ * src/cairo_xcb_surface.c:
+ Fix "implicit declaration" warning in cairo.c by moving
+ cairo_xcb_surface_create prototype into cairo-xcb.h.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-path-fixed-private.h:
+ * src/cairo_path.c: Clean up names of cairo_path internals.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo_path_fill.c:
+ * src/cairo_path_stroke.c: Remove unneeded includes of
+ cairo-path-fixed-private.h.
+
+ * src/cairo_ft_font.c (_cairo_ft_font_glyph_path): Fix
+ indentation.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * TODO: More updates to the API Shakeup chart.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo_path.c: (_cairo_path_fixed_init),
+ (_cairo_path_fixed_init_copy), (_cairo_path_fixed_fini),
+ (_cairo_path_fixed_move_to), (_cairo_path_fixed_rel_move_to),
+ (_cairo_path_fixed_line_to), (_cairo_path_fixed_rel_line_to),
+ (_cairo_path_fixed_curve_to), (_cairo_path_fixed_rel_curve_to),
+ (_cairo_path_fixed_close_path),
+ (_cairo_path_fixed_get_current_point), (_cairo_path_add),
+ (_cairo_path_add_op_buf), (_cairo_path_new_op_buf),
+ (_cairo_path_add_arg_buf), (_cairo_path_new_arg_buf),
+ (_cairo_path_fixed_interpret):
+ * src/cairo_path_bounds.c: (_cairo_path_fixed_bounds):
+ * src/cairo_path_fill.c: (_cairo_path_fixed_fill_to_traps):
+ * src/cairo_path_stroke.c: (_cairo_path_fixed_stroke_to_traps):
+ * src/cairoint.h: Rename cairo_path_real_t to cairo_path_fixed_t
+ and fix all _cairo_path functions to be named as _cairo_path_fixed
+ functions.
+
+ * src/cairo-gstate-private.h:
+ * src/cairo-path-fixed-private.h:
+ * src/cairo_font.c: (_cairo_font_glyph_path):
+ * src/cairo_ft_font.c: (_move_to), (_line_to), (_conic_to),
+ (_cubic_to), (_cairo_ft_font_glyph_path):
+ * src/cairo_gstate.c: (_cairo_gstate_init),
+ (_cairo_gstate_init_copy), (_cairo_gstate_fini),
+ (_cairo_gstate_new_path), (_cairo_gstate_move_to),
+ (_cairo_gstate_line_to), (_cairo_gstate_curve_to),
+ (_cairo_gstate_rel_move_to), (_cairo_gstate_rel_line_to),
+ (_cairo_gstate_rel_curve_to), (_cairo_gstate_close_path),
+ (_cairo_gstate_get_current_point), (_cairo_gstate_interpret_path),
+ (_cairo_gstate_stroke), (_cairo_gstate_in_stroke),
+ (_cairo_gstate_fill), (_cairo_gstate_in_fill),
+ (_cairo_gstate_stroke_extents), (_cairo_gstate_fill_extents),
+ (_cairo_gstate_clip), (_cairo_gstate_text_to_glyphs): Track name
+ change of cairo_path_real_t and _cairo_path_fixed functions.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-path-data-private.h: Remove CAIRO_BEGIN_DECLS and
+ CAIRO_END_DECLS as they are not needed for private headers.
+
+ * src/cairoint.h: Add ASSERT_NOT_REACHED macro.
+
+ * src/cairo.c: (cairo_get_path), (cairo_get_path_flat): Rewrite in
+ terms of cairo_copt_path and cairo_copy_path_flat in preparation
+ for removing cairo_gstate_interpret_path.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-gstate-private.h:
+ * src/cairo-path-fixed-private.h:
+ * src/cairo-private.h:
+ * src/cairoint.h: Begin the process of breaking up cairoint.h,
+ moving structure definitions of cairo_t, cairo_gstate_t, and
+ cairo_path_real_t into their own header files.
+
+ * src/cairo.c:
+ * src/cairo_gstate.c:
+ * src/cairo_path.c:
+ * src/cairo_path_fill.c:
+ * src/cairo_path_stroke.c:
+ * src/cairo_pen.c: Track changes to header files, reaching into
+ the new private headers where necessary.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c: (cairo_set_target_glitz), (cairo_set_target_pdf),
+ (cairo_set_target_pdf_as_file), (cairo_set_target_png),
+ (cairo_set_target_ps), (cairo_set_target_win32),
+ (cairo_set_target_xcb), (cairo_set_target_drawable): Move
+ surface-specific cairo_t functions to cairo.c.
+
+ * src/cairo_glitz_surface.c:
+ * src/cairo_pdf_surface.c:
+ * src/cairo_png_surface.c:
+ * src/cairo_ps_surface.c:
+ * src/cairo_win32_surface.c:
+ * src/cairo_xcb_surface.c:
+ * src/cairo_xlib_surface.c: Remove functions that have now moved
+ to cairo.c.
+
+ * test/.cvsignore: A few new files to ignore now with new
+ compilation mode using a libtool helper library.
+
+2005-03-23 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.h: Add backwards-compatibility for recently renamed
+ functions.
+
+2005-03-21 Carl Worth <cworth@cworth.org>
+
+ * src/cairo.c:
+ * src/cairo_gstate.c: (_cairo_gstate_transform),
+ (_cairo_gstate_user_to_device),
+ (_cairo_gstate_user_to_device_distance),
+ (_cairo_gstate_device_to_user),
+ (_cairo_gstate_device_to_user_distance),
+ (_cairo_gstate_reset_clip):
+ * src/cairo_matrix.c:
+ * src/cairoint.h:
+ * src/cairo.h: Rename functions to eliminate abbreviations:
+ cairo_concat_matrix -> cairo_transform
+ cairo_transform_point -> cairo_user_to_device
+ cairo_transform_distance -> cairo_user_to_device_distance
+ cairo_inverse_transform_point -> cairo_device_to_user
+ cairo_inverse_transform_distance-> cairo_device_to_user_distance
+ cairo_init_clip -> cairo_reset_clip
+
+2005-03-18 Carl Worth <cworth@cworth.org>
+
+ * TODO: Update API shakeup chart.
+
+2005-03-18 Carl Worth <cworth@cworth.org>
+
+ * src/cairo-path-data-private.h: * src/cairo.c: (cairo_copy_path),
+ (cairo_copy_path_flat),
+ (cairo_append_path): Rename cairo_copy_path_data,
+ cairop_copy_path_data_flat, and cairo_append_path_data to
+ cairo_copy_path, cairo_copy_path_flat, and cairo_append_path.
+
+ * src/cairo.h: Add new cairo_path_t, containing a
+ cairo_path_data_t array and an explicit length. Remove
+ CAIRO_PATH_END_PATH terminator from cairo_path_data_t.
+
+ * src/cairo_atsui_font.c: (_cairo_atsui_font_glyph_path):
+ * src/cairo_font.c: (_cairo_font_glyph_path):
+ * src/cairo_ft_font.c: (_move_to), (_line_to), (_conic_to),
+ (_cubic_to), (_cairo_ft_font_glyph_path):
+ * src/cairo_gstate.c: (_cairo_gstate_interpret_path):
+ * src/cairo_path.c: (_cairo_path_init), (_cairo_path_init_copy),
+ (_cairo_path_fini), (_cairo_path_move_to),
+ (_cairo_path_rel_move_to), (_cairo_path_line_to),
+ (_cairo_path_rel_line_to), (_cairo_path_curve_to),
+ (_cairo_path_rel_curve_to), (_cairo_path_close_path),
+ (_cairo_path_get_current_point), (_cairo_path_add),
+ (_cairo_path_add_op_buf), (_cairo_path_new_op_buf),
+ (_cairo_path_add_arg_buf), (_cairo_path_new_arg_buf),
+ (_cairo_path_interpret):
+ * src/cairo_path_bounds.c: (_cairo_path_bounds):
+ * src/cairo_path_data.c: (_cairo_path_data_count),
+ (_cairo_path_data_populate), (_cairo_path_data_create_real),
+ (cairo_path_destroy), (_cairo_path_data_append_to_context):
+ * src/cairo_path_fill.c: (_cairo_path_fill_to_traps):
+ * src/cairo_path_stroke.c: (_cairo_path_stroke_to_traps):
+ * src/cairoint.h:
+ * test/path_data.c: (munge_and_set_path), (draw), (main): Rename
+ the internal path object from cairo_path_t to cairo_path_real_t.
+
+2005-03-18 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo_pdf_surface.c (cairo_set_target_pdf_as_file)
+ (cairo_set_target_pdf): Remove return statements from these
+ functions (bug #2137).
+
+2005-03-18 Carl Worth <cworth@cworth.org>
+
+ * src/Makefile.am (libcairo_la_SOURCES): Remove unused
+ libcairo_freetype_sources (thanks to Damien Carbery). Closes bug
+ #2673.
+
+2005-03-17 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo_matrix.c (cairo_matrix_rotate): doc fix -
+ 90 degrees is MI_PI/2 radians.
+
+ * src/cairo.c src/cairo_matrix.c src/cairo_ft_font.c
+ src/cairo_ps_surface.c src/cairo_quartz_surface.c
+ src/cairo_win32_font.c src/cairo_win32_surface.c
+ src/cairo_xlib_surface.c: Cairo is only capitalized
+ at the beginning of sentences.
+
+2005-03-17 Kristian Høgsberg <krh@redhat.com>
+
+ From Tor Lillqvist <tml@novell.com>:
+
+ * test/cairo_test.c (cairo_test): Open output PNG files in binary
+ mode.
+
+2005-03-17 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo.h src/cairo_surface.c src/cairo-xlib.h
+ src/cairo_xlib_surface.c: Move cairo_xlib_surface_set_device_offset()
+ to a generic cairo_surface_set_device_offset().
+
+ * src/cairo_gstate.c: Take the surface's device offset into
+ account.
+
+ * doc/public/cairo-sections.txt: Update.
+
+2005-03-17 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo_matrix.c: Fix the docs to to correctly describe
+ the order of transformation for muliply/scale/rotate/translate.
+ (cairo_matrix_translate): Fix translate/rotate typo in the
+ parameter descriptions.
+
+2005-03-17 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo_output_stream.c: Forgot to add this file.
+
+2005-03-16 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo_surface.c (_destroy_user_data)
+ (cairo_surface_set_user_data): Dont call user data destroy
+ function if it's NULL.
+
+ * test/user_data.c: (main): Add test case for user data with NULL
+ destroy function.
+
+2005-03-16 Kristian Høgsberg <krh@redhat.com>
+
+ * src/Makefile.am: Add cairo_output_stream.c
+
+ * src/cairo.h: Add new errors, CAIRO_STATUS_WRITE_ERROR and
+ CAIRO_STATUS_SURFACE_FINISHED, add cairo_surface_finish()
+ prototype, add cairo_write_func_t.
+
+ * src/cairo.c: Add strings for new errors, documentation fix.
+
+ * src/cairo_win32_surface.c:
+ * src/cairo_xcb_surface.c:
+ * src/cairo_xlib_surface.c:
+ * src/cairo_glitz_surface.c:
+ * src/cairo_image_surface.c:
+ * src/cairo_png_surface.c:
+ * src/cairo_ps_surface.c: Rename surface destroy functions to
+ finish and change them to not free the surface.
+
+ * src/cairo-pdf.h:
+ * src/cairo_pdf_surface.c: Change PDF surface constructors to take
+ a write function in the general case and add stdio convenience
+ constructors. Change destroy function to finish for
+ cairo_pdf_surface. Change implementation to use
+ cairo_output_stream_t functions for output.
+
+ * src/cairo_font.c: (_cairo_font_show_glyphs): Use
+ _cairo_surface_show_glyphs instead of calling function pointer
+ directly.
+
+ * src/cairoint.h: Add prototypes for cairo output stream
+ functions, rename destroy to finish in cairo_surface_backend_t and
+ add finished flag to cairo_surface_t.
+
+ * src/cairo_surface.c: Add cairo_surface_finish() and call it from
+ cairo_surface_destroy(). Check the finished flag in
+ cairo_surface_t in functions that change the surface.
+
+2005-03-15 Owen Taylor <otaylor@redhat.com>
+
+ * src/cairo-xlib.h src/cairo_xlib_surface.c: Rework set
+ of contructors for XLib surfaces. Add
+ cairo_xlib_surface_set_size().
+
+ * src/cairo-xlib.h src/cairo_xlib_surface.c: Add
+ cairo_xlib_surface_set_device_offset().
+
+ * src/cairo_xlib_surface.c (cairo_xlib_surface_set_clip_region):
+ Rewrite for clarity and efficiency.
+
+ * src/cairo_xlib_surface.c (_get_image_surface): Use a
+ temporary pixmap to avoid possible BadMatch when fetch
+ from windows.
+
+ * src/cairo.[ch] src/cairo-xlib.h: Fix some parameter names
+ for the docs.
+
+ * doc/public/cairo-sections.txt: Update
+
+2005-03-14 Carl Worth <cworth@cworth.org>
+
+ * test/path_data-ref.png: Add reference image.
+
+2005-03-14 Carl Worth <cworth@cworth.org>
+
+ * test/Makefile.am: Fixes to force tests to run against locally
+ compiled version (thanks to Manish Singh).
+
+2005-03-11 Carl Worth <cworth@cworth.org>
+
+ * doc/public/cairo-sections.txt:
+ * doc/public/tmpl/cairo-surface.sgml:
+ * doc/public/tmpl/cairo.sgml: Added some documentation, so we get
+ some churn here.
+
+ * src/cairo.c:
+ * src/cairo.h: New functions: cairo_copy_path_data,
+ cairo_copy_path_data_flat, and cairo_append_path_data.
+
+ * src/Makefile.am:
+ * src/cairo-path-data-private.h:
+ * src/cairo_path_data.c: Add new implementation for
+ cairo_copy_path_data and cairo_append_path_data.
+
+ * test/Makefile.am:
+ * test/path_data.c: New test for new path_data functions.
+
+2005-03-10 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo_surface.c (_destroy_user_data): Add this function and
+ call it on surface destruction.
+
+2005-03-10 Kristian Høgsberg <krh@redhat.com>
+
+ * test/user_data.c (main): Fix assert()'s using = instead of ==.
+
+ * test/cairo_test.c (cairo_test): Move xunlink call below the
+ xasprintf that builds the filename to unlink.
+
+2005-03-10 Carl Worth <cworth@cworth.org>
+
+ * TODO: API Shakeup status update.
+
+2005-03-10 Carl Worth <cworth@cworth.org>
+
+ Originally: 2005-02-24 Carl Worth <cworth@cworth.org>
+
+ * src/cairo_surface.c (cairo_surface_set_user_data)
+ (cairo_surface_get_user_data):
+ * src/cairo.h: Add const qualifier to cairo_user_data_key_t
+ arguments.
+
+ Originally: 2005-02-15 Kristian Høgsberg <krh@redhat.com>
+
+ * src/cairo_surface.c (cairo_surface_get_data, cairo_surface_set_data):
+ Add these two functions to set and get user data on an surface.
+
+ * src/cairo.h: Function prototypes for new functions.
+
+ * test/user_data.c: Test case for user data functions.
+
+2005-03-09 Carl Worth <cworth@cworth.org>
+
+ * test/cairo_test.c (cairo_test): Move filename initialization up
+ to before first use.
+
+ * test/get_and_set.c:
+ * test/Makefile.am: Add test for the most trivial cairo_get and
+ cairo_set functions.
+
+2005-03-09 Carl Worth <cworth@cworth.org>
+
+ * test/cairo_test.c: (cairo_test):
+ * test/cairo_test.h:
+ * test/clip_twice.c: (draw):
+ * test/coverage.c: (draw):
+ * test/fill_rule.c: (draw):
+ * test/leaky_polygon.c: (draw):
+ * test/line_width.c: (draw):
+ * test/linear_gradient.c: (draw):
+ * test/move_to_show_surface.c: (draw):
+ * test/pixman_rotate.c: (draw):
+ * test/text_cache_crash.c: (draw):
+ * test/text_rotate.c: (draw): Change the draw function under test
+ to return a cairo_test_status_t so that it can indicate test
+ failure even if there is no result image.
+
+2005-03-09 Carl Worth <cworth@cworth.org>
+
+ * TODO: Update API Shakeup planning chart.
+ fix typos.
+
+2005-03-09 Carl Worth <cworth@cworth.org>
+
+ * doc/public/cairo-sections.txt:
+ * src/cairo.c: (cairo_get_pattern), (cairo_get_font),
+ (cairo_get_font_extents), (cairo_get_operator),
+ (cairo_get_rgb_color), (cairo_get_alpha), (cairo_get_tolerance),
+ (cairo_get_current_point), (cairo_get_fill_rule),
+ (cairo_get_line_width), (cairo_get_line_cap),
+ (cairo_get_line_join), (cairo_get_miter_limit), (cairo_get_matrix),
+ (cairo_get_target_surface), (cairo_get_path),
+ (cairo_get_path_flat):
+ * src/cairo.h:
+ * src/cairo_ft_font.c: (_conic_to):
+ * src/cairo_gstate.c: (_cairo_gstate_get_target_surface),
+ (_cairo_gstate_get_pattern), (_cairo_gstate_get_operator),
+ (_cairo_gstate_get_rgb_color), (_cairo_gstate_get_tolerance),
+ (_cairo_gstate_get_alpha), (_cairo_gstate_get_fill_rule),
+ (_cairo_gstate_get_line_width), (_cairo_gstate_get_line_cap),
+ (_cairo_gstate_get_line_join), (_cairo_gstate_get_miter_limit),
+ (_cairo_gstate_get_matrix), (_cairo_gstate_get_current_point),
+ (_cairo_gstate_show_surface), (_cairo_gstate_get_font),
+ (_cairo_gstate_get_font_transform), (_cairo_gstate_get_font_scale),
+ (_cairo_gstate_ensure_font), (_cairo_gstate_get_font_extents),
+ (_cairo_gstate_text_to_glyphs):
+ * src/cairo_path.c: (_cairo_path_get_current_point):
+ * src/cairoint.h:
+ * test/pixman_rotate.c: (draw):Rename all the cairo_current
+ functions to cairo_get functions instead. Add documentation for
+ all of these functions (and a few others as well).
+
+ Add support so that old binarys should still run and old source
+ should still compile, (though we'll rip that out again on the API
+ Shakeup flag day).
+
+2005-03-08 Carl Worth <cworth@cworth.org>
+
+ * configure.in: Add -head to CAIRO_VERSION after tagging with
+ SNAPSHOT_0_4_0.
+
2005-03-08 Carl Worth <cworth@cworth.org>
* gtk-doc.make (dist-check-gtkdoc): Commit workaround to prevent
diff --git a/Makefile.am b/Makefile.am
index 60ae805..31aea91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,6 +9,8 @@ EXTRA_DIST = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = cairo.pc
+DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+
# Some custom targets to make it easier to release things.
# Use either:
# make release-check
diff --git a/Makefile.in b/Makefile.in
index 4f53fcb..ab141ad 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -102,8 +102,8 @@ CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
-CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
-CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
+CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@
+CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
@@ -181,14 +181,13 @@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
+PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
-PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
-SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -259,6 +258,7 @@ EXTRA_DIST = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = cairo.pc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
# Some custom targets to make it easier to release things.
# Use either:
diff --git a/NEWS b/NEWS
index 62a1b18..f69bbd0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,409 @@
+Snapshot 0.5.1 (2005-06-20 Carl Worth <cworth@cworth.org>)
+==========================================================
+API changes
+-----------
+* Removed cairo_status_string(cairo_t*) and add
+ cairo_status_to_string(cairo_status_t) in its place. Code using
+ cairo_status_string can be ported forward as follows:
+
+ cairo_status (cr);
+ ->
+ cairo_status_to_string (cairo_status (cr));
+
+* Removed the BAD_NESTING restriction which means that two different
+ cairo_t objects can now interleave drawing to the same
+ cairo_surface_t without causing an error.
+
+* The following functions which previously had a return type of
+ cairo_status_t now have a return type of void:
+
+ cairo_pattern_add_color_stop_rgba
+ cairo_pattern_set_matrix
+ cairo_pattern_get_matrix
+ cairo_pattern_set_extend
+ cairo_pattern_set_filter
+
+ See discussion of cairo_pattern_status below for more details.
+
+API additions
+-------------
+* Improved error handling:
+
+ cairo_status_t
+ cairo_pattern_status (cairo_pattern_t *pattern);
+
+ This snapshot expands the status-based error handling scheme from
+ cairo_t to cairo_path_t and cairo_pattern_t. It also expands the
+ scheme so that object-creating functions, (cairo_create,
+ cairo_pattern_create_*, cairo_copy_path_*), are now guaranteed to
+ not return NULL. Instead, in the case of out-of-memory these
+ functions will return a static object with
+ status==CAIRO_STATUS_NO_MEMORY. The status can be checked with the
+ functions cairo_status and cairo_pattern_status, or by direct
+ inspection of the new status field in cairo_path_t.
+
+ Please note that some objects, including cairo_surface_t and all of
+ the font-related objects have not been converted to this
+ error-handling scheme.
+
+* In addition to the above changes, a new private function has been added:
+
+ _cairo_error
+
+ This function can be used to set a breakpoint in a debugger to make
+ it easier to find programming error in cairo-using code. (Currently,
+ _cairo_error is called when any error is detected within a cairo_t
+ context, but is not called for non-cairo_t errors such as for
+ cairo_path_t and cairo_pattern_t).
+
+* Fixed cairo_path_data_t so that its enum is visible to C++ code, (as
+ cairo_path_data_type_t).
+
+Performance improvements
+------------------------
+* Made a minor performance improvement for clipping, (restrict clip
+ surface to the new intersected bounds).
+
+* Optimize rendering of a solid source pattern with a pixel-aligned
+ rectangular path to use backend clipping rather than rasterization
+ and backend compositing.
+
+* Optimize cairo_paint_with_alpha to defer to cairo_paint when alpha
+ is 1.0.
+
+Bug fixes
+---------
+* Fixed memory leak in cairo_copy_path.
+
+* A build fix for non-srcdir builds.
+
+PDF backend fixes
+-----------------
+* New support for path-based clipping.
+
+* Fix for text rotated to angles other than multiples of π/2.
+
+Win32 backend fixes
+-------------------
+* Fix for text extents.
+
+Xlib backend
+------------
+* Implemented a complex workaround for X server bug[*] related to
+ Render-based compositing with untransformed, repeating source
+ pictures. The workaround uses core Xlib when possible for
+ performance, (ie. with CAIRO_OPERATOR_SOURCE or CAIRO_OPERATOR_OVER
+ with an opaque source surface), and falls back to the pixman
+ image-based compositing otherwise.
+
+ [*] https://bugs.freedesktop.org/show_bug.cgi?id=3566
+
+* Various bug fixes, particularly in the fallback paths.
+
+Snapshot 0.5.0 (2005-05-17 Carl Worth <cworth@cworth.org>)
+==========================================================
+This is a pretty big, and fairly significant snapshot. It represents
+between 2 and 3 months of solid work from a lot of people on improving
+the API as much as possible. I'd like to express my appreciation and
+congratulations to everyone who has worked on the big API Shakeup,
+(whether in email battles over names, or fixing my silly bugs).
+
+This snapshot will require some effort on the part of users, since
+there are a _lot_ of API changes (ie. no cairo program ever written is
+safe --- they're all broken now in at least one way). But, in spite of
+that, we do encourage everyone to move their code to this snapshot as
+soon as possible. And we're doing everything we can think of to make
+the transition as smooth as possible.
+
+The idea behind 0.5 is that we've tried to make every good API change
+we could want now, and get them all done with. That is, between now
+and the 1.0 release of cairo, we expect very few new API changes,
+(though some will certainly sneak in). We will have some significant
+additions, but the pain of moving code from cairo 0.4 to cairo 0.5
+should be a one time experience, and things should be much smoother as
+we continue to move toward cairo 1.0.
+
+And with so many changes coming out for the first time in this 0.5
+release, we really do need a lot of people trying this out to make
+sure the ideas are solid before we freeze the API in preparation for
+the 1.0 release.
+
+OK, enough introduction. Here is a (not-quite-complete) description of
+the API removals, changes and additions in this snapshot, (compared to
+0.4.0)
+
+API removals
+============
+The following public functions have been removed:
+
+- cairo_set_target_*
+
+ This is a big change. See the description of cairo_create in
+ the API changes section for how to deal with this.
+
+- cairo_set_alpha
+
+ Alpha blending hasn't gone away; there's just a much more
+ unified rendering model now. Almost all uses of
+ cairo_set_alpha will be trivially replaced with
+ cairo_set_source_rgba and a few others will be replaced just
+ as easily with cairo_paint_with_alpha.
+
+- cairo_show_surface
+
+ Another useful function that we realized was muddling up the
+ rendering model. The replacement is quite easy:
+ cairo_set_source_surface and cairo_paint.
+
+- cairo_matrix_create
+- cairo_matrix_destroy
+- cairo_matrix_copy
+- cairo_matrix_get_affine
+
+ These functions supported an opaque cairo_matrix_t. We now
+ have an exposed cairo_matrix_t structure, so these can be
+ dropped.
+
+- cairo_surface_set_repeat
+- cairo_surface_set_matrix
+- cairo_surface_set_filter
+
+ These properties don't belong on surfaces. If you were using
+ them, you'll just want to instead use
+ cairo_pattern_create_for_surface and then set these properties
+ on the pattern.
+
+- cairo_copy
+
+ This was a confusing function and hopefully nobody will miss
+ it. But if you really don't find cairo_save/restore adequate,
+ let us know and we have another idea for a potential
+ replacement.
+
+And while we're on the subject of removals, we carefully tightened up
+the cairo header files so they no longer gratuitously include header
+files that are not strictly necessary, (stdio.h, stdint.h, pixman.h,
+Xrender.h, etc. and their dependencies). This may lead to some
+surprising errors, so keep your eyes open for that.
+
+API changes
+===========
+Here are some of the API changes that have occurred:
+
+~ cairo_create(void) -> cairo_create(cairo_surface_t *)
+
+ This is the big change that breaks every program. The ability
+ to re-target a cairo_t was not particularly useful, but it did
+ introduce a lot of muddy semantic questions. To eliminate
+ that, cairo_create now requires its target surface to be
+ passed in at creation time. This isn't too hard to cope with
+ as the typical first operation after cairo_create was often
+ cairo_set_target_foo. So the order of those two swap and the
+ application instead has cairo_foo_surface_create, then
+ cairo_create.
+
+~ cairo_current_* -> cairo_get_*
+
+ We had a strange mixture of cairo_get and cairo_current
+ functions. They've all been standardized on cairo_get, (though
+ note one is cairo_get_current_point).
+
+~ CAIRO_OPERATOR_SRC -> CAIRO_OPERATOR_SOURCE
+~ CAIRO_OPERATOR_OVER_REVERSE -> CAIRO_OPERATOR_DEST_OVER
+
+ Many of the cairo_operator_t symbolic values were renamed to
+ reduce the amount of abbreviation. The confusing "OP_REVERSE"
+ naming was also changed to use "DEST_OP" instead which is
+ easier to read and has wider acceptance in other
+ libraries/languages.
+
+~ cairo_set_pattern -> cairo_set_source
+~ cairo_set_rgb_color -> cairo_set_source_rgb
+
+ All of the various functions that changed the source
+ color/pattern were unified to use cairo_set_source names to
+ make the relation more clear.
+
+~ cairo_transform_point -> cairo_user_to_device
+~ cairo_transform_distance -> cairo_user_to_device_distance
+~ cairo_inverse_transform_point -> cairo_device_to_user
+~ cairo_inverse_transform_distance -> cairo_device_to_user_distance
+
+ These names just seemed a lot more clear.
+
+~ cairo_init_clip -> cairo_reset_clip
+~ cairo_concat_matrix -> cairo_transform
+
+ More abbreviation elimination
+
+~ cairo_current_path -> cairo_copy_path
+~ cairo_current_path_flat -> cairo_copy_path_flat
+
+ The former mechanism for examining the current path was a
+ function that required 3 or 4 callbacks. This was more
+ complexity than warranted in most situations. The new
+ cairo_copy_path function copies the current path into an
+ exposed data structure, and the documentation provides a
+ convenient idiom for navigating the path data.
+
+API additions
+-------------
++ cairo_paint
+
+ A generalized version of the painting operators cairo_stroke
+ and cairo_fill. The cairo_paint call applies the source paint
+ everywhere within the current clip region. Very useful for
+ clearing a surface to a solid color, or painting an image,
+ (see cairo_set_source_surface).
+
++ cairo_paint_with_alpha
+
+ Like cairo_paint but applying some alpha to the source,
+ (making the source paint translucent, eg. to blend an image on
+ top of another).
+
++ cairo_mask
+
+ A more generalized version of cairo_paint_with_alpha which
+ allows a pattern to specify the amount of translucence at each
+ point rather than using a constant value everywhere.
+
++ cairo_mask_surface
+
+ A convenience function on cairo_mask for when the mask pattern
+ is already contained within a surface.
+
++ cairo_surface_set_user_data
++ cairo_surface_get_user_data
++ cairo_font_face_set_user_data
++ cairo_font_face_get_user_data
+
+ Associate arbitrary data with a surface or font face for later
+ retrieval. Get notified when a surface or font face object is
+ destroyed.
+
++ cairo_surface_finish
+
+ Allows the user to instruct cairo to finish all of its
+ operations for a given surface. This provides a safe point for
+ doing things such as flushing and closing files that the
+ surface may have had open for writing.
+
++ cairo_fill_preserve
++ cairo_stroke_preserve
++ cairo_clip_preserve
+
+ One interesting change in cairo is that the path is no longer
+ part of the graphics state managed by
+ cairo_save/restore. This allows functions to construct paths
+ without interfering with the graphics state. But it prevents
+ the traditional idiom for fill-and-stroke:
+
+ cairo_save; cairo_fill; cairo_restore; cairo_stroke
+
+ Instead we know have alternate versions cairo cairo_fill,
+ cairo_stroke, and cairo_clip that preserve the current path
+ rather than consuming it. So the idiom now becomes simply:
+
+ cairo_fill_preserve; cairo_stroke
+
++ cairo_surface_write_to_png
++ cairo_surface_write_to_png_stream
+
+ In place of a single PNG backend, now a surface created
+ through any backend (except PDF currently) can be written out
+ to a PNG image.
+
++ cairo_image_surface_create_from_png
++ cairo_image_surface_create_from_png_stream
+
+ And its just as easy to load a PNG image into a surface as well.
+
++ cairo_append_path
+
+ With the new, exposed path data structure, it's now possible
+ to append bulk path data to the current path, (rather than
+ issuing a long sequence of cairo_move_to/line_to/curve_to
+ function calls).
+
+Xlib and XCB backends
+---------------------
+
+Any cairo_format_t and Colormap arguments have been dropped from
+cairo_xlib_surface_create. There are also two new
+cairo_xlib|xcb_surface_create functions:
+
+ cairo_xlib|xcb_surface_create_for_bitmap
+ (Particular for creating A1 surfaces)
+ cairo_xlib|xcb_surface_create_with_xrender_format
+ (For any other surface types, not described by a Visual*)
+
+All of these surface create functions now accept width and height. In
+addition, there are new cairo_xlib|xcb_surface_set_size functions
+which must be called each time a window that is underlying a surface
+changes size.
+
+Print backends (PS and PDF)
+---------------------------
+The old FILE* based interfaces have been eliminated. In their place we
+have two different functions. One accepts a simple const char
+*filename. The other is a more general function which accepts a
+callback write function and a void* closure. This should allow the
+flexibility needed to hook up with various stream object in many
+languages.
+
+In addition, when specifying the surface size during construction, the
+units are now device-space units (ie. points) rather than inches. This
+provides consistency with all the other surface types and also makes
+it much easier to reason about the size of the surface when drawing to
+it with the default identity matrix.
+
+Finally, the DPI parameters, which are only needed to control the
+quality of fallbacks, have been made optional. Nothing is required
+during surface_create (300 DPI is assumed) and
+cairo_ps|pdf_surface_set_dpi can be used to set alternate values if
+needed.
+
+Font system
+-----------
+Owen very graciously listened to feedback after the big font rework he
+had done for 0.4, and came up with way to improve it even more. In 0.4
+there was a cairo_font_t that was always pre-scaled. Now, there is an
+unscaled cairo_font_face_t which is easier to construct, (eg. no
+scaling matrix required) and work with, (it can be scaled and
+transformed after being set on the graphics state). And the font size
+manipulation functions are much easier. You can set an explicit size
+and read/modify/write the font matrix with:
+
+ cairo_set_font_size
+ cairo_get_font_matrix
+ cairo_set_font_matrix
+
+(Previously you could only multiply in a scale factor or a matrix.) A
+pleasant side effect is that we can (and do) now have a default font
+size that is reasonable, as opposed to the old default height of one
+device-space unit which was useless until scaled.
+
+Of course, the old pre-scaled font had allowed some performance
+benefits when getting many metrics for a font. Those benefits are
+still made available through the new cairo_scaled_font_t. And a
+cairo_font_face_t can be "promoted" to a cairo_scaled_font_t by
+suppling a font_matrix and the desired CTM.
+
+Quartz backend
+--------------
+Tim Rowley put in the work to bring the Quartz backend back after it
+had been disabled in the 0.4.0 snapshot. He was not able to bring back
+the function that allows one to create a cairo_font_t from an ATSUI
+style:
+
+ cairo_font_t *
+ cairo_atsui_font_create (ATSUStyle style);
+
+because he didn't have a test case for it. If you care about this
+function, please provide a fairly minimal test and we'll try to bring
+it back in an upcoming snapshot.
+
Snapshot 0.4.0 (2005-03-08 Carl Worth <cworth@cworth.org>)
==========================================================
New documentation
diff --git a/TODO b/TODO
index f0edbc3..41f8960 100644
--- a/TODO
+++ b/TODO
@@ -1,63 +1,57 @@
-API Shakeup work
-----------------
-Patch? Reviewed?
-yes yes user data (was Re: [cairo] Patch improving fallbacks)
- cairo_paint
-yes yes setters and getters
- cairo_current_matrix
- Renaming the terms of the rendering equation
- Making set_source consistent
- Eliminating cairo_show_surface
- cairo_mask
- cairo_begin_group, cairo_end_group, cairo_get_group
-yes yes cairo_output_stream_t and cairo_surface_finish()
- cairo_create and eliminating cairo_set_target_surface
- cairo_fill_preserve, cairo_stroke_preserve, cairo_clip_preserve
- default matrix
- cairo_current_path -> cairo_copy_path_data
- cairo_surface_finish, cairo_surface_flush
- cairo_<device>_surface_mark_dirty
- Eliminating cairo_copy
- Eliminating cairo_surface_set_repeat/matrix/filter
- A hidden offset for the xlib backend
- cairo_stroke_path -> cairo_stroke_to_path
- Simplifying the operator set
- Abbreviation hunt: cairo_init_clip and cairo_concat_matrix
- Consistent error handling for all objects
-
-* Add support for non-antialiased rendering. API ?
-
-* Clean up the cache code a bit, (there is at least one redundant
- level of cacheing, and there are some minor style issues).
-
-* Add CAIRO_FILL_RULE_INVERSE_WINDING and CAIRO_FILL_RULE_INVERSE_EVEN_ODD
-
-* Fix clipping to work for all operators. The equation we have come up
- with is:
-
- ((src Op dest) In clip) Add (dest Out clip)
-
-* Replace PNG backend with an image_surface function to save a PNG
- image.
-
-* Clean up the API in preparation for freezing and release.
-
-* Make a more interesting PS backend, (other than the current
-"giant-image for every page" approach).
-
-* Figure out what to do with DPI for image/png backends.
-
-* Change stroke code to go through one giant polygon. This will fix
-problems with stroking self-intersecting paths.
-
-* Re-work the backend clipping interface to use geometry rather than
-images.
-
-* Fix the intersection problem, (see reference to Hobby's paper
-mentioned in cairo_traps.c).
-
-* Add a new cairo_text_glyphs function (a sort of bridge between the
-toy and the real text API):
+Changes that are expected to impact the public API
+==================================================
+
+ Patch submitted to mailing list?
+/ Documentation included in patch?
+|/ Review of patch completed?
+||/ Test case included?
+|||/ Committed.
+||||/
+Backwards compatible (API additions only)
+-----------------------------------------
+ cairo_begin_group, cairo_end_group, cairo_get_group
+ cairo_surface_mark_dirty (see below for details)
+ Add support for non-antialiased rendering. API ?
+ Add CAIRO_FILL_RULE_INVERSE_WINDING and CAIRO_FILL_RULE_INVERSE_EVEN_ODD
+ Add cairo_text_glyphs (see below for details)
+ Add support for programmatic patterns, (ie. arbitrary gradients)
+ Add cairo_arc_to.
+ Add support for custom caps (see below for details)
+ Add support for getting at image data from image surface
+ Add CAIRO_STATUS_DESTROYED
+ Add cairo_finish
+
+Backwards incompatible (API deletions or changes)
+-------------------------------------------------
+PDR C cairo_surface_finish, cairo_surface_flush
+PDR C A hidden offset for the xlib backend
+P Consistent error handling for all objects
+ Split cairo_format_t (see below for details)
+P---C Remove cairo_status_string in favor of cairo_status_to_string
+
+Details on some of the above changes
+------------------------------------
+* cairo_surface_mark_dirty
+
+ One question is what the function should accept. A single
+ device-space rectangle seems like a consistent approach. That would
+ allow us to avoid needing backend-specific functions with
+ backend-specific region datatypes, (cf. clipping support)
+
+ In order to get the intended efficiency benefits, we'll need to make
+ two changes:
+
+ 1) In the fallback code, never fetch any data from the clean
+ region.
+
+ 2) Mark clean any region drawn with device-pixel aligned
+ rectangles, (cairo_paint with no clip is the most iportant
+ one here).
+
+* cairo_text_glyphs:
+
+ It would function as a sort of bridge between the toy and the
+ real text APIs:
> void
> cairo_text_glyphs (cairo_t *cr, const unsigned char *utf8,
@@ -76,54 +70,71 @@ toy and the real text API):
> as long as the original size of glyphs/num_glyphs was large
> enough.
-* Implement dashing for cairo_curve_to.
-
-* Implement support for programmatic patterns, (ie. figure out how to
-do gradients the Right Way).
-
-* Implement cairo_arc_to.
-
-* Re-implement the trapezoid rasterization algorithm according to the
- new "specification".
+* support for custom caps:
-* Stroking closed, degenerate paths should still draw caps. Round
- caps are easy; square should probably draw an axis-aligned square.
-
-* It would be nice if the user had a mechanism to reliably draw custom
+ It would be nice if the user had a mechanism to reliably draw custom
caps. One approach here would be to provide the coordinates of the
butt cap faces so that the user can append seamless caps to the
current path. We may also need to provide the coordinates of the
faces of every dash as well.
-* Should add geometry pruning as appropriate.
+* split cairo_format_t into two things:
+
+ - An enumeration that determines the "capabilities" of a surface -
+ A vs. ARGB. vs. RGB
+ - An enumeration that determines a specific in-memory representation
+ of data. (A1/A8/ARGB32/etc.. Could be extensible to things like
+ RGBA32_BYTES_NONPREMULTIPLIED. Some consistent naming convention would
+ be be good.)
+
+ One issue here is that some interfaces, like cairo_surface_create_similar()
+ might be useful with either one. We might want to create an A1 surface
+ compatible with the backend (are there examples other than A1? Should
+ bilevel just be another "capability"?), or we might want to just create
+ an alpha surface without caring about the depth.
+
+ If we want to support this, we could do something like:
+
+ typedef enum cairo_pixel_format_t {
+ CAIRO_PIXEL_FORMAT_A8 = CAIRO_FORMAT_ALPHA,
+ CAIRO_PIXEL_FORMAT_RGB24 = CAIRO_FORMAT_RGB,
+ CAIRO_PIXEL_FORMAT_A1,
+ };
+
+ To allow passing either in.
+
+ (I don't particularly like this idea for create_similar() because then you
+ aren't really saying ALPHA-dont-care, you are saying ALPHA-8. I think it
+ would be better to have a separate path for create_similar_with_pixel_format()
+ if we need that. But it might be useful for cairo_image_surface_create() ...
+ people are going to screw up and pass CAIRO_FORMAT_RGB into that, and if it
+ "just worked" that would save people trouble....)
+
+Changes that do not affect the public API
+=========================================
+* Clean up the cache code a bit, (there is at least one redundant
+ level of cacheing, and there are some minor style issues).
+
+* Fix clipping to work for all operators. The equation we have come up
+ with is:
-* We need a way to get at the image data after something
- like cairo_surface_create_similar with the image backend.
+ ((src Op dest) In clip) Add (dest Out clip)
-* Three suggestions from Owen that will help GTK+ performance:
+* Make a more interesting PS backend, (other than the current
+ "giant-image for every page" approach).
- - The ability have an additional rectangle-list clip in the
- Xlib surface. Frequently during an expose event, GTK+ is
- drawing L shaped areas
+* Change stroke code to go through one giant polygon. This will fix
+ problems with stroking self-intersecting paths.
- XXXXXX
- X.....
- X.....
+* Fix the intersection problem, (see reference to Hobby's paper
+ mentioned in cairo_traps.c).
- And passing the real clip to the server is going to save
- a lot of pixel operations that will be thrown away.
+* Implement dashing for cairo_curve_to.
- - The ability to pass in a width/height to cairo_xlib_surface_create()
- to avoid a round-trip. (Round-trips are bad to the point where
- querying the the server is something you don't want to do in
- production software)
+* Stroking closed, degenerate paths should still draw caps. Round
+ caps are easy; square should probably draw an axis-aligned square.
- - More of a future thing, the ability to hint to to cairo that
- the contents of the Xlib surface passed to
- cairo_xlib_surface_create() are a solid fill ... this is
- very much the normal case for GTK+ usage and allows for
- big optimization in the no-RENDER case.
- (see http://mail.gnome.org/archives/gtk-devel-list/2003-March/msg00045.html
+* Should add geometry pruning as appropriate.
* Verification, profiling, optimization.
diff --git a/aclocal.m4 b/aclocal.m4
index 58ca6c7..681a420 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1262,6 +1262,8 @@ if test -n "$RANLIB"; then
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
fi
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
# Only perform the check for file, if the check method requires it
case $deplibs_check_method in
file_magic*)
@@ -1379,7 +1381,7 @@ fi
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test -z "$ECHO"; then
if test "X${echo_test_string+set}" != Xset; then
@@ -1738,11 +1740,37 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=8192;
;;
- *)
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for *BSD
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ ;;
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ *)
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
- while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
= "XX$teststring") >/dev/null 2>&1 &&
new_result=`expr "X$teststring" : ".*" 2>&1` &&
lt_cv_sys_max_cmd_len=$new_result &&
@@ -2076,8 +2104,8 @@ AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
[AC_MSG_CHECKING([how to hardcode library paths into programs])
_LT_AC_TAGVAR(hardcode_action, $1)=
if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
- test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \
- test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then
+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
# We can hardcode non-existant directories.
if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
@@ -2244,7 +2272,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi[[45]]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2302,7 +2330,7 @@ cygwin* | mingw* | pw32*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
;;
esac
;;
@@ -2360,7 +2388,9 @@ kfreebsd*-gnu)
dynamic_linker='GNU ld.so'
;;
-freebsd*)
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case $version_type in
@@ -2379,7 +2409,7 @@ freebsd*)
freebsd2*)
shlibpath_overrides_runpath=yes
;;
- freebsd3.[01]* | freebsdelf3.[01]*)
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
@@ -2522,7 +2552,7 @@ linux*)
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '`
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
@@ -2585,7 +2615,7 @@ nto-qnx*)
openbsd*)
version_type=sunos
need_lib_prefix=no
- need_version=yes
+ need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
@@ -2751,7 +2781,9 @@ if test -f "$ltmain" && test -n "$tagnames"; then
case $tagname in
CXX)
- if test -n "$CXX" && test "X$CXX" != "Xno"; then
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
AC_LIBTOOL_LANG_CXX_CONFIG
else
tagname=""
@@ -3156,6 +3188,15 @@ case $reload_flag in
*) reload_flag=" $reload_flag" ;;
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
])# AC_PROG_LD_RELOAD_FLAG
@@ -3189,7 +3230,7 @@ beos*)
lt_cv_deplibs_check_method=pass_all
;;
-bsdi4*)
+bsdi[[45]]*)
lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_test_file=/shlib/libc.so
@@ -3212,13 +3253,13 @@ darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
-freebsd* | kfreebsd*-gnu)
+freebsd* | kfreebsd*-gnu | dragonfly*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
@@ -3262,15 +3303,6 @@ irix5* | irix6* | nonstopux*)
# This must be Linux ELF.
linux*)
- case $host_cpu in
- alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
- lt_cv_deplibs_check_method=pass_all ;;
- *)
- # glibc up to 2.1.1 does not perform some relocations on ARM
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
- esac
- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
lt_cv_deplibs_check_method=pass_all
;;
@@ -3293,12 +3325,10 @@ nto-qnx*)
;;
openbsd*)
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
else
- lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
fi
;;
@@ -3488,10 +3518,21 @@ AC_DEFUN([AC_LIBTOOL_CXX],
# ---------------
AC_DEFUN([_LT_AC_LANG_CXX],
[AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([AC_PROG_CXXCPP])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
])# _LT_AC_LANG_CXX
+# _LT_AC_PROG_CXXCPP
+# ---------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
# AC_LIBTOOL_F77
# --------------
@@ -3627,43 +3668,6 @@ aix4* | aix5*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
- ;;
- darwin* | rhapsody*)
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- case "$host_os" in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
- ;;
- esac
- fi
- ;;
- esac
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
;;
esac
AC_MSG_RESULT([$enable_shared])
@@ -3689,7 +3693,7 @@ AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
[AC_LANG_PUSH(C++)
AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([AC_PROG_CXXCPP])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_AC_TAGVAR(allow_undefined_flag, $1)=
@@ -3861,7 +3865,7 @@ case $host_os in
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
if test "$GXX" = yes; then
- case $host_os in aix4.[012]|aix4.[012].*)
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -3882,6 +3886,9 @@ case $host_os in
fi
esac
shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -3941,6 +3948,7 @@ case $host_os in
esac
;;
+
cygwin* | mingw* | pw32*)
# _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
@@ -3964,57 +3972,68 @@ case $host_os in
_LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
+ darwin* | rhapsody*)
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- darwin* | rhapsody*)
- if test "$GXX" = yes; then
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- case "$host_os" in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
- ;;
- esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case "$cc_basename" in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
fi
- ;;
- esac
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
+ ;;
dgux*)
case $cc_basename in
@@ -4033,14 +4052,14 @@ case $host_os in
;;
esac
;;
- freebsd[12]*)
+ freebsd[[12]]*)
# C++ shared libraries reported to be fairly broken before switch to ELF
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
freebsd-elf*)
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
;;
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
# FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
# conventions
_LT_AC_TAGVAR(ld_shlibs, $1)=yes
@@ -4071,7 +4090,7 @@ case $host_os in
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
;;
*)
if test "$GXX" = yes; then
@@ -4220,13 +4239,36 @@ case $host_os in
icpc)
# Intel C++
with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
+ pgCC)
+ # Portland Group C++ compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ ;;
cxx)
# Compaq C++
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
@@ -4279,6 +4321,22 @@ case $host_os in
# Workaround some broken pre-1.5 toolchains
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ openbsd*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ ;;
osf3*)
case $cc_basename in
KCC)
@@ -4449,7 +4507,7 @@ case $host_os in
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
case $host_os in
- solaris2.[0-5] | solaris2.[0-5].*) ;;
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*)
# The C++ compiler is used as linker so we must use $wl
# flag to pass the commands to the underlying system
@@ -4826,7 +4884,7 @@ _LT_AC_TAGVAR(objext, $1)=$objext
lt_simple_compile_test_code="class foo {}\n"
# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
_LT_AC_SYS_COMPILER
@@ -5037,7 +5095,7 @@ Xsed="$SED -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# The names of the tagged configurations supported by this script.
available_tags=
@@ -5068,6 +5126,12 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -5418,9 +5482,6 @@ symcode='[[BCDEGRST]]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \2\3 \3'
-
# Transform an extracted symbol line into a proper C declaration
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
@@ -5442,6 +5503,13 @@ hpux*) # Its linker distinguishes data from code symbols
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
;;
+linux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDGIRSTW]]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
irix* | nonstopux*)
symcode='[[BCDEGRST]]'
;;
@@ -5473,8 +5541,11 @@ esac
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
# Write the raw and C identifiers.
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
@@ -5669,6 +5740,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
esac
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case "$cc_basename" in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
dgux*)
case $cc_basename in
ec++)
@@ -5682,7 +5763,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
esac
;;
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
# FreeBSD uses GNU C++
;;
hpux9* | hpux10* | hpux11*)
@@ -5728,12 +5809,18 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
- icpc)
+ icpc* | ecpc*)
# Intel C++
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
+ pgCC)
+ # Portland Group C++ compiler.
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
cxx)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
@@ -5922,6 +6009,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case "$cc_basename" in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
mingw* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -5957,12 +6054,19 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
;;
linux*)
- case $CC in
+ case $cc_basename in
icc* | ecc*)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
+ pgcc | pgf77 | pgf90)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
ccc*)
_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All Alpha code is PIC.
@@ -6007,6 +6111,11 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
fi
;;
+ unicos*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
uts4*)
_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -6067,7 +6176,7 @@ ifelse([$1],[CXX],[
_LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
;;
cygwin* | mingw*)
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
;;
*)
_LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
@@ -6180,7 +6289,7 @@ EOF
_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_AC_TAGVAR(always_export_symbols, $1)=no
_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -6194,7 +6303,7 @@ EOF
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
else
- ld_shlibs=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
@@ -6238,11 +6347,21 @@ EOF
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds"
+ tmp_addflag=
+ case $CC,$host_cpu in
+ pgf77* | pgf90* ) # Portland Group f77 and f90 compilers
+ tmp_addflag=' -fpic' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
- *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
@@ -6252,9 +6371,9 @@ EOF
_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1)
fi
else
_LT_AC_TAGVAR(ld_shlibs, $1)=no
@@ -6344,7 +6463,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
if test "$GCC" = yes; then
- case $host_os in aix4.[012]|aix4.[012].*)
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -6365,6 +6484,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
fi
esac
shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -6423,7 +6545,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
_LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
- bsdi4*)
+ bsdi[[45]]*)
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
@@ -6444,57 +6566,57 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
_LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
# FIXME: Should let the user specify the lib program.
_LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
- fix_srcfile_path='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
darwin* | rhapsody*)
- if test "$GXX" = yes ; then
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
case "$host_os" in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup'
- ;;
- esac
- fi
- ;;
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
esac
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
_LT_AC_TAGVAR(hardcode_direct, $1)=no
_LT_AC_TAGVAR(hardcode_automatic, $1)=yes
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ case "$cc_basename" in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
fi
;;
@@ -6528,7 +6650,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
@@ -6639,6 +6761,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
else
@@ -6716,7 +6839,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
case $host_os in
solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;;
esac
_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
;;
@@ -6977,7 +7100,7 @@ lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
- test ! -f $lt_ac_sed && break
+ test ! -f $lt_ac_sed && continue
cat /dev/null > conftest.in
lt_ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -7002,8 +7125,8 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
fi
done
done
-SED=$lt_cv_path_SED
])
+SED=$lt_cv_path_SED
AC_MSG_RESULT([$SED])
])
diff --git a/config.h.in b/config.h.in
index 9b8529c..5ac5193 100644
--- a/config.h.in
+++ b/config.h.in
@@ -24,6 +24,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the <sys/int_types.h> header file. */
+#undef HAVE_SYS_INT_TYPES_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
diff --git a/config.sub b/config.sub
index 7cee3d6..6b2ff9f 100755
--- a/config.sub
+++ b/config.sub
@@ -260,7 +260,7 @@ case $basic_machine in
| s390 | s390x \
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
@@ -334,7 +334,7 @@ case $basic_machine in
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
@@ -1051,7 +1051,7 @@ case $basic_machine in
sh64)
basic_machine=sh64-unknown
;;
- sparc | sparcv9 | sparcv9b)
+ sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
diff --git a/configure b/configure
index 67078d4..8b8d7a1 100755
--- a/configure
+++ b/configure
@@ -278,7 +278,7 @@ fi
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test -z "$ECHO"; then
if test "X${echo_test_string+set}" != Xset; then
@@ -463,7 +463,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG XRENDER_CFLAGS XRENDER_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS CAIRO_HAS_XLIB_SURFACE_TRUE CAIRO_HAS_XLIB_SURFACE_FALSE XLIB_SURFACE_FEATURE XRENDER_REQUIRES CAIRO_HAS_QUARTZ_SURFACE_TRUE CAIRO_HAS_QUARTZ_SURFACE_FALSE QUARTZ_SURFACE_FEATURE XCB_CFLAGS XCB_LIBS CAIRO_HAS_XCB_SURFACE_TRUE CAIRO_HAS_XCB_SURFACE_FALSE XCB_SURFACE_FEATURE CAIRO_HAS_WIN32_SURFACE_TRUE CAIRO_HAS_WIN32_SURFACE_FALSE CAIRO_HAS_WIN32_FONT_TRUE CAIRO_HAS_WIN32_FONT_FALSE WIN32_SURFACE_FEATURE WIN32_FONT_FEATURE CAIRO_HAS_PS_SURFACE_TRUE CAIRO_HAS_PS_SURFACE_FALSE PS_SURFACE_FEATURE PS_LIBS PNG_CFLAGS PNG_LIBS CAIRO_HAS_PNG_SURFACE_TRUE CAIRO_HAS_PNG_SURFACE_FALSE PNG_SURFACE_FEATURE PNG_REQUIRES GLITZ_CFLAGS GLITZ_LIBS CAIRO_HAS_GLITZ_SURFACE_TRUE CAIRO_HAS_GLITZ_SURFACE_FALSE GLITZ_SURFACE_FEATURE GLITZ_REQUIRES SANITY_CHECKING_FEATURE PIXMAN_CFLAGS PIXMAN_LIBS FONTCONFIG_CFLAGS FONTCONFIG_LIBS FREETYPE_CONFIG FREETYPE_CFLAGS FREETYPE_LIBS FREETYPE_REQUIRES CAIRO_HAS_FT_FONT_TRUE CAIRO_HAS_FT_FONT_FALSE FT_FONT_FEATURE CAIRO_HAS_PDF_SURFACE_TRUE CAIRO_HAS_PDF_SURFACE_FALSE PDF_SURFACE_FEATURE PDF_LIBS CAIRO_HAS_ATSUI_FONT_TRUE CAIRO_HAS_ATSUI_FONT_FALSE ATSUI_FONT_FEATURE CAIRO_CFLAGS CAIRO_LIBS HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG XRENDER_CFLAGS XRENDER_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS CAIRO_HAS_XLIB_SURFACE_TRUE CAIRO_HAS_XLIB_SURFACE_FALSE XLIB_SURFACE_FEATURE XRENDER_REQUIRES CAIRO_HAS_QUARTZ_SURFACE_TRUE CAIRO_HAS_QUARTZ_SURFACE_FALSE QUARTZ_SURFACE_FEATURE XCB_CFLAGS XCB_LIBS CAIRO_HAS_XCB_SURFACE_TRUE CAIRO_HAS_XCB_SURFACE_FALSE XCB_SURFACE_FEATURE CAIRO_HAS_WIN32_SURFACE_TRUE CAIRO_HAS_WIN32_SURFACE_FALSE WIN32_SURFACE_FEATURE CAIRO_HAS_WIN32_FONT_TRUE CAIRO_HAS_WIN32_FONT_FALSE WIN32_FONT_FEATURE CAIRO_HAS_PS_SURFACE_TRUE CAIRO_HAS_PS_SURFACE_FALSE PS_SURFACE_FEATURE PS_LIBS PNG_CFLAGS PNG_LIBS CAIRO_HAS_PNG_FUNCTIONS_TRUE CAIRO_HAS_PNG_FUNCTIONS_FALSE PNG_FUNCTIONS_FEATURE PNG_REQUIRES GLITZ_CFLAGS GLITZ_LIBS CAIRO_HAS_GLITZ_SURFACE_TRUE CAIRO_HAS_GLITZ_SURFACE_FALSE GLITZ_SURFACE_FEATURE GLITZ_REQUIRES PIXMAN_CFLAGS PIXMAN_LIBS FONTCONFIG_CFLAGS FONTCONFIG_LIBS FREETYPE_CONFIG FREETYPE_CFLAGS FREETYPE_LIBS FREETYPE_REQUIRES CAIRO_HAS_FT_FONT_TRUE CAIRO_HAS_FT_FONT_FALSE FT_FONT_FEATURE CAIRO_HAS_PDF_SURFACE_TRUE CAIRO_HAS_PDF_SURFACE_FALSE PDF_SURFACE_FEATURE PDF_LIBS CAIRO_HAS_ATSUI_FONT_TRUE CAIRO_HAS_ATSUI_FONT_FALSE ATSUI_FONT_FEATURE CAIRO_CFLAGS CAIRO_LIBS HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1043,9 +1043,8 @@ Optional Features:
--disable-xcb Disable cairo's XCB backend
--disable-win32 Disable cairo's Microsoft Windows backend
--disable-ps Disable cairo's PostScript backend
- --disable-png Disable cairo's PNG backend
+ --disable-png Disable cairo's PNG functions
--disable-glitz Disable cairo's glitz backend
- --disable-sanity Disable cairo's sanity checking routines
--disable-freetype Disable cairo's freetype font backend
--disable-pdf Disable cairo's PDF backend
--disable-atsui Disable cairo's atsui font backend
@@ -1517,7 +1516,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Package version number, (as distinct from shared library version)
-CAIRO_VERSION=0.4.0
+CAIRO_VERSION=0.5.1
# libtool shared library version
@@ -3491,7 +3490,7 @@ lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
- test ! -f $lt_ac_sed && break
+ test ! -f $lt_ac_sed && continue
cat /dev/null > conftest.in
lt_ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -3516,10 +3515,10 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
fi
done
done
-SED=$lt_cv_path_SED
fi
+SED=$lt_cv_path_SED
echo "$as_me:$LINENO: result: $SED" >&5
echo "${ECHO_T}$SED" >&6
@@ -3660,6 +3659,15 @@ case $reload_flag in
*) reload_flag=" $reload_flag" ;;
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
@@ -3746,7 +3754,7 @@ beos*)
lt_cv_deplibs_check_method=pass_all
;;
-bsdi4*)
+bsdi[45]*)
lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
lt_cv_file_magic_cmd='/usr/bin/file -L'
lt_cv_file_magic_test_file=/shlib/libc.so
@@ -3769,13 +3777,13 @@ darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
-freebsd* | kfreebsd*-gnu)
+freebsd* | kfreebsd*-gnu | dragonfly*)
if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
# Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
lt_cv_file_magic_cmd=/usr/bin/file
lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
;;
@@ -3819,15 +3827,6 @@ irix5* | irix6* | nonstopux*)
# This must be Linux ELF.
linux*)
- case $host_cpu in
- alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
- lt_cv_deplibs_check_method=pass_all ;;
- *)
- # glibc up to 2.1.1 does not perform some relocations on ARM
- # this will be overridden with pass_all, but let us keep it just in case
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
- esac
- lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
lt_cv_deplibs_check_method=pass_all
;;
@@ -3850,12 +3849,10 @@ nto-qnx*)
;;
openbsd*)
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
else
- lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
fi
;;
@@ -3948,7 +3945,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3951 "configure"' > conftest.$ac_ext
+ echo '#line 3948 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -4963,7 +4960,12 @@ else
fi
-ac_ext=cc
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -5193,6 +5195,8 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+fi
+
ac_ext=f
ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
@@ -5286,7 +5290,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:5289:" \
+echo "$as_me:5293:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -5476,11 +5480,37 @@ else
lt_cv_sys_max_cmd_len=8192;
;;
- *)
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for *BSD
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ ;;
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ *)
# If test is not a shell built-in, we'll probably end up computing a
# maximum length that is only half of the actual maximum length, but
# we can't tell.
- while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
= "XX$teststring") >/dev/null 2>&1 &&
new_result=`expr "X$teststring" : ".*" 2>&1` &&
lt_cv_sys_max_cmd_len=$new_result &&
@@ -5526,9 +5556,6 @@ symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \2\3 \3'
-
# Transform an extracted symbol line into a proper C declaration
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
@@ -5550,6 +5577,13 @@ hpux*) # Its linker distinguishes data from code symbols
lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
;;
+linux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDGIRSTW]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
+ ;;
irix* | nonstopux*)
symcode='[BCDEGRST]'
;;
@@ -5581,8 +5615,11 @@ esac
# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
# Write the raw and C identifiers.
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
@@ -6049,6 +6086,8 @@ if test -n "$RANLIB"; then
old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
fi
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+
# Only perform the check for file, if the check method requires it
case $deplibs_check_method in
file_magic*)
@@ -6320,11 +6359,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6323: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6362: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6327: \$? = $ac_status" >&5
+ echo "$as_me:6366: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -6431,6 +6470,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
fi
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case "$cc_basename" in
+ xlc*)
+ lt_prog_compiler_pic='-qnocommon'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
mingw* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -6466,12 +6515,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
;;
linux*)
- case $CC in
+ case $cc_basename in
icc* | ecc*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-static'
;;
+ pgcc | pgf77 | pgf90)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-static'
+ ;;
ccc*)
lt_prog_compiler_wl='-Wl,'
# All Alpha code is PIC.
@@ -6516,6 +6572,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
fi
;;
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
uts4*)
lt_prog_compiler_pic='-pic'
lt_prog_compiler_static='-Bstatic'
@@ -6553,11 +6614,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6556: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6617: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6560: \$? = $ac_status" >&5
+ echo "$as_me:6621: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -6613,11 +6674,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6616: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6677: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6620: \$? = $ac_status" >&5
+ echo "$as_me:6681: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -6772,7 +6833,7 @@ EOF
allow_undefined_flag=unsupported
always_export_symbols=no
enable_shared_with_static_runtimes=yes
- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -6830,11 +6891,21 @@ EOF
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_cmds="$tmp_archive_cmds"
+ tmp_addflag=
+ case $CC,$host_cpu in
+ pgf77* | pgf90* ) # Portland Group f77 and f90 compilers
+ tmp_addflag=' -fpic' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
- *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
@@ -6844,9 +6915,9 @@ EOF
archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
- archive_expsym_cmds="$tmp_archive_cmds"
+ archive_expsym_cmds=$archive_cmds
fi
else
ld_shlibs=no
@@ -6936,7 +7007,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
link_all_deplibs=yes
if test "$GCC" = yes; then
- case $host_os in aix4.012|aix4.012.*)
+ case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -6957,6 +7028,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
fi
esac
shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -7117,7 +7191,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
ld_shlibs=no
;;
- bsdi4*)
+ bsdi[45]*)
export_dynamic_flag_spec=-rdynamic
;;
@@ -7143,52 +7217,52 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
darwin* | rhapsody*)
- if test "$GXX" = yes ; then
- archive_cmds_need_lc=no
case "$host_os" in
- rhapsody* | darwin1.[012])
- allow_undefined_flag='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- allow_undefined_flag='-flat_namespace -undefined suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[012])
- allow_undefined_flag='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- allow_undefined_flag='-undefined dynamic_lookup'
- ;;
- esac
- fi
- ;;
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
esac
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ archive_cmds_need_lc=no
hardcode_direct=no
hardcode_automatic=yes
hardcode_shlibpath_var=unsupported
- whole_archive_flag_spec='-all_load $convenience'
+ whole_archive_flag_spec=''
link_all_deplibs=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
- ld_shlibs=no
+ case "$cc_basename" in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
fi
;;
@@ -7222,7 +7296,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
@@ -7333,6 +7407,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_shlibpath_var=no
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
export_dynamic_flag_spec='${wl}-E'
else
@@ -7410,7 +7485,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
case $host_os in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
- whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;;
esac
link_all_deplibs=yes
;;
@@ -7684,7 +7759,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi[45]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -7742,7 +7817,7 @@ cygwin* | mingw* | pw32*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
esac
;;
@@ -7800,7 +7875,9 @@ kfreebsd*-gnu)
dynamic_linker='GNU ld.so'
;;
-freebsd*)
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case $version_type in
@@ -7819,7 +7896,7 @@ freebsd*)
freebsd2*)
shlibpath_overrides_runpath=yes
;;
- freebsd3.01* | freebsdelf3.01*)
+ freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
@@ -7947,7 +8024,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 7950 "configure"' > conftest.$ac_ext
+ echo '#line 8027 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7966,7 +8043,7 @@ linux*)
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
@@ -8029,7 +8106,7 @@ nto-qnx*)
openbsd*)
version_type=sunos
need_lib_prefix=no
- need_version=yes
+ need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
@@ -8151,8 +8228,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" || \
- test -n "$runpath_var " || \
- test "X$hardcode_automatic"="Xyes" ; then
+ test -n "$runpath_var" || \
+ test "X$hardcode_automatic" = "Xyes" ; then
# We can hardcode non-existant directories.
if test "$hardcode_direct" != no &&
@@ -8818,7 +8895,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8821 "configure"
+#line 8898 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8916,7 +8993,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8919 "configure"
+#line 8996 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9045,43 +9122,6 @@ aix4* | aix5*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
- ;;
- darwin* | rhapsody*)
- if test "$GCC" = yes; then
- archive_cmds_need_lc=no
- case "$host_os" in
- rhapsody* | darwin1.[012])
- allow_undefined_flag='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- allow_undefined_flag='-flat_namespace -undefined suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[012])
- allow_undefined_flag='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- allow_undefined_flag='-undefined dynamic_lookup'
- ;;
- esac
- fi
- ;;
- esac
- output_verbose_link_cmd='echo'
- archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
- module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- hardcode_direct=no
- hardcode_automatic=yes
- hardcode_shlibpath_var=unsupported
- whole_archive_flag_spec='-all_load $convenience'
- link_all_deplibs=yes
- else
- ld_shlibs=no
- fi
;;
esac
echo "$as_me:$LINENO: result: $enable_shared" >&5
@@ -9226,7 +9266,7 @@ Xsed="$SED -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# The names of the tagged configurations supported by this script.
available_tags=
@@ -9256,6 +9296,12 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -9627,7 +9673,9 @@ echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
case $tagname in
CXX)
- if test -n "$CXX" && test "X$CXX" != "Xno"; then
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -9920,7 +9968,7 @@ case $host_os in
link_all_deplibs_CXX=yes
if test "$GXX" = yes; then
- case $host_os in aix4.012|aix4.012.*)
+ case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -9941,6 +9989,9 @@ case $host_os in
fi
esac
shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -10102,6 +10153,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
esac
;;
+
cygwin* | mingw* | pw32*)
# _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
# as there is no search path for DLLs.
@@ -10125,57 +10177,68 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
ld_shlibs_CXX=no
fi
;;
+ darwin* | rhapsody*)
+ case "$host_os" in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ whole_archive_flag_spec_CXX=''
+ link_all_deplibs_CXX=yes
- darwin* | rhapsody*)
- if test "$GXX" = yes; then
- archive_cmds_need_lc_CXX=no
- case "$host_os" in
- rhapsody* | darwin1.[012])
- allow_undefined_flag_CXX='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[012])
- allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- allow_undefined_flag_CXX='-undefined dynamic_lookup'
- ;;
- esac
+ archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ fi
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case "$cc_basename" in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_CXX=no
+ ;;
+ esac
fi
- ;;
- esac
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- hardcode_direct_CXX=no
- hardcode_automatic_CXX=yes
- hardcode_shlibpath_var_CXX=unsupported
- whole_archive_flag_spec_CXX='-all_load $convenience'
- link_all_deplibs_CXX=yes
- else
- ld_shlibs_CXX=no
- fi
- ;;
+ ;;
dgux*)
case $cc_basename in
@@ -10194,14 +10257,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
esac
;;
- freebsd12*)
+ freebsd[12]*)
# C++ shared libraries reported to be fairly broken before switch to ELF
ld_shlibs_CXX=no
;;
freebsd-elf*)
archive_cmds_need_lc_CXX=no
;;
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
# FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
# conventions
ld_shlibs_CXX=yes
@@ -10232,7 +10295,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
;;
*)
if test "$GXX" = yes; then
@@ -10381,13 +10444,36 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
icpc)
# Intel C++
with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
archive_cmds_need_lc_CXX=no
- archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
+ pgCC)
+ # Portland Group C++ compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ ;;
cxx)
# Compaq C++
archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
@@ -10440,6 +10526,22 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
# Workaround some broken pre-1.5 toolchains
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+ openbsd*)
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ ;;
osf3*)
case $cc_basename in
KCC)
@@ -10610,7 +10712,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_libdir_flag_spec_CXX='-R$libdir'
hardcode_shlibpath_var_CXX=no
case $host_os in
- solaris2.0-5 | solaris2.0-5.*) ;;
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
*)
# The C++ compiler is used as linker so we must use $wl
# flag to pass the commands to the underlying system
@@ -10895,6 +10997,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
;;
esac
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case "$cc_basename" in
+ xlc*)
+ lt_prog_compiler_pic_CXX='-qnocommon'
+ lt_prog_compiler_wl_CXX='-Wl,'
+ ;;
+ esac
+ ;;
dgux*)
case $cc_basename in
ec++)
@@ -10908,7 +11020,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
;;
esac
;;
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
# FreeBSD uses GNU C++
;;
hpux9* | hpux10* | hpux11*)
@@ -10954,12 +11066,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
lt_prog_compiler_wl_CXX='--backend -Wl,'
lt_prog_compiler_pic_CXX='-fPIC'
;;
- icpc)
+ icpc* | ecpc*)
# Intel C++
lt_prog_compiler_wl_CXX='-Wl,'
lt_prog_compiler_pic_CXX='-KPIC'
lt_prog_compiler_static_CXX='-static'
;;
+ pgCC)
+ # Portland Group C++ compiler.
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-fpic'
+ lt_prog_compiler_static_CXX='-static'
+ ;;
cxx)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
@@ -11095,11 +11213,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11098: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11216: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11102: \$? = $ac_status" >&5
+ echo "$as_me:11220: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -11155,11 +11273,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11158: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11276: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11162: \$? = $ac_status" >&5
+ echo "$as_me:11280: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -11223,7 +11341,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
export_symbols_cmds_CXX="$ltdll_cmds"
;;
cygwin* | mingw*)
- export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
;;
*)
export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
@@ -11403,7 +11521,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi[45]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11461,7 +11579,7 @@ cygwin* | mingw* | pw32*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
esac
;;
@@ -11519,7 +11637,9 @@ kfreebsd*-gnu)
dynamic_linker='GNU ld.so'
;;
-freebsd*)
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case $version_type in
@@ -11538,7 +11658,7 @@ freebsd*)
freebsd2*)
shlibpath_overrides_runpath=yes
;;
- freebsd3.01* | freebsdelf3.01*)
+ freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
@@ -11666,7 +11786,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 11669 "configure"' > conftest.$ac_ext
+ echo '#line 11789 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -11685,7 +11805,7 @@ linux*)
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
@@ -11748,7 +11868,7 @@ nto-qnx*)
openbsd*)
version_type=sunos
need_lib_prefix=no
- need_version=yes
+ need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
@@ -11870,8 +11990,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
hardcode_action_CXX=
if test -n "$hardcode_libdir_flag_spec_CXX" || \
- test -n "$runpath_var CXX" || \
- test "X$hardcode_automatic_CXX"="Xyes" ; then
+ test -n "$runpath_var_CXX" || \
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
# We can hardcode non-existant directories.
if test "$hardcode_direct_CXX" != no &&
@@ -12537,7 +12657,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12540 "configure"
+#line 12660 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12635,7 +12755,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 12638 "configure"
+#line 12758 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12853,6 +12973,12 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -13340,6 +13466,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
fi
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case "$cc_basename" in
+ xlc*)
+ lt_prog_compiler_pic_F77='-qnocommon'
+ lt_prog_compiler_wl_F77='-Wl,'
+ ;;
+ esac
+ ;;
mingw* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -13375,12 +13511,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
;;
linux*)
- case $CC in
+ case $cc_basename in
icc* | ecc*)
lt_prog_compiler_wl_F77='-Wl,'
lt_prog_compiler_pic_F77='-KPIC'
lt_prog_compiler_static_F77='-static'
;;
+ pgcc | pgf77 | pgf90)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-fpic'
+ lt_prog_compiler_static_F77='-static'
+ ;;
ccc*)
lt_prog_compiler_wl_F77='-Wl,'
# All Alpha code is PIC.
@@ -13425,6 +13568,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
fi
;;
+ unicos*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_can_build_shared_F77=no
+ ;;
+
uts4*)
lt_prog_compiler_pic_F77='-pic'
lt_prog_compiler_static_F77='-Bstatic'
@@ -13462,11 +13610,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13465: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13613: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13469: \$? = $ac_status" >&5
+ echo "$as_me:13617: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -13522,11 +13670,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13525: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13673: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13529: \$? = $ac_status" >&5
+ echo "$as_me:13677: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -13681,7 +13829,7 @@ EOF
allow_undefined_flag_F77=unsupported
always_export_symbols_F77=no
enable_shared_with_static_runtimes_F77=yes
- export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -13695,7 +13843,7 @@ EOF
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
else
- ld_shlibs=no
+ ld_shlibs_F77=no
fi
;;
@@ -13739,11 +13887,21 @@ EOF
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_cmds_F77="$tmp_archive_cmds"
+ tmp_addflag=
+ case $CC,$host_cpu in
+ pgf77* | pgf90* ) # Portland Group f77 and f90 compilers
+ tmp_addflag=' -fpic' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
- *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
@@ -13753,9 +13911,9 @@ EOF
archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
- archive_expsym_cmds_F77="$tmp_archive_cmds"
+ archive_expsym_cmds_F77=$archive_cmds_F77
fi
else
ld_shlibs_F77=no
@@ -13845,7 +14003,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
link_all_deplibs_F77=yes
if test "$GCC" = yes; then
- case $host_os in aix4.012|aix4.012.*)
+ case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -13866,6 +14024,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
fi
esac
shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -14006,7 +14167,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
ld_shlibs_F77=no
;;
- bsdi4*)
+ bsdi[45]*)
export_dynamic_flag_spec_F77=-rdynamic
;;
@@ -14027,57 +14188,57 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
old_archive_From_new_cmds_F77='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
- fix_srcfile_path='`cygpath -w "$srcfile"`'
+ fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
enable_shared_with_static_runtimes_F77=yes
;;
darwin* | rhapsody*)
- if test "$GXX" = yes ; then
- archive_cmds_need_lc_F77=no
case "$host_os" in
- rhapsody* | darwin1.[012])
- allow_undefined_flag_F77='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- allow_undefined_flag_F77='-flat_namespace -undefined suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[012])
- allow_undefined_flag_F77='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- allow_undefined_flag_F77='-undefined dynamic_lookup'
- ;;
- esac
- fi
- ;;
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
esac
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ archive_cmds_need_lc_F77=no
hardcode_direct_F77=no
hardcode_automatic_F77=yes
hardcode_shlibpath_var_F77=unsupported
- whole_archive_flag_spec_F77='-all_load $convenience'
+ whole_archive_flag_spec_F77=''
link_all_deplibs_F77=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
- ld_shlibs_F77=no
+ case "$cc_basename" in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_F77=no
+ ;;
+ esac
fi
;;
@@ -14111,7 +14272,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec_F77='-R$libdir'
hardcode_direct_F77=yes
@@ -14222,6 +14383,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_shlibpath_var_F77=no
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
export_dynamic_flag_spec_F77='${wl}-E'
else
@@ -14299,7 +14461,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
case $host_os in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
- whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+ whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;;
esac
link_all_deplibs_F77=yes
;;
@@ -14573,7 +14735,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi[45]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14631,7 +14793,7 @@ cygwin* | mingw* | pw32*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
esac
;;
@@ -14689,7 +14851,9 @@ kfreebsd*-gnu)
dynamic_linker='GNU ld.so'
;;
-freebsd*)
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case $version_type in
@@ -14708,7 +14872,7 @@ freebsd*)
freebsd2*)
shlibpath_overrides_runpath=yes
;;
- freebsd3.01* | freebsdelf3.01*)
+ freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
@@ -14836,7 +15000,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 14839 "configure"' > conftest.$ac_ext
+ echo '#line 15003 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -14855,7 +15019,7 @@ linux*)
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
@@ -14918,7 +15082,7 @@ nto-qnx*)
openbsd*)
version_type=sunos
need_lib_prefix=no
- need_version=yes
+ need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
@@ -15040,8 +15204,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
hardcode_action_F77=
if test -n "$hardcode_libdir_flag_spec_F77" || \
- test -n "$runpath_var F77" || \
- test "X$hardcode_automatic_F77"="Xyes" ; then
+ test -n "$runpath_var_F77" || \
+ test "X$hardcode_automatic_F77" = "Xyes" ; then
# We can hardcode non-existant directories.
if test "$hardcode_direct_F77" != no &&
@@ -15218,6 +15382,12 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -15532,7 +15702,7 @@ objext_GCJ=$objext
lt_simple_compile_test_code="class foo {}\n"
# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
# ltmain only uses $CC for tagged configurations so make sure $CC is set.
@@ -15577,11 +15747,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15580: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15750: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15584: \$? = $ac_status" >&5
+ echo "$as_me:15754: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15688,6 +15858,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
fi
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case "$cc_basename" in
+ xlc*)
+ lt_prog_compiler_pic_GCJ='-qnocommon'
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ ;;
+ esac
+ ;;
mingw* | pw32* | os2*)
# This hack is so that the source file can tell whether it is being
@@ -15723,12 +15903,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
;;
linux*)
- case $CC in
+ case $cc_basename in
icc* | ecc*)
lt_prog_compiler_wl_GCJ='-Wl,'
lt_prog_compiler_pic_GCJ='-KPIC'
lt_prog_compiler_static_GCJ='-static'
;;
+ pgcc | pgf77 | pgf90)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-fpic'
+ lt_prog_compiler_static_GCJ='-static'
+ ;;
ccc*)
lt_prog_compiler_wl_GCJ='-Wl,'
# All Alpha code is PIC.
@@ -15773,6 +15960,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
fi
;;
+ unicos*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_can_build_shared_GCJ=no
+ ;;
+
uts4*)
lt_prog_compiler_pic_GCJ='-pic'
lt_prog_compiler_static_GCJ='-Bstatic'
@@ -15810,11 +16002,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15813: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16005: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15817: \$? = $ac_status" >&5
+ echo "$as_me:16009: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -15870,11 +16062,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15873: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16065: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:15877: \$? = $ac_status" >&5
+ echo "$as_me:16069: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16029,7 +16221,7 @@ EOF
allow_undefined_flag_GCJ=unsupported
always_export_symbols_GCJ=no
enable_shared_with_static_runtimes_GCJ=yes
- export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -16043,7 +16235,7 @@ EOF
fi~
$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
else
- ld_shlibs=no
+ ld_shlibs_GCJ=no
fi
;;
@@ -16087,11 +16279,21 @@ EOF
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_cmds_GCJ="$tmp_archive_cmds"
+ tmp_addflag=
+ case $CC,$host_cpu in
+ pgf77* | pgf90* ) # Portland Group f77 and f90 compilers
+ tmp_addflag=' -fpic' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ esac
+ archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
supports_anon_versioning=no
case `$LD -v 2>/dev/null` in
- *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
*\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
*\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
*\ 2.11.*) ;; # other 2.11 versions
@@ -16101,9 +16303,9 @@ EOF
archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
$echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
else
- archive_expsym_cmds_GCJ="$tmp_archive_cmds"
+ archive_expsym_cmds_GCJ=$archive_cmds_GCJ
fi
else
ld_shlibs_GCJ=no
@@ -16193,7 +16395,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
link_all_deplibs_GCJ=yes
if test "$GCC" = yes; then
- case $host_os in aix4.012|aix4.012.*)
+ case $host_os in aix4.[012]|aix4.[012].*)
# We only want to do this on AIX 4.2 and lower, the check
# below for broken collect2 doesn't work under 4.3+
collect2name=`${CC} -print-prog-name=collect2`
@@ -16214,6 +16416,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~
fi
esac
shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
else
# not using gcc
if test "$host_cpu" = ia64; then
@@ -16374,7 +16579,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
ld_shlibs_GCJ=no
;;
- bsdi4*)
+ bsdi[45]*)
export_dynamic_flag_spec_GCJ=-rdynamic
;;
@@ -16395,57 +16600,57 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
old_archive_From_new_cmds_GCJ='true'
# FIXME: Should let the user specify the lib program.
old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
- fix_srcfile_path='`cygpath -w "$srcfile"`'
+ fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
enable_shared_with_static_runtimes_GCJ=yes
;;
darwin* | rhapsody*)
- if test "$GXX" = yes ; then
- archive_cmds_need_lc_GCJ=no
case "$host_os" in
- rhapsody* | darwin1.[012])
- allow_undefined_flag_GCJ='-undefined suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[012])
- allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
- ;;
- 10.*)
- allow_undefined_flag_GCJ='-undefined dynamic_lookup'
- ;;
- esac
- fi
- ;;
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
esac
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ archive_cmds_need_lc_GCJ=no
hardcode_direct_GCJ=no
hardcode_automatic_GCJ=yes
hardcode_shlibpath_var_GCJ=unsupported
- whole_archive_flag_spec_GCJ='-all_load $convenience'
+ whole_archive_flag_spec_GCJ=''
link_all_deplibs_GCJ=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
else
- ld_shlibs_GCJ=no
+ case "$cc_basename" in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
fi
;;
@@ -16479,7 +16684,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd* | kfreebsd*-gnu)
+ freebsd* | kfreebsd*-gnu | dragonfly*)
archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec_GCJ='-R$libdir'
hardcode_direct_GCJ=yes
@@ -16590,6 +16795,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_shlibpath_var_GCJ=no
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
export_dynamic_flag_spec_GCJ='${wl}-E'
else
@@ -16667,7 +16873,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
case $host_os in
solaris2.[0-5] | solaris2.[0-5].*) ;;
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
- whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+ whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;;
esac
link_all_deplibs_GCJ=yes
;;
@@ -16941,7 +17147,7 @@ beos*)
shlibpath_var=LIBRARY_PATH
;;
-bsdi4*)
+bsdi[45]*)
version_type=linux
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -16999,7 +17205,7 @@ cygwin* | mingw* | pw32*)
;;
pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
;;
esac
;;
@@ -17057,7 +17263,9 @@ kfreebsd*-gnu)
dynamic_linker='GNU ld.so'
;;
-freebsd*)
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
version_type=freebsd-$objformat
case $version_type in
@@ -17076,7 +17284,7 @@ freebsd*)
freebsd2*)
shlibpath_overrides_runpath=yes
;;
- freebsd3.01* | freebsdelf3.01*)
+ freebsd3.[01]* | freebsdelf3.[01]*)
shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
;;
@@ -17204,7 +17412,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 17207 "configure"' > conftest.$ac_ext
+ echo '#line 17415 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -17223,7 +17431,7 @@ linux*)
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
@@ -17286,7 +17494,7 @@ nto-qnx*)
openbsd*)
version_type=sunos
need_lib_prefix=no
- need_version=yes
+ need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
shlibpath_var=LD_LIBRARY_PATH
@@ -17408,8 +17616,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
hardcode_action_GCJ=
if test -n "$hardcode_libdir_flag_spec_GCJ" || \
- test -n "$runpath_var GCJ" || \
- test "X$hardcode_automatic_GCJ"="Xyes" ; then
+ test -n "$runpath_var_GCJ" || \
+ test "X$hardcode_automatic_GCJ" = "Xyes" ; then
# We can hardcode non-existant directories.
if test "$hardcode_direct_GCJ" != no &&
@@ -18075,7 +18283,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18078 "configure"
+#line 18286 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18173,7 +18381,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 18176 "configure"
+#line 18384 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18391,6 +18599,12 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -18836,6 +19050,12 @@ fast_install=$enable_fast_install
# The host system.
host_alias=$host_alias
host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
# An echo program that does not interpret backslashes.
echo=$lt_echo
@@ -21645,7 +21865,7 @@ fi
use_xlib=yes
else
- use_xlib="no (requires Xrender http://freedesktop.org/software/xlibs)"
+ use_xlib="no (requires Xrender http://freedesktop.org/Software/xlibs)"
fi
@@ -21653,23 +21873,9 @@ fi
fi
-if test "x$use_xlib" != "xyes"; then
- XLIB_SURFACE_FEATURE=CAIRO_HAS_NO_XLIB_SURFACE
-
-
-if false; then
- CAIRO_HAS_XLIB_SURFACE_TRUE=
- CAIRO_HAS_XLIB_SURFACE_FALSE='#'
-else
- CAIRO_HAS_XLIB_SURFACE_TRUE='#'
- CAIRO_HAS_XLIB_SURFACE_FALSE=
-fi
-
-else
- XLIB_SURFACE_FEATURE=CAIRO_HAS_XLIB_SURFACE
-if true; then
+if test "x$use_xlib" = "xyes"; then
CAIRO_HAS_XLIB_SURFACE_TRUE=
CAIRO_HAS_XLIB_SURFACE_FALSE='#'
else
@@ -21677,6 +21883,8 @@ else
CAIRO_HAS_XLIB_SURFACE_FALSE=
fi
+if test "x$use_xlib" = "xyes"; then
+ XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
fi
@@ -21690,7 +21898,7 @@ if test "${enable_quartz+set}" = set; then
enableval="$enable_quartz"
use_quartz=$enableval
else
- use_quartz="no (temporarily disabled while code is out of sync)"
+ use_quartz=yes
fi;
if test "x$use_quartz" = "xyes"; then
@@ -21840,11 +22048,9 @@ fi
fi
-if test "x$use_quartz" != "xyes"; then
- QUARTZ_SURFACE_FEATURE=CAIRO_HAS_NO_QUARTZ_SURFACE
-if false; then
+if test "x$use_quartz" = "xyes"; then
CAIRO_HAS_QUARTZ_SURFACE_TRUE=
CAIRO_HAS_QUARTZ_SURFACE_FALSE='#'
else
@@ -21852,22 +22058,11 @@ else
CAIRO_HAS_QUARTZ_SURFACE_FALSE=
fi
-else
- QUARTZ_SURFACE_FEATURE=CAIRO_HAS_QUARTZ_SURFACE
+if test "x$use_quartz" = "xyes"; then
+ QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
-
-
-if true; then
- CAIRO_HAS_QUARTZ_SURFACE_TRUE=
- CAIRO_HAS_QUARTZ_SURFACE_FALSE='#'
-else
- CAIRO_HAS_QUARTZ_SURFACE_TRUE='#'
- CAIRO_HAS_QUARTZ_SURFACE_FALSE=
fi
-fi
-
-
CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
@@ -21974,16 +22169,14 @@ echo "${ECHO_T}$XCB_LIBS" >&6
use_xcb=yes
else
- use_xcb="no (requires XCB http://freedesktop.org/software/xcb)"
+ use_xcb="no (requires XCB http://xcb.freedesktop.org)"
fi
fi
-if test "x$use_xcb" != "xyes"; then
- XCB_SURFACE_FEATURE=CAIRO_HAS_NO_XCB_SURFACE
-if false; then
+if test "x$use_xcb" = "xyes"; then
CAIRO_HAS_XCB_SURFACE_TRUE=
CAIRO_HAS_XCB_SURFACE_FALSE='#'
else
@@ -21991,26 +22184,16 @@ else
CAIRO_HAS_XCB_SURFACE_FALSE=
fi
-else
- XCB_SURFACE_FEATURE=CAIRO_HAS_XCB_SURFACE
-
-
-if true; then
- CAIRO_HAS_XCB_SURFACE_TRUE=
- CAIRO_HAS_XCB_SURFACE_FALSE='#'
-else
- CAIRO_HAS_XCB_SURFACE_TRUE='#'
- CAIRO_HAS_XCB_SURFACE_FALSE=
+if test "x$use_xcb" = "xyes"; then
+ XCB_SURFACE_FEATURE="#define CAIRO_HAS_XCB_SURFACE 1"
fi
-fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"
-
echo "$as_me:$LINENO: checking for some Win32 platform" >&5
echo $ECHO_N "checking for some Win32 platform... $ECHO_C" >&6
case "$host" in
@@ -22040,23 +22223,9 @@ if test "x$use_win32" = "xyes"; then
CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
fi
-if test "x$use_win32" != "xyes"; then
- WIN32_SURFACE_FEATURE=CAIRO_HAS_NO_WIN32_SURFACE
-
-
-if false; then
- CAIRO_HAS_WIN32_SURFACE_TRUE=
- CAIRO_HAS_WIN32_SURFACE_FALSE='#'
-else
- CAIRO_HAS_WIN32_SURFACE_TRUE='#'
- CAIRO_HAS_WIN32_SURFACE_FALSE=
-fi
-
-else
- WIN32_SURFACE_FEATURE=CAIRO_HAS_WIN32_SURFACE
-if true; then
+if test "x$use_win32" = "xyes"; then
CAIRO_HAS_WIN32_SURFACE_TRUE=
CAIRO_HAS_WIN32_SURFACE_FALSE='#'
else
@@ -22064,25 +22233,14 @@ else
CAIRO_HAS_WIN32_SURFACE_FALSE=
fi
+if test "x$use_win32" = "xyes"; then
+ WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
fi
-if test "x$use_win32" != "xyes"; then
- WIN32_FONT_FEATURE=CAIRO_HAS_NO_WIN32_FONT
-
-if false; then
- CAIRO_HAS_WIN32_FONT_TRUE=
- CAIRO_HAS_WIN32_FONT_FALSE='#'
-else
- CAIRO_HAS_WIN32_FONT_TRUE='#'
- CAIRO_HAS_WIN32_FONT_FALSE=
-fi
-
-else
- WIN32_FONT_FEATURE=CAIRO_HAS_WIN32_FONT
-if true; then
+if test "x$use_win32" = "xyes"; then
CAIRO_HAS_WIN32_FONT_TRUE=
CAIRO_HAS_WIN32_FONT_FALSE='#'
else
@@ -22090,12 +22248,12 @@ else
CAIRO_HAS_WIN32_FONT_FALSE=
fi
+if test "x$use_win32" = "xyes"; then
+ WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
fi
-
-
# Check whether --enable-ps or --disable-ps was given.
if test "${enable_ps+set}" = set; then
enableval="$enable_ps"
@@ -22104,24 +22262,224 @@ else
use_ps=yes
fi;
-if test "x$use_ps" != "xyes"; then
- PS_SURFACE_FEATURE=CAIRO_HAS_NO_PS_SURFACE
+# The postscript module requires zlib.
+echo "$as_me:$LINENO: checking for compress in -lz" >&5
+echo $ECHO_N "checking for compress in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_compress+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char compress ();
+int
+main ()
+{
+compress ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_z_compress=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-if false; then
- CAIRO_HAS_PS_SURFACE_TRUE=
- CAIRO_HAS_PS_SURFACE_FALSE='#'
+ac_cv_lib_z_compress=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress" >&5
+echo "${ECHO_T}$ac_cv_lib_z_compress" >&6
+if test $ac_cv_lib_z_compress = yes; then
+ if test "${ac_cv_header_zlib_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_zlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6
else
- CAIRO_HAS_PS_SURFACE_TRUE='#'
- CAIRO_HAS_PS_SURFACE_FALSE=
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+# Is the header present?
+echo "$as_me:$LINENO: checking zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <zlib.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
else
- PS_SURFACE_FEATURE=CAIRO_HAS_PS_SURFACE
- PS_LIBS=-lz
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
-if true; then
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_zlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_zlib_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+ :
+else
+ use_ps="no (requires zlib http://www.gzip.org/zlib/)"
+fi
+
+
+else
+ use_ps="no (requires zlib http://www.gzip.org/zlib/)"
+fi
+
+
+
+
+if test "x$use_ps" = "xyes"; then
CAIRO_HAS_PS_SURFACE_TRUE=
CAIRO_HAS_PS_SURFACE_FALSE='#'
else
@@ -22129,10 +22487,13 @@ else
CAIRO_HAS_PS_SURFACE_FALSE=
fi
+if test "x$use_ps" = "xyes"; then
+ PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
+ PS_LIBS=-lz
fi
-CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
+CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
@@ -22262,31 +22623,20 @@ echo "$as_me: WARNING: Could not find libpng in the pkg-config search path" >&2;
fi
fi
-if test "x$use_png" != "xyes"; then
- PNG_SURFACE_FEATURE=CAIRO_HAS_NO_PNG_SURFACE
-if false; then
- CAIRO_HAS_PNG_SURFACE_TRUE=
- CAIRO_HAS_PNG_SURFACE_FALSE='#'
+if test "x$use_png" = "xyes"; then
+ CAIRO_HAS_PNG_FUNCTIONS_TRUE=
+ CAIRO_HAS_PNG_FUNCTIONS_FALSE='#'
else
- CAIRO_HAS_PNG_SURFACE_TRUE='#'
- CAIRO_HAS_PNG_SURFACE_FALSE=
+ CAIRO_HAS_PNG_FUNCTIONS_TRUE='#'
+ CAIRO_HAS_PNG_FUNCTIONS_FALSE=
fi
-else
- PNG_SURFACE_FEATURE=CAIRO_HAS_PNG_SURFACE
-
-
-if true; then
- CAIRO_HAS_PNG_SURFACE_TRUE=
- CAIRO_HAS_PNG_SURFACE_FALSE='#'
-else
- CAIRO_HAS_PNG_SURFACE_TRUE='#'
- CAIRO_HAS_PNG_SURFACE_FALSE=
+if test "x$use_png" = "xyes"; then
+ PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
fi
-fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
@@ -22294,7 +22644,6 @@ CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
-
# Check whether --enable-glitz or --disable-glitz was given.
if test "${enable_glitz+set}" = set; then
enableval="$enable_glitz"
@@ -22399,16 +22748,14 @@ echo "${ECHO_T}$GLITZ_LIBS" >&6
GLITZ_REQUIRES=glitz
use_glitz=yes
else
- use_glitz="no (requires glitz http://freedesktop.org/software/glitz)"
+ use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"
fi
fi
-if test "x$use_glitz" != "xyes"; then
- GLITZ_SURFACE_FEATURE=CAIRO_HAS_NO_GLITZ_SURFACE
-if false; then
+if test "x$use_glitz" = "xyes"; then
CAIRO_HAS_GLITZ_SURFACE_TRUE=
CAIRO_HAS_GLITZ_SURFACE_FALSE='#'
else
@@ -22416,19 +22763,10 @@ else
CAIRO_HAS_GLITZ_SURFACE_FALSE=
fi
-else
- GLITZ_SURFACE_FEATURE=CAIRO_HAS_GLITZ_SURFACE
-
-
-if true; then
- CAIRO_HAS_GLITZ_SURFACE_TRUE=
- CAIRO_HAS_GLITZ_SURFACE_FALSE='#'
-else
- CAIRO_HAS_GLITZ_SURFACE_TRUE='#'
- CAIRO_HAS_GLITZ_SURFACE_FALSE=
+if test "x$use_glitz" = "xyes"; then
+ GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
fi
-fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
@@ -22437,24 +22775,6 @@ CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
-# Check whether --enable-sanity-checking or --disable-sanity-checking was given.
-if test "${enable_sanity_checking+set}" = set; then
- enableval="$enable_sanity_checking"
- check_sanity=$enableval
-else
- check_sanity=yes
-fi;
-
-if test "x$check_sanity" != "xyes"; then
- SANITY_CHECKING_FEATURE=CAIRO_NO_SANITY_CHECKING
-else
- SANITY_CHECKING_FEATURE=CAIRO_DO_SANITY_CHECKING
-fi
-
-
-
-
-
succeeded=no
if test -z "$PKG_CONFIG"; then
@@ -22759,23 +23079,9 @@ fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
-if test "x$use_freetype" != "xyes"; then
- FT_FONT_FEATURE=CAIRO_HAS_NO_FT_FONT
-if false; then
- CAIRO_HAS_FT_FONT_TRUE=
- CAIRO_HAS_FT_FONT_FALSE='#'
-else
- CAIRO_HAS_FT_FONT_TRUE='#'
- CAIRO_HAS_FT_FONT_FALSE=
-fi
-
-else
- FT_FONT_FEATURE=CAIRO_HAS_FT_FONT
-
-
-if true; then
+if test "x$use_freetype" = "xyes"; then
CAIRO_HAS_FT_FONT_TRUE=
CAIRO_HAS_FT_FONT_FALSE='#'
else
@@ -22783,6 +23089,8 @@ else
CAIRO_HAS_FT_FONT_FALSE=
fi
+if test "x$use_freetype" = "xyes"; then
+ FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
fi
@@ -22801,11 +23109,9 @@ echo "$as_me: WARNING: PDF backend requires FreeType, disabling" >&2;}
use_pdf=no
fi
-if test "x$use_pdf" != "xyes"; then
- PDF_SURFACE_FEATURE=CAIRO_HAS_NO_PDF_SURFACE
-if false; then
+if test "x$use_pdf" = "xyes"; then
CAIRO_HAS_PDF_SURFACE_TRUE=
CAIRO_HAS_PDF_SURFACE_FALSE='#'
else
@@ -22813,20 +23119,11 @@ else
CAIRO_HAS_PDF_SURFACE_FALSE=
fi
-else
- PDF_SURFACE_FEATURE=CAIRO_HAS_PDF_SURFACE
+if test "x$use_pdf" = "xyes"; then
+ PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
PDF_LIBS=-lz
-
-
-if true; then
- CAIRO_HAS_PDF_SURFACE_TRUE=
- CAIRO_HAS_PDF_SURFACE_FALSE='#'
-else
- CAIRO_HAS_PDF_SURFACE_TRUE='#'
- CAIRO_HAS_PDF_SURFACE_FALSE=
fi
-fi
CAIRO_LIBS="$CAIRO_LIBS $PDF_LIBS"
@@ -22834,7 +23131,6 @@ CAIRO_LIBS="$CAIRO_LIBS $PDF_LIBS"
-
# Check whether --enable-atsui or --disable-atsui was given.
if test "${enable_atsui+set}" = set; then
enableval="$enable_atsui"
@@ -22990,11 +23286,9 @@ fi
fi
-if test "x$use_atsui" != "xyes"; then
- ATSUI_FONT_FEATURE=CAIRO_HAS_NO_ATSUI_FONT
-if false; then
+if test "x$use_atsui" = "xyes"; then
CAIRO_HAS_ATSUI_FONT_TRUE=
CAIRO_HAS_ATSUI_FONT_FALSE='#'
else
@@ -23002,20 +23296,162 @@ else
CAIRO_HAS_ATSUI_FONT_FALSE=
fi
+if test "x$use_atsui" = "xyes"; then
+ ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
+fi
+
+
+
+
+
+for ac_header in stdint.h inttypes.h sys/int_types.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
- ATSUI_FONT_FEATURE=CAIRO_HAS_ATSUI_FONT
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
-if true; then
- CAIRO_HAS_ATSUI_FONT_TRUE=
- CAIRO_HAS_ATSUI_FONT_FALSE='#'
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
else
- CAIRO_HAS_ATSUI_FONT_TRUE='#'
- CAIRO_HAS_ATSUI_FONT_FALSE=
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+fi
+
+done
echo "$as_me:$LINENO: checking for uint64_t" >&5
echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6
@@ -23399,13 +23835,6 @@ echo "$as_me: error: conditional \"CAIRO_HAS_XLIB_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${CAIRO_HAS_XLIB_SURFACE_TRUE}" && test -z "${CAIRO_HAS_XLIB_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_XLIB_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_XLIB_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${CAIRO_HAS_QUARTZ_SURFACE_TRUE}" && test -z "${CAIRO_HAS_QUARTZ_SURFACE_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_QUARTZ_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -23413,20 +23842,6 @@ echo "$as_me: error: conditional \"CAIRO_HAS_QUARTZ_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${CAIRO_HAS_QUARTZ_SURFACE_TRUE}" && test -z "${CAIRO_HAS_QUARTZ_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_QUARTZ_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_QUARTZ_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${CAIRO_HAS_XCB_SURFACE_TRUE}" && test -z "${CAIRO_HAS_XCB_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_XCB_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_XCB_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${CAIRO_HAS_XCB_SURFACE_TRUE}" && test -z "${CAIRO_HAS_XCB_SURFACE_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_XCB_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -23441,20 +23856,6 @@ echo "$as_me: error: conditional \"CAIRO_HAS_WIN32_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${CAIRO_HAS_WIN32_SURFACE_TRUE}" && test -z "${CAIRO_HAS_WIN32_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_WIN32_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_WIN32_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${CAIRO_HAS_WIN32_FONT_TRUE}" && test -z "${CAIRO_HAS_WIN32_FONT_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_WIN32_FONT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_WIN32_FONT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${CAIRO_HAS_WIN32_FONT_TRUE}" && test -z "${CAIRO_HAS_WIN32_FONT_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_WIN32_FONT\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -23469,31 +23870,10 @@ echo "$as_me: error: conditional \"CAIRO_HAS_PS_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${CAIRO_HAS_PS_SURFACE_TRUE}" && test -z "${CAIRO_HAS_PS_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PS_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_PS_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${CAIRO_HAS_PNG_SURFACE_TRUE}" && test -z "${CAIRO_HAS_PNG_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PNG_SURFACE\" was never defined.
+if test -z "${CAIRO_HAS_PNG_FUNCTIONS_TRUE}" && test -z "${CAIRO_HAS_PNG_FUNCTIONS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PNG_FUNCTIONS\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_PNG_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${CAIRO_HAS_PNG_SURFACE_TRUE}" && test -z "${CAIRO_HAS_PNG_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PNG_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_PNG_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${CAIRO_HAS_GLITZ_SURFACE_TRUE}" && test -z "${CAIRO_HAS_GLITZ_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_GLITZ_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_GLITZ_SURFACE\" was never defined.
+echo "$as_me: error: conditional \"CAIRO_HAS_PNG_FUNCTIONS\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
@@ -23511,20 +23891,6 @@ echo "$as_me: error: conditional \"CAIRO_HAS_FT_FONT\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${CAIRO_HAS_FT_FONT_TRUE}" && test -z "${CAIRO_HAS_FT_FONT_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_FT_FONT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_FT_FONT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${CAIRO_HAS_PDF_SURFACE_TRUE}" && test -z "${CAIRO_HAS_PDF_SURFACE_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PDF_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_PDF_SURFACE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${CAIRO_HAS_PDF_SURFACE_TRUE}" && test -z "${CAIRO_HAS_PDF_SURFACE_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PDF_SURFACE\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -23539,13 +23905,6 @@ echo "$as_me: error: conditional \"CAIRO_HAS_ATSUI_FONT\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${CAIRO_HAS_ATSUI_FONT_TRUE}" && test -z "${CAIRO_HAS_ATSUI_FONT_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_ATSUI_FONT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"CAIRO_HAS_ATSUI_FONT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"ENABLE_GTK_DOC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -24188,9 +24547,9 @@ s,@CAIRO_HAS_XCB_SURFACE_FALSE@,$CAIRO_HAS_XCB_SURFACE_FALSE,;t t
s,@XCB_SURFACE_FEATURE@,$XCB_SURFACE_FEATURE,;t t
s,@CAIRO_HAS_WIN32_SURFACE_TRUE@,$CAIRO_HAS_WIN32_SURFACE_TRUE,;t t
s,@CAIRO_HAS_WIN32_SURFACE_FALSE@,$CAIRO_HAS_WIN32_SURFACE_FALSE,;t t
+s,@WIN32_SURFACE_FEATURE@,$WIN32_SURFACE_FEATURE,;t t
s,@CAIRO_HAS_WIN32_FONT_TRUE@,$CAIRO_HAS_WIN32_FONT_TRUE,;t t
s,@CAIRO_HAS_WIN32_FONT_FALSE@,$CAIRO_HAS_WIN32_FONT_FALSE,;t t
-s,@WIN32_SURFACE_FEATURE@,$WIN32_SURFACE_FEATURE,;t t
s,@WIN32_FONT_FEATURE@,$WIN32_FONT_FEATURE,;t t
s,@CAIRO_HAS_PS_SURFACE_TRUE@,$CAIRO_HAS_PS_SURFACE_TRUE,;t t
s,@CAIRO_HAS_PS_SURFACE_FALSE@,$CAIRO_HAS_PS_SURFACE_FALSE,;t t
@@ -24198,9 +24557,9 @@ s,@PS_SURFACE_FEATURE@,$PS_SURFACE_FEATURE,;t t
s,@PS_LIBS@,$PS_LIBS,;t t
s,@PNG_CFLAGS@,$PNG_CFLAGS,;t t
s,@PNG_LIBS@,$PNG_LIBS,;t t
-s,@CAIRO_HAS_PNG_SURFACE_TRUE@,$CAIRO_HAS_PNG_SURFACE_TRUE,;t t
-s,@CAIRO_HAS_PNG_SURFACE_FALSE@,$CAIRO_HAS_PNG_SURFACE_FALSE,;t t
-s,@PNG_SURFACE_FEATURE@,$PNG_SURFACE_FEATURE,;t t
+s,@CAIRO_HAS_PNG_FUNCTIONS_TRUE@,$CAIRO_HAS_PNG_FUNCTIONS_TRUE,;t t
+s,@CAIRO_HAS_PNG_FUNCTIONS_FALSE@,$CAIRO_HAS_PNG_FUNCTIONS_FALSE,;t t
+s,@PNG_FUNCTIONS_FEATURE@,$PNG_FUNCTIONS_FEATURE,;t t
s,@PNG_REQUIRES@,$PNG_REQUIRES,;t t
s,@GLITZ_CFLAGS@,$GLITZ_CFLAGS,;t t
s,@GLITZ_LIBS@,$GLITZ_LIBS,;t t
@@ -24208,7 +24567,6 @@ s,@CAIRO_HAS_GLITZ_SURFACE_TRUE@,$CAIRO_HAS_GLITZ_SURFACE_TRUE,;t t
s,@CAIRO_HAS_GLITZ_SURFACE_FALSE@,$CAIRO_HAS_GLITZ_SURFACE_FALSE,;t t
s,@GLITZ_SURFACE_FEATURE@,$GLITZ_SURFACE_FEATURE,;t t
s,@GLITZ_REQUIRES@,$GLITZ_REQUIRES,;t t
-s,@SANITY_CHECKING_FEATURE@,$SANITY_CHECKING_FEATURE,;t t
s,@PIXMAN_CFLAGS@,$PIXMAN_CFLAGS,;t t
s,@PIXMAN_LIBS@,$PIXMAN_LIBS,;t t
s,@FONTCONFIG_CFLAGS@,$FONTCONFIG_CFLAGS,;t t
@@ -24961,14 +25319,15 @@ echo " XCB: $use_xcb"
echo " Win32: $use_win32"
echo " PostScript: $use_ps"
echo " PDF: $use_pdf"
-echo " PNG: $use_png"
echo " glitz: $use_glitz"
echo ""
-echo "and the following font backends:"
+echo "the following font backends:"
echo " FreeType: $use_freetype"
echo " Win32: $use_win32"
echo " ATSUI: $use_atsui"
echo ""
+echo "and the following features:"
+echo " PNG functions: $use_png"
if test x"$use_freetype" != "xyes" && \
test x"$use_win32" != "xyes" && \
@@ -24984,4 +25343,3 @@ echo "$as_me: error: Cairo requires at least one font backend.
" >&2;}
{ (exit 1); exit 1; }; }
fi
-
diff --git a/configure.in b/configure.in
index 5ee585e..c2305de 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,7 @@ AC_INIT(src/cairo.h)
dnl ===========================================================================
# Package version number, (as distinct from shared library version)
-CAIRO_VERSION=0.4.0
+CAIRO_VERSION=0.5.1
# libtool shared library version
@@ -60,18 +60,15 @@ if test "x$use_xlib" = "xyes"; then
AC_PATH_XTRA
XRENDER_LIBS="$X_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS"
use_xlib=yes], [
- use_xlib="no (requires Xrender http://freedesktop.org/software/xlibs)"])])
+ use_xlib="no (requires Xrender http://freedesktop.org/Software/xlibs)"])])
fi
-if test "x$use_xlib" != "xyes"; then
- XLIB_SURFACE_FEATURE=CAIRO_HAS_NO_XLIB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, false)
-else
- XLIB_SURFACE_FEATURE=CAIRO_HAS_XLIB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, true)
+AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, test "x$use_xlib" = "xyes")
+if test "x$use_xlib" = "xyes"; then
+ XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
fi
-
AC_SUBST(XLIB_SURFACE_FEATURE)
+
AC_SUBST(XRENDER_REQUIRES)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XRENDER_CFLAGS"
@@ -79,22 +76,18 @@ CAIRO_LIBS="$CAIRO_LIBS $XRENDER_LIBS"
AC_ARG_ENABLE(quartz,
[ --disable-quartz Disable cairo's quartz backend],
- [use_quartz=$enableval], [use_quartz="no (temporarily disabled while code is out of sync)"])
+ [use_quartz=$enableval], [use_quartz=yes])
if test "x$use_quartz" = "xyes"; then
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz=no])
fi
-if test "x$use_quartz" != "xyes"; then
- QUARTZ_SURFACE_FEATURE=CAIRO_HAS_NO_QUARTZ_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, false)
-else
- QUARTZ_SURFACE_FEATURE=CAIRO_HAS_QUARTZ_SURFACE
+AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, test "x$use_quartz" = "xyes")
+if test "x$use_quartz" = "xyes"; then
+ QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
- AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, true)
fi
-
AC_SUBST(QUARTZ_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
@@ -106,21 +99,18 @@ AC_ARG_ENABLE(xcb,
if test "x$use_xcb" = "xyes"; then
PKG_CHECK_MODULES(XCB, xcb, [use_xcb=yes], [
- use_xcb="no (requires XCB http://freedesktop.org/software/xcb)"])
+ use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
fi
-if test "x$use_xcb" != "xyes"; then
- XCB_SURFACE_FEATURE=CAIRO_HAS_NO_XCB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, false)
-else
- XCB_SURFACE_FEATURE=CAIRO_HAS_XCB_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, true)
+AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, test "x$use_xcb" = "xyes")
+if test "x$use_xcb" = "xyes"; then
+ XCB_SURFACE_FEATURE="#define CAIRO_HAS_XCB_SURFACE 1"
fi
+AC_SUBST(XCB_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"
-AC_SUBST(XCB_SURFACE_FEATURE)
dnl ===========================================================================
@@ -147,23 +137,16 @@ if test "x$use_win32" = "xyes"; then
CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
fi
-if test "x$use_win32" != "xyes"; then
- WIN32_SURFACE_FEATURE=CAIRO_HAS_NO_WIN32_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, false)
-else
- WIN32_SURFACE_FEATURE=CAIRO_HAS_WIN32_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, true)
+AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, test "x$use_win32" = "xyes")
+if test "x$use_win32" = "xyes"; then
+ WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
fi
+AC_SUBST(WIN32_SURFACE_FEATURE)
-if test "x$use_win32" != "xyes"; then
- WIN32_FONT_FEATURE=CAIRO_HAS_NO_WIN32_FONT
- AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, false)
-else
- WIN32_FONT_FEATURE=CAIRO_HAS_WIN32_FONT
- AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, true)
+AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, test "x$use_win32" = "xyes")
+if test "x$use_win32" = "xyes"; then
+ WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
fi
-
-AC_SUBST(WIN32_SURFACE_FEATURE)
AC_SUBST(WIN32_FONT_FEATURE)
dnl ===========================================================================
@@ -172,24 +155,27 @@ AC_ARG_ENABLE(ps,
[ --disable-ps Disable cairo's PostScript backend],
[use_ps=$enableval], [use_ps=yes])
-if test "x$use_ps" != "xyes"; then
- PS_SURFACE_FEATURE=CAIRO_HAS_NO_PS_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, false)
-else
- PS_SURFACE_FEATURE=CAIRO_HAS_PS_SURFACE
+# The postscript module requires zlib.
+AC_CHECK_LIB(z, compress,
+ [AC_CHECK_HEADER(zlib.h, [],
+ [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
+ [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
+
+AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, test "x$use_ps" = "xyes")
+if test "x$use_ps" = "xyes"; then
+ PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
PS_LIBS=-lz
- AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, true)
fi
+AC_SUBST(PS_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
-AC_SUBST(PS_SURFACE_FEATURE)
AC_SUBST(PS_LIBS)
dnl ===========================================================================
AC_ARG_ENABLE(png,
- [ --disable-png Disable cairo's PNG backend],
+ [ --disable-png Disable cairo's PNG functions],
[use_png=$enableval], [use_png=yes])
if test "x$use_png" = "xyes"; then
@@ -211,18 +197,15 @@ if test "x$use_png" = "xyes"; then
fi
fi
-if test "x$use_png" != "xyes"; then
- PNG_SURFACE_FEATURE=CAIRO_HAS_NO_PNG_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_PNG_SURFACE, false)
-else
- PNG_SURFACE_FEATURE=CAIRO_HAS_PNG_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_PNG_SURFACE, true)
+AM_CONDITIONAL(CAIRO_HAS_PNG_FUNCTIONS, test "x$use_png" = "xyes")
+if test "x$use_png" = "xyes"; then
+ PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
fi
+AC_SUBST(PNG_FUNCTIONS_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
-AC_SUBST(PNG_SURFACE_FEATURE)
AC_SUBST(PNG_REQUIRES)
dnl ===========================================================================
@@ -234,39 +217,22 @@ AC_ARG_ENABLE(glitz,
if test "x$use_glitz" = "xyes"; then
PKG_CHECK_MODULES(GLITZ, glitz >= 0.4.0, [
GLITZ_REQUIRES=glitz
- use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/software/glitz)"])
+ use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
fi
-if test "x$use_glitz" != "xyes"; then
- GLITZ_SURFACE_FEATURE=CAIRO_HAS_NO_GLITZ_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, false)
-else
- GLITZ_SURFACE_FEATURE=CAIRO_HAS_GLITZ_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, true)
+AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, test "x$use_glitz" = "xyes")
+if test "x$use_glitz" = "xyes"; then
+ GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
fi
+AC_SUBST(GLITZ_SURFACE_FEATURE)
CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
-AC_SUBST(GLITZ_SURFACE_FEATURE)
AC_SUBST(GLITZ_REQUIRES)
dnl ===========================================================================
-AC_ARG_ENABLE(sanity-checking,
- [ --disable-sanity Disable cairo's sanity checking routines],
- [check_sanity=$enableval], [check_sanity=yes])
-
-if test "x$check_sanity" != "xyes"; then
- SANITY_CHECKING_FEATURE=CAIRO_NO_SANITY_CHECKING
-else
- SANITY_CHECKING_FEATURE=CAIRO_DO_SANITY_CHECKING
-fi
-
-AC_SUBST(SANITY_CHECKING_FEATURE)
-
-dnl ===========================================================================
-
PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.4)
CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS"
@@ -333,12 +299,9 @@ fi
CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
-if test "x$use_freetype" != "xyes"; then
- FT_FONT_FEATURE=CAIRO_HAS_NO_FT_FONT
- AM_CONDITIONAL(CAIRO_HAS_FT_FONT, false)
-else
- FT_FONT_FEATURE=CAIRO_HAS_FT_FONT
- AM_CONDITIONAL(CAIRO_HAS_FT_FONT, true)
+AM_CONDITIONAL(CAIRO_HAS_FT_FONT, test "x$use_freetype" = "xyes")
+if test "x$use_freetype" = "xyes"; then
+ FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
fi
AC_SUBST(FT_FONT_FEATURE)
@@ -353,18 +316,15 @@ if test x"$use_freetype" != "xyes" ; then
use_pdf=no
fi
-if test "x$use_pdf" != "xyes"; then
- PDF_SURFACE_FEATURE=CAIRO_HAS_NO_PDF_SURFACE
- AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, false)
-else
- PDF_SURFACE_FEATURE=CAIRO_HAS_PDF_SURFACE
+AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, test "x$use_pdf" = "xyes")
+if test "x$use_pdf" = "xyes"; then
+ PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
PDF_LIBS=-lz
- AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, true)
fi
+AC_SUBST(PDF_SURFACE_FEATURE)
CAIRO_LIBS="$CAIRO_LIBS $PDF_LIBS"
-AC_SUBST(PDF_SURFACE_FEATURE)
AC_SUBST(PDF_LIBS)
dnl ===========================================================================
@@ -381,17 +341,15 @@ if test "x$use_atsui" = "xyes"; then
AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
fi
-if test "x$use_atsui" != "xyes"; then
- ATSUI_FONT_FEATURE=CAIRO_HAS_NO_ATSUI_FONT
- AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, false)
-else
- ATSUI_FONT_FEATURE=CAIRO_HAS_ATSUI_FONT
- AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, true)
+AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, test "x$use_atsui" = "xyes")
+if test "x$use_atsui" = "xyes"; then
+ ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
fi
AC_SUBST(ATSUI_FONT_FEATURE)
dnl ===========================================================================
dnl Checks for precise integer types
+AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
AC_CHECK_TYPES([uint64_t, uint128_t])
dnl Use lots of warning flags with GCC
@@ -435,14 +393,15 @@ echo " XCB: $use_xcb"
echo " Win32: $use_win32"
echo " PostScript: $use_ps"
echo " PDF: $use_pdf"
-echo " PNG: $use_png"
echo " glitz: $use_glitz"
echo ""
-echo "and the following font backends:"
+echo "the following font backends:"
echo " FreeType: $use_freetype"
echo " Win32: $use_win32"
echo " ATSUI: $use_atsui"
echo ""
+echo "and the following features:"
+echo " PNG functions: $use_png"
if test x"$use_freetype" != "xyes" && \
test x"$use_win32" != "xyes" && \
@@ -453,4 +412,3 @@ if test x"$use_freetype" != "xyes" && \
http://freetype.org/ http://fontconfig.org/
])
fi
-
diff --git a/depcomp b/depcomp
index edb5d38..11e2d3b 100755
--- a/depcomp
+++ b/depcomp
@@ -1,7 +1,9 @@
#! /bin/sh
-
# depcomp - compile a program generating dependencies as side-effects
-# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
+
+scriptversion=2004-05-31.23
+
+# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,22 +27,45 @@
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit 0
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit 0
+ ;;
+esac
+
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
-# `libtool' can also be set to `yes' or `no'.
-
-if test -z "$depfile"; then
- base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
- dir=`echo "$object" | sed 's,/.*$,/,'`
- if test "$dir" = "$object"; then
- dir=
- fi
- # FIXME: should be _deps on DOS.
- depfile="$dir.deps/$base"
-fi
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
@@ -262,26 +287,35 @@ tru64)
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
+ # Dependencies are output in .lo.d with libtool 1.4.
+ # With libtool 1.5 they are output both in $dir.libs/$base.o.d
+ # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
+ # latter, because the former will be cleaned when $dir.libs is
+ # erased.
tmpdepfile1="$dir.libs/$base.lo.d"
- tmpdepfile2="$dir.libs/$base.d"
+ tmpdepfile2="$dir$base.o.d"
+ tmpdepfile3="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
+ tmpdepfile3="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
- rm -f "$tmpdepfile1" "$tmpdepfile2"
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
- else
+ elif test -f "$tmpdepfile2"; then
tmpdepfile="$tmpdepfile2"
+ else
+ tmpdepfile="$tmpdepfile3"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
@@ -477,3 +511,12 @@ none)
esac
exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/doc/Makefile.in b/doc/Makefile.in
index dd16f9c..42b8ffd 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -76,8 +76,8 @@ CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
-CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
-CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
+CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@
+CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
@@ -155,14 +155,13 @@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
+PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
-PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
-SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
diff --git a/doc/public/Makefile.am b/doc/public/Makefile.am
index b993bb9..9e4c103 100644
--- a/doc/public/Makefile.am
+++ b/doc/public/Makefile.am
@@ -19,11 +19,15 @@ HFILE_GLOB=$(top_srcdir)/src/*.h
CFILE_GLOB=$(top_srcdir)/src/*.c $(top_srcdir)/src/*.h
# Headers to ignore
-IGNORE_HFILES= \
- cairo-features.h \
- cairo-ft-private.h \
- cairo-win32-private.h \
- cairoint.h \
+IGNORE_HFILES= \
+ cairo-features.h \
+ cairo-ft-private.h \
+ cairo-gstate-private.h \
+ cairo-path-fixed-private.h \
+ cairo-private.h \
+ cairo-win32-private.h \
+ cairo-xlib-test.h \
+ cairoint.h \
cairo-wideint.h
# CFLAGS and LDFLAGS for compiling scan program. Only needed
@@ -34,8 +38,12 @@ GTKDOC_LIBS =
# Extra options to supply to gtkdoc-mkdb
MKDB_OPTIONS=--sgml-mode --output-format=xml
+# Extra options to supply to gtkdoc-mktmpl
+MKTMPL_OPTIONS=
+
# Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE)
-content_files =
+content_files = \
+ language-bindings.xml
# Images to copy into HTML directory
HTML_IMAGES =
diff --git a/doc/public/Makefile.in b/doc/public/Makefile.in
index 7d3f8dc..5c71566 100644
--- a/doc/public/Makefile.in
+++ b/doc/public/Makefile.in
@@ -14,12 +14,6 @@
@SET_MAKE@
-#
-# *** NOTE *** this file is checked into CVS for convenience only.
-# DO NOT EDIT. Rather get changes into upstream gtk-doc and then
-# update this version from the gtk-doc version.
-#
-
# -*- mode: makefile -*-
####################################
@@ -80,8 +74,8 @@ CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
-CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
-CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
+CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@
+CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
@@ -159,14 +153,13 @@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
+PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
-PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
-SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -248,10 +241,14 @@ CFILE_GLOB = $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h
# Headers to ignore
IGNORE_HFILES = \
- cairo-features.h \
- cairo-ft-private.h \
- cairo-win32-private.h \
- cairoint.h \
+ cairo-features.h \
+ cairo-ft-private.h \
+ cairo-gstate-private.h \
+ cairo-path-fixed-private.h \
+ cairo-private.h \
+ cairo-win32-private.h \
+ cairo-xlib-test.h \
+ cairoint.h \
cairo-wideint.h
@@ -263,8 +260,13 @@ GTKDOC_LIBS =
# Extra options to supply to gtkdoc-mkdb
MKDB_OPTIONS = --sgml-mode --output-format=xml
+# Extra options to supply to gtkdoc-mktmpl
+MKTMPL_OPTIONS =
+
# Non-autogenerated SGML files to be included in $(DOC_MAIN_SGML_FILE)
-content_files =
+content_files = \
+ language-bindings.xml
+
# Images to copy into HTML directory
HTML_IMAGES =
@@ -287,7 +289,6 @@ EXTRA_DIST = \
$(content_files) \
$(HTML_IMAGES) \
$(DOC_MAIN_SGML_FILE) \
- $(DOC_MODULE).types \
$(DOC_MODULE)-sections.txt \
$(DOC_MODULE)-overrides.txt
@@ -478,7 +479,7 @@ uninstall-am: uninstall-info-am uninstall-local
@ENABLE_GTK_DOC_TRUE@scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
@ENABLE_GTK_DOC_TRUE@ @echo '*** Scanning header files ***'
@ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir)
-@ENABLE_GTK_DOC_TRUE@ if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
+@ENABLE_GTK_DOC_TRUE@ if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
@ENABLE_GTK_DOC_TRUE@ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
@ENABLE_GTK_DOC_TRUE@ else \
@ENABLE_GTK_DOC_TRUE@ cd $(srcdir) ; \
@@ -498,7 +499,7 @@ uninstall-am: uninstall-info-am uninstall-local
@ENABLE_GTK_DOC_TRUE@tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
@ENABLE_GTK_DOC_TRUE@ @echo '*** Rebuilding template files ***'
@ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir)
-@ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
+@ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
@ENABLE_GTK_DOC_TRUE@ touch tmpl-build.stamp
@ENABLE_GTK_DOC_TRUE@tmpl.stamp: tmpl-build.stamp
@@ -506,11 +507,11 @@ uninstall-am: uninstall-info-am uninstall-local
#### xml ####
-@ENABLE_GTK_DOC_TRUE@sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
+@ENABLE_GTK_DOC_TRUE@sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml $(expand_content_files)
@ENABLE_GTK_DOC_TRUE@ @echo '*** Building XML ***'
@ENABLE_GTK_DOC_TRUE@ @-chmod -R u+w $(srcdir)
@ENABLE_GTK_DOC_TRUE@ cd $(srcdir) && \
-@ENABLE_GTK_DOC_TRUE@ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml $(MKDB_OPTIONS)
+@ENABLE_GTK_DOC_TRUE@ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" $(MKDB_OPTIONS)
@ENABLE_GTK_DOC_TRUE@ touch sgml-build.stamp
@ENABLE_GTK_DOC_TRUE@sgml.stamp: sgml-build.stamp
@@ -564,19 +565,16 @@ uninstall-local:
@ENABLE_GTK_DOC_FALSE@ @echo "*** gtk-doc must be installed and enabled in order to make dist"
@ENABLE_GTK_DOC_FALSE@ @false
-# XXX: Before this was:
-# dist-hook: dist-check-gtkdoc dist-hook-local
-# which seems reasonable, but for some reason the dist-check-gtkdoc
-# was always failing on me, even though I do have gtk-doc installed
-# and it is successfully building the documentation.
-
-dist-hook: dist-hook-local
+dist-hook: dist-check-gtkdoc dist-hook-local
mkdir $(distdir)/tmpl
mkdir $(distdir)/xml
mkdir $(distdir)/html
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
-cp $(srcdir)/xml/*.xml $(distdir)/xml
-cp $(srcdir)/html/* $(distdir)/html
+ if test -f $(srcdir)/$(DOC_MODULE).types; then \
+ cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \
+ fi
.PHONY : dist-hook-local
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/doc/public/cairo-docs.xml b/doc/public/cairo-docs.xml
index 2a4cdae..729738a 100644
--- a/doc/public/cairo-docs.xml
+++ b/doc/public/cairo-docs.xml
@@ -12,6 +12,7 @@
<xi:include href="xml/cairo-surface.xml"/>
<xi:include href="xml/cairo-pattern.xml"/>
<xi:include href="xml/cairo-matrix.xml"/>
+ <xi:include href="xml/cairo-font.xml"/>
<xi:include href="xml/cairo-atsui.xml"/>
<xi:include href="xml/cairo-ft.xml"/>
<xi:include href="xml/cairo-glitz.xml"/>
@@ -22,10 +23,9 @@
<xi:include href="xml/cairo-win32.xml"/>
<xi:include href="xml/cairo-xcb.xml"/>
<xi:include href="xml/cairo-xlib.xml"/>
- </part>
+ </part>
+ <index>
+ <title>Index</title>
+ </index>
+ <xi:include href="language-bindings.xml"/>
</book>
-
-
-
-
-
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 3da0fa8..4db600b 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -1,91 +1,98 @@
<SECTION>
-<FILE>cairo-atsui</FILE>
-<TITLE>ATSUI Fonts</TITLE>
-cairo_atsui_font_create
-</SECTION>
-
-<SECTION>
<FILE>cairo-ft</FILE>
<TITLE>FreeType Fonts</TITLE>
-cairo_ft_font_create
-cairo_ft_font_create_for_ft_face
-cairo_ft_font_lock_face
-cairo_ft_font_unlock_face
-cairo_ft_font_get_pattern
+cairo_ft_font_face_create_for_pattern
+cairo_ft_font_face_create_for_ft_face
+cairo_ft_scaled_font_lock_face
+cairo_ft_scaled_font_unlock_face
</SECTION>
<SECTION>
<FILE>cairo-glitz</FILE>
<TITLE>Glitz backend</TITLE>
-cairo_set_target_glitz
cairo_glitz_surface_create
</SECTION>
<SECTION>
<FILE>cairo-pdf</FILE>
<TITLE>PDF Backend</TITLE>
-cairo_set_target_pdf
cairo_pdf_surface_create
+cairo_pdf_surface_create_for_stream
+cairo_pdf_surface_set_dpi
</SECTION>
<SECTION>
<FILE>cairo-png</FILE>
<TITLE>PNG Backend</TITLE>
-cairo_set_target_png
-cairo_png_surface_create
+cairo_image_surface_create_from_png
+cairo_image_surface_create_from_png_stream
+cairo_surface_write_to_png
+cairo_surface_write_to_png_stream
</SECTION>
<SECTION>
<FILE>cairo-ps</FILE>
<TITLE>PS Backend</TITLE>
-cairo_set_target_ps
cairo_ps_surface_create
+cairo_ps_surface_create_for_stream
+cairo_ps_surface_set_dpi
</SECTION>
<SECTION>
<FILE>cairo-quartz</FILE>
<TITLE>Quartz Backend</TITLE>
-cairo_set_target_quartz_context
cairo_quartz_surface_create
</SECTION>
<SECTION>
<FILE>cairo-win32</FILE>
<TITLE>Microsoft Windows Backend</TITLE>
-cairo_set_target_win32
cairo_win32_surface_create
-cairo_win32_font_create_for_logfontw
-cairo_win32_font_select_font
-cairo_win32_font_done_font
-cairo_win32_font_get_scale_factor
+cairo_win32_font_face_create_for_logfontw
+cairo_win32_scaled_font_select_font
+cairo_win32_scaled_font_done_font
+cairo_win32_scaled_font_get_metrics_factor
</SECTION>
<SECTION>
<FILE>cairo-xcb</FILE>
<TITLE>XCB Backend</TITLE>
-cairo_set_target_xcb
+cairo_xcb_surface_create
+cairo_xcb_surface_create_for_bitmap
+cairo_xcb_surface_set_size
+</SECTION>
+
+<SECTION>
+<FILE>cairo-xcb-xrender</FILE>
+<TITLE>XCB Backend</TITLE>
+cairo_xcb_surface_create_with_xrender_format
</SECTION>
<SECTION>
<FILE>cairo-xlib</FILE>
<TITLE>XLib Backend</TITLE>
-cairo_set_target_drawable
cairo_xlib_surface_create
+cairo_xlib_surface_create_for_bitmap
+cairo_xlib_surface_set_size
+</SECTION>
+
+<SECTION>
+<FILE>cairo-xlib-xrender</FILE>
+<TITLE>XLib/Xrender Backend</TITLE>
+cairo_xlib_surface_create_with_xrender_format
</SECTION>
<SECTION>
<FILE>cairo-surface</FILE>
<TITLE>cairo_surface_t</TITLE>
cairo_surface_t
-cairo_surface_create_for_image
cairo_surface_create_similar
cairo_surface_reference
cairo_surface_destroy
-cairo_surface_set_repeat
-cairo_surface_set_matrix
-cairo_surface_get_matrix
-cairo_surface_set_filter
-cairo_surface_get_filter
+cairo_surface_finish
+cairo_surface_set_user_data
+cairo_surface_get_user_data
+cairo_surface_set_device_offset
</SECTION>
<SECTION>
@@ -97,7 +104,9 @@ cairo_pattern_create_linear
cairo_pattern_create_radial
cairo_pattern_reference
cairo_pattern_destroy
-cairo_pattern_add_color_stop
+cairo_pattern_status
+cairo_pattern_add_color_stop_rgb
+cairo_pattern_add_color_stop_rgba
cairo_pattern_set_matrix
cairo_pattern_get_matrix
cairo_extend_t
@@ -111,12 +120,11 @@ cairo_pattern_get_filter
<FILE>cairo-matrix</FILE>
<TITLE>cairo_matrix_t</TITLE>
cairo_matrix_t
-cairo_matrix_create
-cairo_matrix_destroy
-cairo_matrix_copy
-cairo_matrix_set_identity
-cairo_matrix_set_affine
-cairo_matrix_get_affine
+cairo_matrix_init
+cairo_matrix_init_identity
+cairo_matrix_init_translate
+cairo_matrix_init_scale
+cairo_matrix_init_rotate
cairo_matrix_translate
cairo_matrix_scale
cairo_matrix_rotate
@@ -127,6 +135,24 @@ cairo_matrix_transform_point
</SECTION>
<SECTION>
+<FILE>cairo-font</FILE>
+<TITLE>Fonts</TITLE>
+cairo_font_face_t
+cairo_scaled_font_t
+cairo_font_face_reference
+cairo_font_face_destroy
+cairo_font_face_get_user_data
+cairo_font_face_set_user_data
+cairo_scaled_font_create
+cairo_scaled_font_reference
+cairo_scaled_font_destroy
+cairo_font_extents_t
+cairo_scaled_font_extents
+cairo_text_extents_t
+cairo_scaled_font_glyph_extents
+</SECTION>
+
+<SECTION>
<FILE>cairo</FILE>
<TITLE>cairo_t</TITLE>
cairo_t
@@ -135,15 +161,13 @@ cairo_reference
cairo_destroy
cairo_save
cairo_restore
-cairo_copy
-cairo_set_target_surface
cairo_format_t
-cairo_set_target_image
cairo_operator_t
cairo_set_operator
-cairo_set_rgb_color
-cairo_set_pattern
-cairo_set_alpha
+cairo_set_source_rgb
+cairo_set_source_rgba
+cairo_set_source
+cairo_set_source_surface
cairo_set_tolerance
cairo_fill_rule_t
cairo_set_fill_rule
@@ -157,14 +181,13 @@ cairo_set_miter_limit
cairo_translate
cairo_scale
cairo_rotate
-cairo_concat_matrix
+cairo_transform
cairo_set_matrix
-cairo_default_matrix
cairo_identity_matrix
-cairo_transform_point
-cairo_transform_distance
-cairo_inverse_transform_point
-cairo_inverse_transform_distance
+cairo_user_to_device
+cairo_user_to_device_distance
+cairo_device_to_user
+cairo_device_to_user_distance
cairo_new_path
cairo_move_to
cairo_line_to
@@ -176,8 +199,14 @@ cairo_rel_line_to
cairo_rel_curve_to
cairo_rectangle
cairo_close_path
+cairo_paint
+cairo_paint_with_alpha
+cairo_mask
+cairo_mask_surface
cairo_stroke
+cairo_stroke_preserve
cairo_fill
+cairo_fill_preserve
cairo_copy_page
cairo_show_page
cairo_in_stroke
@@ -185,35 +214,64 @@ cairo_in_fill
cairo_bool_t
cairo_stroke_extents
cairo_fill_extents
-cairo_init_clip
cairo_clip
-cairo_font_t
+cairo_clip_preserve
+cairo_reset_clip
cairo_glyph_t
-cairo_text_extents_t
-cairo_font_extents_t
cairo_font_slant_t
cairo_font_weight_t
-cairo_select_font
-cairo_scale_font
-cairo_transform_font
+cairo_select_font_face
+cairo_set_font_size
+cairo_set_font_matrix
+cairo_get_font_matrix
cairo_show_text
cairo_show_glyphs
-cairo_current_font
-cairo_current_font_extents
-cairo_set_font
+cairo_get_font_face
+cairo_font_extents
+cairo_set_font_face
cairo_text_extents
cairo_glyph_extents
cairo_text_path
cairo_glyph_path
-cairo_font_reference
-cairo_font_destroy
-cairo_font_extents
-cairo_font_glyph_extents
-cairo_show_surface
+cairo_get_operator
+cairo_get_source
+cairo_get_tolerance
+cairo_get_current_point
+cairo_get_fill_rule
+cairo_get_line_width
+cairo_get_line_cap
+cairo_get_line_join
+cairo_get_miter_limit
+cairo_get_matrix
+cairo_get_target
+cairo_copy_path
+cairo_copy_path_flat
+cairo_append_path
+cairo_path_data_type_t
+cairo_path_data_t
+cairo_path_t
+cairo_path_destroy
+cairo_status_t
+cairo_status
+cairo_status_string
+cairo_status_to_string
+cairo_error_notify_func_t
+cairo_set_error_notify
+cairo_filter_t
+cairo_image_surface_create
+cairo_image_surface_create_for_data
+cairo_image_surface_get_width
+cairo_image_surface_get_height
+cairo_destroy_func_t
+cairo_user_data_key_t
+cairo_read_func_t
+cairo_write_func_t
+<SUBSECTION Private>
+CAIRO_BEGIN_DECLS
+CAIRO_END_DECLS
+cairo_current_font_extents
+cairo_get_font_extents
cairo_current_operator
-cairo_current_rgb_color
-cairo_current_pattern
-cairo_current_alpha
cairo_current_tolerance
cairo_current_point
cairo_current_fill_rule
@@ -223,29 +281,54 @@ cairo_current_line_join
cairo_current_miter_limit
cairo_current_matrix
cairo_current_target_surface
-cairo_current_path
-cairo_current_path_flat
-cairo_status_t
-cairo_status
-cairo_status_string
-cairo_filter_t
-cairo_image_surface_create
-cairo_image_surface_create_for_data
-<SUBSECTION Private>
-CAIRO_BEGIN_DECLS
-CAIRO_END_DECLS
-cairo_get_operator
-cairo_get_rgb_color
-cairo_get_alpha
-cairo_get_tolerance
-cairo_get_current_point
-cairo_get_fill_rule
-cairo_get_line_width
-cairo_get_line_cap
-cairo_get_line_join
-cairo_get_miter_limit
-cairo_get_matrix
-cairo_get_target_surface
cairo_get_status
cairo_get_status_string
+cairo_concat_matrix
+cairo_scale_font
+cairo_select_font
+cairo_transform_font
+cairo_transform_point
+cairo_transform_distance
+cairo_inverse_transform_point
+cairo_inverse_transform_distance
+cairo_init_clip
+cairo_surface_create_for_image
+cairo_default_matrix
+cairo_matrix_set_affine
+cairo_matrix_set_identity
+cairo_pattern_add_color_stop
+cairo_set_rgb_color
+cairo_set_pattern
+cairo_xlib_surface_create_for_pixmap_with_visual
+cairo_xlib_surface_create_for_window_with_visual
+cairo_xcb_surface_create_for_pixmap_with_visual
+cairo_xcb_surface_create_for_window_with_visual
+cairo_current_path
+cairo_current_path_flat
+cairo_get_path
+cairo_get_path_flat
+cairo_set_alpha
+cairo_show_surface
+cairo_copy
+cairo_surface_set_repeat
+cairo_surface_set_matrix
+cairo_surface_get_matrix
+cairo_surface_set_filter
+cairo_surface_get_filter
+cairo_matrix_create
+cairo_matrix_destroy
+cairo_matrix_copy
+cairo_matrix_set_identity
+cairo_matrix_set_affine
+cairo_matrix_get_affine
+cairo_set_target_surface
+cairo_set_target_glitz
+cairo_set_target_image
+cairo_set_target_pdf
+cairo_set_target_png
+cairo_set_target_ps
+cairo_set_target_quartz
+cairo_set_target_win32
+cairo_set_target_xcb
+cairo_set_target_drawable
</SECTION>
diff --git a/doc/public/html/bindings-errors.html b/doc/public/html/bindings-errors.html
new file mode 100644
index 0000000..9dd83ed
--- /dev/null
+++ b/doc/public/html/bindings-errors.html
@@ -0,0 +1,127 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Error handling</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-streams.html" title="Streams and File I/O">
+<link rel="next" href="bindings-patterns.html" title="Patterns">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-streams.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-patterns.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-errors"></a>Error handling</h2></div></div>
+<div></div>
+</div>
+<p>
+ The error handling approach in C for Cairo has multiple
+ elements:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li><p>
+ When a method on an object fails, the object is put into
+ an error state. Subsequent operations on the object do
+ nothing. The status of the object can be queried with
+ a function like <a href="cairo-cairo-t.html#cairo-status"><tt class="function">status()</tt></a>.
+ </p></li>
+<li>
+<p>
+ Constructors, rather than
+ returning<tt class="constant">NULL</tt> on out-of-memory failure,
+ return a special singleton object on which all
+ operations do nothing. Retrieving the status of the
+ singleton object returns <tt class="constant">CAIRO_STATUS_NO_MEMORY</tt>
+ </p>
+<i><span class="remark">
+ Is this going to apply to
+ <span class="type">cairo_surface_t</span> as well?
+ </span></i><i><span class="remark">
+ What about cairo_copy_path_data()? It's probably going to
+ have to return <tt class="constant">NULL</tt>.
+ </span></i>
+</li>
+<li><p>
+ Errors propagate from object to object. Setting a pattern
+ in an out-of-memory state as the source of a
+ <span class="type">cairo_t</span> puts the type into an error state.
+ </p></li>
+</ul></div>
+<i><span class="remark">Much of the above is not yet implemented at the time of
+ this writing</span></i><p>
+ A language binding could copy the C approach, and for a
+ language without exceptions, this is likely the right thing
+ to do. However, for a language with exceptions, exposing
+ a completely different style of error handling for cairo
+ would be strange. So, instead, status should be checked
+ after every call to cairo, and exceptions thrown as necessary.
+ </p>
+<p>
+ One problem that can arise with this, in languages
+ where handling exceptions is mandatory (like Java), is that almost
+ every cairo function can result in a status being set,
+ usually because of an out-of-memory condition. This could make
+ cairo hard to use. To resolve this problem, let's classify then
+ cairo status codes:
+ </p>
+<pre class="programlisting">
+/* Memory */
+CAIRO_STATUS_NO_MEMORY,
+
+/* Programmer error */
+CAIRO_STATUS_INVALID_RESTORE
+CAIRO_STATUS_INVALID_POP_GROUP
+CAIRO_STATUS_NO_CURRENT_POINT
+CAIRO_STATUS_INVALID_MATRIX
+CAIRO_STATUS_NO_TARGET_SURFACE
+CAIRO_STATUS_INVALID_STRING
+CAIRO_STATUS_SURFACE_FINISHED
+CAIRO_STATUS_BAD_NESTING
+
+/* Language binding implementation */
+CAIRO_STATUS_NULL_POINTER
+CAIRO_STATUS_INVALID_PATH_DATA
+CAIRO_STATUS_SURFACE_TYPE_MISMATCH
+
+/* Other */
+CAIRO_STATUS_READ_ERROR
+CAIRO_STATUS_WRITE_ERROR
+</pre>
+<p>
+ If we look at these, the
+ <tt class="constant">CAIRO_STATUS_NO_MEMORY</tt>
+ should map to the native out-of-memory exception, which could
+ happen at any point in any case. Most of the others indicate
+ programmer error, and handling them in user code would be
+ silly. These should be mapped into whatever the language uses
+ for assertion failures, rather than errors that are normally
+ handled. (In Java, a subclass of Error rather than Exception,
+ perhaps.) And <tt class="constant">CAIRO_STATUS_READ_ERROR</tt>,
+ and <tt class="constant">CAIRO_STATUS_WRITE_ERROR</tt> can occur
+ only in very specific places. (In fact, as described
+ in <a href="bindings-streams.html" title="Streams and File I/O">the section called &#8220;Streams and File I/O&#8221;</a>, these errors may be
+ mapped into the language's native I/O error types.)
+ So, there really aren't exceptions that the programmer must
+ handle at most points in the Cairo API.
+ </p>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-streams.html"><b>&lt;&lt;&#160;Streams and File I/O</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-patterns.html"><b>Patterns&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-fonts.html b/doc/public/html/bindings-fonts.html
new file mode 100644
index 0000000..45ed7a7
--- /dev/null
+++ b/doc/public/html/bindings-fonts.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Fonts</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-surfaces.html" title="Surfaces">
+<link rel="next" href="bindings-path.html" title="cairo_path_t">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-surfaces.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-path.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-fonts"></a>Fonts</h2></div></div>
+<div></div>
+</div>
+<p>
+ Fonts are once more an area where there is a hierarchy of types:
+ </p>
+<pre class="programlisting">
+cairo_font_face_t
+ cairo_ft_font_face_t
+ cairo_win32_font_face_t
+cairo_scaled_font_t
+ cairo_ft_scaled_font_t
+ cairo_win32_scaled_font_t
+</pre>
+<p>
+ The methods on the subtypes are, however, not useful without
+ bindings for fontconfig and FreeType or for the Win32 GDI,
+ so most language bindings will choose not to bind these
+ types.
+ </p>
+<p>
+ The <a href="cairo-Fonts.html#cairo-font-face-set-user-data"><tt class="function">cairo_font_face_set_user_data()</tt></a>,
+ and <a href="cairo-Fonts.html#cairo-font-face-get-user-data"><tt class="function">cairo_font_face_get_user_data()</tt></a>
+ methods are provided for use in language bindings, and should
+ not be directly exposed to applications.
+ </p>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-surfaces.html"><b>&lt;&lt;&#160;Surfaces</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-path.html"><b>cairo_path_t&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-memory.html b/doc/public/html/bindings-memory.html
new file mode 100644
index 0000000..8d820c4
--- /dev/null
+++ b/doc/public/html/bindings-memory.html
@@ -0,0 +1,130 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Memory Management</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="next" href="bindings-return-values.html" title="Multiple return values">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="language-bindings.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-return-values.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-memory"></a>Memory Management</h2></div></div>
+<div></div>
+</div>
+<p>
+ The objects in cairo can roughly be divided into two types:
+ refcounted opaque types like
+ <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
+ and plain structures like
+ <a href="cairo-cairo-t.html#cairo-glyph-t"><span class="type">cairo_glyph_t</span></a>.
+ <a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a>
+ and
+ <span class="type">cairo_path_data_t</span>
+ are special cases and are treated separately in this appendix.
+ </p>
+<p>
+ Refcounted opaque types all have a
+ <tt class="function">..._reference()</tt>
+ function to increase the refcount by one and a
+ <tt class="function">..._destroy()</tt> to decrease the refcount
+ by one. These should not be exposed to the user of the language
+ binding, but rather used to implement memory management within
+ the language binding. The simplest way to do memory management
+ for a language binding is to treat the language binding object
+ as a simple handle to the cairo object. The language binding
+ object references the cairo object, and unreferences it when
+ finalized. This is the recommended method, though there are
+ a couple of caveats to be noted:
+ </p>
+<div class="itemizedlist"><ul type="disc">
+<li><p>
+ Equality won't work as expected. You can have two language
+ objects for the same cairo and they won't necessarily
+ compare equal. If the language allows customizing the
+ equality operation, then this is fixable by comparing
+ the underlying pointers. It also can be fixed by creating
+ at most one language object per cairo object, and
+ uniquifying via a <i class="firstterm">pin table</i> (a hash
+ table that goes from cairo object to language object).
+ For <span class="type">cairo_surface_t</span> you can use also
+ <a href="cairo-cairo-surface-t.html#cairo-surface-set-user-data"><tt class="function">cairo_surface_set_user_data()</tt></a>
+ instead of a separate pin table.
+ </p></li>
+<li>
+<p>
+ Derivation from the language object doesn't work because
+ you can lose the language object while keeping the Cairo
+ object. Code like:
+ </p>
+<pre class="programlisting">
+public class MySurface (ImageSurface) {
+ public MySurface (width, height) {
+ super (Format.ARGB32, width, height);
+ }
+ public int get42 () {
+ return 42;
+ }
+}
+
+ cr = Cairo(MySurface(width, height));
+ surface = cr.getTarget();
+</pre>
+<p>
+ Can result in <tt class="varname">surface</tt> containing an
+ <tt class="classname">ImageSurface</tt> not a <tt class="classname">MySurface</tt>.
+ This is not easily fixable without creating memory leaks,
+ and it's probably best to simply forbid deriving from the
+ language objects.
+ </p>
+</li>
+</ul></div>
+<p>
+ When a plain structure is used as a return value from cairo,
+ this is done by passing it as a &#8220;out parameter&#8221;.
+ </p>
+<pre class="programlisting">
+cairo_font_extents_t extents;
+
+cairo_font_extents (cr, &amp;extents);</pre>
+<p>
+ In a language binding, this should typically be treated
+ as a return value:
+ </p>
+<pre class="programlisting">
+FontExtents extents = cr.fontExtents ();</pre>
+<p>
+ A language binding has a choice in how it implements the
+ language objects for plain structures. It can use a pure
+ language object with fields corresponding to those of the C
+ structure, and convert from and to the C structure when calling
+ cairo functions or converting cairo return values. Or it
+ can keep a pointer to the C structure internally and wrap
+ it inside a language object much like occurs for refcounted
+ objects. The choice should be invisible to the user: they should
+ be able to imagine that it is implemented as a pure language
+ object.
+ </p>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="language-bindings.html"><b>&lt;&lt;&#160;Appendix&#160;A.&#160;Creating a language binding for cairo</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-return-values.html"><b>Multiple return values&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-overloading.html b/doc/public/html/bindings-overloading.html
new file mode 100644
index 0000000..fb7ccd3
--- /dev/null
+++ b/doc/public/html/bindings-overloading.html
@@ -0,0 +1,128 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Overloading and optional arguments</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-return-values.html" title="Multiple return values">
+<link rel="next" href="bindings-streams.html" title="Streams and File I/O">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-return-values.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-streams.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-overloading"></a>Overloading and optional arguments</h2></div></div>
+<div></div>
+</div>
+<p>
+ Function overloading (having a several variants of a function
+ with the same name and different arguments) is a language
+ feature available in many languages but not in C.
+ </p>
+<p>
+ In general, language binding authors should use restraint in
+ combining functions in the cairo API via function
+ overloading. What may seem like an obvious overload now may
+ turn out to be strange with future additions to cairo.
+ It might seem logical to make
+ <a href="cairo-cairo-t.html#cairo-set-source-rgb"><tt class="function">cairo_set_source_rgb()</tt></a>
+ an overload of <tt class="function">cairo_set_source()</tt>, but future plans to add
+ <tt class="function">cairo_set_source_rgb_premultiplied()</tt>,
+ which will also take three doubles make this a bad idea. For
+ this reason, only the following pairs of functions should
+ be combined via overloading
+ </p>
+<pre class="programlisting">
+void
+cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
+
+void
+cairo_set_source_surface (cairo_t *cr,
+ cairo_surface_t *source,
+ double surface_x,
+ double surface_y);
+
+void
+cairo_mask (cairo_t *cr,
+ cairo_pattern_t *pattern);
+
+void
+cairo_mask_surface (cairo_t *cr,
+ cairo_surface_t *surface,
+ double surface_x,
+ double surface_y);
+
+cairo_surface_t *
+cairo_image_surface_create (cairo_format_t format,
+ int width,
+ int height);
+cairo_surface_t *
+cairo_image_surface_create_for_data (unsigned char *data,
+ cairo_format_t format,
+ int width,
+ int height,
+ int stride);
+
+cairo_status_t
+cairo_surface_write_to_png (cairo_surface_t *surface,
+ const char *filename);
+
+cairo_status_t
+cairo_surface_write_to_png_stream (cairo_surface_t *surface,
+ cairo_write_func_t write_func,
+ void *closure);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png (const char *filename);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ void *closure);
+ </pre>
+<p>
+ Note that there are cases where all constructors for a type
+ aren't overloaded together. For example
+ <a href="cairo-PNG-Backend.html#cairo-image-surface-create-from-png"><tt class="function">cairo_image_surface_create_from_png()</tt></a>
+ should <span class="emphasis"><em>not</em></span> be overloaded together with
+ <a href="cairo-cairo-t.html#cairo-image-surface-create"><tt class="function">cairo_image_surface_create()</tt></a>.
+ In such cases, the remaining constructors will typically need to
+ be bound as static methods. In Java, for example, we might have:
+ </p>
+<pre class="programlisting">
+Surface surface1 = ImageSurface(Format.RGB24, 100, 100);
+Surface surface2 = ImageSurface.createFromPNG("camera.png");</pre>
+<p>
+ Some other overloads that add combinations not found in C may be
+ convenient for users for language bindings that provide
+ <span class="type">cairo_point_t</span> and <span class="type">cairo_rectangle_t</span>
+ types, for example:
+ </p>
+<pre class="programlisting">
+void
+cairo_move_to (cairo_t *cr,
+ cairo_point_t *point);
+void
+cairo_rectangle (cairo_t *cr,
+ cairo_rectangle_t *rectangle);
+ </pre>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-return-values.html"><b>&lt;&lt;&#160;Multiple return values</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-streams.html"><b>Streams and File I/O&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-path.html b/doc/public/html/bindings-path.html
new file mode 100644
index 0000000..592e38a
--- /dev/null
+++ b/doc/public/html/bindings-path.html
@@ -0,0 +1,123 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>cairo_path_t</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-fonts.html" title="Fonts">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-path"></a>cairo_path_t</h2></div></div>
+<div></div>
+</div>
+<p>
+ The <a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a> type is one
+ area in which most language bindings will differ significantly
+ from the C API. The C API for <span class="type">cairo_path_t</span> is
+ designed for efficiency and to avoid auxiliary objects that
+ would be have to be manually memory managed by the
+ application. However,
+ a language binding should not present <span class="type">cairo_path_t</span> as an
+ array, but rather as an opaque that can be iterated
+ over. Different languages have quite different conventions for
+ how iterators work, so it is impossible to give an exact
+ specification for how this API should work, but the type names
+ and methods should be similar to the language's mapping of the following:
+ </p>
+<pre class="programlisting">
+typedef struct cairo_path_iterator cairo_path_iterator_t;
+typedef struct cairo_path_element cairo_path_element_t;
+
+cairo_path_iterator_t *
+cairo_path_get_iterator (cairo_path_t *path);
+
+cairo_bool_t
+cairo_path_iterator_has_next (cairo_path_iterator_t *iterator);
+
+cairo_path_element_t *
+cairo_path_iterator_next (cairo_path_iterator_t *iterator);
+
+cairo_path_element_type_t
+cairo_path_element_get_type (cairo_path_element_t *element);
+
+void
+cairo_path_element_get_point (cairo_path_element_t *element,
+ int index,
+ double *x,
+ double *y);
+ </pre>
+<p>
+ The above is written using the Java conventions for
+ iterators. To illustrate how the API for PathIterator might
+ depend on the native iteration conventions of the API, examine
+ three versions of the loop, first written in a hypothetical Java
+ binding:
+ </p>
+<pre class="programlisting">
+PathIterator iter = cr.copyPath().iterator();
+while (cr.hasNext()) {
+ PathElement element = iter.next();
+ if (element.getType() == PathElementType.MOVE_TO) {
+ Point p = element.getPoint(0);
+ doMoveTo (p.x, p.y);
+ }
+}</pre>
+<p>
+ And then in a hypothetical C++ binding:
+ </p>
+<pre class="programlisting">
+Path path = cr.copyPath();
+for (PathIterator iter = path.begin(); iter != path.end(); iter++) {
+ PathElement element = *iter;
+ if (element.getType() == PathElementType.MOVE_TO) {
+ Point p = element.getPoint(0);
+ doMoveTo (p.x, p.y);
+ }
+}</pre>
+<p>
+ And then finally in a Python binding:
+ </p>
+<pre class="programlisting">
+for element in cr.copy_path():
+ if element.getType == cairo.PATH_ELEMENT_MOVE_TO:
+ (x, y) = element.getPoint(0)
+ doMoveTo (x, y);</pre>
+<p>
+ While many of the API elements stay the same in the three
+ examples, the exact iteration mechanism is quite different, to
+ match how users of the language would expect to iterate over
+ a container.
+ </p>
+<p>
+ You should not present an API for mutating or for creating new
+ <span class="type">cairo_path_t</span> objects. In the future, these
+ guidelines may be extended to present an API for creating a
+ <span class="type">cairo_path_t</span> from scratch for use with
+ <a href="cairo-cairo-t.html#cairo-append-path"><tt class="function">cairo_append_path()</tt></a>
+ but the current expectation is that <tt class="function">cairo_append_path()</tt> will
+ mostly be used with paths from
+ <a href="cairo-cairo-t.html#cairo-append-path"><tt class="function">cairo_copy_path()</tt></a>.
+ </p>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-fonts.html"><b>&lt;&lt;&#160;Fonts</b></a></td>
+<td align="right"></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-patterns.html b/doc/public/html/bindings-patterns.html
new file mode 100644
index 0000000..f55c3a8
--- /dev/null
+++ b/doc/public/html/bindings-patterns.html
@@ -0,0 +1,64 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Patterns</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-errors.html" title="Error handling">
+<link rel="next" href="bindings-surfaces.html" title="Surfaces">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-errors.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-surfaces.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-patterns"></a>Patterns</h2></div></div>
+<div></div>
+</div>
+<p>
+ The cairo C API allows for creating a number of different types
+ of patterns. All of these different types of patterns map to
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
+ in C, but in an object oriented language, there should instead
+ be a hierarchy of types. (The functions that should map to
+ constructors for the various types are listed after the type,
+ methods on that type are listed below)
+ </p>
+<pre class="programlisting">
+cairo_pattern_t
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix"><tt class="function">cairo_pattern_set_matrix()</tt></a>
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix"><tt class="function">cairo_pattern_get_matrix()</tt></a>
+ cairo_solid_pattern_t
+ cairo_surface_pattern_t (<a href="cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface"><tt class="function">cairo_pattern_create_for_surface()</tt></a>)
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-extend"><tt class="function">cairo_pattern_set_extend()</tt></a>
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-extend"><tt class="function">cairo_pattern_get_extend()</tt></a>
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-filter"><tt class="function">cairo_pattern_set_filter()</tt></a>
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-filter"><tt class="function">cairo_pattern_get_filter()</tt></a>
+ cairo_gradient_t
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"><tt class="function">cairo_pattern_add_color_stop_rgb()</tt></a>
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"><tt class="function">cairo_pattern_add_color_stop_rgba()</tt></a>
+ cairo_linear_gradient_t (<a href="cairo-cairo-pattern-t.html#cairo-pattern-create-linear"><tt class="function">cairo_pattern_create_linear()</tt></a>)
+ cairo_radial_gradient_t (<a href="cairo-cairo-pattern-t.html#cairo-pattern-create-radial"><tt class="function">cairo_pattern_create_radial()</tt></a>)
+ </pre>
+<p>
+ </p>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-errors.html"><b>&lt;&lt;&#160;Error handling</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-surfaces.html"><b>Surfaces&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-return-values.html b/doc/public/html/bindings-return-values.html
new file mode 100644
index 0000000..9ae514f
--- /dev/null
+++ b/doc/public/html/bindings-return-values.html
@@ -0,0 +1,126 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Multiple return values</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-memory.html" title="Memory Management">
+<link rel="next" href="bindings-overloading.html" title="Overloading and optional arguments">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-memory.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-overloading.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-return-values"></a>Multiple return values</h2></div></div>
+<div></div>
+</div>
+<p>
+ There are a number of functions in the cairo API that have
+ multiple <i class="firstterm">out parameters</i> or
+ <i class="firstterm">in-out parameters</i>. In some languages
+ these can be translated into multiple return values. In Python,
+ what is:
+ </p>
+<pre class="programlisting">
+cairo_user_to_device (cr, &amp;x, &amp;y);</pre>
+<p>
+ can by mapped to:
+ </p>
+<pre class="programlisting">
+(x, y) = cr.user_to_device (cr, x, y);</pre>
+<p>
+ but many languages don't have provisions for multiple return
+ values, so it is necessary to introduce auxiliary types.
+ Most of the functions that require the auxiliary types
+ require a type that would, in C, look like
+ </p>
+<pre class="programlisting">
+typedef struct _cairo_point cairo_point_t;
+struct _cairo_point {
+ double x;
+ double y;
+}</pre>
+<p>
+ The same type should be used both for functions that use a pair
+ of coordinates as an absolute position, and functions that use
+ a pair of coordinates as a displacement. While an argument could
+ be made that having a separate &#8220;distance&#8221; type is more correct,
+ it is more likely just to confuse users.
+ </p>
+<pre class="programlisting">
+void
+cairo_user_to_device (cairo_t *cr, double *x, double *y);
+
+void
+cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
+
+void
+cairo_device_to_user (cairo_t *cr, double *x, double *y);
+
+void
+cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
+
+void
+cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy);
+
+void
+cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y);
+
+void
+cairo_get_current_point (cairo_t *cr, double *x, double *y);
+ </pre>
+<p>
+ There are also a couple of functions that return four values
+ representing a rectangle. These should be mapped to a
+ &#8220;rectangle&#8221; type that looks like:
+ </p>
+<pre class="programlisting">
+typedef struct _cairo_rectangle cairo_rectangle_t;
+struct _cairo_rectangle {
+ double x;
+ double y;
+ double width;
+ double height;
+}</pre>
+<p>
+ The C function returns the rectangle as a set of two points to
+ facilitate rounding to integral extents, but this isn't worth
+ adding a &#8220;box&#8221; type to go along with the more obvious
+ &#8220;rectangle&#8221; representation.
+ </p>
+<i><span class="remark">
+ Q: Would it make sense here to define a standard
+ <tt class="function">cairo_rectangle_round()</tt> method
+ that language bindings should map?
+ </span></i><pre class="programlisting">
+void
+cairo_stroke_extents (cairo_t *cr,
+ double *x1, double *y1,
+ double *x2, double *y2);
+
+void
+cairo_fill_extents (cairo_t *cr,
+ double *x1, double *y1,
+ double *x2, double *y2);
+ </pre>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-memory.html"><b>&lt;&lt;&#160;Memory Management</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-overloading.html"><b>Overloading and optional arguments&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-streams.html b/doc/public/html/bindings-streams.html
new file mode 100644
index 0000000..4001c16
--- /dev/null
+++ b/doc/public/html/bindings-streams.html
@@ -0,0 +1,99 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Streams and File I/O</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-overloading.html" title="Overloading and optional arguments">
+<link rel="next" href="bindings-errors.html" title="Error handling">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-overloading.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-errors.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-streams"></a>Streams and File I/O</h2></div></div>
+<div></div>
+</div>
+<p>
+ Various places in the cairo API deal with reading and writing
+ data, whether from and to files, or to other sources and
+ destinations. In these cases, what is typically provided in the
+ C API is a simple version that just takes a filename, and a
+ complex version that takes a callback function.
+ An example is the PNG handling functions:
+ </p>
+<pre class="programlisting">
+cairo_surface_t *
+cairo_image_surface_create_from_png (const char *filename);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ void *closure);
+
+cairo_status_t
+cairo_surface_write_to_png (cairo_surface_t *surface,
+ const char *filename);
+
+cairo_status_t
+cairo_surface_write_to_png_stream (cairo_surface_t *surface,
+ cairo_write_func_t write_func,
+ void *closure);</pre>
+<p>
+ The expectation is that the filename version will be mapped
+ literally in the language binding, but the callback version
+ will be mapped to a version that takes a language stream
+ object. For example, in Java, the four functions above
+ might be mapped to:
+ </p>
+<pre class="programlisting">
+static public ImageSurface createFromPNG (String filename) throws IOException;
+static public ImageSurface createFromPNG (InputStream stream) throws IOException;
+public void writeToPNG (String filename) throws IOException;
+public void writeToPNG (OutputStream stream) throws IOException;
+</pre>
+<p>
+ In many cases, it will be better to
+ implement the filename version internally
+ using the stream version, rather than building it on top of the
+ filename version in C. The reason for this is that will
+ naturally give a more standard handling of file errors for
+ the language, as seen in the above Java example, where
+ <tt class="methodname">createFromPNG()</tt> is marked as raising
+ an exception. Propagating exceptions from inside the callback
+ function to the caller will pose a challenge to the language
+ binding implementor, since an exception must not propagate
+ through the Cairo code. A technique that will be useful in
+ some cases is to catch the exception in the callback,
+ store the exception object inside a structure pointed to by
+ <i class="parameter"><tt>closure</tt></i>, and then rethrow it once
+ the function returns.
+ </p>
+<i><span class="remark">
+ I'm not sure how to handle this for
+ <tt class="function">cairo_pdf_surface_create_for_callback()</tt>.
+ Other than keep a &#8220;exception to rethrow&#8221; thread-specific
+ variable
+ that is checked after <span class="emphasis"><em>every</em></span> call to a Cairo
+ function.
+ </span></i>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-overloading.html"><b>&lt;&lt;&#160;Overloading and optional arguments</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-errors.html"><b>Error handling&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/bindings-surfaces.html b/doc/public/html/bindings-surfaces.html
new file mode 100644
index 0000000..17def5f
--- /dev/null
+++ b/doc/public/html/bindings-surfaces.html
@@ -0,0 +1,99 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Surfaces</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<link rel="previous" href="bindings-patterns.html" title="Patterns">
+<link rel="next" href="bindings-fonts.html" title="Fonts">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="bindings-patterns.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="language-bindings.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-surfaces"></a>Surfaces</h2></div></div>
+<div></div>
+</div>
+<p>
+ Like patterns, surfaces, which use only the
+ <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
+ type in the C API should be broken up into a heirarchy of types
+ in a language binding.
+ </p>
+<pre class="programlisting">
+cairo_surface_t
+ cairo_image_surface_t
+ cairo_atsui_surface_t
+ cairo_win32_surface_t
+ cairo_xlib_surface_t
+ </pre>
+<p>
+ Unlike patterns, the constructors and methods on these types are
+ clearly named, and can be trivially associated with the
+ appropriate subtype. Many language bindings will want to avoid
+ binding the platform-specific subtypes at all, since the
+ methods on these types are not useful without passing in native
+ C types. Unless there is a language binding for Xlib available,
+ there is no way to represent a XLib <span class="type">Display</span> * in
+ that language.
+ </p>
+<p>
+ This doesn't mean that platform-specific surface types can't
+ be used in a language binding that doesn't bind the constructor.
+ A very common situation is to use a cairo language binding in
+ combination with a binding for a higher level system like
+ the <a href="http://www.gtk.org/" target="_top">GTK+</a> widget
+ toolkit. In such a situation, the higher level toolkit provides
+ ways to get references to platform specific surfaces.
+ </p>
+<p>
+ The <a href="cairo-cairo-surface-t.html#cairo-surface-set-user-data"><tt class="function">cairo_surface_set_user_data()</tt></a>,
+ and <a href="cairo-cairo-surface-t.html#cairo-surface-get-user-data"><tt class="function">cairo_surface_get_user_data()</tt></a>
+ methods are provided for use in language bindings, and should
+ not be directly exposed to applications. One example of the use
+ of these functions in a language binding is creating a binding for:
+ </p>
+<pre class="programlisting">
+cairo_surface_t *
+<a href="cairo-cairo-t.html#cairo-image-surface-create-for-data"><tt class="function">cairo_image_surface_create_for_data</tt></a> (unsigned char *data,
+ cairo_format_t format,
+ int width,
+ int height,
+ int stride);
+</pre>
+<p>
+ The memory block passed in for <i class="parameter"><tt>data</tt></i> must be
+ kept around until the surface is destroyed, so the language
+ binding must have some way of determining when that happens. The
+ way to do this is to use the <i class="parameter"><tt>destroy</tt></i>
+ argument to <tt class="function">cairo_surface_set_user_data()</tt>.
+ </p>
+<i><span class="remark">
+ Some languages may not have a suitable &#8220;pointer to a block of
+ data&#8221; type to pass in for <i class="parameter"><tt>data</tt></i>. And even
+ where a language does have such a type, the user will be
+ frequently able to cause the backing store to be reallocated
+ to a different location or truncated. Should we recommend a
+ standard type name and binding for a buffer object here?
+ </span></i>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="bindings-patterns.html"><b>&lt;&lt;&#160;Patterns</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-fonts.html"><b>Fonts&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-ATSUI-Fonts.html b/doc/public/html/cairo-ATSUI-Fonts.html
index 50af682..a4a51e3 100644
--- a/doc/public/html/cairo-ATSUI-Fonts.html
+++ b/doc/public/html/cairo-ATSUI-Fonts.html
@@ -1,14 +1,60 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>ATSUI Fonts</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-cairo-matrix-t.html" title="cairo_matrix_t"><link rel="next" href="cairo-FreeType-Fonts.html" title="FreeType Fonts"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-cairo-matrix-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-FreeType-Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-ATSUI-Fonts"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">ATSUI Fonts</span></h2><p>ATSUI Fonts &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>ATSUI Fonts</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-Fonts.html" title="Fonts">
+<link rel="next" href="cairo-FreeType-Fonts.html" title="FreeType Fonts">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-Fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-FreeType-Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-ATSUI-Fonts"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">ATSUI Fonts</span></h2>
+<p>ATSUI Fonts &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* <a href="cairo-ATSUI-Fonts.html#cairo-atsui-font-create">cairo_atsui_font_create</a> (ATSUStyle style);
-</pre></div><div class="refsect1" lang="en"><a name="id2707012"></a><h2>Description</h2><p>
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2967419"></a><h2>Description</h2>
+<p>
-</p></div><div class="refsect1" lang="en"><a name="id2698366"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2714083"></a><h3><a name="cairo-atsui-font-create"></a>cairo_atsui_font_create ()</h3><a class="indexterm" name="id2716792"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* cairo_atsui_font_create (ATSUStyle style);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>style</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-cairo-matrix-t.html"><b>&lt;&lt;cairo_matrix_t</b></a></td><td align="right"><a accesskey="n" href="cairo-FreeType-Fonts.html"><b>FreeType Fonts&gt;&gt;</b></a></td></tr></table></body></html>
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2951233"></a><h2>Details</h2>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-Fonts.html"><b>&lt;&lt;&#160;Fonts</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-FreeType-Fonts.html"><b>FreeType Fonts&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-Fonts.html b/doc/public/html/cairo-Fonts.html
new file mode 100644
index 0000000..01c2fb1
--- /dev/null
+++ b/doc/public/html/cairo-Fonts.html
@@ -0,0 +1,590 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Fonts</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-cairo-matrix-t.html" title="cairo_matrix_t">
+<link rel="next" href="cairo-ATSUI-Fonts.html" title="ATSUI Fonts">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-cairo-matrix-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-ATSUI-Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-Fonts"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">Fonts</span></h2>
+<p>Fonts &#8212; Font Handling</p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
+
+
+
+typedef <a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>;
+typedef <a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>;
+void <a href="cairo-Fonts.html#cairo-font-face-reference">cairo_font_face_reference</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);
+void <a href="cairo-Fonts.html#cairo-font-face-destroy">cairo_font_face_destroy</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);
+void* <a href="cairo-Fonts.html#cairo-font-face-get-user-data">cairo_font_face_get_user_data</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key);
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Fonts.html#cairo-font-face-set-user-data">cairo_font_face_set_user_data</a>
+ (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key,
+ void *user_data,
+ <a href="cairo-cairo-t.html#cairo-destroy-func-t">cairo_destroy_func_t</a> destroy);
+<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>* <a href="cairo-Fonts.html#cairo-scaled-font-create">cairo_scaled_font_create</a>
+ (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *ctm);
+void <a href="cairo-Fonts.html#cairo-scaled-font-reference">cairo_scaled_font_reference</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
+void <a href="cairo-Fonts.html#cairo-scaled-font-destroy">cairo_scaled_font_destroy</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
+ <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a>;
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Fonts.html#cairo-scaled-font-extents">cairo_scaled_font_extents</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font,
+ <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a>;
+void <a href="cairo-Fonts.html#cairo-scaled-font-glyph-extents">cairo_scaled_font_glyph_extents</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font,
+ <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
+ int num_glyphs,
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2954869"></a><h2>Description</h2>
+<p>
+
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2954880"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2954886"></a><h3>
+<a name="cairo-font-face-t"></a>cairo_font_face_t</h3>
+<a class="indexterm" name="id2954896"></a><pre class="programlisting">typedef struct _cairo_font_face cairo_font_face_t;
+</pre>
+<p>
+A <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a> specifies all aspects of a font other
+than the size or font matrix (a font matrix is used to distort
+a font by sheering it or scaling it unequally in the two
+directions) . A font face can be set on a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> by using
+<a href="cairo-cairo-t.html#cairo-set-font-face"><tt class="function">cairo_set_font_face()</tt></a>; the size and font matrix are set with
+<a href="cairo-cairo-t.html#cairo-set-font-size"><tt class="function">cairo_set_font_size()</tt></a> and <a href="cairo-cairo-t.html#cairo-set-font-matrix"><tt class="function">cairo_set_font_matrix()</tt></a>.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2930972"></a><h3>
+<a name="cairo-scaled-font-t"></a>cairo_scaled_font_t</h3>
+<a class="indexterm" name="id2930982"></a><pre class="programlisting">typedef struct _cairo_scaled_font cairo_scaled_font_t;
+</pre>
+<p>
+A <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> is a font scaled to a particular size and device
+resolution. A cairo_scaled_font_t is most useful for low-level font
+usage where a library or application wants to cache a reference
+to a scaled font to speed up the computation of metrics.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2931013"></a><h3>
+<a name="cairo-font-face-reference"></a>cairo_font_face_reference ()</h3>
+<a class="indexterm" name="id2931022"></a><pre class="programlisting">void cairo_font_face_reference (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre>
+<p>
+Increases the reference count on <i class="parameter"><tt>font_face</tt></i> by one. This prevents
+<i class="parameter"><tt>font_face</tt></i> from being destroyed until a matching call to
+<a href="cairo-Fonts.html#cairo-font-face-destroy"><tt class="function">cairo_font_face_destroy()</tt></a> is made.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_face</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>, (may be NULL in which case this
+function does nothing).
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2931100"></a><h3>
+<a name="cairo-font-face-destroy"></a>cairo_font_face_destroy ()</h3>
+<a class="indexterm" name="id2931109"></a><pre class="programlisting">void cairo_font_face_destroy (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre>
+<p>
+Decreases the reference count on <i class="parameter"><tt>font_face</tt></i> by one. If the result
+is zero, then <i class="parameter"><tt>font_face</tt></i> and all associated resources are freed.
+See <a href="cairo-Fonts.html#cairo-font-face-reference"><tt class="function">cairo_font_face_reference()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_face</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2931186"></a><h3>
+<a name="cairo-font-face-get-user-data"></a>cairo_font_face_get_user_data ()</h3>
+<a class="indexterm" name="id2931196"></a><pre class="programlisting">void* cairo_font_face_get_user_data (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key);</pre>
+<p>
+Return user data previously attached to <i class="parameter"><tt>font_face</tt></i> using the specified
+key. If no user data has been attached with the given key this
+function returns <tt class="literal">NULL</tt>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_face</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>key</tt></i>&#160;:</span></td>
+<td> the address of the <a href="cairo-cairo-t.html#cairo-user-data-key-t"><span class="type">cairo_user_data_key_t</span></a> the user data was
+attached to
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the user data previously attached or <tt class="literal">NULL</tt>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2931311"></a><h3>
+<a name="cairo-font-face-set-user-data"></a>cairo_font_face_set_user_data ()</h3>
+<a class="indexterm" name="id2931322"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_face_set_user_data
+ (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key,
+ void *user_data,
+ <a href="cairo-cairo-t.html#cairo-destroy-func-t">cairo_destroy_func_t</a> destroy);</pre>
+<p>
+Attach user data to <i class="parameter"><tt>font_face</tt></i>. To remove user data from a font face,
+call this function with the key that was used to set it and <tt class="literal">NULL</tt>
+for <i class="parameter"><tt>data</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_face</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>key</tt></i>&#160;:</span></td>
+<td> the address of a <a href="cairo-cairo-t.html#cairo-user-data-key-t"><span class="type">cairo_user_data_key_t</span></a> to attach the user data to
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>user_data</tt></i>&#160;:</span></td>
+<td> the user data to attach to the font face
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>destroy</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-destroy-func-t"><span class="type">cairo_destroy_func_t</span></a> which will be called when the
+font face is destroyed or when new user data is attached using the
+same key.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> or <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt> if a
+slot could not be allocated for the user data.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974065"></a><h3>
+<a name="cairo-scaled-font-create"></a>cairo_scaled_font_create ()</h3>
+<a class="indexterm" name="id2974074"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>* cairo_scaled_font_create
+ (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *ctm);</pre>
+<p>
+Creates a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> object from a font face and matrices that
+describe the size of the font and the environment in which it will
+be used.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_face</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_matrix</tt></i>&#160;:</span></td>
+<td> font space to user space transformation matrix for the
+ font. In the simplest case of a N point font, this matrix is
+ just a scale by N, but it can also be used to shear the font
+ or stretch it unequally along the two axes. See
+ <a href="cairo-cairo-t.html#cairo-set-font-matrix"><tt class="function">cairo_set_font_matrix()</tt></a>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>ctm</tt></i>&#160;:</span></td>
+<td> user to device transformation matrix with which the font will
+ be used.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a newly created <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>. Destroy with
+ <a href="cairo-Fonts.html#cairo-scaled-font-destroy"><tt class="function">cairo_scaled_font_destroy()</tt></a>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974225"></a><h3>
+<a name="cairo-scaled-font-reference"></a>cairo_scaled_font_reference ()</h3>
+<a class="indexterm" name="id2974235"></a><pre class="programlisting">void cairo_scaled_font_reference (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
+<p>
+Increases the reference count on <i class="parameter"><tt>scaled_font</tt></i> by one. This prevents
+<i class="parameter"><tt>scaled_font</tt></i> from being destroyed until a matching call to
+<a href="cairo-Fonts.html#cairo-scaled-font-destroy"><tt class="function">cairo_scaled_font_destroy()</tt></a> is made.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>, (may be NULL in which case
+this function does nothing)
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974314"></a><h3>
+<a name="cairo-scaled-font-destroy"></a>cairo_scaled_font_destroy ()</h3>
+<a class="indexterm" name="id2974324"></a><pre class="programlisting">void cairo_scaled_font_destroy (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
+<p>
+Decreases the reference count on <i class="parameter"><tt>font</tt></i> by one. If the result
+is zero, then <i class="parameter"><tt>font</tt></i> and all associated resources are freed.
+See <a href="cairo-Fonts.html#cairo-scaled-font-reference"><tt class="function">cairo_scaled_font_reference()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974404"></a><h3>
+<a name="cairo-font-extents-t"></a>cairo_font_extents_t</h3>
+<a class="indexterm" name="id2974413"></a><pre class="programlisting">typedef struct {
+ double ascent;
+ double descent;
+ double height;
+ double max_x_advance;
+ double max_y_advance;
+} cairo_font_extents_t;
+</pre>
+<p>
+The <a href="cairo-Fonts.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> structure stores metric information for
+a font. Values are given in the current user-space coordinate
+system.
+</p>
+<p>
+Because font metrics are in user-space coordinates, they are
+mostly, but not entirely, independent of the current transformation
+matrix. If you call <tt class="literal">cairo_scale(cr, 2.0, 2.0)</tt>,
+text will be drawn twice as big, but the reported text extents will
+not be doubled. They will change slightly due to hinting (so you
+can't assume that metrics are independent of the transformation
+matrix), but otherwise will remain unchanged.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>ascent</tt></i>;</span></td>
+<td> the distance that the font extends above the baseline.
+ Note that this is not always exactly equal to the maximum
+ of the extents of all the glyphs in the font, but rather
+ is picked to express the font designer's intent as to
+ how the font should align with elements above it.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>descent</tt></i>;</span></td>
+<td> the distance that the font extends below the baseline.
+ This value is positive for typical fonts that include
+ portions below the baseline. Note that this is not always
+ exactly equal to the maximum of the extents of all the
+ glyphs in the font, but rather is picked to express the
+ font designer's intent as to how the the font should
+ align with elements below it.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>height</tt></i>;</span></td>
+<td> the recommended vertical distance between baselines when
+ setting consecutive lines of text with the font. This
+ is greater than <i class="parameter"><tt>ascent</tt></i>+<i class="parameter"><tt>descent</tt></i> by a
+ quantity known as the <i class="firstterm">line spacing</i>
+ or <i class="firstterm">external leading</i>. When space
+ is at a premium, most fonts can be set with only
+ a distance of <i class="parameter"><tt>ascent</tt></i>+<i class="parameter"><tt>descent</tt></i> between lines.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>max_x_advance</tt></i>;</span></td>
+<td> the maximum distance in the X direction that
+ the the origin is advanced for any glyph in the font.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>max_y_advance</tt></i>;</span></td>
+<td> the maximum distance in the Y direction that
+ the the origin is advanced for any glyph in the font.
+ this will be zero for normal fonts used for horizontal
+ writing. (The scripts of East Asia are sometimes written
+ vertically.)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974621"></a><h3>
+<a name="cairo-scaled-font-extents"></a>cairo_scaled_font_extents ()</h3>
+<a class="indexterm" name="id2974630"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_scaled_font_extents (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font,
+ <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre>
+<p>
+Gets the metrics for a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>extents</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-extents-t"><span class="type">cairo_font_extents_t</span></a> which to store the retrieved extents.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> on success. Otherwise, an
+ error such as <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974745"></a><h3>
+<a name="cairo-text-extents-t"></a>cairo_text_extents_t</h3>
+<a class="indexterm" name="id2974754"></a><pre class="programlisting">typedef struct {
+ double x_bearing;
+ double y_bearing;
+ double width;
+ double height;
+ double x_advance;
+ double y_advance;
+} cairo_text_extents_t;
+</pre>
+<p>
+The <a href="cairo-Fonts.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> structure stores the extents of a single
+glyph or a string of glyphs in user-space coordinates. Because text
+extents are in user-space coordinates, they are mostly, but not
+entirely, independent of the current transformation matrix. If you call
+<tt class="literal">cairo_scale(cr, 2.0, 2.0)</tt>, text will
+be drawn twice as big, but the reported text extents will not be
+doubled. They will change slightly due to hinting (so you can't
+assume that metrics are independent of the transformation matrix),
+but otherwise will remain unchanged.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>x_bearing</tt></i>;</span></td>
+<td> the horizontal distance from the origin to the
+ leftmost part of the glyphs as drawn. Positive if the
+ glyphs lie entirely to the right of the origin.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>y_bearing</tt></i>;</span></td>
+<td> the vertical distance from the origin to the
+ topmost part of the glyphs as drawn. Positive only if the
+ glyphs lie completely below the origin; will usually be
+ negative.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>width</tt></i>;</span></td>
+<td> width of the glyphs as drawn
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>height</tt></i>;</span></td>
+<td> height of the glyphs as drawn
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>x_advance</tt></i>;</span></td>
+<td>distance to advance in the X direction
+ after drawing these glyphs
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>y_advance</tt></i>;</span></td>
+<td> distance to advance in the Y direction
+ after drawing these glyphs. Will typically be zero except
+ for vertical text layout as found in East-Asian languages.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2974934"></a><h3>
+<a name="cairo-scaled-font-glyph-extents"></a>cairo_scaled_font_glyph_extents ()</h3>
+<a class="indexterm" name="id2974945"></a><pre class="programlisting">void cairo_scaled_font_glyph_extents (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font,
+ <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
+ int num_glyphs,
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>glyphs</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>num_glyphs</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>extents</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-cairo-matrix-t.html"><b>&lt;&lt;&#160;cairo_matrix_t</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-ATSUI-Fonts.html"><b>ATSUI Fonts&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-FreeType-Fonts.html b/doc/public/html/cairo-FreeType-Fonts.html
index 92df2ba..10e291e 100644
--- a/doc/public/html/cairo-FreeType-Fonts.html
+++ b/doc/public/html/cairo-FreeType-Fonts.html
@@ -1,114 +1,229 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>FreeType Fonts</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-ATSUI-Fonts.html" title="ATSUI Fonts"><link rel="next" href="cairo-Glitz-backend.html" title="Glitz backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-ATSUI-Fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-Glitz-backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-FreeType-Fonts"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">FreeType Fonts</span></h2><p>FreeType Fonts &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>FreeType Fonts</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-ATSUI-Fonts.html" title="ATSUI Fonts">
+<link rel="next" href="cairo-Glitz-backend.html" title="Glitz backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-ATSUI-Fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-Glitz-backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-FreeType-Fonts"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">FreeType Fonts</span></h2>
+<p>FreeType Fonts &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create">cairo_ft_font_create</a> (FcPattern *pattern,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *scale);
-<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face">cairo_ft_font_create_for_ft_face</a>
+<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* <a href="cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-pattern">cairo_ft_font_face_create_for_pattern</a>
+ (FcPattern *pattern);
+<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* <a href="cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-ft-face">cairo_ft_font_face_create_for_ft_face</a>
(FT_Face face,
- int load_flags,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *scale);
-FT_Face <a href="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face">cairo_ft_font_lock_face</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *ft_font);
-void <a href="cairo-FreeType-Fonts.html#cairo-ft-font-unlock-face">cairo_ft_font_unlock_face</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *ft_font);
-FcPattern* <a href="cairo-FreeType-Fonts.html#cairo-ft-font-get-pattern">cairo_ft_font_get_pattern</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *ft_font);
-</pre></div><div class="refsect1" lang="en"><a name="id2733938"></a><h2>Description</h2><p>
+ int load_flags);
+FT_Face <a href="cairo-FreeType-Fonts.html#cairo-ft-scaled-font-lock-face">cairo_ft_scaled_font_lock_face</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
+void <a href="cairo-FreeType-Fonts.html#cairo-ft-scaled-font-unlock-face">cairo_ft_scaled_font_unlock_face</a>
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2936838"></a><h2>Description</h2>
+<p>
-</p></div><div class="refsect1" lang="en"><a name="id2733947"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2733953"></a><h3><a name="cairo-ft-font-create"></a>cairo_ft_font_create ()</h3><a class="indexterm" name="id2733961"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* cairo_ft_font_create (FcPattern *pattern,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *scale);</pre><p>
-Creates a new font for the FreeType font backend based on a
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2936849"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2936855"></a><h3>
+<a name="cairo-ft-font-face-create-for-pattern"></a>cairo_ft_font_face_create_for_pattern ()</h3>
+<a class="indexterm" name="id2936865"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_ft_font_face_create_for_pattern
+ (FcPattern *pattern);</pre>
+<p>
+Creates a new font face for the FreeType font backend based on a
fontconfig pattern. This font can then be used with
-<a href="cairo-cairo-t.html#cairo-set-font"><tt class="function">cairo_set_font()</tt></a>, <a href="cairo-cairo-t.html#cairo-font-glyph-extents"><tt class="function">cairo_font_glyph_extents()</tt></a>, or FreeType backend
-specific functions like <a href="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face"><tt class="function">cairo_ft_font_lock_face()</tt></a>.</p><p>
+<a href="cairo-cairo-t.html#cairo-set-font-face"><tt class="function">cairo_set_font_face()</tt></a> or <tt class="function">cairo_font_create()</tt>. The <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>
+returned from <tt class="function">cairo_font_create()</tt> is also for the FreeType backend
+and can be used with functions such as <tt class="function">cairo_ft_font_lock_face()</tt>.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td> A fully resolved fontconfig
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td> A fully resolved fontconfig
pattern. A pattern can be resolved, by, among other things, calling
<tt class="function">FcConfigSubstitute()</tt>, <tt class="function">FcDefaultSubstitute()</tt>, then
<tt class="function">FcFontMatch()</tt>. Cairo will call <tt class="function">FcPatternReference()</tt> on this
pattern, so you should not further modify the pattern, but you can
release your reference to the pattern with <tt class="function">FcPatternDestroy()</tt> if
you no longer need to access it.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>scale</tt></i>:</span></td><td> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <a href="cairo-cairo-t.html#cairo-transform-font"><tt class="function">cairo_transform_font()</tt></a>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> a newly created <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>. Free with
- <a href="cairo-cairo-t.html#cairo-font-destroy"><tt class="function">cairo_font_destroy()</tt></a> when you are done using it.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2718712"></a><h3><a name="cairo-ft-font-create-for-ft-face"></a>cairo_ft_font_create_for_ft_face ()</h3><a class="indexterm" name="id2718720"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* cairo_ft_font_create_for_ft_face
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a newly created <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>. Free with
+ <a href="cairo-Fonts.html#cairo-font-face-destroy"><tt class="function">cairo_font_face_destroy()</tt></a> when you are done using it.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2930778"></a><h3>
+<a name="cairo-ft-font-face-create-for-ft-face"></a>cairo_ft_font_face_create_for_ft_face ()</h3>
+<a class="indexterm" name="id2930789"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_ft_font_face_create_for_ft_face
(FT_Face face,
- int load_flags,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *scale);</pre><p>
-Creates a new font forthe FreeType font backend from a pre-opened
-FreeType face. This font can then be used with <a href="cairo-cairo-t.html#cairo-set-font"><tt class="function">cairo_set_font()</tt></a>,
-<a href="cairo-cairo-t.html#cairo-font-glyph-extents"><tt class="function">cairo_font_glyph_extents()</tt></a>, or FreeType backend specific
-functions like <a href="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face"><tt class="function">cairo_ft_font_lock_face()</tt></a> Cairo will determine the
-pixel size and transformation from the <i class="parameter"><tt>scale</tt></i> parameter and call
-<tt class="function">FT_Set_Transform()</tt> and <tt class="function">FT_Set_Pixel_Sizes()</tt>.</p><p>
+ int load_flags);</pre>
+<p>
+Creates a new font face for the FreeType font backend from a pre-opened
+FreeType face. This font can then be used with
+<a href="cairo-cairo-t.html#cairo-set-font-face"><tt class="function">cairo_set_font_face()</tt></a> or <tt class="function">cairo_font_create()</tt>. The <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>
+returned from <tt class="function">cairo_font_create()</tt> is also for the FreeType backend
+and can be used with functions such as <tt class="function">cairo_ft_font_lock_face()</tt>.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>face</tt></i>:</span></td><td> A FreeType face object, already opened. This must
- be kept around until the font object's refcount drops to
- zero and it is freed. The font object can be kept alive by
- internal caching, so it's safest to keep the face object
- around forever.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>load_flags</tt></i>:</span></td><td> The flags to pass to FT_Load_Glyph when loading
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>face</tt></i>&#160;:</span></td>
+<td> A FreeType face object, already opened. This must
+ be kept around until the face's refcount drops to
+ zero and it is freed. Since the face may be referenced
+ internally to Cairo, the best way to determine when it
+ is safe to free the face is to pass a
+ <a href="cairo-cairo-t.html#cairo-destroy-func-t"><span class="type">cairo_destroy_func_t</span></a> to <a href="cairo-Fonts.html#cairo-font-face-set-user-data"><tt class="function">cairo_font_face_set_user_data()</tt></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>load_flags</tt></i>&#160;:</span></td>
+<td> The flags to pass to FT_Load_Glyph when loading
glyphs from the font. These flags control aspects of
rendering such as hinting and antialiasing. See the FreeType
docs for full information.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>scale</tt></i>:</span></td><td> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <a href="cairo-cairo-t.html#cairo-transform-font"><tt class="function">cairo_transform_font()</tt></a>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> a newly created <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>. Free with
- <a href="cairo-cairo-t.html#cairo-font-destroy"><tt class="function">cairo_font_destroy()</tt></a> when you are done using it.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2741214"></a><h3><a name="cairo-ft-font-lock-face"></a>cairo_ft_font_lock_face ()</h3><a class="indexterm" name="id2741222"></a><pre class="programlisting">FT_Face cairo_ft_font_lock_face (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *ft_font);</pre><p>
-<a href="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face"><tt class="function">cairo_ft_font_lock_face()</tt></a> gets the <span class="type">FT_Face</span> object from a FreeType
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a newly created <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>. Free with
+ <a href="cairo-Fonts.html#cairo-font-face-destroy"><tt class="function">cairo_font_face_destroy()</tt></a> when you are done using it.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2944636"></a><h3>
+<a name="cairo-ft-scaled-font-lock-face"></a>cairo_ft_scaled_font_lock_face ()</h3>
+<a class="indexterm" name="id2944645"></a><pre class="programlisting">FT_Face cairo_ft_scaled_font_lock_face (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
+<p>
+<tt class="function">cairo_ft_font_lock_face()</tt> gets the <span class="type">FT_Face</span> object from a FreeType
backend font and scales it appropriately for the font. You must
-release the face with <a href="cairo-FreeType-Fonts.html#cairo-ft-font-unlock-face"><tt class="function">cairo_ft_font_unlock_face()</tt></a>
+release the face with <tt class="function">cairo_ft_font_unlock_face()</tt>
when you are done using it. Since the <span class="type">FT_Face</span> object can be
-shared between multiple <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> objects, you must not
+shared between multiple <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> objects, you must not
lock any other font objects until you unlock this one. A count is
-kept of the number of times <a href="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face"><tt class="function">cairo_ft_font_lock_face()</tt></a> is
-called. <a href="cairo-FreeType-Fonts.html#cairo-ft-font-unlock-face"><tt class="function">cairo_ft_font_unlock_face()</tt></a> must be called the same number
+kept of the number of times <tt class="function">cairo_ft_font_lock_face()</tt> is
+called. <tt class="function">cairo_ft_font_unlock_face()</tt> must be called the same number
of times.
-</p><p>
+</p>
+<p>
You must be careful when using this function in a library or in a
threaded application, because other threads may lock faces that
share the same <span class="type">FT_Face</span> object. For this reason, you must call
<tt class="function">cairo_ft_lock()</tt> before locking any face objects, and
<tt class="function">cairo_ft_unlock()</tt> after you are done. (These functions are not yet
implemented, so this function cannot be currently safely used in a
-threaded application.)</p><p>
+threaded application.)</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>ft_font</tt></i>:</span></td><td> A <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> from the FreeType font backend. Such an
- object can be created with <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create"><tt class="function">cairo_ft_font_create()</tt></a> or
- <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face"><tt class="function">cairo_ft_font_create_for_ft_face()</tt></a>. On some platforms the font from
- <a href="cairo-cairo-t.html#cairo-current-font"><tt class="function">cairo_current_font()</tt></a> will also be a FreeType font, but using this
- functionality with fonts you don't create yourself is not
- recommended.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> The <span class="type">FT_Face</span> object for <i class="parameter"><tt>font</tt></i>, scaled appropriately.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2737382"></a><h3><a name="cairo-ft-font-unlock-face"></a>cairo_ft_font_unlock_face ()</h3><a class="indexterm" name="id2737391"></a><pre class="programlisting">void cairo_ft_font_unlock_face (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *ft_font);</pre><p>
-Releases a face obtained with <a href="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face"><tt class="function">cairo_ft_font_lock_face()</tt></a>. See the
-documentation for that function for full details.</p><p>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> A <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> from the FreeType font backend. Such an
+ object can be created by calling <a href="cairo-Fonts.html#cairo-scaled-font-create"><tt class="function">cairo_scaled_font_create()</tt></a> on a
+ FreeType backend font face (see <a href="cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-pattern"><tt class="function">cairo_ft_font_face_create_for_pattern()</tt></a>,
+ <tt class="function">cairo_ft_font_face_create_for_face()</tt>).
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> The <span class="type">FT_Face</span> object for <i class="parameter"><tt>font</tt></i>, scaled appropriately.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2973551"></a><h3>
+<a name="cairo-ft-scaled-font-unlock-face"></a>cairo_ft_scaled_font_unlock_face ()</h3>
+<a class="indexterm" name="id2973562"></a><pre class="programlisting">void cairo_ft_scaled_font_unlock_face
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
+<p>
+Releases a face obtained with <tt class="function">cairo_ft_font_lock_face()</tt>. See the
+documentation for that function for full details.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>ft_font</tt></i>:</span></td><td> A <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> from the FreeType font backend. Such an
- object can be created with <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create"><tt class="function">cairo_ft_font_create()</tt></a> or
- <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face"><tt class="function">cairo_ft_font_create_for_ft_face()</tt></a>. On some platforms the font from
- <a href="cairo-cairo-t.html#cairo-current-font"><tt class="function">cairo_current_font()</tt></a> will also be a FreeType font, but using this
- functionality with fonts you don't create yourself is not
- recommended.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2737467"></a><h3><a name="cairo-ft-font-get-pattern"></a>cairo_ft_font_get_pattern ()</h3><a class="indexterm" name="id2737476"></a><pre class="programlisting">FcPattern* cairo_ft_font_get_pattern (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *ft_font);</pre><p>
-<a href="cairo-FreeType-Fonts.html#cairo-ft-font-get-pattern"><tt class="function">cairo_ft_font_get_pattern()</tt></a> gets the <span class="type">FcPattern</span> for a FreeType
-backend font.
-</p><p>
-Return value: The <span class="type">FcPattenr</span> for <i class="parameter"><tt>font</tt></i>. The return value is owned
- by the font, so you must not modify it, and must call
- <tt class="function">FcPatternReference()</tt> to keep a persistant reference to the
- pattern. If the font was created with <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face"><tt class="function">cairo_ft_font_create_for_ft_face()</tt></a></p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>ft_font</tt></i>:</span></td><td> A <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> from the FreeType font backend. Such an
- object can be created with <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create"><tt class="function">cairo_ft_font_create()</tt></a> or
- <a href="cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face"><tt class="function">cairo_ft_font_create_for_ft_face()</tt></a>. On some platforms the font from
- <a href="cairo-cairo-t.html#cairo-current-font"><tt class="function">cairo_current_font()</tt></a> will also be a FreeType font, but using this
- functionality with fonts you don't create yourself is not
- recommended.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">NULL</tt>.
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-ATSUI-Fonts.html"><b>&lt;&lt;ATSUI Fonts</b></a></td><td align="right"><a accesskey="n" href="cairo-Glitz-backend.html"><b>Glitz backend&gt;&gt;</b></a></td></tr></table></body></html>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> A <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> from the FreeType font backend. Such an
+ object can be created by calling <a href="cairo-Fonts.html#cairo-scaled-font-create"><tt class="function">cairo_scaled_font_create()</tt></a> on a
+ FreeType backend font face (see <a href="cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-pattern"><tt class="function">cairo_ft_font_face_create_for_pattern()</tt></a>,
+ <tt class="function">cairo_ft_font_face_create_for_face()</tt>).
+</td>
+</tr></tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-ATSUI-Fonts.html"><b>&lt;&lt;&#160;ATSUI Fonts</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-Glitz-backend.html"><b>Glitz backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-Glitz-backend.html b/doc/public/html/cairo-Glitz-backend.html
index 7ebeb09..8aa7ad9 100644
--- a/doc/public/html/cairo-Glitz-backend.html
+++ b/doc/public/html/cairo-Glitz-backend.html
@@ -1,23 +1,88 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Glitz backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-FreeType-Fonts.html" title="FreeType Fonts"><link rel="next" href="cairo-PDF-Backend.html" title="PDF Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-FreeType-Fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-PDF-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-Glitz-backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">Glitz backend</span></h2><p>Glitz backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Glitz backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-FreeType-Fonts.html" title="FreeType Fonts">
+<link rel="next" href="cairo-PDF-Backend.html" title="PDF Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-FreeType-Fonts.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-PDF-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-Glitz-backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">Glitz backend</span></h2>
+<p>Glitz backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-void <a href="cairo-Glitz-backend.html#cairo-set-target-glitz">cairo_set_target_glitz</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- glitz_surface_t *surface);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-Glitz-backend.html#cairo-glitz-surface-create">cairo_glitz_surface_create</a> (glitz_surface_t *surface);
-</pre></div><div class="refsect1" lang="en"><a name="id2691367"></a><h2>Description</h2><p>
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2908709"></a><h2>Description</h2>
+<p>
-</p></div><div class="refsect1" lang="en"><a name="id2696554"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2696559"></a><h3><a name="cairo-set-target-glitz"></a>cairo_set_target_glitz ()</h3><a class="indexterm" name="id2696567"></a><pre class="programlisting">void cairo_set_target_glitz (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- glitz_surface_t *surface);</pre><p>
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2968352"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2975519"></a><h3>
+<a name="cairo-glitz-surface-create"></a>cairo_glitz_surface_create ()</h3>
+<a class="indexterm" name="id2968939"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_glitz_surface_create (glitz_surface_t *surface);</pre>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2741449"></a><h3><a name="cairo-glitz-surface-create"></a>cairo_glitz_surface_create ()</h3><a class="indexterm" name="id2741458"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_glitz_surface_create (glitz_surface_t *surface);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-FreeType-Fonts.html"><b>&lt;&lt;FreeType Fonts</b></a></td><td align="right"><a accesskey="n" href="cairo-PDF-Backend.html"><b>PDF Backend&gt;&gt;</b></a></td></tr></table></body></html>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-FreeType-Fonts.html"><b>&lt;&lt;&#160;FreeType Fonts</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-PDF-Backend.html"><b>PDF Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-Microsoft-Windows-Backend.html b/doc/public/html/cairo-Microsoft-Windows-Backend.html
index 63e69ec..04bfa97 100644
--- a/doc/public/html/cairo-Microsoft-Windows-Backend.html
+++ b/doc/public/html/cairo-Microsoft-Windows-Backend.html
@@ -1,83 +1,240 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Microsoft Windows Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-Quartz-Backend.html" title="Quartz Backend"><link rel="next" href="cairo-XCB-Backend.html" title="XCB Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-Quartz-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-XCB-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-Microsoft-Windows-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">Microsoft Windows Backend</span></h2><p>Microsoft Windows Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Microsoft Windows Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-Quartz-Backend.html" title="Quartz Backend">
+<link rel="next" href="cairo-XCB-Backend.html" title="XCB Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-Quartz-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-XCB-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-Microsoft-Windows-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">Microsoft Windows Backend</span></h2>
+<p>Microsoft Windows Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-void <a href="cairo-Microsoft-Windows-Backend.html#cairo-set-target-win32">cairo_set_target_win32</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- HDC hdc);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-surface-create">cairo_win32_surface_create</a> (HDC hdc);
-<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-create-for-logfontw">cairo_win32_font_create_for_logfontw</a>
- (LOGFONTW *logfont,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *scale);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-select-font">cairo_win32_font_select_font</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font,
+<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-face-create-for-logfontw">cairo_win32_font_face_create_for_logfontw</a>
+ (LOGFONTW *logfont);
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font">cairo_win32_scaled_font_select_font</a>
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font,
HDC hdc);
-void <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-done-font">cairo_win32_font_done_font</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);
-double <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-get-scale-factor">cairo_win32_font_get_scale_factor</a>
- (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);
-</pre></div><div class="refsect1" lang="en"><a name="id2731014"></a><h2>Description</h2><p>
-
-</p></div><div class="refsect1" lang="en"><a name="id2731024"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2731029"></a><h3><a name="cairo-set-target-win32"></a>cairo_set_target_win32 ()</h3><a class="indexterm" name="id2731038"></a><pre class="programlisting">void cairo_set_target_win32 (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- HDC hdc);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>hdc</tt></i>:</span></td><td>
-
+void <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-done-font">cairo_win32_scaled_font_done_font</a>
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
+double <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-get-metrics-factor">cairo_win32_scaled_font_get_metrics_factor</a>
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2937432"></a><h2>Description</h2>
+<p>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2731088"></a><h3><a name="cairo-win32-surface-create"></a>cairo_win32_surface_create ()</h3><a class="indexterm" name="id2731096"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_win32_surface_create (HDC hdc);</pre><p>
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2937443"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2937449"></a><h3>
+<a name="cairo-win32-surface-create"></a>cairo_win32_surface_create ()</h3>
+<a class="indexterm" name="id2937458"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_win32_surface_create (HDC hdc);</pre>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>hdc</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>hdc</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2735228"></a><h3><a name="cairo-win32-font-create-for-logfontw"></a>cairo_win32_font_create_for_logfontw ()</h3><a class="indexterm" name="id2735236"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* cairo_win32_font_create_for_logfontw
- (LOGFONTW *logfont,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *scale);</pre><p>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2943496"></a><h3>
+<a name="cairo-win32-font-face-create-for-logfontw"></a>cairo_win32_font_face_create_for_logfontw ()</h3>
+<a class="indexterm" name="id2943506"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_win32_font_face_create_for_logfontw
+ (LOGFONTW *logfont);</pre>
+<p>
Creates a new font for the Win32 font backend based on a
<span class="type">LOGFONT</span>. This font can then be used with
-<a href="cairo-cairo-t.html#cairo-set-font"><tt class="function">cairo_set_font()</tt></a>, <a href="cairo-cairo-t.html#cairo-font-glyph-extents"><tt class="function">cairo_font_glyph_extents()</tt></a>, or FreeType backend
-specific functions like <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-select-font"><tt class="function">cairo_win32_font_select_font()</tt></a>.</p><p>
+<a href="cairo-cairo-t.html#cairo-set-font-face"><tt class="function">cairo_set_font_face()</tt></a> or <tt class="function">cairo_font_create()</tt>. The <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>
+returned from <tt class="function">cairo_font_create()</tt> is also for the Win32 backend
+and can be used with functions such as <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font"><tt class="function">cairo_win32_scaled_font_select_font()</tt></a>.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>logfont</tt></i>:</span></td><td> A <span class="type">LOGFONTW</span> structure specifying the font to use.
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>logfont</tt></i>&#160;:</span></td>
+<td> A <span class="type">LOGFONTW</span> structure specifying the font to use.
The lfHeight, lfWidth, lfOrientation and lfEscapement
- fields of this structure are ignored; information from
- <i class="parameter"><tt>scale</tt></i> will be used instead.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>scale</tt></i>:</span></td><td> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <a href="cairo-cairo-t.html#cairo-transform-font"><tt class="function">cairo_transform_font()</tt></a>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> a newly created <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>. Free with
- <a href="cairo-cairo-t.html#cairo-font-destroy"><tt class="function">cairo_font_destroy()</tt></a> when you are done using it.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2680481"></a><h3><a name="cairo-win32-font-select-font"></a>cairo_win32_font_select_font ()</h3><a class="indexterm" name="id2680492"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_win32_font_select_font (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font,
- HDC hdc);</pre><p>
+ fields of this structure are ignored.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a newly created <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>. Free with
+ <a href="cairo-Fonts.html#cairo-font-face-destroy"><tt class="function">cairo_font_face_destroy()</tt></a> when you are done using it.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2926688"></a><h3>
+<a name="cairo-win32-scaled-font-select-font"></a>cairo_win32_scaled_font_select_font ()</h3>
+<a class="indexterm" name="id2926698"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_win32_scaled_font_select_font
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font,
+ HDC hdc);</pre>
+<p>
Selects the font into the given device context and changes the
map mode and world transformation of the device context to match
that of the font. This function is intended for use when using
layout APIs such as Uniscribe to do text layout with the
-Cairo font. After finishing using the device context, you must call
-<a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-done-font"><tt class="function">cairo_win32_font_done_font()</tt></a> to release any resources allocated
+cairo font. After finishing using the device context, you must call
+<a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-done-font"><tt class="function">cairo_win32_scaled_font_done_font()</tt></a> to release any resources allocated
by this function.
-</p><p>
-See <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-get-scale-factor"><tt class="function">cairo_win32_font_get_scale_factor()</tt></a> for converting logical
+</p>
+<p>
+See <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-get-metrics-factor"><tt class="function">cairo_win32_scaled_font_get_metrics_factor()</tt></a> for converting logical
coordinates from the device context to font space.
-</p><p>
+</p>
+<p>
Normally, calls to <tt class="function">SaveDC()</tt> and <tt class="function">RestoreDC()</tt> would be made around
-the use of this function to preserve the original graphics state.</p><p>
+the use of this function to preserve the original graphics state.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td> A <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> from the Win32 font backend. Such an
- object can be created with <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-create-for-logfontw"><tt class="function">cairo_win32_font_create_for_logfontw()</tt></a>.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>hdc</tt></i>:</span></td><td> a device context
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> if the operation succeeded.
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> A <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> from the Win32 font backend. Such an
+ object can be created with <tt class="function">cairo_win32_scaled_font_create_for_logfontw()</tt>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>hdc</tt></i>&#160;:</span></td>
+<td> a device context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> if the operation succeeded.
otherwise an error such as <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt> and
the device context is unchanged.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2680622"></a><h3><a name="cairo-win32-font-done-font"></a>cairo_win32_font_done_font ()</h3><a class="indexterm" name="id2680631"></a><pre class="programlisting">void cairo_win32_font_done_font (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);</pre><p>
-Releases any resources allocated by <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-select-font"><tt class="function">cairo_win32_font_select_font()</tt></a></p><p>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2926866"></a><h3>
+<a name="cairo-win32-scaled-font-done-font"></a>cairo_win32_scaled_font_done_font ()</h3>
+<a class="indexterm" name="id2926878"></a><pre class="programlisting">void cairo_win32_scaled_font_done_font
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
+<p>
+Releases any resources allocated by <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font"><tt class="function">cairo_win32_scaled_font_select_font()</tt></a></p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td> A <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> from the Win32 font backend.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2680683"></a><h3><a name="cairo-win32-font-get-scale-factor"></a>cairo_win32_font_get_scale_factor ()</h3><a class="indexterm" name="id2680695"></a><pre class="programlisting">double cairo_win32_font_get_scale_factor
- (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);</pre><p>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> A <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> from the Win32 font backend.
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2970197"></a><h3>
+<a name="cairo-win32-scaled-font-get-metrics-factor"></a>cairo_win32_scaled_font_get_metrics_factor ()</h3>
+<a class="indexterm" name="id2970209"></a><pre class="programlisting">double cairo_win32_scaled_font_get_metrics_factor
+ (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre>
+<p>
Gets a scale factor between logical coordinates in the coordinate
-space used by <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-select-font"><tt class="function">cairo_win32_font_select_font()</tt></a> and font space coordinates.</p><p>
+space used by <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font"><tt class="function">cairo_win32_scaled_font_select_font()</tt></a> (that is, the
+coordinate system used by the Windows functions to return metrics) and
+font space coordinates.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> from the Win32 font backend
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> factor to multiply logical units by to get font space
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>scaled_font</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> from the Win32 font backend
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> factor to multiply logical units by to get font space
coordinates.
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-Quartz-Backend.html"><b>&lt;&lt;Quartz Backend</b></a></td><td align="right"><a accesskey="n" href="cairo-XCB-Backend.html"><b>XCB Backend&gt;&gt;</b></a></td></tr></table></body></html>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-Quartz-Backend.html"><b>&lt;&lt;&#160;Quartz Backend</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-XCB-Backend.html"><b>XCB Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-PDF-Backend.html b/doc/public/html/cairo-PDF-Backend.html
index 2824b74..a3c781a 100644
--- a/doc/public/html/cairo-PDF-Backend.html
+++ b/doc/public/html/cairo-PDF-Backend.html
@@ -1,47 +1,198 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>PDF Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-Glitz-backend.html" title="Glitz backend"><link rel="next" href="cairo-PNG-Backend.html" title="PNG Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-Glitz-backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-PNG-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-PDF-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">PDF Backend</span></h2><p>PDF Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
-
-
-
-void <a href="cairo-PDF-Backend.html#cairo-set-target-pdf">cairo_set_target_pdf</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
-<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PDF-Backend.html#cairo-pdf-surface-create">cairo_pdf_surface_create</a> (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
-</pre></div><div class="refsect1" lang="en"><a name="id2736241"></a><h2>Description</h2><p>
-
-</p></div><div class="refsect1" lang="en"><a name="id2736251"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2736256"></a><h3><a name="cairo-set-target-pdf"></a>cairo_set_target_pdf ()</h3><a class="indexterm" name="id2736264"></a><pre class="programlisting">void cairo_set_target_pdf (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>file</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width_inches</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height_inches</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x_pixels_per_inch</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y_pixels_per_inch</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2720822"></a><h3><a name="cairo-pdf-surface-create"></a>cairo_pdf_surface_create ()</h3><a class="indexterm" name="id2720830"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>file</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width_inches</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height_inches</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x_pixels_per_inch</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y_pixels_per_inch</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-Glitz-backend.html"><b>&lt;&lt;Glitz backend</b></a></td><td align="right"><a accesskey="n" href="cairo-PNG-Backend.html"><b>PNG Backend&gt;&gt;</b></a></td></tr></table></body></html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>PDF Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-Glitz-backend.html" title="Glitz backend">
+<link rel="next" href="cairo-PNG-Backend.html" title="PNG Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-Glitz-backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-PNG-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-PDF-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">PDF Backend</span></h2>
+<p>PDF Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
+
+
+
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PDF-Backend.html#cairo-pdf-surface-create">cairo_pdf_surface_create</a> (const char *filename,
+ double width_in_points,
+ double height_in_points);
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PDF-Backend.html#cairo-pdf-surface-create-for-stream">cairo_pdf_surface_create_for_stream</a>
+ (<a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points);
+void <a href="cairo-PDF-Backend.html#cairo-pdf-surface-set-dpi">cairo_pdf_surface_set_dpi</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x_dpi,
+ double y_dpi);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2975158"></a><h2>Description</h2>
+<p>
+
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2975169"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2975175"></a><h3>
+<a name="cairo-pdf-surface-create"></a>cairo_pdf_surface_create ()</h3>
+<a class="indexterm" name="id2975184"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create (const char *filename,
+ double width_in_points,
+ double height_in_points);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>filename</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2944378"></a><h3>
+<a name="cairo-pdf-surface-create-for-stream"></a>cairo_pdf_surface_create_for_stream ()</h3>
+<a class="indexterm" name="id2944387"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create_for_stream
+ (<a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>write_func</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>closure</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2973720"></a><h3>
+<a name="cairo-pdf-surface-set-dpi"></a>cairo_pdf_surface_set_dpi ()</h3>
+<a class="indexterm" name="id2973729"></a><pre class="programlisting">void cairo_pdf_surface_set_dpi (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x_dpi,
+ double y_dpi);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x_dpi</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y_dpi</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-Glitz-backend.html"><b>&lt;&lt;&#160;Glitz backend</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-PNG-Backend.html"><b>PNG Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-PNG-Backend.html b/doc/public/html/cairo-PNG-Backend.html
index aea978c..3562c88 100644
--- a/doc/public/html/cairo-PNG-Backend.html
+++ b/doc/public/html/cairo-PNG-Backend.html
@@ -1,41 +1,229 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>PNG Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-PDF-Backend.html" title="PDF Backend"><link rel="next" href="cairo-PS-Backend.html" title="PS Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-PDF-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-PS-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-PNG-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">PNG Backend</span></h2><p>PNG Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>PNG Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-PDF-Backend.html" title="PDF Backend">
+<link rel="next" href="cairo-PS-Backend.html" title="PS Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-PDF-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-PS-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-PNG-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">PNG Backend</span></h2>
+<p>PNG Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-void <a href="cairo-PNG-Backend.html#cairo-set-target-png">cairo_set_target_png</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- FILE *file,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height);
-<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PNG-Backend.html#cairo-png-surface-create">cairo_png_surface_create</a> (FILE *file,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height);
-</pre></div><div class="refsect1" lang="en"><a name="id2730876"></a><h2>Description</h2><p>
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PNG-Backend.html#cairo-image-surface-create-from-png">cairo_image_surface_create_from_png</a>
+ (const char *filename);
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PNG-Backend.html#cairo-image-surface-create-from-png-stream">cairo_image_surface_create_from_png_stream</a>
+ (<a href="cairo-cairo-t.html#cairo-read-func-t">cairo_read_func_t</a> read_func,
+ void *closure);
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-PNG-Backend.html#cairo-surface-write-to-png">cairo_surface_write_to_png</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ const char *filename);
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-PNG-Backend.html#cairo-surface-write-to-png-stream">cairo_surface_write_to_png_stream</a>
+ (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ <a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func,
+ void *closure);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2972224"></a><h2>Description</h2>
+<p>
-</p></div><div class="refsect1" lang="en"><a name="id2730885"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2730891"></a><h3><a name="cairo-set-target-png"></a>cairo_set_target_png ()</h3><a class="indexterm" name="id2730899"></a><pre class="programlisting">void cairo_set_target_png (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- FILE *file,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height);</pre><p>
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2972235"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2972242"></a><h3>
+<a name="cairo-image-surface-create-from-png"></a>cairo_image_surface_create_from_png ()</h3>
+<a class="indexterm" name="id2972250"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_from_png
+ (const char *filename);</pre>
+<p>
+Creates a new image surface and initializes the contents to the
+given PNG file.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>file</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>filename</tt></i>&#160;:</span></td>
+<td> name of PNG file to load
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a new <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> initialized with the contents
+of the PNG file or <tt class="literal">NULL</tt> if the file is not a valid PNG file or
+memory could not be allocated for the operation.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2973862"></a><h3>
+<a name="cairo-image-surface-create-from-png-stream"></a>cairo_image_surface_create_from_png_stream ()</h3>
+<a class="indexterm" name="id2973873"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_from_png_stream
+ (<a href="cairo-cairo-t.html#cairo-read-func-t">cairo_read_func_t</a> read_func,
+ void *closure);</pre>
+<p>
+Creates a new image surface from PNG data read incrementally
+via the <i class="parameter"><tt>read_func</tt></i> function.</p>
+<p>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>read_func</tt></i>&#160;:</span></td>
+<td> function called to read the data of the file
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>closure</tt></i>&#160;:</span></td>
+<td> data to pass to <i class="parameter"><tt>read_func</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a new <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> initialized with the contents
+of the PNG file or <tt class="literal">NULL</tt> if the data read is not a valid PNG image or
+memory could not be allocated for the operation.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2970718"></a><h3>
+<a name="cairo-surface-write-to-png"></a>cairo_surface_write_to_png ()</h3>
+<a class="indexterm" name="id2970727"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_write_to_png (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ const char *filename);</pre>
+<p>
+Writes the contents of <i class="parameter"><tt>surface</tt></i> to a new file <i class="parameter"><tt>filename</tt></i> as a PNG
+image.</p>
+<p>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2742406"></a><h3><a name="cairo-png-surface-create"></a>cairo_png_surface_create ()</h3><a class="indexterm" name="id2742414"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_png_surface_create (FILE *file,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height);</pre><p>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> with pixel contents
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>filename</tt></i>&#160;:</span></td>
+<td> the name of a file to write to
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> CAIRO_STATUS_SUCCESS if the PNG file was written
+successfully. Otherwise, CAIRO_STATUS_NO_MEMORY if memory could not
+be allocated for the operation or
+CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
+pixel contents, or CAIRO_STATUS_WRITE_ERROR if an I/O error occurs
+while attempting to write the file.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2970831"></a><h3>
+<a name="cairo-surface-write-to-png-stream"></a>cairo_surface_write_to_png_stream ()</h3>
+<a class="indexterm" name="id2970841"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_write_to_png_stream
+ (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ <a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func,
+ void *closure);</pre>
+<p>
+Writes the image surface to the write function.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>file</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-PDF-Backend.html"><b>&lt;&lt;PDF Backend</b></a></td><td align="right"><a accesskey="n" href="cairo-PS-Backend.html"><b>PS Backend&gt;&gt;</b></a></td></tr></table></body></html>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> with pixel contents
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>write_func</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-write-func-t"><span class="type">cairo_write_func_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>closure</tt></i>&#160;:</span></td>
+<td> closure data for the write function
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> CAIRO_STATUS_SUCCESS if the PNG file was written
+successfully. Otherwise, CAIRO_STATUS_NO_MEMORY is returned if
+memory could not be allocated for the operation,
+CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
+pixel contents.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-PDF-Backend.html"><b>&lt;&lt;&#160;PDF Backend</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-PS-Backend.html"><b>PS Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-PS-Backend.html b/doc/public/html/cairo-PS-Backend.html
index cf2c53c..361b8c6 100644
--- a/doc/public/html/cairo-PS-Backend.html
+++ b/doc/public/html/cairo-PS-Backend.html
@@ -1,51 +1,198 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>PS Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-PNG-Backend.html" title="PNG Backend"><link rel="next" href="cairo-Quartz-Backend.html" title="Quartz Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-PNG-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-Quartz-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-PS-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">PS Backend</span></h2><p>PS Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
-
-
-
-void <a href="cairo-PS-Backend.html#cairo-set-target-ps">cairo_set_target_ps</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
-<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PS-Backend.html#cairo-ps-surface-create">cairo_ps_surface_create</a> (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
-</pre></div><div class="refsect1" lang="en"><a name="id2742152"></a><h2>Description</h2><p>
-
-</p></div><div class="refsect1" lang="en"><a name="id2742161"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2742167"></a><h3><a name="cairo-set-target-ps"></a>cairo_set_target_ps ()</h3><a class="indexterm" name="id2742175"></a><pre class="programlisting">void cairo_set_target_ps (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);</pre><p>
-Directs output for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> to a postscript file. The file must
-be kept open until the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> is destroyed or set to have a
-different target, and then must be closed by the application.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>file</tt></i>:</span></td><td> an open, writeable file
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width_inches</tt></i>:</span></td><td> width of the output page, in inches
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height_inches</tt></i>:</span></td><td> height of the output page, in inches
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x_pixels_per_inch</tt></i>:</span></td><td> X resolution to use for image fallbacks;
- not all Cairo drawing can be represented in a postscript
- file, so Cairo will write out images for some portions
- of the output.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y_pixels_per_inch</tt></i>:</span></td><td> Y resolution to use for image fallbacks.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2741578"></a><h3><a name="cairo-ps-surface-create"></a>cairo_ps_surface_create ()</h3><a class="indexterm" name="id2741587"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>file</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width_inches</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height_inches</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x_pixels_per_inch</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y_pixels_per_inch</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-PNG-Backend.html"><b>&lt;&lt;PNG Backend</b></a></td><td align="right"><a accesskey="n" href="cairo-Quartz-Backend.html"><b>Quartz Backend&gt;&gt;</b></a></td></tr></table></body></html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>PS Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-PNG-Backend.html" title="PNG Backend">
+<link rel="next" href="cairo-Quartz-Backend.html" title="Quartz Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-PNG-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-Quartz-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-PS-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">PS Backend</span></h2>
+<p>PS Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
+
+
+
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PS-Backend.html#cairo-ps-surface-create">cairo_ps_surface_create</a> (const char *filename,
+ double width_in_points,
+ double height_in_points);
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-PS-Backend.html#cairo-ps-surface-create-for-stream">cairo_ps_surface_create_for_stream</a>
+ (<a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points);
+void <a href="cairo-PS-Backend.html#cairo-ps-surface-set-dpi">cairo_ps_surface_set_dpi</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x_dpi,
+ double y_dpi);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2975361"></a><h2>Description</h2>
+<p>
+
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2975372"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2975378"></a><h3>
+<a name="cairo-ps-surface-create"></a>cairo_ps_surface_create ()</h3>
+<a class="indexterm" name="id2975387"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create (const char *filename,
+ double width_in_points,
+ double height_in_points);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>filename</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2975614"></a><h3>
+<a name="cairo-ps-surface-create-for-stream"></a>cairo_ps_surface_create_for_stream ()</h3>
+<a class="indexterm" name="id2975623"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create_for_stream
+ (<a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>write_func</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>closure</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height_in_points</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2970062"></a><h3>
+<a name="cairo-ps-surface-set-dpi"></a>cairo_ps_surface_set_dpi ()</h3>
+<a class="indexterm" name="id2970071"></a><pre class="programlisting">void cairo_ps_surface_set_dpi (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x_dpi,
+ double y_dpi);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x_dpi</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y_dpi</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-PNG-Backend.html"><b>&lt;&lt;&#160;PNG Backend</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-Quartz-Backend.html"><b>Quartz Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-Quartz-Backend.html b/doc/public/html/cairo-Quartz-Backend.html
index 6c45f77..d5ecf08 100644
--- a/doc/public/html/cairo-Quartz-Backend.html
+++ b/doc/public/html/cairo-Quartz-Backend.html
@@ -1,37 +1,106 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Quartz Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-PS-Backend.html" title="PS Backend"><link rel="next" href="cairo-Microsoft-Windows-Backend.html" title="Microsoft Windows Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-PS-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-Microsoft-Windows-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-Quartz-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">Quartz Backend</span></h2><p>Quartz Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Quartz Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-PS-Backend.html" title="PS Backend">
+<link rel="next" href="cairo-Microsoft-Windows-Backend.html" title="Microsoft Windows Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-PS-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-Microsoft-Windows-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-Quartz-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">Quartz Backend</span></h2>
+<p>Quartz Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-void <a href="cairo-Quartz-Backend.html#cairo-set-target-quartz-context">cairo_set_target_quartz_context</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- CGContextRef context,
- int width,
- int height);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-Quartz-Backend.html#cairo-quartz-surface-create">cairo_quartz_surface_create</a>
(CGContextRef context,
int width,
int height);
-</pre></div><div class="refsect1" lang="en"><a name="id2719460"></a><h2>Description</h2><p>
-
-</p></div><div class="refsect1" lang="en"><a name="id2719470"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2719475"></a><h3><a name="cairo-set-target-quartz-context"></a>cairo_set_target_quartz_context ()</h3><a class="indexterm" name="id2719484"></a><pre class="programlisting">void cairo_set_target_quartz_context (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- CGContextRef context,
- int width,
- int height);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>context</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2978366"></a><h2>Description</h2>
+<p>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2718783"></a><h3><a name="cairo-quartz-surface-create"></a>cairo_quartz_surface_create ()</h3><a class="indexterm" name="id2718791"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_quartz_surface_create
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2969823"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2969829"></a><h3>
+<a name="cairo-quartz-surface-create"></a>cairo_quartz_surface_create ()</h3>
+<a class="indexterm" name="id2969837"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_quartz_surface_create
(CGContextRef context,
int width,
- int height);</pre><p>
+ int height);</pre>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>context</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>context</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-PS-Backend.html"><b>&lt;&lt;PS Backend</b></a></td><td align="right"><a accesskey="n" href="cairo-Microsoft-Windows-Backend.html"><b>Microsoft Windows Backend&gt;&gt;</b></a></td></tr></table></body></html>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-PS-Backend.html"><b>&lt;&lt;&#160;PS Backend</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-Microsoft-Windows-Backend.html"><b>Microsoft Windows Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-XCB-Backend.html b/doc/public/html/cairo-XCB-Backend.html
index 73c0397..a470ee5 100644
--- a/doc/public/html/cairo-XCB-Backend.html
+++ b/doc/public/html/cairo-XCB-Backend.html
@@ -1,25 +1,233 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XCB Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-Microsoft-Windows-Backend.html" title="Microsoft Windows Backend"><link rel="next" href="cairo-XLib-Backend.html" title="XLib Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-Microsoft-Windows-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-XLib-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-XCB-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">XCB Backend</span></h2><p>XCB Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>XCB Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-Microsoft-Windows-Backend.html" title="Microsoft Windows Backend">
+<link rel="next" href="cairo-XLib-Backend.html" title="XLib Backend">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-Microsoft-Windows-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-XLib-Backend.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-XCB-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">XCB Backend</span></h2>
+<p>XCB Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-void <a href="cairo-XCB-Backend.html#cairo-set-target-xcb">cairo_set_target_xcb</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- XCBConnection *dpy,
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-XCB-Backend.html#cairo-xcb-surface-create">cairo_xcb_surface_create</a> (XCBConnection *c,
XCBDRAWABLE drawable,
XCBVISUALTYPE *visual,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format);
-</pre></div><div class="refsect1" lang="en"><a name="id2731419"></a><h2>Description</h2><p>
+ int width,
+ int height);
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-XCB-Backend.html#cairo-xcb-surface-create-for-bitmap">cairo_xcb_surface_create_for_bitmap</a>
+ (XCBConnection *c,
+ XCBPIXMAP bitmap,
+ int width,
+ int height);
+void <a href="cairo-XCB-Backend.html#cairo-xcb-surface-set-size">cairo_xcb_surface_set_size</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ int width,
+ int height);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2970367"></a><h2>Description</h2>
+<p>
-</p></div><div class="refsect1" lang="en"><a name="id2682143"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2682148"></a><h3><a name="cairo-set-target-xcb"></a>cairo_set_target_xcb ()</h3><a class="indexterm" name="id2682156"></a><pre class="programlisting">void cairo_set_target_xcb (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- XCBConnection *dpy,
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2970379"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2970385"></a><h3>
+<a name="cairo-xcb-surface-create"></a>cairo_xcb_surface_create ()</h3>
+<a class="indexterm" name="id2970394"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xcb_surface_create (XCBConnection *c,
XCBDRAWABLE drawable,
XCBVISUALTYPE *visual,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format);</pre><p>
+ int width,
+ int height);</pre>
+<p>
+Creates an XCB surface that draws to the given drawable.
+The way that colors are represented in the drawable is specified
+by the provided visual.
+</p>
+<p>
+NOTE: If <i class="parameter"><tt>drawable</tt></i> is a window, then the function
+cairo_xcb_surface_set_size must be called whenever the size of the
+window changes.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dpy</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>drawable</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>visual</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>c</tt></i>&#160;:</span></td>
+<td> an XCB connection
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>drawable</tt></i>&#160;:</span></td>
+<td> an XCB drawable
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>visual</tt></i>&#160;:</span></td>
+<td> the visual to use for drawing to <i class="parameter"><tt>drawable</tt></i>. The depth
+ of the visual must match the depth of the drawable.
+ Currently, only TrueColor visuals are fully supported.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the current width of <i class="parameter"><tt>drawable</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the current height of <i class="parameter"><tt>drawable</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the newly created surface
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2978879"></a><h3>
+<a name="cairo-xcb-surface-create-for-bitmap"></a>cairo_xcb_surface_create_for_bitmap ()</h3>
+<a class="indexterm" name="id2978888"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xcb_surface_create_for_bitmap
+ (XCBConnection *c,
+ XCBPIXMAP bitmap,
+ int width,
+ int height);</pre>
+<p>
+Creates an XCB surface that draws to the given bitmap.
+This will be drawn to as a CAIRO_FORMAT_A1 object.</p>
+<p>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>c</tt></i>&#160;:</span></td>
+<td> an XCB connection
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>bitmap</tt></i>&#160;:</span></td>
+<td> an XCB Pixmap (a depth-1 pixmap)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the current width of <i class="parameter"><tt>bitmap</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the current height of <i class="parameter"><tt>bitmap</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the newly created surface
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2979025"></a><h3>
+<a name="cairo-xcb-surface-set-size"></a>cairo_xcb_surface_set_size ()</h3>
+<a class="indexterm" name="id2979034"></a><pre class="programlisting">void cairo_xcb_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ int width,
+ int height);</pre>
+<p>
+Informs cairo of the new size of the XCB drawable underlying the
+surface. For a surface created for a window (rather than a pixmap),
+this function must be called each time the size of the window
+changes. (For a subwindow, you are normally resizing the window
+yourself, but for a toplevel window, it is necessary to listen for
+ConfigureNotify events.)
+</p>
+<p>
+A pixmap can never change size, so it is never necessary to call
+this function on a surface created for a pixmap.</p>
+<p>
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-Microsoft-Windows-Backend.html"><b>&lt;&lt;Microsoft Windows Backend</b></a></td><td align="right"><a accesskey="n" href="cairo-XLib-Backend.html"><b>XLib Backend&gt;&gt;</b></a></td></tr></table></body></html>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> for the XCB backend
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the new width of the surface
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the new height of the surface
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-Microsoft-Windows-Backend.html"><b>&lt;&lt;&#160;Microsoft Windows Backend</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-XLib-Backend.html"><b>XLib Backend&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-XLib-Backend.html b/doc/public/html/cairo-XLib-Backend.html
index bbfcf0d..aec063c 100644
--- a/doc/public/html/cairo-XLib-Backend.html
+++ b/doc/public/html/cairo-XLib-Backend.html
@@ -1,45 +1,233 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XLib Backend</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-XCB-Backend.html" title="XCB Backend"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-XCB-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th></tr></table><div class="refentry" lang="en"><a name="cairo-XLib-Backend"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">XLib Backend</span></h2><p>XLib Backend &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>XLib Backend</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-XCB-Backend.html" title="XCB Backend">
+<link rel="next" href="ix01.html" title="Index">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-XCB-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="ix01.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-XLib-Backend"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">XLib Backend</span></h2>
+<p>XLib Backend &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
-void <a href="cairo-XLib-Backend.html#cairo-set-target-drawable">cairo_set_target_drawable</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- Display *dpy,
- Drawable drawable);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-XLib-Backend.html#cairo-xlib-surface-create">cairo_xlib_surface_create</a> (Display *dpy,
Drawable drawable,
Visual *visual,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- Colormap colormap);
-</pre></div><div class="refsect1" lang="en"><a name="id2739388"></a><h2>Description</h2><p>
+ int width,
+ int height);
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-XLib-Backend.html#cairo-xlib-surface-create-for-bitmap">cairo_xlib_surface_create_for_bitmap</a>
+ (Display *dpy,
+ Pixmap bitmap,
+ int width,
+ int height);
+void <a href="cairo-XLib-Backend.html#cairo-xlib-surface-set-size">cairo_xlib_surface_set_size</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ int width,
+ int height);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2979126"></a><h2>Description</h2>
+<p>
-</p></div><div class="refsect1" lang="en"><a name="id2739397"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2739403"></a><h3><a name="cairo-set-target-drawable"></a>cairo_set_target_drawable ()</h3><a class="indexterm" name="id2739411"></a><pre class="programlisting">void cairo_set_target_drawable (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- Display *dpy,
- Drawable drawable);</pre><p>
-Directs output for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> to an Xlib drawable. <i class="parameter"><tt>drawable</tt></i> must
-be a Window or Pixmap on the default screen of <i class="parameter"><tt>dpy</tt></i> using the
-default colormap and visual. Using this function is slow because
-the function must retrieve information about <i class="parameter"><tt>drawable</tt></i> from the X
-server.
-
-The combination of <a href="cairo-XLib-Backend.html#cairo-xlib-surface-create"><tt class="function">cairo_xlib_surface_create()</tt></a> and
-<a href="cairo-cairo-t.html#cairo-set-target-surface"><tt class="function">cairo_set_target_surface()</tt></a> is somewhat more flexible, although
-it still is slow.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dpy</tt></i>:</span></td><td> an X display
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>drawable</tt></i>:</span></td><td> a window or pixmap on the default screen of <i class="parameter"><tt>dpy</tt></i>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2681239"></a><h3><a name="cairo-xlib-surface-create"></a>cairo_xlib_surface_create ()</h3><a class="indexterm" name="id2681247"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create (Display *dpy,
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2979138"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2979144"></a><h3>
+<a name="cairo-xlib-surface-create"></a>cairo_xlib_surface_create ()</h3>
+<a class="indexterm" name="id2979153"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create (Display *dpy,
Drawable drawable,
Visual *visual,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- Colormap colormap);</pre><p>
+ int width,
+ int height);</pre>
+<p>
+Creates an Xlib surface that draws to the given drawable.
+The way that colors are represented in the drawable is specified
+by the provided visual.
+</p>
+<p>
+NOTE: If <i class="parameter"><tt>drawable</tt></i> is a Window, then the function
+cairo_xlib_surface_set_size must be called whenever the size of the
+window changes.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>dpy</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>drawable</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>visual</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>colormap</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dpy</tt></i>&#160;:</span></td>
+<td> an X Display
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>drawable</tt></i>&#160;:</span></td>
+<td> an X Drawable, (a Pixmap or a Window)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>visual</tt></i>&#160;:</span></td>
+<td> the visual to use for drawing to <i class="parameter"><tt>drawable</tt></i>. The depth
+ of the visual must match the depth of the drawable.
+ Currently, only TrueColor visuals are fully supported.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the current width of <i class="parameter"><tt>drawable</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the current height of <i class="parameter"><tt>drawable</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the newly created surface
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2927399"></a><h3>
+<a name="cairo-xlib-surface-create-for-bitmap"></a>cairo_xlib_surface_create_for_bitmap ()</h3>
+<a class="indexterm" name="id2927409"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create_for_bitmap
+ (Display *dpy,
+ Pixmap bitmap,
+ int width,
+ int height);</pre>
+<p>
+Creates an Xlib surface that draws to the given bitmap.
+This will be drawn to as a CAIRO_FORMAT_A1 object.</p>
+<p>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dpy</tt></i>&#160;:</span></td>
+<td> an X Display
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>bitmap</tt></i>&#160;:</span></td>
+<td> an X Drawable, (a depth-1 Pixmap)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the current width of <i class="parameter"><tt>bitmap</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the current height of <i class="parameter"><tt>bitmap</tt></i>.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the newly created surface
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2926098"></a><h3>
+<a name="cairo-xlib-surface-set-size"></a>cairo_xlib_surface_set_size ()</h3>
+<a class="indexterm" name="id2926107"></a><pre class="programlisting">void cairo_xlib_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ int width,
+ int height);</pre>
+<p>
+Informs cairo of the new size of the X Drawable underlying the
+surface. For a surface created for a Window (rather than a Pixmap),
+this function must be called each time the size of the window
+changes. (For a subwindow, you are normally resizing the window
+yourself, but for a toplevel window, it is necessary to listen for
+ConfigureNotify events.)
+</p>
+<p>
+A Pixmap can never change size, so it is never necessary to call
+this function on a surface created for a Pixmap.</p>
+<p>
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-XCB-Backend.html"><b>&lt;&lt;XCB Backend</b></a></td><td align="right"></td></tr></table></body></html>
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> for the XLib backend
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the new width of the surface
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the new height of the surface
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-XCB-Backend.html"><b>&lt;&lt;&#160;XCB Backend</b></a></td>
+<td align="right"><a accesskey="n" href="ix01.html"><b>Index&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-cairo-matrix-t.html b/doc/public/html/cairo-cairo-matrix-t.html
index 84aacff..252bd4c 100644
--- a/doc/public/html/cairo-cairo-matrix-t.html
+++ b/doc/public/html/cairo-cairo-matrix-t.html
@@ -1,220 +1,613 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>cairo_matrix_t</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-cairo-pattern-t.html" title="cairo_pattern_t"><link rel="next" href="cairo-ATSUI-Fonts.html" title="ATSUI Fonts"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-cairo-pattern-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-ATSUI-Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-cairo-matrix-t"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">cairo_matrix_t</span></h2><p>cairo_matrix_t &#8212;
- Transformation matrices</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
-
-
-
-typedef <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a>;
-<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a>* <a href="cairo-cairo-matrix-t.html#cairo-matrix-create">cairo_matrix_create</a> (void);
-void <a href="cairo-cairo-matrix-t.html#cairo-matrix-destroy">cairo_matrix_destroy</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-copy">cairo_matrix_copy</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *other);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-set-identity">cairo_matrix_set_identity</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-set-affine">cairo_matrix_set_affine</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- double a,
- double b,
- double c,
- double d,
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>cairo_matrix_t</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-cairo-pattern-t.html" title="cairo_pattern_t">
+<link rel="next" href="cairo-Fonts.html" title="Fonts">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-cairo-pattern-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-cairo-matrix-t"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">cairo_matrix_t</span></h2>
+<p>cairo_matrix_t &#8212;
+ Transformation matrices</p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
+
+
+
+ <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a>;
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init">cairo_matrix_init</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double xx,
+ double yx,
+ double xy,
+ double yy,
+ double x0,
+ double y0);
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-identity">cairo_matrix_init_identity</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-translate">cairo_matrix_init_translate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double tx,
double ty);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-get-affine">cairo_matrix_get_affine</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- double *a,
- double *b,
- double *c,
- double *d,
- double *tx,
- double *ty);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-translate">cairo_matrix_translate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-scale">cairo_matrix_init_scale</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double sx,
+ double sy);
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-rotate">cairo_matrix_init_rotate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double radians);
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-translate">cairo_matrix_translate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double tx,
double ty);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-scale">cairo_matrix_scale</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-scale">cairo_matrix_scale</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double sx,
double sy);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-rotate">cairo_matrix_rotate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-rotate">cairo_matrix_rotate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double radians);
<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-invert">cairo_matrix_invert</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-multiply">cairo_matrix_multiply</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result,
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-multiply">cairo_matrix_multiply</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *a,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *b);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-distance">cairo_matrix_transform_distance</a>
- (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-distance">cairo_matrix_transform_distance</a> (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double *dx,
double *dy);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-point">cairo_matrix_transform_point</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+void <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-point">cairo_matrix_transform_point</a> (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double *x,
double *y);
-</pre></div><div class="refsect1" lang="en"><a name="id2733267"></a><h2>Description</h2><p><a class="indexterm" name="id2733273"></a><a class="indexterm" name="id2733279"></a>
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2938599"></a><h2>Description</h2>
+<p><a class="indexterm" name="id2938606"></a><a class="indexterm" name="id2938614"></a>
<span class="structname">cairo_matrix_t</span> is used throughout
Cairo to represents between different coordinates spaces.
A <span class="structname">cairo_matrix</span> holds an affine
transformation, such as a scale, rotation, or shear, or a
combination of those. Mathematically, the effect of an affine
transformation on a point (<tt class="literal">x</tt>,<tt class="literal">y</tt>) is given by:
- </p><pre class="programlisting">
+ </p>
+<pre class="programlisting">
x_new = x * a + y * c + tx;
y_new = x * b + y * d + ty;
- </pre><p>
+ </pre>
+<p>
The parameters <tt class="literal">a</tt>, <tt class="literal">b</tt>,
<tt class="literal">c</tt>, <tt class="literal">d</tt>, <tt class="literal">tx</tt>,
<tt class="literal">ty</tt> can be retrieved with
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-get-affine"><tt class="function">cairo_matrix_get_affine()</tt></a> and set with <a href="cairo-cairo-matrix-t.html#cairo-matrix-get-affine"><tt class="function">cairo_matrix_get_affine()</tt></a>.
- </p><p>
+ <tt class="function">cairo_matrix_get_affine()</tt> and set with <tt class="function">cairo_matrix_get_affine()</tt>.
+ </p>
+<p>
The primary use of transformation matrices in Cairo is as the
current transformation matrix in a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>. The current
transformation matrix gives the transformation from user space
coordinates to device coordinates. See <a href="cairo-cairo-t.html#cairo-set-matrix"><tt class="function">cairo_set_matrix()</tt></a>,
- <a href="cairo-cairo-t.html#cairo-current-matrix"><tt class="function">cairo_current_matrix()</tt></a>.
- </p></div><div class="refsect1" lang="en"><a name="id2733367"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2733372"></a><h3><a name="cairo-matrix-t"></a>cairo_matrix_t</h3><a class="indexterm" name="id2733381"></a><pre class="programlisting">typedef struct _cairo_matrix cairo_matrix_t;
-</pre><p>
+ <tt class="function">cairo_current_matrix()</tt>.
+ </p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2938742"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2938749"></a><h3>
+<a name="cairo-matrix-t"></a>cairo_matrix_t</h3>
+<a class="indexterm" name="id2938759"></a><pre class="programlisting">typedef struct {
+ double xx; double yx;
+ double xy; double yy;
+ double x0; double y0;
+} cairo_matrix_t;
+</pre>
+<p>
A <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a> holds an affine transformation, such as a scale,
-rotation, or shear, or a combination of those.</p><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2733402"></a><h3><a name="cairo-matrix-create"></a>cairo_matrix_create ()</h3><a class="indexterm" name="id2733411"></a><pre class="programlisting"><a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a>* cairo_matrix_create (void);</pre><p>
-Creates a new identity matrix.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> a newly created matrix; free with <a href="cairo-cairo-matrix-t.html#cairo-matrix-destroy"><tt class="function">cairo_matrix_destroy()</tt></a>,
- or <tt class="literal">NULL</tt> if memory couldn't be allocated.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2733451"></a><h3><a name="cairo-matrix-destroy"></a>cairo_matrix_destroy ()</h3><a class="indexterm" name="id2733459"></a><pre class="programlisting">void cairo_matrix_destroy (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-Frees a matrix created with cairo_matrix_create.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2734685"></a><h3><a name="cairo-matrix-copy"></a>cairo_matrix_copy ()</h3><a class="indexterm" name="id2734693"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_copy (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *other);</pre><p>
-Modifies <i class="parameter"><tt>matrix</tt></i> to be identical to <i class="parameter"><tt>other</tt></i>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>other</tt></i>:</span></td><td> another <span class="type">cairo_</span>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2734779"></a><h3><a name="cairo-matrix-set-identity"></a>cairo_matrix_set_identity ()</h3><a class="indexterm" name="id2734787"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_set_identity (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-Modifies <i class="parameter"><tt>matrix</tt></i> to be an identity transformation.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2734846"></a><h3><a name="cairo-matrix-set-affine"></a>cairo_matrix_set_affine ()</h3><a class="indexterm" name="id2734855"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_set_affine (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- double a,
- double b,
- double c,
- double d,
- double tx,
- double ty);</pre><p>
+rotation, or shear, or a combination of those.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2971462"></a><h3>
+<a name="cairo-matrix-init"></a>cairo_matrix_init ()</h3>
+<a class="indexterm" name="id2971473"></a><pre class="programlisting">void cairo_matrix_init (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double xx,
+ double yx,
+ double xy,
+ double yy,
+ double x0,
+ double y0);</pre>
+<p>
Sets <i class="parameter"><tt>matrix</tt></i> to be the affine transformation given by
-<i class="parameter"><tt>a</tt></i>, b, <i class="parameter"><tt>c</tt></i>, <i class="parameter"><tt>d</tt></i>, <i class="parameter"><tt>tx</tt></i>, <i class="parameter"><tt>ty</tt></i>. The transformation is given
+<i class="parameter"><tt>xx</tt></i>, <i class="parameter"><tt>yx</tt></i>, <i class="parameter"><tt>xy</tt></i>, <i class="parameter"><tt>yy</tt></i>, <i class="parameter"><tt>x0</tt></i>, <i class="parameter"><tt>y0</tt></i>. The transformation is given
by:
-</p><pre class="programlisting">
- x_new = x * a + y * c + tx;
- y_new = x * b + y * d + ty;
-</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a cairo_matrix_t
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>a</tt></i>:</span></td><td> a component of the affine transformation
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>b</tt></i>:</span></td><td> b component of the affine transformation
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>c</tt></i>:</span></td><td> c component of the affine transformation
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>d</tt></i>:</span></td><td> d component of the affine transformation
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>tx</tt></i>:</span></td><td> X translation component of the affine transformation
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>ty</tt></i>:</span></td><td> Y translation component of the affine transformation
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2678925"></a><h3><a name="cairo-matrix-get-affine"></a>cairo_matrix_get_affine ()</h3><a class="indexterm" name="id2678933"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_get_affine (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- double *a,
- double *b,
- double *c,
- double *d,
- double *tx,
- double *ty);</pre><p>
-Gets the matrix values for the affine tranformation that <i class="parameter"><tt>matrix</tt></i> represents.
-See <a href="cairo-cairo-matrix-t.html#cairo-matrix-set-affine"><tt class="function">cairo_matrix_set_affine()</tt></a>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>a</tt></i>:</span></td><td> location to store a component of affine transformation, or <tt class="literal">NULL</tt>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>b</tt></i>:</span></td><td> location to store b component of affine transformation, or <tt class="literal">NULL</tt>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>c</tt></i>:</span></td><td> location to store c component of affine transformation, or <tt class="literal">NULL</tt>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>d</tt></i>:</span></td><td> location to store d component of affine transformation, or <tt class="literal">NULL</tt>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>tx</tt></i>:</span></td><td> location to store X-translation component of affine transformation, or <tt class="literal">NULL</tt>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>ty</tt></i>:</span></td><td> location to store Y-translation component of affine transformation, or <tt class="literal">NULL</tt>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679124"></a><h3><a name="cairo-matrix-translate"></a>cairo_matrix_translate ()</h3><a class="indexterm" name="id2679133"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+</p>
+<pre class="programlisting">
+ x_new = xx * x + xy * y + x0;
+ y_new = yx * x + yy * y + y0;
+</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a cairo_matrix_t
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>xx</tt></i>&#160;:</span></td>
+<td> xx component of the affine transformation
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>yx</tt></i>&#160;:</span></td>
+<td> yx component of the affine transformation
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>xy</tt></i>&#160;:</span></td>
+<td> xy component of the affine transformation
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>yy</tt></i>&#160;:</span></td>
+<td> yy component of the affine transformation
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x0</tt></i>&#160;:</span></td>
+<td> X translation component of the affine transformation
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y0</tt></i>&#160;:</span></td>
+<td> Y translation component of the affine transformation
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2971695"></a><h3>
+<a name="cairo-matrix-init-identity"></a>cairo_matrix_init_identity ()</h3>
+<a class="indexterm" name="id2971704"></a><pre class="programlisting">void cairo_matrix_init_identity (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+Modifies <i class="parameter"><tt>matrix</tt></i> to be an identity transformation.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2931794"></a><h3>
+<a name="cairo-matrix-init-translate"></a>cairo_matrix_init_translate ()</h3>
+<a class="indexterm" name="id2931803"></a><pre class="programlisting">void cairo_matrix_init_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double tx,
- double ty);</pre><p>
+ double ty);</pre>
+<p>
+Initializes <i class="parameter"><tt>matrix</tt></i> to a transformation that translates by <i class="parameter"><tt>tx</tt></i> and
+<i class="parameter"><tt>ty</tt></i> in the X and Y dimensions, respectively.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a cairo_matrix_t
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>tx</tt></i>&#160;:</span></td>
+<td> amount to translate in the X direction
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>ty</tt></i>&#160;:</span></td>
+<td> amount to translate in the Y direction
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2931915"></a><h3>
+<a name="cairo-matrix-init-scale"></a>cairo_matrix_init_scale ()</h3>
+<a class="indexterm" name="id2931924"></a><pre class="programlisting">void cairo_matrix_init_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double sx,
+ double sy);</pre>
+<p>
+Initializes <i class="parameter"><tt>matrix</tt></i> to a transformation that scales by <i class="parameter"><tt>sx</tt></i> and <i class="parameter"><tt>sy</tt></i>
+in the X and Y dimensions, respectively.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a cairo_matrix_t
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>sx</tt></i>&#160;:</span></td>
+<td> scale factor in the X direction
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>sy</tt></i>&#160;:</span></td>
+<td> scale factor in the Y direction
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2932034"></a><h3>
+<a name="cairo-matrix-init-rotate"></a>cairo_matrix_init_rotate ()</h3>
+<a class="indexterm" name="id2932043"></a><pre class="programlisting">void cairo_matrix_init_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double radians);</pre>
+<p>
+Initialized <i class="parameter"><tt>matrix</tt></i> to a transformation that rotates by <i class="parameter"><tt>radians</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a cairo_matrix_t
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>radians</tt></i>&#160;:</span></td>
+<td> angle of rotation, in radians. The direction of rotation
+is defined such that positive angles rotate in the direction from
+the positive X axis toward the positive Y axis. With the default
+axis orientation of cairo, positive angles rotate in a clockwise
+direction.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2932130"></a><h3>
+<a name="cairo-matrix-translate"></a>cairo_matrix_translate ()</h3>
+<a class="indexterm" name="id2932139"></a><pre class="programlisting">void cairo_matrix_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double tx,
+ double ty);</pre>
+<p>
Applies a translation by <i class="parameter"><tt>tx</tt></i>, <i class="parameter"><tt>ty</tt></i> to the transformation in
-<i class="parameter"><tt>matrix</tt></i>. The new transformation is given by first translating by
-<i class="parameter"><tt>tx</tt></i>, <i class="parameter"><tt>ty</tt></i> then applying the original transformation</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a cairo_matrix_t
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>tx</tt></i>:</span></td><td> amount to rotate in the X direction
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>ty</tt></i>:</span></td><td> amount to rotate in the Y direction
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679235"></a><h3><a name="cairo-matrix-scale"></a>cairo_matrix_scale ()</h3><a class="indexterm" name="id2679243"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+<i class="parameter"><tt>matrix</tt></i>. The effect of the new transformation is to first translate
+the coordinates by <i class="parameter"><tt>tx</tt></i> and <i class="parameter"><tt>ty</tt></i>, then apply the original transformation
+to the coordinates.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a cairo_matrix_t
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>tx</tt></i>&#160;:</span></td>
+<td> amount to translate in the X direction
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>ty</tt></i>&#160;:</span></td>
+<td> amount to translate in the Y direction
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2932264"></a><h3>
+<a name="cairo-matrix-scale"></a>cairo_matrix_scale ()</h3>
+<a class="indexterm" name="id2932274"></a><pre class="programlisting">void cairo_matrix_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double sx,
- double sy);</pre><p>
-Applies scaling by <i class="parameter"><tt>tx</tt></i>, <i class="parameter"><tt>ty</tt></i> to the transformation in
-<i class="parameter"><tt>matrix</tt></i>. The new transformation is given by first scaling by <i class="parameter"><tt>sx</tt></i>
-and <i class="parameter"><tt>sy</tt></i> then applying the original transformation</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>sx</tt></i>:</span></td><td> Scale factor in the X direction
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>sy</tt></i>:</span></td><td> Scale factor in the Y direction
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679353"></a><h3><a name="cairo-matrix-rotate"></a>cairo_matrix_rotate ()</h3><a class="indexterm" name="id2679361"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
- double radians);</pre><p>
+ double sy);</pre>
+<p>
+Applies scaling by <i class="parameter"><tt>tx</tt></i>, <i class="parameter"><tt>ty</tt></i> to the transformation in <i class="parameter"><tt>matrix</tt></i>. The
+effect of the new transformation is to first scale the coordinates
+by <i class="parameter"><tt>sx</tt></i> and <i class="parameter"><tt>sy</tt></i>, then apply the original transformation to the coordinates.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>sx</tt></i>&#160;:</span></td>
+<td> scale factor in the X direction
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>sy</tt></i>&#160;:</span></td>
+<td> scale factor in the Y direction
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2932405"></a><h3>
+<a name="cairo-matrix-rotate"></a>cairo_matrix_rotate ()</h3>
+<a class="indexterm" name="id2932415"></a><pre class="programlisting">void cairo_matrix_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+ double radians);</pre>
+<p>
Applies rotation by <i class="parameter"><tt>radians</tt></i> to the transformation in
-<i class="parameter"><tt>matrix</tt></i>. The new transformation is given by first rotating by
-<i class="parameter"><tt>radians</tt></i> then applying the original transformation</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>radians</tt></i>:</span></td><td> angle of rotation, in radians. Angles are defined
- so that an angle of 90 degrees (<tt class="literal">M_PI</tt> radians) rotates the
- positive X axis into the positive Y axis. With the default
- Cairo choice of axis orientation, positive rotations are
- clockwise.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679451"></a><h3><a name="cairo-matrix-invert"></a>cairo_matrix_invert ()</h3><a class="indexterm" name="id2679459"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_invert (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
+<i class="parameter"><tt>matrix</tt></i>. The effect of the new transformation is to first rotate the
+coordinates by <i class="parameter"><tt>radians</tt></i>, then apply the original transformation
+to the coordinates.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>radians</tt></i>&#160;:</span></td>
+<td> angle of rotation, in radians. The direction of rotation
+is defined such that positive angles rotate in the direction from
+the positive X axis toward the positive Y axis. With the default
+axis orientation of cairo, positive angles rotate in a clockwise
+direction.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2932516"></a><h3>
+<a name="cairo-matrix-invert"></a>cairo_matrix_invert ()</h3>
+<a class="indexterm" name="id2932526"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_invert (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
Changes <i class="parameter"><tt>matrix</tt></i> to be the inverse of it's original value. Not
all transformation matrices have inverses; if the matrix
collapses points together (it is <i class="firstterm">degenerate</i>),
then it has no inverse and this function will fail.
-</p><p>
+</p>
+<p>
Returns: If <i class="parameter"><tt>matrix</tt></i> has an inverse, modifies <i class="parameter"><tt>matrix</tt></i> to
- be the inverse matrix and returns <tt class="literal">CAIRO_STATUS_SUCCESS</tt>. Otherwise,</p><p>
+ be the inverse matrix and returns <tt class="literal">CAIRO_STATUS_SUCCESS</tt>. Otherwise,</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">CAIRO_STATUS_INVALID_MATRIX</tt>.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679535"></a><h3><a name="cairo-matrix-multiply"></a>cairo_matrix_multiply ()</h3><a class="indexterm" name="id2679543"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_multiply (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result,
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+<tt class="literal">CAIRO_STATUS_INVALID_MATRIX</tt>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2932631"></a><h3>
+<a name="cairo-matrix-multiply"></a>cairo_matrix_multiply ()</h3>
+<a class="indexterm" name="id2932640"></a><pre class="programlisting">void cairo_matrix_multiply (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *a,
- const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *b);</pre><p>
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *b);</pre>
+<p>
Multiplies the affine transformations in <i class="parameter"><tt>a</tt></i> and <i class="parameter"><tt>b</tt></i> together
-and stores the result in <i class="parameter"><tt>result</tt></i>. The resulting transformation
-is given by first applying the transformation in <i class="parameter"><tt>b</tt></i> then
-applying the transformation in <i class="parameter"><tt>a</tt></i>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>result</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i> in which to store the result
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>a</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>b</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679658"></a><h3><a name="cairo-matrix-transform-distance"></a>cairo_matrix_transform_distance ()</h3><a class="indexterm" name="id2679669"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_transform_distance
- (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+and stores the result in <i class="parameter"><tt>result</tt></i>. The effect of the resulting
+transformation is to first apply the transformation in <i class="parameter"><tt>a</tt></i> to the
+coordinates and then apply the transformation in <i class="parameter"><tt>b</tt></i> to the
+coordinates.
+</p>
+<p>
+It is allowable for <i class="parameter"><tt>result</tt></i> to be identical to either <i class="parameter"><tt>a</tt></i> or <i class="parameter"><tt>b</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>result</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i> in which to store the result
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>a</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>b</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2973056"></a><h3>
+<a name="cairo-matrix-transform-distance"></a>cairo_matrix_transform_distance ()</h3>
+<a class="indexterm" name="id2973067"></a><pre class="programlisting">void cairo_matrix_transform_distance (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double *dx,
- double *dy);</pre><p>
-Transforms the vector (<i class="parameter"><tt>dx</tt></i>,<i class="parameter"><tt>dy</tt></i>) by <i class="parameter"><tt>matrix</tt></i>. Translation is
-ignored. In terms of the components of the affine transformation:
-</p><p>
-</p><pre class="programlisting">
+ double *dy);</pre>
+<p>
+Transforms the distance vector (<i class="parameter"><tt>dx</tt></i>,<i class="parameter"><tt>dy</tt></i>) by <i class="parameter"><tt>matrix</tt></i>. This is
+similar to <tt class="function">cairo_matrix_transform()</tt> except that the translation
+components of the transformation are ignored. The calculation of
+the returned vector is as follows:
+</p>
+<p>
+</p>
+<pre class="programlisting">
dx2 = dx1 * a + dy1 * c;
dy2 = dx1 * b + dy1 * d;
-</pre><p>
-</p><p>
+</pre>
+<p>
+</p>
+<p>
Affine transformations are position invariant, so the same vector
always transforms to the same vector. If (<i class="parameter"><tt>x1</tt></i>,<i class="parameter"><tt>y1</tt></i>) transforms
to (<i class="parameter"><tt>x2</tt></i>,<i class="parameter"><tt>y2</tt></i>) then (<i class="parameter"><tt>x1</tt></i>+<i class="parameter"><tt>dx1</tt></i>,<i class="parameter"><tt>y1</tt></i>+<i class="parameter"><tt>dy1</tt></i>) will transform to
-(<i class="parameter"><tt>x1</tt></i>+<i class="parameter"><tt>dx2</tt></i>,<i class="parameter"><tt>y1</tt></i>+<i class="parameter"><tt>dy2</tt></i>) for all values of <i class="parameter"><tt>x1</tt></i> and <i class="parameter"><tt>x2</tt></i>.</p><p>
+(<i class="parameter"><tt>x1</tt></i>+<i class="parameter"><tt>dx2</tt></i>,<i class="parameter"><tt>y1</tt></i>+<i class="parameter"><tt>dy2</tt></i>) for all values of <i class="parameter"><tt>x1</tt></i> and <i class="parameter"><tt>x2</tt></i>.</p>
+<p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx</tt></i>:</span></td><td> a distance in the X direction. An in/out parameter
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy</tt></i>:</span></td><td> a distance in the Y direction. An in/out parameter
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2679828"></a><h3><a name="cairo-matrix-transform-point"></a>cairo_matrix_transform_point ()</h3><a class="indexterm" name="id2679839"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_transform_point (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx</tt></i>&#160;:</span></td>
+<td> X component of a distance vector. An in/out parameter
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy</tt></i>&#160;:</span></td>
+<td> Y component of a distance vector. An in/out parameter
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2973295"></a><h3>
+<a name="cairo-matrix-transform-point"></a>cairo_matrix_transform_point ()</h3>
+<a class="indexterm" name="id2973306"></a><pre class="programlisting">void cairo_matrix_transform_point (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix,
double *x,
- double *y);</pre><p>
-Transforms the point (<i class="parameter"><tt>x</tt></i>, <i class="parameter"><tt>y</tt></i>) by <i class="parameter"><tt>matrix</tt></i>.</p><p>
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td> X position. An in/out parameter
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td> Y position. An in/out parameter
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt>, always.
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-cairo-pattern-t.html"><b>&lt;&lt;cairo_pattern_t</b></a></td><td align="right"><a accesskey="n" href="cairo-ATSUI-Fonts.html"><b>ATSUI Fonts&gt;&gt;</b></a></td></tr></table></body></html>
+ double *y);</pre>
+<p>
+Transforms the point (<i class="parameter"><tt>x</tt></i>, <i class="parameter"><tt>y</tt></i>) by <i class="parameter"><tt>matrix</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <i class="parameter"><tt>cairo_matrix_t</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td> X position. An in/out parameter
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td> Y position. An in/out parameter
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-cairo-pattern-t.html"><b>&lt;&lt;&#160;cairo_pattern_t</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-Fonts.html"><b>Fonts&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-cairo-pattern-t.html b/doc/public/html/cairo-cairo-pattern-t.html
index 9a48f3e..99b9187 100644
--- a/doc/public/html/cairo-cairo-pattern-t.html
+++ b/doc/public/html/cairo-cairo-pattern-t.html
@@ -1,4 +1,42 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>cairo_pattern_t</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-cairo-surface-t.html" title="cairo_surface_t"><link rel="next" href="cairo-cairo-matrix-t.html" title="cairo_matrix_t"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-cairo-surface-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-cairo-matrix-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-cairo-pattern-t"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">cairo_pattern_t</span></h2><p>cairo_pattern_t &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>cairo_pattern_t</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-cairo-surface-t.html" title="cairo_surface_t">
+<link rel="next" href="cairo-cairo-matrix-t.html" title="cairo_matrix_t">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-cairo-surface-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-cairo-matrix-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-cairo-pattern-t"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">cairo_pattern_t</span></h2>
+<p>cairo_pattern_t &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
@@ -19,140 +57,560 @@ typedef <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t
double radius1);
void <a href="cairo-cairo-pattern-t.html#cairo-pattern-reference">cairo_pattern_reference</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
void <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy">cairo_pattern_destroy</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop">cairo_pattern_add_color_stop</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-status">cairo_pattern_status</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
+void <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb">cairo_pattern_add_color_stop_rgb</a>
+ (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ double offset,
+ double red,
+ double green,
+ double blue);
+void <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba">cairo_pattern_add_color_stop_rgba</a>
+ (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue,
double alpha);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix">cairo_pattern_set_matrix</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix">cairo_pattern_get_matrix</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+void <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix">cairo_pattern_set_matrix</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
+void <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix">cairo_pattern_get_matrix</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
enum <a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a>;
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-extend">cairo_pattern_set_extend</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+void <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-extend">cairo_pattern_set_extend</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> extend);
<a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-extend">cairo_pattern_get_extend</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-filter">cairo_pattern_set_filter</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+void <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-filter">cairo_pattern_set_filter</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter);
<a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-filter">cairo_pattern_get_filter</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
-</pre></div><div class="refsect1" lang="en"><a name="id2735726"></a><h2>Description</h2><p>
-
-</p></div><div class="refsect1" lang="en"><a name="id2735736"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2735741"></a><h3><a name="cairo-pattern-t"></a>cairo_pattern_t</h3><a class="indexterm" name="id2735750"></a><pre class="programlisting">typedef struct _cairo_pattern cairo_pattern_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2735760"></a><h3><a name="cairo-pattern-create-for-surface"></a>cairo_pattern_create_for_surface ()</h3><a class="indexterm" name="id2735768"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_for_surface
- (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2735813"></a><h3><a name="cairo-pattern-create-linear"></a>cairo_pattern_create_linear ()</h3><a class="indexterm" name="id2735822"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_linear
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2934221"></a><h2>Description</h2>
+<p>
+
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2934232"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2934238"></a><h3>
+<a name="cairo-pattern-t"></a>cairo_pattern_t</h3>
+<a class="indexterm" name="id2934248"></a><pre class="programlisting">typedef struct _cairo_pattern cairo_pattern_t;
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2934264"></a><h3>
+<a name="cairo-pattern-create-for-surface"></a>cairo_pattern_create_for_surface ()</h3>
+<a class="indexterm" name="id2934273"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_for_surface
+ (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2934331"></a><h3>
+<a name="cairo-pattern-create-linear"></a>cairo_pattern_create_linear ()</h3>
+<a class="indexterm" name="id2934340"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_linear
(double x0,
double y0,
double x1,
- double y1);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>x0</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y0</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2735917"></a><h3><a name="cairo-pattern-create-radial"></a>cairo_pattern_create_radial ()</h3><a class="indexterm" name="id2735925"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_radial
+ double y1);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x0</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y0</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2972519"></a><h3>
+<a name="cairo-pattern-create-radial"></a>cairo_pattern_create_radial ()</h3>
+<a class="indexterm" name="id2972529"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_radial
(double cx0,
double cy0,
double radius0,
double cx1,
double cy1,
- double radius1);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cx0</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>cy0</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>radius0</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>cx1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>cy1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>radius1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2617438"></a><h3><a name="cairo-pattern-reference"></a>cairo_pattern_reference ()</h3><a class="indexterm" name="id2617446"></a><pre class="programlisting">void cairo_pattern_reference (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2617480"></a><h3><a name="cairo-pattern-destroy"></a>cairo_pattern_destroy ()</h3><a class="indexterm" name="id2617488"></a><pre class="programlisting">void cairo_pattern_destroy (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2617522"></a><h3><a name="cairo-pattern-add-color-stop"></a>cairo_pattern_add_color_stop ()</h3><a class="indexterm" name="id2617533"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_add_color_stop (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ double radius1);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cx0</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cy0</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>radius0</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cx1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cy1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>radius1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2972691"></a><h3>
+<a name="cairo-pattern-reference"></a>cairo_pattern_reference ()</h3>
+<a class="indexterm" name="id2972700"></a><pre class="programlisting">void cairo_pattern_reference (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2944809"></a><h3>
+<a name="cairo-pattern-destroy"></a>cairo_pattern_destroy ()</h3>
+<a class="indexterm" name="id2944818"></a><pre class="programlisting">void cairo_pattern_destroy (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2944862"></a><h3>
+<a name="cairo-pattern-status"></a>cairo_pattern_status ()</h3>
+<a class="indexterm" name="id2944871"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_status (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
+<p>
+Checks whether an error has previously occurred for this
+pattern.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> or <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2944950"></a><h3>
+<a name="cairo-pattern-add-color-stop-rgb"></a>cairo_pattern_add_color_stop_rgb ()</h3>
+<a class="indexterm" name="id2944961"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgb
+ (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ double offset,
+ double red,
+ double green,
+ double blue);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>offset</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>red</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>green</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>blue</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2945092"></a><h3>
+<a name="cairo-pattern-add-color-stop-rgba"></a>cairo_pattern_add_color_stop_rgba ()</h3>
+<a class="indexterm" name="id2945103"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgba
+ (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue,
- double alpha);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>offset</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>red</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>green</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>blue</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>alpha</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2740442"></a><h3><a name="cairo-pattern-set-matrix"></a>cairo_pattern_set_matrix ()</h3><a class="indexterm" name="id2740450"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_set_matrix (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2740510"></a><h3><a name="cairo-pattern-get-matrix"></a>cairo_pattern_get_matrix ()</h3><a class="indexterm" name="id2740519"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_get_matrix (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2740580"></a><h3><a name="cairo-extend-t"></a>enum cairo_extend_t</h3><a class="indexterm" name="id2740588"></a><pre class="programlisting">typedef enum {
+ double alpha);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>offset</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>red</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>green</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>blue</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>alpha</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938063"></a><h3>
+<a name="cairo-pattern-set-matrix"></a>cairo_pattern_set_matrix ()</h3>
+<a class="indexterm" name="id2938072"></a><pre class="programlisting">void cairo_pattern_set_matrix (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938138"></a><h3>
+<a name="cairo-pattern-get-matrix"></a>cairo_pattern_get_matrix ()</h3>
+<a class="indexterm" name="id2938147"></a><pre class="programlisting">void cairo_pattern_get_matrix (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938213"></a><h3>
+<a name="cairo-extend-t"></a>enum cairo_extend_t</h3>
+<a class="indexterm" name="id2938223"></a><pre class="programlisting">typedef enum {
CAIRO_EXTEND_NONE,
CAIRO_EXTEND_REPEAT,
CAIRO_EXTEND_REFLECT
} cairo_extend_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2740599"></a><h3><a name="cairo-pattern-set-extend"></a>cairo_pattern_set_extend ()</h3><a class="indexterm" name="id2740608"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_set_extend (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
- <a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> extend);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>extend</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2740669"></a><h3><a name="cairo-pattern-get-extend"></a>cairo_pattern_get_extend ()</h3><a class="indexterm" name="id2740677"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> cairo_pattern_get_extend (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2740721"></a><h3><a name="cairo-pattern-set-filter"></a>cairo_pattern_set_filter ()</h3><a class="indexterm" name="id2740730"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_set_filter (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
- <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>filter</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2740790"></a><h3><a name="cairo-pattern-get-filter"></a>cairo_pattern_get_filter ()</h3><a class="indexterm" name="id2740799"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> cairo_pattern_get_filter (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-cairo-surface-t.html"><b>&lt;&lt;cairo_surface_t</b></a></td><td align="right"><a accesskey="n" href="cairo-cairo-matrix-t.html"><b>cairo_matrix_t&gt;&gt;</b></a></td></tr></table></body></html>
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938241"></a><h3>
+<a name="cairo-pattern-set-extend"></a>cairo_pattern_set_extend ()</h3>
+<a class="indexterm" name="id2938250"></a><pre class="programlisting">void cairo_pattern_set_extend (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ <a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> extend);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>extend</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938316"></a><h3>
+<a name="cairo-pattern-get-extend"></a>cairo_pattern_get_extend ()</h3>
+<a class="indexterm" name="id2938325"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> cairo_pattern_get_extend (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938381"></a><h3>
+<a name="cairo-pattern-set-filter"></a>cairo_pattern_set_filter ()</h3>
+<a class="indexterm" name="id2938390"></a><pre class="programlisting">void cairo_pattern_set_filter (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
+ <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>filter</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2938457"></a><h3>
+<a name="cairo-pattern-get-filter"></a>cairo_pattern_get_filter ()</h3>
+<a class="indexterm" name="id2938466"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> cairo_pattern_get_filter (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-cairo-surface-t.html"><b>&lt;&lt;&#160;cairo_surface_t</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-cairo-matrix-t.html"><b>cairo_matrix_t&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-cairo-surface-t.html b/doc/public/html/cairo-cairo-surface-t.html
index 9d13be9..6ab7669 100644
--- a/doc/public/html/cairo-cairo-surface-t.html
+++ b/doc/public/html/cairo-cairo-surface-t.html
@@ -1,14 +1,46 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>cairo_surface_t</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="cairo-cairo-t.html" title="cairo_t"><link rel="next" href="cairo-cairo-pattern-t.html" title="cairo_pattern_t"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="cairo-cairo-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-cairo-pattern-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-cairo-surface-t"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">cairo_surface_t</span></h2><p>cairo_surface_t &#8212; </p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>cairo_surface_t</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="cairo-cairo-t.html" title="cairo_t">
+<link rel="next" href="cairo-cairo-pattern-t.html" title="cairo_pattern_t">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-cairo-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-cairo-pattern-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-cairo-surface-t"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">cairo_surface_t</span></h2>
+<p>cairo_surface_t &#8212; </p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
typedef <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>;
-<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-surface-t.html#cairo-surface-create-for-image">cairo_surface_create_for_image</a>
- (char *data,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height,
- int stride);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-surface-t.html#cairo-surface-create-similar">cairo_surface_create_similar</a>
(<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *other,
<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
@@ -16,102 +48,322 @@ typedef <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t
int height);
void <a href="cairo-cairo-surface-t.html#cairo-surface-reference">cairo_surface_reference</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
void <a href="cairo-cairo-surface-t.html#cairo-surface-destroy">cairo_surface_destroy</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-set-repeat">cairo_surface_set_repeat</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- int repeat);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-set-matrix">cairo_surface_set_matrix</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-get-matrix">cairo_surface_get_matrix</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-set-filter">cairo_surface_set_filter</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter);
-<a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-get-filter">cairo_surface_get_filter</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
-</pre></div><div class="refsect1" lang="en"><a name="id2728748"></a><h2>Description</h2><p>
-
-</p></div><div class="refsect1" lang="en"><a name="id2728757"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2728763"></a><h3><a name="cairo-surface-t"></a>cairo_surface_t</h3><a class="indexterm" name="id2728771"></a><pre class="programlisting">typedef struct _cairo_surface cairo_surface_t;
-</pre><p>
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-finish">cairo_surface_finish</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-set-user-data">cairo_surface_set_user_data</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key,
+ void *user_data,
+ <a href="cairo-cairo-t.html#cairo-destroy-func-t">cairo_destroy_func_t</a> destroy);
+void* <a href="cairo-cairo-surface-t.html#cairo-surface-get-user-data">cairo_surface_get_user_data</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key);
+void <a href="cairo-cairo-surface-t.html#cairo-surface-set-device-offset">cairo_surface_set_device_offset</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x_offset,
+ double y_offset);
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2933298"></a><h2>Description</h2>
+<p>
+
+</p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2933309"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2933315"></a><h3>
+<a name="cairo-surface-t"></a>cairo_surface_t</h3>
+<a class="indexterm" name="id2933325"></a><pre class="programlisting">typedef struct _cairo_surface cairo_surface_t;
+</pre>
+<p>
A <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> represents an image, either as the destination
of a drawing operation or as source when drawing onto another
surface. There are different subtypes of cairo_surface_t for
different drawing backends; for example, <a href="cairo-cairo-t.html#cairo-image-surface-create"><tt class="function">cairo_image_surface_create()</tt></a>
creates a bitmap image in memory.
-</p><p>
+</p>
+<p>
Memory management of <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> is done with
-<a href="cairo-cairo-surface-t.html#cairo-surface-reference"><tt class="function">cairo_surface_reference()</tt></a> and <a href="cairo-cairo-surface-t.html#cairo-surface-destroy"><tt class="function">cairo_surface_destroy()</tt></a>.</p><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2728823"></a><h3><a name="cairo-surface-create-for-image"></a>cairo_surface_create_for_image ()</h3><a class="indexterm" name="id2616534"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_surface_create_for_image
- (char *data,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height,
- int stride);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>data</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>stride</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2616646"></a><h3><a name="cairo-surface-create-similar"></a>cairo_surface_create_similar ()</h3><a class="indexterm" name="id2616655"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_surface_create_similar
+<a href="cairo-cairo-surface-t.html#cairo-surface-reference"><tt class="function">cairo_surface_reference()</tt></a> and <a href="cairo-cairo-surface-t.html#cairo-surface-destroy"><tt class="function">cairo_surface_destroy()</tt></a>.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2933393"></a><h3>
+<a name="cairo-surface-create-similar"></a>cairo_surface_create_similar ()</h3>
+<a class="indexterm" name="id2933402"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_surface_create_similar
(<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *other,
<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
int width,
- int height);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>other</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2616752"></a><h3><a name="cairo-surface-reference"></a>cairo_surface_reference ()</h3><a class="indexterm" name="id2616760"></a><pre class="programlisting">void cairo_surface_reference (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2690242"></a><h3><a name="cairo-surface-destroy"></a>cairo_surface_destroy ()</h3><a class="indexterm" name="id2690250"></a><pre class="programlisting">void cairo_surface_destroy (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2690284"></a><h3><a name="cairo-surface-set-repeat"></a>cairo_surface_set_repeat ()</h3><a class="indexterm" name="id2690292"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_set_repeat (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- int repeat);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>repeat</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2690353"></a><h3><a name="cairo-surface-set-matrix"></a>cairo_surface_set_matrix ()</h3><a class="indexterm" name="id2690361"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_set_matrix (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2690422"></a><h3><a name="cairo-surface-get-matrix"></a>cairo_surface_get_matrix ()</h3><a class="indexterm" name="id2690431"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_get_matrix (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2690492"></a><h3><a name="cairo-surface-set-filter"></a>cairo_surface_set_filter ()</h3><a class="indexterm" name="id2690500"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_set_filter (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>filter</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2738900"></a><h3><a name="cairo-surface-get-filter"></a>cairo_surface_get_filter ()</h3><a class="indexterm" name="id2738909"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> cairo_surface_get_filter (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="cairo-cairo-t.html"><b>&lt;&lt;cairo_t</b></a></td><td align="right"><a accesskey="n" href="cairo-cairo-pattern-t.html"><b>cairo_pattern_t&gt;&gt;</b></a></td></tr></table></body></html>
+ int height);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>other</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>format</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2969148"></a><h3>
+<a name="cairo-surface-reference"></a>cairo_surface_reference ()</h3>
+<a class="indexterm" name="id2969157"></a><pre class="programlisting">void cairo_surface_reference (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2969202"></a><h3>
+<a name="cairo-surface-destroy"></a>cairo_surface_destroy ()</h3>
+<a class="indexterm" name="id2969211"></a><pre class="programlisting">void cairo_surface_destroy (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2968003"></a><h3>
+<a name="cairo-surface-finish"></a>cairo_surface_finish ()</h3>
+<a class="indexterm" name="id2968012"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_finish (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
+<p>
+This function finishes the surface and drops all references to
+external resources. For example, for the Xlib backend it means
+that cairo will no longer access the drawable, which can be freed.
+After calling <a href="cairo-cairo-surface-t.html#cairo-surface-finish"><tt class="function">cairo_surface_finish()</tt></a> the only valid operations on a
+surface are getting and setting user data and referencing and
+destroying it. Further drawing the the surface will not affect the
+surface but set the surface status to
+CAIRO_STATUS_SURFACE_FINISHED.
+</p>
+<p>
+When the last call to <a href="cairo-cairo-surface-t.html#cairo-surface-destroy"><tt class="function">cairo_surface_destroy()</tt></a> decreases the
+reference count to zero, cairo will call <a href="cairo-cairo-surface-t.html#cairo-surface-finish"><tt class="function">cairo_surface_finish()</tt></a> if
+it hasn't been called already, before freeing the resources
+associated with the surface.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> the <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> to finish
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> CAIRO_STATUS_SUCCESS if the surface was finished
+successfully, otherwise CAIRO_STATUS_NO_MEMORY or
+CAIRO_STATUS_WRITE_ERROR.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2968120"></a><h3>
+<a name="cairo-surface-set-user-data"></a>cairo_surface_set_user_data ()</h3>
+<a class="indexterm" name="id2968130"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_set_user_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key,
+ void *user_data,
+ <a href="cairo-cairo-t.html#cairo-destroy-func-t">cairo_destroy_func_t</a> destroy);</pre>
+<p>
+Attach user data to <i class="parameter"><tt>surface</tt></i>. To remove user data from a surface,
+call this function with the key that was used to set it and <tt class="literal">NULL</tt>
+for <i class="parameter"><tt>data</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>key</tt></i>&#160;:</span></td>
+<td> the address of a <a href="cairo-cairo-t.html#cairo-user-data-key-t"><span class="type">cairo_user_data_key_t</span></a> to attach the user data to
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>user_data</tt></i>&#160;:</span></td>
+<td> the user data to attach to the surface
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>destroy</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-destroy-func-t"><span class="type">cairo_destroy_func_t</span></a> which will be called when the
+surface is destroyed or when new user data is attached using the
+same key.
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> or <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt> if a
+slot could not be allocated for the user data.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2935377"></a><h3>
+<a name="cairo-surface-get-user-data"></a>cairo_surface_get_user_data ()</h3>
+<a class="indexterm" name="id2935386"></a><pre class="programlisting">void* cairo_surface_get_user_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key);</pre>
+<p>
+Return user data previously attached to <i class="parameter"><tt>surface</tt></i> using the specified
+key. If no user data has been attached with the given key this
+function returns <tt class="literal">NULL</tt>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>key</tt></i>&#160;:</span></td>
+<td> the address of the <a href="cairo-cairo-t.html#cairo-user-data-key-t"><span class="type">cairo_user_data_key_t</span></a> the user data was
+attached to
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the user data previously attached or <tt class="literal">NULL</tt>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2935499"></a><h3>
+<a name="cairo-surface-set-device-offset"></a>cairo_surface_set_device_offset ()</h3>
+<a class="indexterm" name="id2935510"></a><pre class="programlisting">void cairo_surface_set_device_offset (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x_offset,
+ double y_offset);</pre>
+<p>
+Sets an offset that is added to the device coordinates determined
+by the CTM when drawing to <i class="parameter"><tt>surface</tt></i>. One use case for this function
+is when we want to create a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> that redirects drawing
+for a portion of an onscreen surface to an offscreen surface in a
+way that is completely invisible to the user of the cairo
+API. Setting a transformation via <a href="cairo-cairo-t.html#cairo-translate"><tt class="function">cairo_translate()</tt></a> isn't
+sufficient to do this, since functions like
+<a href="cairo-cairo-t.html#cairo-device-to-user"><tt class="function">cairo_device_to_user()</tt></a> will expose the hidden offset.
+</p>
+<p>
+Note that the offset only affects drawing to the surface, not using
+the surface in a surface pattern.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x_offset</tt></i>&#160;:</span></td>
+<td> the offset in the X direction, in device units
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y_offset</tt></i>&#160;:</span></td>
+<td> the offset in the Y direction, in device units
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-cairo-t.html"><b>&lt;&lt;&#160;cairo_t</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-cairo-pattern-t.html"><b>cairo_pattern_t&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo-cairo-t.html b/doc/public/html/cairo-cairo-t.html
index 865aed7..36e28b6 100644
--- a/doc/public/html/cairo-cairo-t.html
+++ b/doc/public/html/cairo-cairo-t.html
@@ -1,35 +1,70 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>cairo_t</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="pt02.html" title="PartII.Reference"><link rel="previous" href="pt02.html" title="PartII.Reference"><link rel="next" href="cairo-cairo-surface-t.html" title="cairo_surface_t"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="pt02.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-cairo-surface-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="cairo-cairo-t"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">cairo_t</span></h2><p>cairo_t &#8212; Drawing contexts.</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>cairo_t</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="previous" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="next" href="cairo-cairo-surface-t.html" title="cairo_surface_t">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="pt02.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-cairo-surface-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="refentry" lang="en">
+<a name="cairo-cairo-t"></a><div class="titlepage">
+<div></div>
+<div></div>
+</div>
+<div class="refnamediv"><table width="100%"><tr>
+<td valign="top">
+<h2><span class="refentrytitle">cairo_t</span></h2>
+<p>cairo_t &#8212; Drawing contexts.</p>
+</td>
+<td valign="top" align="right"></td>
+</tr></table></div>
+<div class="refsynopsisdiv">
+<h2>Synopsis</h2>
+<pre class="synopsis">
typedef <a href="cairo-cairo-t.html#cairo-t">cairo_t</a>;
-<a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* <a href="cairo-cairo-t.html#cairo-create">cairo_create</a> (void);
+<a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* <a href="cairo-cairo-t.html#cairo-create">cairo_create</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *target);
void <a href="cairo-cairo-t.html#cairo-reference">cairo_reference</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-destroy">cairo_destroy</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-save">cairo_save</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-restore">cairo_restore</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-copy">cairo_copy</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *dest,
- <a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *src);
-void <a href="cairo-cairo-t.html#cairo-set-target-surface">cairo_set_target_surface</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
enum <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a>;
-void <a href="cairo-cairo-t.html#cairo-set-target-image">cairo_set_target_image</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- char *data,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height,
- int stride);
enum <a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a>;
void <a href="cairo-cairo-t.html#cairo-set-operator">cairo_set_operator</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> op);
-void <a href="cairo-cairo-t.html#cairo-set-rgb-color">cairo_set_rgb_color</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-set-source-rgb">cairo_set_source_rgb</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double red,
double green,
double blue);
-void <a href="cairo-cairo-t.html#cairo-set-pattern">cairo_set_pattern</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
-void <a href="cairo-cairo-t.html#cairo-set-alpha">cairo_set_alpha</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-set-source-rgba">cairo_set_source_rgba</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double red,
+ double green,
+ double blue,
double alpha);
+void <a href="cairo-cairo-t.html#cairo-set-source">cairo_set_source</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *source);
+void <a href="cairo-cairo-t.html#cairo-set-source-surface">cairo_set_source_surface</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x,
+ double y);
void <a href="cairo-cairo-t.html#cairo-set-tolerance">cairo_set_tolerance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double tolerance);
enum <a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a>;
@@ -57,23 +92,21 @@ void <a href="cairo-cairo-t.html#cairo-scale">cairo_scale</a>
double sy);
void <a href="cairo-cairo-t.html#cairo-rotate">cairo_rotate</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double angle);
-void <a href="cairo-cairo-t.html#cairo-concat-matrix">cairo_concat_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
+void <a href="cairo-cairo-t.html#cairo-transform">cairo_transform</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-cairo-t.html#cairo-set-matrix">cairo_set_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-void <a href="cairo-cairo-t.html#cairo-default-matrix">cairo_default_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-cairo-t.html#cairo-identity-matrix">cairo_identity_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-transform-point">cairo_transform_point</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-user-to-device">cairo_user_to_device</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);
-void <a href="cairo-cairo-t.html#cairo-transform-distance">cairo_transform_distance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-user-to-device-distance">cairo_user_to_device_distance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
double *dy);
-void <a href="cairo-cairo-t.html#cairo-inverse-transform-point">cairo_inverse_transform_point</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-device-to-user">cairo_device_to_user</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);
-void <a href="cairo-cairo-t.html#cairo-inverse-transform-distance">cairo_inverse_transform_distance</a>
- (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-device-to-user-distance">cairo_device_to_user_distance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
double *dy);
void <a href="cairo-cairo-t.html#cairo-new-path">cairo_new_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
@@ -121,8 +154,19 @@ void <a href="cairo-cairo-t.html#cairo-rectangle">cairo_rectangle</a>
double width,
double height);
void <a href="cairo-cairo-t.html#cairo-close-path">cairo_close_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-paint">cairo_paint</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-paint-with-alpha">cairo_paint_with_alpha</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double alpha);
+void <a href="cairo-cairo-t.html#cairo-mask">cairo_mask</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
+void <a href="cairo-cairo-t.html#cairo-mask-surface">cairo_mask_surface</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double surface_x,
+ double surface_y);
void <a href="cairo-cairo-t.html#cairo-stroke">cairo_stroke</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-stroke-preserve">cairo_stroke_preserve</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-fill">cairo_fill</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-fill-preserve">cairo_fill_preserve</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-copy-page">cairo_copy_page</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-show-page">cairo_show_page</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
<a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> <a href="cairo-cairo-t.html#cairo-in-stroke">cairo_in_stroke</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
@@ -142,302 +186,628 @@ void <a href="cairo-cairo-t.html#cairo-fill-extents">cairo_fill_extents</
double *y1,
double *x2,
double *y2);
-void <a href="cairo-cairo-t.html#cairo-init-clip">cairo_init_clip</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-cairo-t.html#cairo-clip">cairo_clip</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-typedef <a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>;
+void <a href="cairo-cairo-t.html#cairo-clip-preserve">cairo_clip_preserve</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-reset-clip">cairo_reset_clip</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a>;
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a>;
- <a href="cairo-cairo-t.html#cairo-font-extents-t">cairo_font_extents_t</a>;
enum <a href="cairo-cairo-t.html#cairo-font-slant-t">cairo_font_slant_t</a>;
enum <a href="cairo-cairo-t.html#cairo-font-weight-t">cairo_font_weight_t</a>;
-void <a href="cairo-cairo-t.html#cairo-select-font">cairo_select_font</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-select-font-face">cairo_select_font_face</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *family,
<a href="cairo-cairo-t.html#cairo-font-slant-t">cairo_font_slant_t</a> slant,
<a href="cairo-cairo-t.html#cairo-font-weight-t">cairo_font_weight_t</a> weight);
-void <a href="cairo-cairo-t.html#cairo-scale-font">cairo_scale_font</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double scale);
-void <a href="cairo-cairo-t.html#cairo-transform-font">cairo_transform_font</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+void <a href="cairo-cairo-t.html#cairo-set-font-size">cairo_set_font_size</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double size);
+void <a href="cairo-cairo-t.html#cairo-set-font-matrix">cairo_set_font_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
+void <a href="cairo-cairo-t.html#cairo-get-font-matrix">cairo_get_font_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-cairo-t.html#cairo-show-text">cairo_show_text</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- unsigned char *utf8);
+ const char *utf8);
void <a href="cairo-cairo-t.html#cairo-show-glyphs">cairo_show_glyphs</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs);
-<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* <a href="cairo-cairo-t.html#cairo-current-font">cairo_current_font</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-current-font-extents">cairo_current_font_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);
-void <a href="cairo-cairo-t.html#cairo-set-font">cairo_set_font</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);
+<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* <a href="cairo-cairo-t.html#cairo-get-font-face">cairo_get_font_face</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-font-extents">cairo_font_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);
+void <a href="cairo-cairo-t.html#cairo-set-font-face">cairo_set_font_face</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);
void <a href="cairo-cairo-t.html#cairo-text-extents">cairo_text_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- unsigned char *utf8,
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
+ const char *utf8,
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
void <a href="cairo-cairo-t.html#cairo-glyph-extents">cairo_glyph_extents</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs,
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
void <a href="cairo-cairo-t.html#cairo-text-path">cairo_text_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- unsigned char *utf8);
+ const char *utf8);
void <a href="cairo-cairo-t.html#cairo-glyph-path">cairo_glyph_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs);
-void <a href="cairo-cairo-t.html#cairo-font-reference">cairo_font_reference</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);
-void <a href="cairo-cairo-t.html#cairo-font-destroy">cairo_font_destroy</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);
-<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-t.html#cairo-font-extents">cairo_font_extents</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix,
- <a href="cairo-cairo-t.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);
-void <a href="cairo-cairo-t.html#cairo-font-glyph-extents">cairo_font_glyph_extents</a> (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix,
- <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
- int num_glyphs,
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);
-void <a href="cairo-cairo-t.html#cairo-show-surface">cairo_show_surface</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- int width,
- int height);
-<a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> <a href="cairo-cairo-t.html#cairo-current-operator">cairo_current_operator</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-current-rgb-color">cairo_current_rgb_color</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double *red,
- double *green,
- double *blue);
-<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-t.html#cairo-current-pattern">cairo_current_pattern</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-double <a href="cairo-cairo-t.html#cairo-current-alpha">cairo_current_alpha</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-double <a href="cairo-cairo-t.html#cairo-current-tolerance">cairo_current_tolerance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-current-point">cairo_current_point</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+<a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> <a href="cairo-cairo-t.html#cairo-get-operator">cairo_get_operator</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-t.html#cairo-get-source">cairo_get_source</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+double <a href="cairo-cairo-t.html#cairo-get-tolerance">cairo_get_tolerance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-get-current-point">cairo_get_current_point</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);
-<a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> <a href="cairo-cairo-t.html#cairo-current-fill-rule">cairo_current_fill_rule</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-double <a href="cairo-cairo-t.html#cairo-current-line-width">cairo_current_line_width</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-<a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> <a href="cairo-cairo-t.html#cairo-current-line-cap">cairo_current_line_cap</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-<a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> <a href="cairo-cairo-t.html#cairo-current-line-join">cairo_current_line_join</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-double <a href="cairo-cairo-t.html#cairo-current-miter-limit">cairo_current_miter_limit</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-current-matrix">cairo_current_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+<a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> <a href="cairo-cairo-t.html#cairo-get-fill-rule">cairo_get_fill_rule</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+double <a href="cairo-cairo-t.html#cairo-get-line-width">cairo_get_line_width</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+<a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> <a href="cairo-cairo-t.html#cairo-get-line-cap">cairo_get_line_cap</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+<a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> <a href="cairo-cairo-t.html#cairo-get-line-join">cairo_get_line_join</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+double <a href="cairo-cairo-t.html#cairo-get-miter-limit">cairo_get_miter_limit</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-get-matrix">cairo_get_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
-<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-t.html#cairo-current-target-surface">cairo_current_target_surface</a>
- (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-void <a href="cairo-cairo-t.html#cairo-current-path">cairo_current_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_curve_to_func_t *curve_to,
- cairo_close_path_func_t *close_path,
- void *closure);
-void <a href="cairo-cairo-t.html#cairo-current-path-flat">cairo_current_path_flat</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_close_path_func_t *close_path,
- void *closure);
+<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-t.html#cairo-get-target">cairo_get_target</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+<a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* <a href="cairo-cairo-t.html#cairo-copy-path">cairo_copy_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+<a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* <a href="cairo-cairo-t.html#cairo-copy-path-flat">cairo_copy_path_flat</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+void <a href="cairo-cairo-t.html#cairo-append-path">cairo_append_path</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);
+enum <a href="cairo-cairo-t.html#cairo-path-data-type-t">cairo_path_data_type_t</a>;
+ <a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>;
+void <a href="cairo-cairo-t.html#cairo-path-destroy">cairo_path_destroy</a> (<a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);
enum <a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a>;
<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-t.html#cairo-status">cairo_status</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
-const char* <a href="cairo-cairo-t.html#cairo-status-string">cairo_status_string</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
+#define <a href="cairo-cairo-t.html#cairo-status-string">cairo_status_string</a>
+const char* <a href="cairo-cairo-t.html#cairo-status-to-string">cairo_status_to_string</a> (<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> status);
enum <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a>;
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-t.html#cairo-image-surface-create">cairo_image_surface_create</a> (<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
int width,
int height);
<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-t.html#cairo-image-surface-create-for-data">cairo_image_surface_create_for_data</a>
- (char *data,
+ (unsigned char *data,
<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
int width,
int height,
int stride);
-
-</pre></div><div class="refsect1" lang="en"><a name="id2745724"></a><h2>Description</h2><p>
+int <a href="cairo-cairo-t.html#cairo-image-surface-get-width">cairo_image_surface_get_width</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
+int <a href="cairo-cairo-t.html#cairo-image-surface-get-height">cairo_image_surface_get_height</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
+void (<a href="cairo-cairo-t.html#cairo-destroy-func-t">*cairo_destroy_func_t</a>) (void *data);
+ <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a>;
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (<a href="cairo-cairo-t.html#cairo-read-func-t">*cairo_read_func_t</a>) (void *closure,
+ unsigned char *data,
+ unsigned int length);
+<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (<a href="cairo-cairo-t.html#cairo-write-func-t">*cairo_write_func_t</a>) (void *closure,
+ unsigned char *data,
+ unsigned int length);
+
+</pre>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2983102"></a><h2>Description</h2>
+<p>
<a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> is the main object used when drawing with Cairo. To
draw with Cairo, you create a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>, set the target surface,
and drawing options for the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>, create shapes with
functions like <a href="cairo-cairo-t.html#cairo-move-to"><tt class="function">cairo_move_to()</tt></a> and <a href="cairo-cairo-t.html#cairo-line-to"><tt class="function">cairo_line_to()</tt></a>, and then
draw ships with <a href="cairo-cairo-t.html#cairo-stroke"><tt class="function">cairo_stroke()</tt></a> or <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a>.
- </p><p>
+ </p>
+<p>
<a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>'s can be pushed to a stack via <a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a>.
They may then safely be changed, without loosing the current state.
Use <a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a> to restore to the saved state.
- </p></div><div class="refsect1" lang="en"><a name="id2745817"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2745823"></a><h3><a name="cairo-t"></a>cairo_t</h3><a class="indexterm" name="id2745834"></a><pre class="programlisting">typedef struct _cairo cairo_t;
-</pre><p>
+ </p>
+</div>
+<div class="refsect1" lang="en">
+<a name="id2983209"></a><h2>Details</h2>
+<div class="refsect2" lang="en">
+<a name="id2983216"></a><h3>
+<a name="cairo-t"></a>cairo_t</h3>
+<a class="indexterm" name="id2983226"></a><pre class="programlisting">typedef struct _cairo cairo_t;
+</pre>
+<p>
A <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> contains the current state of the rendering device,
-including coordinates of yet to be drawn shapes.</p><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2745858"></a><h3><a name="cairo-create"></a>cairo_create ()</h3><a class="indexterm" name="id2745869"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* cairo_create (void);</pre><p>
-Creates a new <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with default values. The target
-surface must be set on the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with <a href="cairo-cairo-t.html#cairo-set-target-surface"><tt class="function">cairo_set_target_surface()</tt></a>,
-or a backend-specific function like <a href="cairo-cairo-t.html#cairo-set-target-image"><tt class="function">cairo_set_target_image()</tt></a> before
-drawing with the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> a newly allocated <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with a reference
+including coordinates of yet to be drawn shapes.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2983254"></a><h3>
+<a name="cairo-create"></a>cairo_create ()</h3>
+<a class="indexterm" name="id2983265"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* cairo_create (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *target);</pre>
+<p>
+Creates a new <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with all graphics state parameters set to
+default values and with <i class="parameter"><tt>target</tt></i> as a target surface. The target
+surface should be constructed with a backend-specific function such
+as cairo_image_surface_create (or any other
+cairo_&lt;backend&gt;_surface_create variant).
+</p>
+<p>
+This function references <i class="parameter"><tt>target</tt></i>, so you can immediately
+call <a href="cairo-cairo-surface-t.html#cairo-surface-destroy"><tt class="function">cairo_surface_destroy()</tt></a> on it if you don't need to
+maintain a separate reference to it.
+</p>
+<p>
+Note that there are restrictions on using the same surface in
+multiple contexts at the same time. If, after creating <i class="parameter"><tt>cr_a</tt></i> with
+<i class="parameter"><tt>surface</tt></i> you also create <i class="parameter"><tt>cr_b</tt></i> with the same surface, you must
+ensure that <i class="parameter"><tt>cr_b</tt></i> has finished using <i class="parameter"><tt>surface</tt></i> before resuming use
+of <i class="parameter"><tt>cr_a</tt></i>. Currently, the only way time at which this is guaranteed
+is when the the last reference to <i class="parameter"><tt>cr_b</tt></i> is released with
+<a href="cairo-cairo-t.html#cairo-destroy"><tt class="function">cairo_destroy()</tt></a>. (XXX: We need to add a <tt class="function">cairo_finish()</tt> call to
+provide a way to achieve this explicitly). See also the
+<tt class="literal">CAIRO_STATUS_BAD_NESTING</tt> status.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>target</tt></i>&#160;:</span></td>
+<td> target surface for the context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> a newly allocated <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with a reference
count of 1. The initial reference count should be released
with <a href="cairo-cairo-t.html#cairo-destroy"><tt class="function">cairo_destroy()</tt></a> when you are done using the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2745966"></a><h3><a name="cairo-reference"></a>cairo_reference ()</h3><a class="indexterm" name="id2745977"></a><pre class="programlisting">void cairo_reference (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
+ This function never returns <tt class="literal">NULL</tt>. If memory cannot be
+ allocated, a special <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> object will be returned on
+ which <a href="cairo-cairo-t.html#cairo-status"><tt class="function">cairo_status()</tt></a> returns <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt>.
+ You can use this object normally, but no drawing will
+ be done.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2983498"></a><h3>
+<a name="cairo-reference"></a>cairo_reference ()</h3>
+<a class="indexterm" name="id2983509"></a><pre class="programlisting">void cairo_reference (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
Increases the reference count on <i class="parameter"><tt>cr</tt></i> by one. This prevents
<i class="parameter"><tt>cr</tt></i> from being destroyed until a matching call to <a href="cairo-cairo-t.html#cairo-destroy"><tt class="function">cairo_destroy()</tt></a>
-is made.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746043"></a><h3><a name="cairo-destroy"></a>cairo_destroy ()</h3><a class="indexterm" name="id2746054"></a><pre class="programlisting">void cairo_destroy (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
+is made.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2983588"></a><h3>
+<a name="cairo-destroy"></a>cairo_destroy ()</h3>
+<a class="indexterm" name="id2983599"></a><pre class="programlisting">void cairo_destroy (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
Decreases the reference count on <i class="parameter"><tt>cr</tt></i> by one. If the result
is zero, then <i class="parameter"><tt>cr</tt></i> and all associated resources are freed.
-See <a href="cairo-cairo-t.html#cairo-destroy"><tt class="function">cairo_destroy()</tt></a>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746120"></a><h3><a name="cairo-save"></a>cairo_save ()</h3><a class="indexterm" name="id2746130"></a><pre class="programlisting">void cairo_save (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
+See <a href="cairo-cairo-t.html#cairo-reference"><tt class="function">cairo_reference()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2983679"></a><h3>
+<a name="cairo-save"></a>cairo_save ()</h3>
+<a class="indexterm" name="id2983689"></a><pre class="programlisting">void cairo_save (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
Makes a copy of the current state of <i class="parameter"><tt>cr</tt></i> and saves it
on an internal stack of saved states for <i class="parameter"><tt>cr</tt></i>. When
<a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a> is called, <i class="parameter"><tt>cr</tt></i> will be restored to
the saved state. Multiple calls to <a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a> and
<a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a> can be nested; each call to <a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a>
restores the state from the matching paired <a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a>.
-</p><p>
+</p>
+<p>
It isn't necessary to clear all saved states before
a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> is freed. If the reference count of a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
drops to zero in response to a call to <a href="cairo-cairo-t.html#cairo-destroy"><tt class="function">cairo_destroy()</tt></a>,
-any saved states will be freed along with the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746266"></a><h3><a name="cairo-restore"></a>cairo_restore ()</h3><a class="indexterm" name="id2746277"></a><pre class="programlisting">void cairo_restore (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
+any saved states will be freed along with the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2983852"></a><h3>
+<a name="cairo-restore"></a>cairo_restore ()</h3>
+<a class="indexterm" name="id2983863"></a><pre class="programlisting">void cairo_restore (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
Restores <i class="parameter"><tt>cr</tt></i> to the state saved by a preceding call to
<a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a> and removes that state from the stack of
-saved states.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746339"></a><h3><a name="cairo-copy"></a>cairo_copy ()</h3><a class="indexterm" name="id2746350"></a><pre class="programlisting">void cairo_copy (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *dest,
- <a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *src);</pre><p>
-This function copies all current state information from src to
-dest. This includes the current point and path, the target surface,
-the transformation matrix, and so forth.
-</p><p>
-The stack of states saved with <a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a> is <span class="emphasis"><em>not</em></span>
-not copied; nor are any saved states on <i class="parameter"><tt>dest</tt></i> cleared. The
-operation only copies the current state of <i class="parameter"><tt>src</tt></i> to the current
-state of <i class="parameter"><tt>dest</tt></i>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>dest</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>src</tt></i>:</span></td><td> another <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746456"></a><h3><a name="cairo-set-target-surface"></a>cairo_set_target_surface ()</h3><a class="indexterm" name="id2746467"></a><pre class="programlisting">void cairo_set_target_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre><p>
-Directs output for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> to a given surface. The surface
-will be referenced by the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>, so you can immediately
-call <a href="cairo-cairo-surface-t.html#cairo-surface-destroy"><tt class="function">cairo_surface_destroy()</tt></a> on it if you don't need to
-keep a reference to it around.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746567"></a><h3><a name="cairo-format-t"></a>enum cairo_format_t</h3><a class="indexterm" name="id2746578"></a><pre class="programlisting">typedef enum cairo_format {
+saved states.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2983936"></a><h3>
+<a name="cairo-format-t"></a>enum cairo_format_t</h3>
+<a class="indexterm" name="id2983947"></a><pre class="programlisting">typedef enum cairo_format {
CAIRO_FORMAT_ARGB32,
CAIRO_FORMAT_RGB24,
CAIRO_FORMAT_A8,
CAIRO_FORMAT_A1
} cairo_format_t;
-</pre><p>
+</pre>
+<p>
<a href="cairo-cairo-t.html#cairo-format-t"><span class="type">cairo_format_t</span></a> is used to identify the memory format of
-image data.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">CAIRO_FORMAT_ARGB32</tt></span></td><td> each pixel is a 32-bit quantity, with
+image data.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_FORMAT_ARGB32</tt></span></td>
+<td> each pixel is a 32-bit quantity, with
alpha in the upper 8 bits, then red, then green, then blue.
- The 32-bit quanties are stored native-endian. Pre-multiplied
+ The 32-bit quantities are stored native-endian. Pre-multiplied
alpha is used. (That is, 50% transparent red is 0x80800000,
not 0x80ff0000.)
-</td></tr><tr><td><span class="term"><tt class="literal">CAIRO_FORMAT_RGB24</tt></span></td><td> each pixel is a 32-bit quantity, with
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_FORMAT_RGB24</tt></span></td>
+<td> each pixel is a 32-bit quantity, with
the upper 8 bits unused. Red, Green, and Blue are stored
in the remaining 24 bits in that order.
-</td></tr><tr><td><span class="term"><tt class="literal">CAIRO_FORMAT_A8</tt></span></td><td> each pixel is a 8-bit quantity holding
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_FORMAT_A8</tt></span></td>
+<td> each pixel is a 8-bit quantity holding
an alpha value.
-</td></tr><tr><td><span class="term"><tt class="literal">CAIRO_FORMAT_A1</tt></span></td><td> each pixel is a 1-bit quantity holding
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_FORMAT_A1</tt></span></td>
+<td> each pixel is a 1-bit quantity holding
an alpha value. Pixels are packed together into 32-bit
quantities. The ordering of the bits matches the
endianess of the platform. On a big-endian machine, the
first pixel is in the uppermost bit, on a little-endian
machine the first pixel is in the least-significant bit.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746674"></a><h3><a name="cairo-set-target-image"></a>cairo_set_target_image ()</h3><a class="indexterm" name="id2746686"></a><pre class="programlisting">void cairo_set_target_image (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- char *data,
- <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
- int width,
- int height,
- int stride);</pre><p>
-Directs output for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> to an in-memory image. The output
-buffer must be kept around until the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> is destroyed or set
-to to have a different target. The initial contents of <i class="parameter"><tt>buffer</tt></i>
-will be used as the inital image contents; you must explicitely
-clear the buffer, using, for example, <a href="cairo-cairo-t.html#cairo-rectangle"><tt class="function">cairo_rectangle()</tt></a> and
-<a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a> if you want it cleared.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i>:</span></td><td> a pointer to a buffer supplied by the application
- in which to write contents.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td> the format of pixels in the buffer
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td> the width of the image to be stored in the buffer
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td> the eight of the image to be stored in the buffer
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>stride</tt></i>:</span></td><td> the number of bytes between the start of rows
- in the buffer. Having this be specified separate from <i class="parameter"><tt>width</tt></i>
- allows for padding at the end of rows, or for writing
- to a subportion of a larger image.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746877"></a><h3><a name="cairo-operator-t"></a>enum cairo_operator_t</h3><a class="indexterm" name="id2746888"></a><pre class="programlisting">typedef enum cairo_operator {
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984056"></a><h3>
+<a name="cairo-operator-t"></a>enum cairo_operator_t</h3>
+<a class="indexterm" name="id2984068"></a><pre class="programlisting">typedef enum cairo_operator {
CAIRO_OPERATOR_CLEAR,
- CAIRO_OPERATOR_SRC,
- CAIRO_OPERATOR_DST,
+
+ CAIRO_OPERATOR_SOURCE,
CAIRO_OPERATOR_OVER,
- CAIRO_OPERATOR_OVER_REVERSE,
CAIRO_OPERATOR_IN,
- CAIRO_OPERATOR_IN_REVERSE,
CAIRO_OPERATOR_OUT,
- CAIRO_OPERATOR_OUT_REVERSE,
CAIRO_OPERATOR_ATOP,
- CAIRO_OPERATOR_ATOP_REVERSE,
+
+ CAIRO_OPERATOR_DEST,
+ CAIRO_OPERATOR_DEST_OVER,
+ CAIRO_OPERATOR_DEST_IN,
+ CAIRO_OPERATOR_DEST_OUT,
+ CAIRO_OPERATOR_DEST_ATOP,
+
CAIRO_OPERATOR_XOR,
CAIRO_OPERATOR_ADD,
CAIRO_OPERATOR_SATURATE
} cairo_operator_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2746906"></a><h3><a name="cairo-set-operator"></a>cairo_set_operator ()</h3><a class="indexterm" name="id2746918"></a><pre class="programlisting">void cairo_set_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> op);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>op</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2746975"></a><h3><a name="cairo-set-rgb-color"></a>cairo_set_rgb_color ()</h3><a class="indexterm" name="id2746987"></a><pre class="programlisting">void cairo_set_rgb_color (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984090"></a><h3>
+<a name="cairo-set-operator"></a>cairo_set_operator ()</h3>
+<a class="indexterm" name="id2984102"></a><pre class="programlisting">void cairo_set_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> op);</pre>
+<p>
+Sets the compositing operator to be used for all drawing
+operations. See <a href="cairo-cairo-t.html#cairo-operator-t"><span class="type">cairo_operator_t</span></a> for details on the semantics of
+each available drawing operator.
+</p>
+<p>
+XXX: I'd also like to direct the reader's attention to some
+(not-yet-written) section on cairo's imaging model. How would I do
+that if such a section existed? (cworth).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>op</tt></i>&#160;:</span></td>
+<td> a compositing operator, specified as a <a href="cairo-cairo-t.html#cairo-operator-t"><span class="type">cairo_operator_t</span></a>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984203"></a><h3>
+<a name="cairo-set-source-rgb"></a>cairo_set_source_rgb ()</h3>
+<a class="indexterm" name="id2984214"></a><pre class="programlisting">void cairo_set_source_rgb (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double red,
+ double green,
+ double blue);</pre>
+<p>
+Sets the source pattern within <i class="parameter"><tt>cr</tt></i> to an opaque color. This opaque
+color will then be used for any subsequent drawing operation until
+a new source pattern is set.
+</p>
+<p>
+The color components are floating point numbers in the range 0 to
+1. If the values passed in are outside that range, they will be
+clamped.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>red</tt></i>&#160;:</span></td>
+<td> red component of color
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>green</tt></i>&#160;:</span></td>
+<td> green component of color
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>blue</tt></i>&#160;:</span></td>
+<td> blue component of color
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984342"></a><h3>
+<a name="cairo-set-source-rgba"></a>cairo_set_source_rgba ()</h3>
+<a class="indexterm" name="id2984353"></a><pre class="programlisting">void cairo_set_source_rgba (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double red,
double green,
- double blue);</pre><p>
-Sets a constant color for filling and stroking. This replaces any
-pattern set with <a href="cairo-cairo-t.html#cairo-set-pattern"><tt class="function">cairo_set_pattern()</tt></a>. The color components are
-floating point numbers in the range 0 to 1. If the values passed in
-are outside that range, they will be clamped.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>red</tt></i>:</span></td><td> red component of color
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>green</tt></i>:</span></td><td> green component of color
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>blue</tt></i>:</span></td><td> blue component of color
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747104"></a><h3><a name="cairo-set-pattern"></a>cairo_set_pattern ()</h3><a class="indexterm" name="id2747116"></a><pre class="programlisting">void cairo_set_pattern (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>pattern</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747173"></a><h3><a name="cairo-set-alpha"></a>cairo_set_alpha ()</h3><a class="indexterm" name="id2747184"></a><pre class="programlisting">void cairo_set_alpha (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double alpha);</pre><p>
-Sets an overall alpha value used for stroking and filling. This
-value is multiplied with any alpha value coming from a gradient or
-image pattern.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>alpha</tt></i>:</span></td><td> the alpha value. 0 is transparent, 1 fully opaque.
- if the value is outside the range 0 to 1, it will be
- clamped to that range.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747257"></a><h3><a name="cairo-set-tolerance"></a>cairo_set_tolerance ()</h3><a class="indexterm" name="id2747269"></a><pre class="programlisting">void cairo_set_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double tolerance);</pre><p>
+ double blue,
+ double alpha);</pre>
+<p>
+Sets the source pattern within <i class="parameter"><tt>cr</tt></i> to a translucent color. This
+color will then be used for any subsequent drawing operation until
+a new source pattern is set.
+</p>
+<p>
+The color and alpha components are floating point numbers in the
+range 0 to 1. If the values passed in are outside that range, they
+will be clamped.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>red</tt></i>&#160;:</span></td>
+<td> red component of color
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>green</tt></i>&#160;:</span></td>
+<td> green component of color
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>blue</tt></i>&#160;:</span></td>
+<td> blue component of color
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>alpha</tt></i>&#160;:</span></td>
+<td> alpha component of color
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984503"></a><h3>
+<a name="cairo-set-source"></a>cairo_set_source ()</h3>
+<a class="indexterm" name="id2984513"></a><pre class="programlisting">void cairo_set_source (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *source);</pre>
+<p>
+Sets the source pattern within <i class="parameter"><tt>cr</tt></i> to <i class="parameter"><tt>source</tt></i>. This pattern
+will then be used for any subsequent drawing operation until a new
+source pattern is set.
+</p>
+<p>
+XXX: I'd also like to direct the reader's attention to some
+(not-yet-written) section on cairo's imaging model. How would I do
+that if such a section existed? (cworth).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>source</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> to be used as the source for
+subsequent drawing operations.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984613"></a><h3>
+<a name="cairo-set-source-surface"></a>cairo_set_source_surface ()</h3>
+<a class="indexterm" name="id2984624"></a><pre class="programlisting">void cairo_set_source_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double x,
+ double y);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984733"></a><h3>
+<a name="cairo-set-tolerance"></a>cairo_set_tolerance ()</h3>
+<a class="indexterm" name="id2984744"></a><pre class="programlisting">void cairo_set_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double tolerance);</pre>
+<p>
Sets the tolerance used when converting paths into trapezoids.
Curved segments of the path will be subdivided until the maximum
deviation between the original path and the polygonal approximation
is less than <i class="parameter"><tt>tolerance</tt></i>. The default value is 0.1. A larger
value will give better performance, a smaller value, better
appearance. (Reducing the value from the default value of 0.1
-is unlikely to improve appearance significantly.)</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>tolerance</tt></i>:</span></td><td> the tolerance, in device units (typically pixels)
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747348"></a><h3><a name="cairo-fill-rule-t"></a>enum cairo_fill_rule_t</h3><a class="indexterm" name="id2747359"></a><pre class="programlisting">typedef enum cairo_fill_rule {
+is unlikely to improve appearance significantly.)</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>tolerance</tt></i>&#160;:</span></td>
+<td> the tolerance, in device units (typically pixels)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984835"></a><h3>
+<a name="cairo-fill-rule-t"></a>enum cairo_fill_rule_t</h3>
+<a class="indexterm" name="id2984846"></a><pre class="programlisting">typedef enum cairo_fill_rule {
CAIRO_FILL_RULE_WINDING,
CAIRO_FILL_RULE_EVEN_ODD
} cairo_fill_rule_t;
-</pre><p>
+</pre>
+<p>
<a href="cairo-cairo-t.html#cairo-fill-rule-t"><span class="type">cairo_fill_rule_t</span></a> is used to select how paths are filled. For both
fill rules, whether or not a point is included in the fill is
determined by taking a ray from that point to infinity and looking
@@ -445,213 +815,822 @@ at intersections with the path. The ray can be in any direction,
as long as it doesn't pass through the end point of a segment
or have a tricky intersection such as intersecting tangent to the path.
(Note that filling is not actually implemented in this way. This
-is just a description of the rule that is applied.)</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">CAIRO_FILL_RULE_WINDING</tt></span></td><td> If the path crosses the ray from
+is just a description of the rule that is applied.)</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_FILL_RULE_WINDING</tt></span></td>
+<td> If the path crosses the ray from
left-to-right, counts +1. If the path crosses the ray
from right to left, counts -1. (Left and right are determined
from the perspective of looking along the ray from the starting
point.) If the total count is non-zero, the point will be filled.
-</td></tr><tr><td><span class="term"><tt class="literal">CAIRO_FILL_RULE_EVEN_ODD</tt></span></td><td> Counts the total number of
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_FILL_RULE_EVEN_ODD</tt></span></td>
+<td> Counts the total number of
intersections, without regard to the orientation of the contour. If
the total number of intersections is odd, the point will be
filled.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747430"></a><h3><a name="cairo-set-fill-rule"></a>cairo_set_fill_rule ()</h3><a class="indexterm" name="id2747442"></a><pre class="programlisting">void cairo_set_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> fill_rule);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>fill_rule</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747499"></a><h3><a name="cairo-set-line-width"></a>cairo_set_line_width ()</h3><a class="indexterm" name="id2747511"></a><pre class="programlisting">void cairo_set_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double width);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747569"></a><h3><a name="cairo-line-cap-t"></a>enum cairo_line_cap_t</h3><a class="indexterm" name="id2747580"></a><pre class="programlisting">typedef enum cairo_line_cap {
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2984926"></a><h3>
+<a name="cairo-set-fill-rule"></a>cairo_set_fill_rule ()</h3>
+<a class="indexterm" name="id2984937"></a><pre class="programlisting">void cairo_set_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> fill_rule);</pre>
+<p>
+Set the current fill rule within the cairo context. The fill rule
+is used to determine which regions are inside or outside a complex
+(potentially self-intersecting) path. The current fill rule affects
+both cairo_fill and cairo_clip. See <a href="cairo-cairo-t.html#cairo-fill-rule-t"><span class="type">cairo_fill_rule_t</span></a> for details
+on the semantics of each available fill rule.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>fill_rule</tt></i>&#160;:</span></td>
+<td> a fill rule, specified as a <a href="cairo-cairo-t.html#cairo-fill-rule-t"><span class="type">cairo_fill_rule_t</span></a>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985035"></a><h3>
+<a name="cairo-set-line-width"></a>cairo_set_line_width ()</h3>
+<a class="indexterm" name="id2985046"></a><pre class="programlisting">void cairo_set_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double width);</pre>
+<p>
+Sets the current line width within the cairo context. The line
+width specifies the diameter of a pen that is circular in
+user-space.
+</p>
+<p>
+As with the other stroke parameters, the current line cap style is
+examined by <a href="cairo-cairo-t.html#cairo-stroke"><tt class="function">cairo_stroke()</tt></a>, <a href="cairo-cairo-t.html#cairo-stroke-extents"><tt class="function">cairo_stroke_extents()</tt></a>, and
+<tt class="function">cairo_stroke_to_path()</tt>, but does not have any effect during path
+construction.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> a line width, as a user-space value
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985161"></a><h3>
+<a name="cairo-line-cap-t"></a>enum cairo_line_cap_t</h3>
+<a class="indexterm" name="id2985172"></a><pre class="programlisting">typedef enum cairo_line_cap {
CAIRO_LINE_CAP_BUTT,
CAIRO_LINE_CAP_ROUND,
CAIRO_LINE_CAP_SQUARE
} cairo_line_cap_t;
-</pre><p>
-enumeration for style of line-endings</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">CAIRO_LINE_CAP_BUTT</tt></span></td><td> start(stop) the line exactly at the start(end) point
-</td></tr><tr><td><span class="term"><tt class="literal">CAIRO_LINE_CAP_ROUND</tt></span></td><td> use a round ending, the center of the circle is the end point
-</td></tr><tr><td><span class="term"><tt class="literal">CAIRO_LINE_CAP_SQUARE</tt></span></td><td> use squared ending, the center of the square is the end point
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747645"></a><h3><a name="cairo-set-line-cap"></a>cairo_set_line_cap ()</h3><a class="indexterm" name="id2747657"></a><pre class="programlisting">void cairo_set_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> line_cap);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>line_cap</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747714"></a><h3><a name="cairo-line-join-t"></a>enum cairo_line_join_t</h3><a class="indexterm" name="id2747726"></a><pre class="programlisting">typedef enum cairo_line_join {
+</pre>
+<p>
+enumeration for style of line-endings</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_LINE_CAP_BUTT</tt></span></td>
+<td> start(stop) the line exactly at the start(end) point
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_LINE_CAP_ROUND</tt></span></td>
+<td> use a round ending, the center of the circle is the end point
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_LINE_CAP_SQUARE</tt></span></td>
+<td> use squared ending, the center of the square is the end point
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985249"></a><h3>
+<a name="cairo-set-line-cap"></a>cairo_set_line_cap ()</h3>
+<a class="indexterm" name="id2985260"></a><pre class="programlisting">void cairo_set_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> line_cap);</pre>
+<p>
+Sets the current line cap style within the cairo context. See
+<a href="cairo-cairo-t.html#cairo-line-cap-t"><span class="type">cairo_line_cap_t</span></a> for details about how the available line cap
+styles are drawn.
+</p>
+<p>
+As with the other stroke parameters, the current line cap style is
+examined by <a href="cairo-cairo-t.html#cairo-stroke"><tt class="function">cairo_stroke()</tt></a>, <a href="cairo-cairo-t.html#cairo-stroke-extents"><tt class="function">cairo_stroke_extents()</tt></a>, and
+<tt class="function">cairo_stroke_to_path()</tt>, but does not have any effect during path
+construction.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context, as a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>line_cap</tt></i>&#160;:</span></td>
+<td> a line cap style, as a <a href="cairo-cairo-t.html#cairo-line-cap-t"><span class="type">cairo_line_cap_t</span></a>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985390"></a><h3>
+<a name="cairo-line-join-t"></a>enum cairo_line_join_t</h3>
+<a class="indexterm" name="id2985401"></a><pre class="programlisting">typedef enum cairo_line_join {
CAIRO_LINE_JOIN_MITER,
CAIRO_LINE_JOIN_ROUND,
CAIRO_LINE_JOIN_BEVEL
} cairo_line_join_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2747739"></a><h3><a name="cairo-set-line-join"></a>cairo_set_line_join ()</h3><a class="indexterm" name="id2747750"></a><pre class="programlisting">void cairo_set_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> line_join);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>line_join</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747808"></a><h3><a name="cairo-set-dash"></a>cairo_set_dash ()</h3><a class="indexterm" name="id2747819"></a><pre class="programlisting">void cairo_set_dash (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985418"></a><h3>
+<a name="cairo-set-line-join"></a>cairo_set_line_join ()</h3>
+<a class="indexterm" name="id2985430"></a><pre class="programlisting">void cairo_set_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> line_join);</pre>
+<p>
+Sets the current line join style within the cairo context. See
+<a href="cairo-cairo-t.html#cairo-line-join-t"><span class="type">cairo_line_join_t</span></a> for details about how the available line join
+styles are drawn.
+</p>
+<p>
+As with the other stroke parameters, the current line join style is
+examined by <a href="cairo-cairo-t.html#cairo-stroke"><tt class="function">cairo_stroke()</tt></a>, <a href="cairo-cairo-t.html#cairo-stroke-extents"><tt class="function">cairo_stroke_extents()</tt></a>, and
+<tt class="function">cairo_stroke_to_path()</tt>, but does not have any effect during path
+construction.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context, as a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>line_join</tt></i>&#160;:</span></td>
+<td> a line joint style, as a <a href="cairo-cairo-t.html#cairo-line-join-t"><span class="type">cairo_line_join_t</span></a>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985559"></a><h3>
+<a name="cairo-set-dash"></a>cairo_set_dash ()</h3>
+<a class="indexterm" name="id2985570"></a><pre class="programlisting">void cairo_set_dash (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dashes,
int ndash,
- double offset);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dashes</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>ndash</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>offset</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747914"></a><h3><a name="cairo-set-miter-limit"></a>cairo_set_miter_limit ()</h3><a class="indexterm" name="id2747926"></a><pre class="programlisting">void cairo_set_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double limit);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>limit</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2747983"></a><h3><a name="cairo-translate"></a>cairo_translate ()</h3><a class="indexterm" name="id2747994"></a><pre class="programlisting">void cairo_translate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double offset);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dashes</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>ndash</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>offset</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985679"></a><h3>
+<a name="cairo-set-miter-limit"></a>cairo_set_miter_limit ()</h3>
+<a class="indexterm" name="id2985690"></a><pre class="programlisting">void cairo_set_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double limit);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>limit</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985757"></a><h3>
+<a name="cairo-translate"></a>cairo_translate ()</h3>
+<a class="indexterm" name="id2985768"></a><pre class="programlisting">void cairo_translate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double tx,
- double ty);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>tx</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>ty</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748071"></a><h3><a name="cairo-scale"></a>cairo_scale ()</h3><a class="indexterm" name="id2748081"></a><pre class="programlisting">void cairo_scale (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double ty);</pre>
+<p>
+Modifies the current transformation matrix (CTM) by tanslating the
+user-space origin by (<i class="parameter"><tt>tx</tt></i>, <i class="parameter"><tt>ty</tt></i>). This offset is interpreted as a
+user-space coordinate according to the CTM in place before the new
+call to cairo_translate. In other words, the translation of the
+user-space origin takes place after any existing transformation.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>tx</tt></i>&#160;:</span></td>
+<td> amount to translate in the X direction
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>ty</tt></i>&#160;:</span></td>
+<td> amount to translate in the Y direction
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985877"></a><h3>
+<a name="cairo-scale"></a>cairo_scale ()</h3>
+<a class="indexterm" name="id2985888"></a><pre class="programlisting">void cairo_scale (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double sx,
- double sy);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>sx</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>sy</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748158"></a><h3><a name="cairo-rotate"></a>cairo_rotate ()</h3><a class="indexterm" name="id2748169"></a><pre class="programlisting">void cairo_rotate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double angle);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>angle</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748227"></a><h3><a name="cairo-concat-matrix"></a>cairo_concat_matrix ()</h3><a class="indexterm" name="id2748238"></a><pre class="programlisting">void cairo_concat_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748296"></a><h3><a name="cairo-set-matrix"></a>cairo_set_matrix ()</h3><a class="indexterm" name="id2748307"></a><pre class="programlisting">void cairo_set_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748365"></a><h3><a name="cairo-default-matrix"></a>cairo_default_matrix ()</h3><a class="indexterm" name="id2748377"></a><pre class="programlisting">void cairo_default_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748416"></a><h3><a name="cairo-identity-matrix"></a>cairo_identity_matrix ()</h3><a class="indexterm" name="id2748428"></a><pre class="programlisting">void cairo_identity_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748467"></a><h3><a name="cairo-transform-point"></a>cairo_transform_point ()</h3><a class="indexterm" name="id2748478"></a><pre class="programlisting">void cairo_transform_point (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double sy);</pre>
+<p>
+Modifies the current transformation matrix (CTM) by scaling the X
+and Y user-space axes by <i class="parameter"><tt>sx</tt></i> and <i class="parameter"><tt>sy</tt></i> respectively. The scaling of
+the axes takes place after any existing transformation of user
+space.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>sx</tt></i>&#160;:</span></td>
+<td> scale factor for the X dimension
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>sy</tt></i>&#160;:</span></td>
+<td> scale factor for the Y dimension
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2985995"></a><h3>
+<a name="cairo-rotate"></a>cairo_rotate ()</h3>
+<a class="indexterm" name="id2986006"></a><pre class="programlisting">void cairo_rotate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double angle);</pre>
+<p>
+Modifies the current transformation matrix (CTM) by rotating the
+user-space axes by <i class="parameter"><tt>angle</tt></i> radians. The rotation of the axes takes
+places after any existing transformation of user space. The
+rotation direction for positive angles is from the positive X axis
+toward the positive Y axis.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>angle</tt></i>&#160;:</span></td>
+<td> angle (in radians) by which the user-space axes will be
+rotated
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986088"></a><h3>
+<a name="cairo-transform"></a>cairo_transform ()</h3>
+<a class="indexterm" name="id2986099"></a><pre class="programlisting">void cairo_transform (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+Modifies the current transformation matrix (CTM) by applying
+<i class="parameter"><tt>matrix</tt></i> as an additional transformation. The new transformation of
+user space takes place after any existing transformation.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a transformation to be applied to the user-space axes
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986179"></a><h3>
+<a name="cairo-set-matrix"></a>cairo_set_matrix ()</h3>
+<a class="indexterm" name="id2986191"></a><pre class="programlisting">void cairo_set_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+Modifies the current transformation matrix (CTM) by setting it
+equal to <i class="parameter"><tt>matrix</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a transformation matrix from user space to device space
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986270"></a><h3>
+<a name="cairo-identity-matrix"></a>cairo_identity_matrix ()</h3>
+<a class="indexterm" name="id2986281"></a><pre class="programlisting">void cairo_identity_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Resets the current transformation matrix (CTM) by setting it equal
+to the identity matrix. That is, the user-space and device-space
+axes will be aligned and one user-space unit will transform to one
+device-space unit.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986334"></a><h3>
+<a name="cairo-user-to-device"></a>cairo_user_to_device ()</h3>
+<a class="indexterm" name="id2986345"></a><pre class="programlisting">void cairo_user_to_device (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
- double *y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748555"></a><h3><a name="cairo-transform-distance"></a>cairo_transform_distance ()</h3><a class="indexterm" name="id2748566"></a><pre class="programlisting">void cairo_transform_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double *y);</pre>
+<p>
+Transform a coordinate from user space to device space by
+multiplying the given point by the current transformation matrix
+(CTM).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td> X value of coordinate (in/out parameter)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td> Y value of coordinate (in/out parameter)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986440"></a><h3>
+<a name="cairo-user-to-device-distance"></a>cairo_user_to_device_distance ()</h3>
+<a class="indexterm" name="id2986452"></a><pre class="programlisting">void cairo_user_to_device_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
- double *dy);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748643"></a><h3><a name="cairo-inverse-transform-point"></a>cairo_inverse_transform_point ()</h3><a class="indexterm" name="id2748655"></a><pre class="programlisting">void cairo_inverse_transform_point (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double *dy);</pre>
+<p>
+Transform a distance vector from user space to device space. This
+function is similar to <a href="cairo-cairo-t.html#cairo-user-to-device"><tt class="function">cairo_user_to_device()</tt></a> except that the
+translation components of the CTM will be ignored when transforming
+(<i class="parameter"><tt>dx</tt></i>,<i class="parameter"><tt>dy</tt></i>).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx</tt></i>&#160;:</span></td>
+<td> X component of a distance vector (in/out parameter)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy</tt></i>&#160;:</span></td>
+<td> Y component of a distance vector (in/out parameter)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986570"></a><h3>
+<a name="cairo-device-to-user"></a>cairo_device_to_user ()</h3>
+<a class="indexterm" name="id2986581"></a><pre class="programlisting">void cairo_device_to_user (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
- double *y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748731"></a><h3><a name="cairo-inverse-transform-distance"></a>cairo_inverse_transform_distance ()</h3><a class="indexterm" name="id2748743"></a><pre class="programlisting">void cairo_inverse_transform_distance
- (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double *y);</pre>
+<p>
+Transform a coordinate from device space to user space by
+multiplying the given point by the inverse of the current
+transformation matrix (CTM).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td> X value of coordinate (in/out parameter)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td> Y value of coordinate (in/out parameter)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986676"></a><h3>
+<a name="cairo-device-to-user-distance"></a>cairo_device_to_user_distance ()</h3>
+<a class="indexterm" name="id2986687"></a><pre class="programlisting">void cairo_device_to_user_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
- double *dy);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748821"></a><h3><a name="cairo-new-path"></a>cairo_new_path ()</h3><a class="indexterm" name="id2748832"></a><pre class="programlisting">void cairo_new_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748871"></a><h3><a name="cairo-move-to"></a>cairo_move_to ()</h3><a class="indexterm" name="id2748882"></a><pre class="programlisting">void cairo_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double *dy);</pre>
+<p>
+Transform a distance vector from device space to user space. This
+function is similar to <a href="cairo-cairo-t.html#cairo-device-to-user"><tt class="function">cairo_device_to_user()</tt></a> except that the
+translation components of the inverse CTM will be ignored when
+transforming (<i class="parameter"><tt>dx</tt></i>,<i class="parameter"><tt>dy</tt></i>).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx</tt></i>&#160;:</span></td>
+<td> X component of a distance vector (in/out parameter)
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy</tt></i>&#160;:</span></td>
+<td> Y component of a distance vector (in/out parameter)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986805"></a><h3>
+<a name="cairo-new-path"></a>cairo_new_path ()</h3>
+<a class="indexterm" name="id2986816"></a><pre class="programlisting">void cairo_new_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986862"></a><h3>
+<a name="cairo-move-to"></a>cairo_move_to ()</h3>
+<a class="indexterm" name="id2986873"></a><pre class="programlisting">void cairo_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double x,
- double y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2748959"></a><h3><a name="cairo-line-to"></a>cairo_line_to ()</h3><a class="indexterm" name="id2748970"></a><pre class="programlisting">void cairo_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double y);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2986960"></a><h3>
+<a name="cairo-line-to"></a>cairo_line_to ()</h3>
+<a class="indexterm" name="id2986971"></a><pre class="programlisting">void cairo_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double x,
- double y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749046"></a><h3><a name="cairo-curve-to"></a>cairo_curve_to ()</h3><a class="indexterm" name="id2749057"></a><pre class="programlisting">void cairo_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double y);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2987059"></a><h3>
+<a name="cairo-curve-to"></a>cairo_curve_to ()</h3>
+<a class="indexterm" name="id2987069"></a><pre class="programlisting">void cairo_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double x1,
double y1,
double x2,
double y2,
double x3,
- double y3);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x2</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y2</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x3</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y3</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749208"></a><h3><a name="cairo-arc"></a>cairo_arc ()</h3><a class="indexterm" name="id2749219"></a><pre class="programlisting">void cairo_arc (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double y3);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x2</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y2</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x3</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y3</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2987241"></a><h3>
+<a name="cairo-arc"></a>cairo_arc ()</h3>
+<a class="indexterm" name="id2987251"></a><pre class="programlisting">void cairo_arc (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double xc,
double yc,
double radius,
double angle1,
- double angle2);</pre><p>
+ double angle2);</pre>
+<p>
Adds an arc from <i class="parameter"><tt>angle1</tt></i> to <i class="parameter"><tt>angle2</tt></i> to the current path. If there
is a current point, that point is connected to the start of the arc
by a straight line segment. Angles are measured in radians with an
@@ -662,200 +1641,931 @@ radians, use <tt class="literal">degrees * (M_PI / 180.)</tt>.) This
function gives the arc in the direction of increasing angle; see
<a href="cairo-cairo-t.html#cairo-arc-negative"><tt class="function">cairo_arc_negative()</tt></a> to get the arc in the direction of decreasing
angle.
-</p><p>
+</p>
+<p>
A full arc is drawn as a circle. To make an oval arc, you can scale
the current transformation matrix by different amounts in the X and
Y directions. For example, to draw a full oval in the box given
by <i class="parameter"><tt>x</tt></i>, <i class="parameter"><tt>y</tt></i>, <i class="parameter"><tt>width</tt></i>, <i class="parameter"><tt>height</tt></i>:
-</p><div class="informalexample"><pre class="programlisting">
+</p>
+<div class="informalexample"><pre class="programlisting">
cairo_save (cr);
cairo_translate (x + width / 2., y + height / 2.);
cairo_scale (1. / (height / 2.), 1. / (width / 2.));
cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI);
cairo_restore (cr);
-</pre></div><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a Cairo context
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>xc</tt></i>:</span></td><td> X position of the center of the arc
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>yc</tt></i>:</span></td><td> Y position of the center of the arc
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>radius</tt></i>:</span></td><td> the radius of the arc
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>angle1</tt></i>:</span></td><td> the start angle, in radians
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>angle2</tt></i>:</span></td><td> the end angle, in radians
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749416"></a><h3><a name="cairo-arc-negative"></a>cairo_arc_negative ()</h3><a class="indexterm" name="id2749427"></a><pre class="programlisting">void cairo_arc_negative (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+</pre></div>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>xc</tt></i>&#160;:</span></td>
+<td> X position of the center of the arc
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>yc</tt></i>&#160;:</span></td>
+<td> Y position of the center of the arc
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>radius</tt></i>&#160;:</span></td>
+<td> the radius of the arc
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>angle1</tt></i>&#160;:</span></td>
+<td> the start angle, in radians
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>angle2</tt></i>&#160;:</span></td>
+<td> the end angle, in radians
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2987489"></a><h3>
+<a name="cairo-arc-negative"></a>cairo_arc_negative ()</h3>
+<a class="indexterm" name="id2987501"></a><pre class="programlisting">void cairo_arc_negative (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double xc,
double yc,
double radius,
double angle1,
- double angle2);</pre><p>
+ double angle2);</pre>
+<p>
Adds an arc from <i class="parameter"><tt>angle1</tt></i> to <i class="parameter"><tt>angle2</tt></i> to the current path. The
function behaves identically to <a href="cairo-cairo-t.html#cairo-arc"><tt class="function">cairo_arc()</tt></a> except that instead of
giving the arc in the direction of increasing angle, it gives
-the arc in the direction of decreasing angle.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a Cairo context
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>xc</tt></i>:</span></td><td> X position of the center of the arc
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>yc</tt></i>:</span></td><td> Y position of the center of the arc
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>radius</tt></i>:</span></td><td> the radius of the arc
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>angle1</tt></i>:</span></td><td> the start angle, in radians
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>angle2</tt></i>:</span></td><td> the end angle, in radians
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749583"></a><h3><a name="cairo-rel-move-to"></a>cairo_rel_move_to ()</h3><a class="indexterm" name="id2749594"></a><pre class="programlisting">void cairo_rel_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+the arc in the direction of decreasing angle.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>xc</tt></i>&#160;:</span></td>
+<td> X position of the center of the arc
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>yc</tt></i>&#160;:</span></td>
+<td> Y position of the center of the arc
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>radius</tt></i>&#160;:</span></td>
+<td> the radius of the arc
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>angle1</tt></i>&#160;:</span></td>
+<td> the start angle, in radians
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>angle2</tt></i>&#160;:</span></td>
+<td> the end angle, in radians
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2987681"></a><h3>
+<a name="cairo-rel-move-to"></a>cairo_rel_move_to ()</h3>
+<a class="indexterm" name="id2987692"></a><pre class="programlisting">void cairo_rel_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double dx,
- double dy);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749670"></a><h3><a name="cairo-rel-line-to"></a>cairo_rel_line_to ()</h3><a class="indexterm" name="id2749682"></a><pre class="programlisting">void cairo_rel_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double dy);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2987780"></a><h3>
+<a name="cairo-rel-line-to"></a>cairo_rel_line_to ()</h3>
+<a class="indexterm" name="id2987791"></a><pre class="programlisting">void cairo_rel_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double dx,
- double dy);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749758"></a><h3><a name="cairo-rel-curve-to"></a>cairo_rel_curve_to ()</h3><a class="indexterm" name="id2749769"></a><pre class="programlisting">void cairo_rel_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double dy);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2987878"></a><h3>
+<a name="cairo-rel-curve-to"></a>cairo_rel_curve_to ()</h3>
+<a class="indexterm" name="id2987889"></a><pre class="programlisting">void cairo_rel_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double dx1,
double dy1,
double dx2,
double dy2,
double dx3,
- double dy3);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx2</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy2</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dx3</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>dy3</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2749920"></a><h3><a name="cairo-rectangle"></a>cairo_rectangle ()</h3><a class="indexterm" name="id2749931"></a><pre class="programlisting">void cairo_rectangle (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double dy3);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx2</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy2</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dx3</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>dy3</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988060"></a><h3>
+<a name="cairo-rectangle"></a>cairo_rectangle ()</h3>
+<a class="indexterm" name="id2988071"></a><pre class="programlisting">void cairo_rectangle (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double x,
double y,
double width,
- double height);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750045"></a><h3><a name="cairo-close-path"></a>cairo_close_path ()</h3><a class="indexterm" name="id2750056"></a><pre class="programlisting">void cairo_close_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750095"></a><h3><a name="cairo-stroke"></a>cairo_stroke ()</h3><a class="indexterm" name="id2750106"></a><pre class="programlisting">void cairo_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750145"></a><h3><a name="cairo-fill"></a>cairo_fill ()</h3><a class="indexterm" name="id2750156"></a><pre class="programlisting">void cairo_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750195"></a><h3><a name="cairo-copy-page"></a>cairo_copy_page ()</h3><a class="indexterm" name="id2750206"></a><pre class="programlisting">void cairo_copy_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750245"></a><h3><a name="cairo-show-page"></a>cairo_show_page ()</h3><a class="indexterm" name="id2750256"></a><pre class="programlisting">void cairo_show_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750295"></a><h3><a name="cairo-in-stroke"></a>cairo_in_stroke ()</h3><a class="indexterm" name="id2750306"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double height);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988201"></a><h3>
+<a name="cairo-close-path"></a>cairo_close_path ()</h3>
+<a class="indexterm" name="id2988212"></a><pre class="programlisting">void cairo_close_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988258"></a><h3>
+<a name="cairo-paint"></a>cairo_paint ()</h3>
+<a class="indexterm" name="id2988268"></a><pre class="programlisting">void cairo_paint (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+A drawing operator that paints the current source everywhere within
+the current clip region.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988319"></a><h3>
+<a name="cairo-paint-with-alpha"></a>cairo_paint_with_alpha ()</h3>
+<a class="indexterm" name="id2988330"></a><pre class="programlisting">void cairo_paint_with_alpha (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double alpha);</pre>
+<p>
+A drawing operator that paints the current source everywhere within
+the current clip region using a mask of constant alpha value
+<i class="parameter"><tt>alpha</tt></i>. The effect is similar to <a href="cairo-cairo-t.html#cairo-paint"><tt class="function">cairo_paint()</tt></a>, but the drawing
+is faded out using the alpha value.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>alpha</tt></i>&#160;:</span></td>
+<td> alpha value, between 0 (transparent) and 1 (opaque)
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988421"></a><h3>
+<a name="cairo-mask"></a>cairo_mask ()</h3>
+<a class="indexterm" name="id2988431"></a><pre class="programlisting">void cairo_mask (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
+<p>
+A drawing operator that paints the current source
+using the alpha channel of <i class="parameter"><tt>pattern</tt></i> as a mask. (Opaque
+areas of <i class="parameter"><tt>mask</tt></i> are painted with the source, transparent
+areas are not painted.)</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>pattern</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988524"></a><h3>
+<a name="cairo-mask-surface"></a>cairo_mask_surface ()</h3>
+<a class="indexterm" name="id2988535"></a><pre class="programlisting">void cairo_mask_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
+ double surface_x,
+ double surface_y);</pre>
+<p>
+A drawing operator that paints the current source
+using the alpha channel of <i class="parameter"><tt>surface</tt></i> as a mask. (Opaque
+areas of <i class="parameter"><tt>surface</tt></i> are painted with the source, transparent
+areas are not painted.)</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface_x</tt></i>&#160;:</span></td>
+<td> X coordinate at which to place the origin of <i class="parameter"><tt>surface</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface_y</tt></i>&#160;:</span></td>
+<td> Y coordinate at which to place the origin of <i class="parameter"><tt>surface</tt></i>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988683"></a><h3>
+<a name="cairo-stroke"></a>cairo_stroke ()</h3>
+<a class="indexterm" name="id2988694"></a><pre class="programlisting">void cairo_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+A drawing operator that strokes the current path according to the
+current line width, line join, line cap, and dash settings. After
+cairo_stroke, the current path will be cleared from the cairo
+context. See <a href="cairo-cairo-t.html#cairo-set-line-width"><tt class="function">cairo_set_line_width()</tt></a>, <a href="cairo-cairo-t.html#cairo-set-line-join"><tt class="function">cairo_set_line_join()</tt></a>,
+<a href="cairo-cairo-t.html#cairo-set-line-cap"><tt class="function">cairo_set_line_cap()</tt></a>, <a href="cairo-cairo-t.html#cairo-set-dash"><tt class="function">cairo_set_dash()</tt></a>, and
+<a href="cairo-cairo-t.html#cairo-stroke-preserve"><tt class="function">cairo_stroke_preserve()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988796"></a><h3>
+<a name="cairo-stroke-preserve"></a>cairo_stroke_preserve ()</h3>
+<a class="indexterm" name="id2988807"></a><pre class="programlisting">void cairo_stroke_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+A drawing operator that strokes the current path according to the
+current line width, line join, line cap, and dash settings. Unlike
+<a href="cairo-cairo-t.html#cairo-stroke"><tt class="function">cairo_stroke()</tt></a>, cairo_stroke_preserve preserves the path within the
+cairo context.
+</p>
+<p>
+See <a href="cairo-cairo-t.html#cairo-set-line-width"><tt class="function">cairo_set_line_width()</tt></a>, <a href="cairo-cairo-t.html#cairo-set-line-join"><tt class="function">cairo_set_line_join()</tt></a>,
+<a href="cairo-cairo-t.html#cairo-set-line-cap"><tt class="function">cairo_set_line_cap()</tt></a>, <a href="cairo-cairo-t.html#cairo-set-dash"><tt class="function">cairo_set_dash()</tt></a>, and
+<a href="cairo-cairo-t.html#cairo-stroke-preserve"><tt class="function">cairo_stroke_preserve()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2988922"></a><h3>
+<a name="cairo-fill"></a>cairo_fill ()</h3>
+<a class="indexterm" name="id2988933"></a><pre class="programlisting">void cairo_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+A drawing operator that fills the current path according to the
+current fill rule. After cairo_fill, the current path will be
+cleared from the cairo context. See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><tt class="function">cairo_set_fill_rule()</tt></a> and
+<a href="cairo-cairo-t.html#cairo-fill-preserve"><tt class="function">cairo_fill_preserve()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989004"></a><h3>
+<a name="cairo-fill-preserve"></a>cairo_fill_preserve ()</h3>
+<a class="indexterm" name="id2989015"></a><pre class="programlisting">void cairo_fill_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+A drawing operator that fills the current path according to the
+current fill rule. Unlike <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a>, cairo_fill_preserve
+preserves the path within the cairo context.
+</p>
+<p>
+See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><tt class="function">cairo_set_fill_rule()</tt></a> and <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989099"></a><h3>
+<a name="cairo-copy-page"></a>cairo_copy_page ()</h3>
+<a class="indexterm" name="id2989110"></a><pre class="programlisting">void cairo_copy_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989156"></a><h3>
+<a name="cairo-show-page"></a>cairo_show_page ()</h3>
+<a class="indexterm" name="id2989167"></a><pre class="programlisting">void cairo_show_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989212"></a><h3>
+<a name="cairo-in-stroke"></a>cairo_in_stroke ()</h3>
+<a class="indexterm" name="id2989223"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double x,
- double y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750393"></a><h3><a name="cairo-in-fill"></a>cairo_in_fill ()</h3><a class="indexterm" name="id2750404"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double y);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989322"></a><h3>
+<a name="cairo-in-fill"></a>cairo_in_fill ()</h3>
+<a class="indexterm" name="id2989332"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double x,
- double y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750491"></a><h3><a name="cairo-bool-t"></a>cairo_bool_t</h3><a class="indexterm" name="id2750502"></a><pre class="programlisting">typedef int cairo_bool_t;
-</pre><p>
+ double y);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989431"></a><h3>
+<a name="cairo-bool-t"></a>cairo_bool_t</h3>
+<a class="indexterm" name="id2989442"></a><pre class="programlisting">typedef int cairo_bool_t;
+</pre>
+<p>
<a href="cairo-cairo-t.html#cairo-bool-t"><span class="type">cairo_bool_t</span></a> is used for boolean values. Returns of type
<a href="cairo-cairo-t.html#cairo-bool-t"><span class="type">cairo_bool_t</span></a> will always be either 0 or 1, but testing against
-these values explicitely is not encouraged; just use the
+these values explicitly is not encouraged; just use the
value as a boolean condition.
-</p><p>
-</p><div class="informalexample"><pre class="programlisting">
+</p>
+<p>
+</p>
+<div class="informalexample"><pre class="programlisting">
if (cairo_in_stroke (cr, x, y)) {
/* do something */
}
-</pre></div><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2750548"></a><h3><a name="cairo-stroke-extents"></a>cairo_stroke_extents ()</h3><a class="indexterm" name="id2750560"></a><pre class="programlisting">void cairo_stroke_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+</pre></div>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989494"></a><h3>
+<a name="cairo-stroke-extents"></a>cairo_stroke_extents ()</h3>
+<a class="indexterm" name="id2989505"></a><pre class="programlisting">void cairo_stroke_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x1,
double *y1,
double *x2,
- double *y2);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x2</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y2</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750674"></a><h3><a name="cairo-fill-extents"></a>cairo_fill_extents ()</h3><a class="indexterm" name="id2750685"></a><pre class="programlisting">void cairo_fill_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double *y2);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x2</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y2</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989635"></a><h3>
+<a name="cairo-fill-extents"></a>cairo_fill_extents ()</h3>
+<a class="indexterm" name="id2989646"></a><pre class="programlisting">void cairo_fill_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x1,
double *y1,
double *x2,
- double *y2);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y1</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x2</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y2</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750798"></a><h3><a name="cairo-init-clip"></a>cairo_init_clip ()</h3><a class="indexterm" name="id2750810"></a><pre class="programlisting">void cairo_init_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750849"></a><h3><a name="cairo-clip"></a>cairo_clip ()</h3><a class="indexterm" name="id2750860"></a><pre class="programlisting">void cairo_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2750898"></a><h3><a name="cairo-font-t"></a>cairo_font_t</h3><a class="indexterm" name="id2750909"></a><pre class="programlisting">typedef struct _cairo_font cairo_font_t;
-</pre><p>
-A <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> is a font scaled to a particular size and device
-resolution. A font can be set on a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> by using
-<a href="cairo-cairo-t.html#cairo-set-font"><tt class="function">cairo_set_font()</tt></a> assuming that the current transformation and
-target surface of the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> match that for which the
-<a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> was created. The effect of using a mismatched
-<a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> will be incorrect font metrics.</p><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2750972"></a><h3><a name="cairo-glyph-t"></a>cairo_glyph_t</h3><a class="indexterm" name="id2750984"></a><pre class="programlisting">typedef struct {
+ double *y2);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y1</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x2</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y2</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989776"></a><h3>
+<a name="cairo-clip"></a>cairo_clip ()</h3>
+<a class="indexterm" name="id2989786"></a><pre class="programlisting">void cairo_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Establishes a new clip region by intersecting the current clip
+region with the current path as it would be filled by <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a>
+and according to the current fill rule (see <a href="cairo-cairo-t.html#cairo-set-fill-rule"><tt class="function">cairo_set_fill_rule()</tt></a>).
+</p>
+<p>
+After cairo_clip, the current path will be cleared from the cairo
+context.
+</p>
+<p>
+The current clip region affects all drawing operations by
+effectively masking out any changes to the surface that are outside
+the current clip region.
+</p>
+<p>
+Calling <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a> can only make the clip region smaller, never
+larger. But the current clip is part of the graphics state, so a
+tempoarary restriction of the clip region can be achieved by
+calling <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a> within a <a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a>/<a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a>
+pair. The only other means of increasing the size of the clip
+region is <a href="cairo-cairo-t.html#cairo-reset-clip"><tt class="function">cairo_reset_clip()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2989924"></a><h3>
+<a name="cairo-clip-preserve"></a>cairo_clip_preserve ()</h3>
+<a class="indexterm" name="id2989935"></a><pre class="programlisting">void cairo_clip_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Establishes a new clip region by intersecting the current clip
+region with the current path as it would be filled by <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a>
+and according to the current fill rule (see <a href="cairo-cairo-t.html#cairo-set-fill-rule"><tt class="function">cairo_set_fill_rule()</tt></a>).
+</p>
+<p>
+Unlike <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a>, cairo_clip_preserve preserves the path within
+the cairo context.
+</p>
+<p>
+The current clip region affects all drawing operations by
+effectively masking out any changes to the surface that are outside
+the current clip region.
+</p>
+<p>
+Calling <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a> can only make the clip region smaller, never
+larger. But the current clip is part of the graphics state, so a
+tempoarary restriction of the clip region can be achieved by
+calling <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a> within a <a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a>/<a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a>
+pair. The only other means of increasing the size of the clip
+region is <a href="cairo-cairo-t.html#cairo-reset-clip"><tt class="function">cairo_reset_clip()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990082"></a><h3>
+<a name="cairo-reset-clip"></a>cairo_reset_clip ()</h3>
+<a class="indexterm" name="id2990092"></a><pre class="programlisting">void cairo_reset_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Reset the current clip region to its original, unrestricted
+state. That is, set the clip region to an infinitely large shape
+containing the target surface. Equivalently, if infinity is too
+hard to grasp, one can imagine the clip region being reset to the
+exact bounds of the target surface.
+</p>
+<p>
+Note that code meant to be reusable should not call
+<a href="cairo-cairo-t.html#cairo-reset-clip"><tt class="function">cairo_reset_clip()</tt></a> as it will cause results unexpected by
+higher-level code which calls <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a>. Consider using
+<a href="cairo-cairo-t.html#cairo-save"><tt class="function">cairo_save()</tt></a> and <a href="cairo-cairo-t.html#cairo-restore"><tt class="function">cairo_restore()</tt></a> around <a href="cairo-cairo-t.html#cairo-clip"><tt class="function">cairo_clip()</tt></a> as a more
+robust means of temporarily restricting the clip region.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990201"></a><h3>
+<a name="cairo-glyph-t"></a>cairo_glyph_t</h3>
+<a class="indexterm" name="id2990212"></a><pre class="programlisting">typedef struct {
unsigned long index;
double x;
double y;
} cairo_glyph_t;
-</pre><p>
+</pre>
+<p>
The <a href="cairo-cairo-t.html#cairo-glyph-t"><span class="type">cairo_glyph_t</span></a> structure holds information about a single glyph
when drawing or measuring text. A font is (in simple terms) a
collection of shapes used to draw text. A glyph is one of these
@@ -866,347 +2576,1083 @@ characters. Cairo doesn't expose any way of converting input text
into glyphs, so in order to use the Cairo interfaces that take
arrays of glyphs, you must directly access the appropriate
underlying font system.
-</p><p>
+</p>
+<p>
Note that the offsets given by <i class="parameter"><tt>x</tt></i> and <i class="parameter"><tt>y</tt></i> are not cumulative. When
drawing or measuring text, each glyph is individually positioned
-with respect to the overall origin</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term">unsignedlong<i class="structfield"><tt>index</tt></i>;</span></td><td> glyph index in the font. The exact interpretation of the
+with respect to the overall origin</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term">unsigned&#160;long&#160;<i class="structfield"><tt>index</tt></i>;</span></td>
+<td> glyph index in the font. The exact interpretation of the
glyph index depends on the font technology being used.
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>x</tt></i>;</span></td><td> the offset in the X direction between the origin used for
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>x</tt></i>;</span></td>
+<td> the offset in the X direction between the origin used for
drawing or measuring the string and the origin of this glyph.
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>y</tt></i>;</span></td><td> the offset in the Y direction between the origin used for
+</td>
+</tr>
+<tr>
+<td>
+<span class="term">double&#160;<i class="structfield"><tt>y</tt></i>;</span></td>
+<td> the offset in the Y direction between the origin used for
drawing or measuring the string and the origin of this glyph.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751108"></a><h3><a name="cairo-text-extents-t"></a>cairo_text_extents_t</h3><a class="indexterm" name="id2751119"></a><pre class="programlisting">typedef struct {
- double x_bearing;
- double y_bearing;
- double width;
- double height;
- double x_advance;
- double y_advance;
-} cairo_text_extents_t;
-</pre><p>
-The <a href="cairo-cairo-t.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a>&lt; structure stores the extents of a single
-glyph or a string of glyphs in user-space coordinates. Because text
-extents are in user-space coordinates, they don't scale along with
-the current transformation matrix. If you call
-<tt class="literal">cairo_scale(cr, 2.0, 2.0)</tt>, text will
-be drawn twice as big, but the reported text extents will not be
-doubled. They will change slightly due to hinting (so you can't
-assume that metrics are independent of the transformation matrix),
-but otherwise will remain unchanged.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term">double<i class="structfield"><tt>x_bearing</tt></i>;</span></td><td> the horizontal distance from the origin to the
- leftmost part of the glyphs as drawn. Positive if the
- glyphs lie entirely to the right of the origin.
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>y_bearing</tt></i>;</span></td><td> the vertical distance from the origin to the
- topmost part of the glyphs as drawn. Positive only if the
- glyphs lie completely below the origin; will usually be
- negative.
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>width</tt></i>;</span></td><td> width of the glyphs as drawn
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>height</tt></i>;</span></td><td> height of the glyphs as drawn
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>x_advance</tt></i>;</span></td><td>distance to advance in the X direction
- after drawing these glyphs
-</td></tr><tr><td><span class="term">double<i class="structfield"><tt>y_advance</tt></i>;</span></td><td> distance to advance in the Y direction
- after drawing these glyphs. Will typically be zero except
- for vertical text layout as found in East-Asian languages.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751294"></a><h3><a name="cairo-font-extents-t"></a>cairo_font_extents_t</h3><a class="indexterm" name="id2751306"></a><pre class="programlisting">typedef struct {
- double ascent;
- double descent;
- double height;
- double max_x_advance;
- double max_y_advance;
-} cairo_font_extents_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2751319"></a><h3><a name="cairo-font-slant-t"></a>enum cairo_font_slant_t</h3><a class="indexterm" name="id2751331"></a><pre class="programlisting">typedef enum cairo_font_slant {
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990345"></a><h3>
+<a name="cairo-font-slant-t"></a>enum cairo_font_slant_t</h3>
+<a class="indexterm" name="id2990357"></a><pre class="programlisting">typedef enum cairo_font_slant {
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_SLANT_ITALIC,
CAIRO_FONT_SLANT_OBLIQUE
} cairo_font_slant_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2751344"></a><h3><a name="cairo-font-weight-t"></a>enum cairo_font_weight_t</h3><a class="indexterm" name="id2751356"></a><pre class="programlisting">typedef enum cairo_font_weight {
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990374"></a><h3>
+<a name="cairo-font-weight-t"></a>enum cairo_font_weight_t</h3>
+<a class="indexterm" name="id2990385"></a><pre class="programlisting">typedef enum cairo_font_weight {
CAIRO_FONT_WEIGHT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD
} cairo_font_weight_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2751368"></a><h3><a name="cairo-select-font"></a>cairo_select_font ()</h3><a class="indexterm" name="id2751380"></a><pre class="programlisting">void cairo_select_font (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990402"></a><h3>
+<a name="cairo-select-font-face"></a>cairo_select_font_face ()</h3>
+<a class="indexterm" name="id2990413"></a><pre class="programlisting">void cairo_select_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const char *family,
<a href="cairo-cairo-t.html#cairo-font-slant-t">cairo_font_slant_t</a> slant,
- <a href="cairo-cairo-t.html#cairo-font-weight-t">cairo_font_weight_t</a> weight);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>family</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>slant</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>weight</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751475"></a><h3><a name="cairo-scale-font"></a>cairo_scale_font ()</h3><a class="indexterm" name="id2751486"></a><pre class="programlisting">void cairo_scale_font (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double scale);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>scale</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751544"></a><h3><a name="cairo-transform-font"></a>cairo_transform_font ()</h3><a class="indexterm" name="id2751556"></a><pre class="programlisting">void cairo_transform_font (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751614"></a><h3><a name="cairo-show-text"></a>cairo_show_text ()</h3><a class="indexterm" name="id2751625"></a><pre class="programlisting">void cairo_show_text (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- unsigned char *utf8);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>utf8</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751683"></a><h3><a name="cairo-show-glyphs"></a>cairo_show_glyphs ()</h3><a class="indexterm" name="id2751694"></a><pre class="programlisting">void cairo_show_glyphs (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-font-weight-t">cairo_font_weight_t</a> weight);</pre>
+<p>
+Selects a family and style of font from a simplified description as
+a family name, slant and weight. This function is meant to be used
+only for applications with simple font needs: Cairo doesn't provide
+for operations such as listing all available fonts on the system,
+and it is expected that most applications will need to use a more
+comprehensive font handling and text layout library in addition to
+Cairo.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>family</tt></i>&#160;:</span></td>
+<td> a font family name, encoded in UTF-8
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>slant</tt></i>&#160;:</span></td>
+<td> the slant for the font
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>weight</tt></i>&#160;:</span></td>
+<td> the weight for the font
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990542"></a><h3>
+<a name="cairo-set-font-size"></a>cairo_set_font_size ()</h3>
+<a class="indexterm" name="id2990553"></a><pre class="programlisting">void cairo_set_font_size (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ double size);</pre>
+<p>
+Sets the current font matrix to a scale by a factor of <i class="parameter"><tt>size</tt></i>, replacing
+any font matrix previously set with <a href="cairo-cairo-t.html#cairo-set-font-size"><tt class="function">cairo_set_font_size()</tt></a> or
+<a href="cairo-cairo-t.html#cairo-set-font-matrix"><tt class="function">cairo_set_font_matrix()</tt></a>. This results in a font size of <i class="parameter"><tt>size</tt></i> user space
+units. (More precisely, this matrix will result in the font's
+em-square being a <i class="parameter"><tt>size</tt></i> by <i class="parameter"><tt>size</tt></i> square in user space.)</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>size</tt></i>&#160;:</span></td>
+<td> the new font size, in user space units
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990678"></a><h3>
+<a name="cairo-set-font-matrix"></a>cairo_set_font_matrix ()</h3>
+<a class="indexterm" name="id2990690"></a><pre class="programlisting">void cairo_set_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+Sets the current font matrix to <i class="parameter"><tt>matrix</tt></i>. The font matrix gives a
+transformation from the design space of the font (in this space,
+the em-square is 1 unit by 1 unit) to user space. Normally, a
+simple scale is used (see <a href="cairo-cairo-t.html#cairo-set-font-size"><tt class="function">cairo_set_font_size()</tt></a>), but a more
+complex font matrix can be used to shear the font
+or stretch it unequally along the two axes</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a> describing a transform to be applied to
+the current font.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990797"></a><h3>
+<a name="cairo-get-font-matrix"></a>cairo_get_font_matrix ()</h3>
+<a class="indexterm" name="id2990808"></a><pre class="programlisting">void cairo_get_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+Stores the current font matrix into <i class="parameter"><tt>matrix</tt></i>. See
+<a href="cairo-cairo-t.html#cairo-set-font-matrix"><tt class="function">cairo_set_font_matrix()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> return value for the matrix
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990903"></a><h3>
+<a name="cairo-show-text"></a>cairo_show_text ()</h3>
+<a class="indexterm" name="id2990913"></a><pre class="programlisting">void cairo_show_text (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const char *utf8);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>utf8</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2990980"></a><h3>
+<a name="cairo-show-glyphs"></a>cairo_show_glyphs ()</h3>
+<a class="indexterm" name="id2990991"></a><pre class="programlisting">void cairo_show_glyphs (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
- int num_glyphs);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>glyphs</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>num_glyphs</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751771"></a><h3><a name="cairo-current-font"></a>cairo_current_font ()</h3><a class="indexterm" name="id2751782"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a>* cairo_current_font (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-Gets the current font object for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>. If there is no current
-font object, because the font parameters, transform, or target
-surface has been changed since a font was last used, a font object
-will be created and stored in in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> the current font object. Can return <tt class="literal">NULL</tt>
+ int num_glyphs);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>glyphs</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>num_glyphs</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991079"></a><h3>
+<a name="cairo-get-font-face"></a>cairo_get_font_face ()</h3>
+<a class="indexterm" name="id2991090"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_get_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current font face for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current font object. Can return <tt class="literal">NULL</tt>
on out-of-memory or if the context is already in
- an error state. This object is owned by Cairo. To keep
- a reference to it, you must call <a href="cairo-cairo-t.html#cairo-font-reference"><tt class="function">cairo_font_reference()</tt></a>.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751874"></a><h3><a name="cairo-current-font-extents"></a>cairo_current_font_extents ()</h3><a class="indexterm" name="id2751887"></a><pre class="programlisting">void cairo_current_font_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>extents</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2751945"></a><h3><a name="cairo-set-font"></a>cairo_set_font ()</h3><a class="indexterm" name="id2751956"></a><pre class="programlisting">void cairo_set_font (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);</pre><p>
-Replaces the current <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> object in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with
-<i class="parameter"><tt>font</tt></i>. The replaced font in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> will be destroyed if there
-are no other references to it. Since a <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a> is specific to
-a particular output device and size, changing the transformation,
-font transformation, or target surfaces of a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> will clear
-any previously set font. Setting the font using <a href="cairo-cairo-t.html#cairo-set-font"><tt class="function">cairo_set_font()</tt></a> is
-exclusive with the simple font selection API provided by
-<a href="cairo-cairo-t.html#cairo-select-font"><tt class="function">cairo_select_font()</tt></a>. The size and transformation set by
-<a href="cairo-cairo-t.html#cairo-scale-font"><tt class="function">cairo_scale_font()</tt></a> and <a href="cairo-cairo-t.html#cairo-transform-font"><tt class="function">cairo_transform_font()</tt></a> are ignored unless
-they were taken into account when creating <i class="parameter"><tt>font</tt></i>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>, or <tt class="literal">NULL</tt> to unset any previously set font.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752116"></a><h3><a name="cairo-text-extents"></a>cairo_text_extents ()</h3><a class="indexterm" name="id2752127"></a><pre class="programlisting">void cairo_text_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- unsigned char *utf8,
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>utf8</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>extents</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752204"></a><h3><a name="cairo-glyph-extents"></a>cairo_glyph_extents ()</h3><a class="indexterm" name="id2752216"></a><pre class="programlisting">void cairo_glyph_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ an error state. This object is owned by cairo. To keep
+ a reference to it, you must call <a href="cairo-Fonts.html#cairo-font-face-reference"><tt class="function">cairo_font_face_reference()</tt></a>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991184"></a><h3>
+<a name="cairo-font-extents"></a>cairo_font_extents ()</h3>
+<a class="indexterm" name="id2991195"></a><pre class="programlisting">void cairo_font_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre>
+<p>
+Gets the font extents for the currently selected font.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>extents</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-extents-t"><span class="type">cairo_font_extents_t</span></a> object into which the results
+will be stored.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991282"></a><h3>
+<a name="cairo-set-font-face"></a>cairo_set_font_face ()</h3>
+<a class="indexterm" name="id2991293"></a><pre class="programlisting">void cairo_set_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre>
+<p>
+Replaces the current <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a> object in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with
+<i class="parameter"><tt>font_face</tt></i>. The replaced font face in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> will be
+destroyed if there are no other references to it.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>font_face</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>, or <tt class="literal">NULL</tt> to restore to the default font
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991414"></a><h3>
+<a name="cairo-text-extents"></a>cairo_text_extents ()</h3>
+<a class="indexterm" name="id2991425"></a><pre class="programlisting">void cairo_text_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const char *utf8,
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre>
+<p>
+Gets the extents for a string of text. The extents describe a
+user-space rectangle that encloses the "inked" portion of the text,
+(as it would be drawn by cairo_show_text). Additionally, the
+x_advance and y_advance values indicate the amount by which the
+current point would be advanced by cairo_show_text.
+</p>
+<p>
+Note that whitespace characters do not directly contribute to the
+size of the rectangle (extents.width and extents.height). They do
+contribute indirectly by changing the position of non-whitespace
+characters. In particular, trailing whitespace characters are
+likely to not affect the size of the rectangle, though they will
+affect the x_advance and y_advance values.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>utf8</tt></i>&#160;:</span></td>
+<td> a string of text, encoded in utf-8
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>extents</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> object into which the results
+will be stored.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991548"></a><h3>
+<a name="cairo-glyph-extents"></a>cairo_glyph_extents ()</h3>
+<a class="indexterm" name="id2991559"></a><pre class="programlisting">void cairo_glyph_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
int num_glyphs,
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>glyphs</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>num_glyphs</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>extents</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752312"></a><h3><a name="cairo-text-path"></a>cairo_text_path ()</h3><a class="indexterm" name="id2752324"></a><pre class="programlisting">void cairo_text_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- unsigned char *utf8);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>utf8</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752381"></a><h3><a name="cairo-glyph-path"></a>cairo_glyph_path ()</h3><a class="indexterm" name="id2752393"></a><pre class="programlisting">void cairo_glyph_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
- int num_glyphs);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>glyphs</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>num_glyphs</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752470"></a><h3><a name="cairo-font-reference"></a>cairo_font_reference ()</h3><a class="indexterm" name="id2752482"></a><pre class="programlisting">void cairo_font_reference (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752521"></a><h3><a name="cairo-font-destroy"></a>cairo_font_destroy ()</h3><a class="indexterm" name="id2752533"></a><pre class="programlisting">void cairo_font_destroy (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752572"></a><h3><a name="cairo-font-extents"></a>cairo_font_extents ()</h3><a class="indexterm" name="id2752583"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_extents (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix,
- <a href="cairo-cairo-t.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre><p>
-Gets the metrics for a <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>font_matrix</tt></i>:</span></td><td> the font transformation for which this font was
- created. (See <a href="cairo-cairo-t.html#cairo-transform-font"><tt class="function">cairo_transform_font()</tt></a>). This is needed
- properly convert the metrics from the font into user space.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>extents</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-font-extents-t"><span class="type">cairo_font_extents_t</span></a> which to store the retrieved extents.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> <tt class="literal">CAIRO_STATUS_SUCCESS</tt> on success. Otherwise, an
- error such as <tt class="literal">CAIRO_STATUS_NO_MEMORY</tt>.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752716"></a><h3><a name="cairo-font-glyph-extents"></a>cairo_font_glyph_extents ()</h3><a class="indexterm" name="id2752729"></a><pre class="programlisting">void cairo_font_glyph_extents (<a href="cairo-cairo-t.html#cairo-font-t">cairo_font_t</a> *font,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix,
+ <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre>
+<p>
+Gets the extents for an array of glyphs. The extents describe a
+user-space rectangle that encloses the "inked" portion of the
+glyphs, (as they would be drawn by cairo_show_glyphs).
+Additionally, the x_advance and y_advance values indicate the
+amount by which the current point would be advanced by
+cairo_show_glyphs.
+</p>
+<p>
+Note that whitespace glyphs do not contribute to the size of the
+rectangle (extents.width and extents.height).</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>glyphs</tt></i>&#160;:</span></td>
+<td> an array of <a href="cairo-cairo-t.html#cairo-glyph-t"><span class="type">cairo_glyph_t</span></a> objects
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>num_glyphs</tt></i>&#160;:</span></td>
+<td> the number of elements in <i class="parameter"><tt>glyphs</tt></i>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>extents</tt></i>&#160;:</span></td>
+<td> a <a href="cairo-Fonts.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> object into which the results
+will be stored
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991712"></a><h3>
+<a name="cairo-text-path"></a>cairo_text_path ()</h3>
+<a class="indexterm" name="id2991723"></a><pre class="programlisting">void cairo_text_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ const char *utf8);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>utf8</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991790"></a><h3>
+<a name="cairo-glyph-path"></a>cairo_glyph_path ()</h3>
+<a class="indexterm" name="id2991801"></a><pre class="programlisting">void cairo_glyph_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs,
- int num_glyphs,
- <a href="cairo-cairo-t.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre><p>
-<a href="cairo-cairo-t.html#cairo-font-glyph-extents"><tt class="function">cairo_font_glyph_extents()</tt></a> gets the overall metrics for a string of
-glyphs. The X and Y offsets in <i class="parameter"><tt>glyphs</tt></i> are taken from an origin of 0,0.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>font</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-font-t"><span class="type">cairo_font_t</span></a>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>font_matrix</tt></i>:</span></td><td> the font transformation for which this font was
- created. (See <a href="cairo-cairo-t.html#cairo-transform-font"><tt class="function">cairo_transform_font()</tt></a>). This is needed
- properly convert the metrics from the font into user space.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>glyphs</tt></i>:</span></td><td> an array of glyph IDs with X and Y offsets.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>num_glyphs</tt></i>:</span></td><td> the number of glyphs in the <i class="parameter"><tt>glyphs</tt></i> array
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>extents</tt></i>:</span></td><td> a <a href="cairo-cairo-t.html#cairo-text-extents-t"><span class="type">cairo_text_extents_t</span></a> which to store the retrieved extents.
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752891"></a><h3><a name="cairo-show-surface"></a>cairo_show_surface ()</h3><a class="indexterm" name="id2752902"></a><pre class="programlisting">void cairo_show_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface,
- int width,
- int height);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>surface</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2752998"></a><h3><a name="cairo-current-operator"></a>cairo_current_operator ()</h3><a class="indexterm" name="id2753009"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> cairo_current_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753059"></a><h3><a name="cairo-current-rgb-color"></a>cairo_current_rgb_color ()</h3><a class="indexterm" name="id2753071"></a><pre class="programlisting">void cairo_current_rgb_color (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- double *red,
- double *green,
- double *blue);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>red</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>green</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>blue</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753166"></a><h3><a name="cairo-current-pattern"></a>cairo_current_pattern ()</h3><a class="indexterm" name="id2753178"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_current_pattern (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753227"></a><h3><a name="cairo-current-alpha"></a>cairo_current_alpha ()</h3><a class="indexterm" name="id2753240"></a><pre class="programlisting">double cairo_current_alpha (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753289"></a><h3><a name="cairo-current-tolerance"></a>cairo_current_tolerance ()</h3><a class="indexterm" name="id2753300"></a><pre class="programlisting">double cairo_current_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753350"></a><h3><a name="cairo-current-point"></a>cairo_current_point ()</h3><a class="indexterm" name="id2753362"></a><pre class="programlisting">void cairo_current_point (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ int num_glyphs);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>glyphs</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>num_glyphs</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991890"></a><h3>
+<a name="cairo-get-operator"></a>cairo_get_operator ()</h3>
+<a class="indexterm" name="id2991901"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> cairo_get_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current compositing operator for a cairo context.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current compositing operator.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2991962"></a><h3>
+<a name="cairo-get-source"></a>cairo_get_source ()</h3>
+<a class="indexterm" name="id2991973"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_get_source (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current source pattern for <i class="parameter"><tt>cr</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current source pattern. This object is owned by
+cairo. To keep a reference to it, you must call
+<a href="cairo-cairo-pattern-t.html#cairo-pattern-reference"><tt class="function">cairo_pattern_reference()</tt></a>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992051"></a><h3>
+<a name="cairo-get-tolerance"></a>cairo_get_tolerance ()</h3>
+<a class="indexterm" name="id2992063"></a><pre class="programlisting">double cairo_get_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current tolerance value, as set by <a href="cairo-cairo-t.html#cairo-set-tolerance"><tt class="function">cairo_set_tolerance()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current tolerance value.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992133"></a><h3>
+<a name="cairo-get-current-point"></a>cairo_get_current_point ()</h3>
+<a class="indexterm" name="id2992144"></a><pre class="programlisting">void cairo_get_current_point (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
- double *y);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>x</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>y</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753438"></a><h3><a name="cairo-current-fill-rule"></a>cairo_current_fill_rule ()</h3><a class="indexterm" name="id2753450"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> cairo_current_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753500"></a><h3><a name="cairo-current-line-width"></a>cairo_current_line_width ()</h3><a class="indexterm" name="id2753512"></a><pre class="programlisting">double cairo_current_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753561"></a><h3><a name="cairo-current-line-cap"></a>cairo_current_line_cap ()</h3><a class="indexterm" name="id2753573"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> cairo_current_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753623"></a><h3><a name="cairo-current-line-join"></a>cairo_current_line_join ()</h3><a class="indexterm" name="id2753634"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> cairo_current_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753684"></a><h3><a name="cairo-current-miter-limit"></a>cairo_current_miter_limit ()</h3><a class="indexterm" name="id2753697"></a><pre class="programlisting">double cairo_current_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753746"></a><h3><a name="cairo-current-matrix"></a>cairo_current_matrix ()</h3><a class="indexterm" name="id2753758"></a><pre class="programlisting">void cairo_current_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>matrix</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753816"></a><h3><a name="cairo-current-target-surface"></a>cairo_current_target_surface ()</h3><a class="indexterm" name="id2753828"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_current_target_surface
- (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2753879"></a><h3><a name="cairo-current-path"></a>cairo_current_path ()</h3><a class="indexterm" name="id2753891"></a><pre class="programlisting">void cairo_current_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_curve_to_func_t *curve_to,
- cairo_close_path_func_t *close_path,
- void *closure);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>move_to</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>line_to</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>curve_to</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>close_path</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>closure</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2754026"></a><h3><a name="cairo-current-path-flat"></a>cairo_current_path_flat ()</h3><a class="indexterm" name="id2754037"></a><pre class="programlisting">void cairo_current_path_flat (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_close_path_func_t *close_path,
- void *closure);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>move_to</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>line_to</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>close_path</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>closure</tt></i>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2754153"></a><h3><a name="cairo-status-t"></a>enum cairo_status_t</h3><a class="indexterm" name="id2754164"></a><pre class="programlisting">typedef enum cairo_status {
+ double *y);</pre>
+<p>
+Gets the current point of the current path, which is
+conceptually the final point reached by the path so far.
+</p>
+<p>
+The current point is returned in the user-space coordinate
+system. If there is no defined current point then <i class="parameter"><tt>x</tt></i> and <i class="parameter"><tt>y</tt></i> will
+both be set to 0.0.
+</p>
+<p>
+Most path construction functions alter the current point. See the
+following for details on how they affect the current point:
+</p>
+<p>
+<a href="cairo-cairo-t.html#cairo-new-path"><tt class="function">cairo_new_path()</tt></a>, <a href="cairo-cairo-t.html#cairo-move-to"><tt class="function">cairo_move_to()</tt></a>, <a href="cairo-cairo-t.html#cairo-line-to"><tt class="function">cairo_line_to()</tt></a>,
+<a href="cairo-cairo-t.html#cairo-curve-to"><tt class="function">cairo_curve_to()</tt></a>, <a href="cairo-cairo-t.html#cairo-arc"><tt class="function">cairo_arc()</tt></a>, <a href="cairo-cairo-t.html#cairo-rel-move-to"><tt class="function">cairo_rel_move_to()</tt></a>,
+<a href="cairo-cairo-t.html#cairo-rel-line-to"><tt class="function">cairo_rel_line_to()</tt></a>, <a href="cairo-cairo-t.html#cairo-rel-curve-to"><tt class="function">cairo_rel_curve_to()</tt></a>, <a href="cairo-cairo-t.html#cairo-arc"><tt class="function">cairo_arc()</tt></a>,
+<a href="cairo-cairo-t.html#cairo-text-path"><tt class="function">cairo_text_path()</tt></a>, <tt class="function">cairo_stroke_to_path()</tt></p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>x</tt></i>&#160;:</span></td>
+<td> return value for X coordinate of the current point
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>y</tt></i>&#160;:</span></td>
+<td> return value for Y coordinate of the current point
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992371"></a><h3>
+<a name="cairo-get-fill-rule"></a>cairo_get_fill_rule ()</h3>
+<a class="indexterm" name="id2992382"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> cairo_get_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current fill rule, as set by <a href="cairo-cairo-t.html#cairo-set-fill-rule"><tt class="function">cairo_set_fill_rule()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current fill rule.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992453"></a><h3>
+<a name="cairo-get-line-width"></a>cairo_get_line_width ()</h3>
+<a class="indexterm" name="id2992464"></a><pre class="programlisting">double cairo_get_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current line width, as set by <a href="cairo-cairo-t.html#cairo-set-line-width"><tt class="function">cairo_set_line_width()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current line width, in user-space units.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992535"></a><h3>
+<a name="cairo-get-line-cap"></a>cairo_get_line_cap ()</h3>
+<a class="indexterm" name="id2992547"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> cairo_get_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current line cap style, as set by <a href="cairo-cairo-t.html#cairo-set-line-cap"><tt class="function">cairo_set_line_cap()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current line cap style.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992618"></a><h3>
+<a name="cairo-get-line-join"></a>cairo_get_line_join ()</h3>
+<a class="indexterm" name="id2992629"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> cairo_get_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current line join style, as set by <a href="cairo-cairo-t.html#cairo-set-line-join"><tt class="function">cairo_set_line_join()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current line join style.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992700"></a><h3>
+<a name="cairo-get-miter-limit"></a>cairo_get_miter_limit ()</h3>
+<a class="indexterm" name="id2992711"></a><pre class="programlisting">double cairo_get_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the current miter limit, as set by <a href="cairo-cairo-t.html#cairo-set-miter-limit"><tt class="function">cairo_set_miter_limit()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the current miter limit.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992782"></a><h3>
+<a name="cairo-get-matrix"></a>cairo_get_matrix ()</h3>
+<a class="indexterm" name="id2992793"></a><pre class="programlisting">void cairo_get_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
+<p>
+Stores the current transformation matrix (CTM) into <i class="parameter"><tt>matrix</tt></i>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>matrix</tt></i>&#160;:</span></td>
+<td> return value for the matrix
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992871"></a><h3>
+<a name="cairo-get-target"></a>cairo_get_target ()</h3>
+<a class="indexterm" name="id2992882"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_get_target (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets the target surface for the cairo context as passed to
+<a href="cairo-cairo-t.html#cairo-create"><tt class="function">cairo_create()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the target surface, (or NULL if <i class="parameter"><tt>cr</tt></i> is in an error
+state). This object is owned by cairo. To keep a reference to it,
+you must call <a href="cairo-cairo-surface-t.html#cairo-surface-reference"><tt class="function">cairo_surface_reference()</tt></a>.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2992971"></a><h3>
+<a name="cairo-copy-path"></a>cairo_copy_path ()</h3>
+<a class="indexterm" name="id2992982"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* cairo_copy_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Creates a copy of the current path and returns it to the user as a
+<a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a>. See <span class="type">cairo_path_data_t</span> for hints on how to iterate
+over the returned data structure.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the copy of the current path. The caller owns the
+returned object and should call <a href="cairo-cairo-t.html#cairo-path-destroy"><tt class="function">cairo_path_destroy()</tt></a> when finished
+with it.
+
+This function will always return a valid pointer, but the result
+will have no data, (data==NULL and num_data==0), if either of the
+following conditions hold:
+
+1) If there is insufficient memory to copy the path. In this case
+ path-&gt;status will be set to CAIRO_STATUS_NO_MEMORY.
+
+2) If <i class="parameter"><tt>cr</tt></i> is already in an error state. In this case path-&gt;status
+ will contain the same status that would be returned by
+ cairo_status(cr).
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993083"></a><h3>
+<a name="cairo-copy-path-flat"></a>cairo_copy_path_flat ()</h3>
+<a class="indexterm" name="id2993094"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* cairo_copy_path_flat (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+Gets a flattened copy of the current path and returns it to the
+user as a <a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a>. See <span class="type">cairo_path_data_t</span> for hints on
+how to iterate over the returned data structure.
+</p>
+<p>
+This function is like <a href="cairo-cairo-t.html#cairo-copy-path"><tt class="function">cairo_copy_path()</tt></a> except that any curves
+in the path will be approximated with piecewise-linear
+approximations, (accurate to within the current tolerance
+value). That is, the result is guaranteed to not have any elements
+of type CAIRO_PATH_CURVE_TO which will instead be replaced by a
+series of CAIRO_PATH_LINE_TO elements.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the copy of the current path. The caller owns the
+returned object and should call <a href="cairo-cairo-t.html#cairo-path-destroy"><tt class="function">cairo_path_destroy()</tt></a> when finished
+with it.
+
+This function will always return a valid pointer, but the result
+will have no data, (data==NULL and num_data==0), if either of the
+following conditions hold:
+
+1) If there is insufficient memory to copy the path. In this case
+ path-&gt;status will be set to CAIRO_STATUS_NO_MEMORY.
+
+2) If <i class="parameter"><tt>cr</tt></i> is already in an error state. In this case path-&gt;status
+ will contain the same status that would be returned by
+ cairo_status(cr).
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993214"></a><h3>
+<a name="cairo-append-path"></a>cairo_append_path ()</h3>
+<a class="indexterm" name="id2993226"></a><pre class="programlisting">void cairo_append_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
+ <a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);</pre>
+<p>
+Append the <i class="parameter"><tt>path</tt></i> onto the current path. The <i class="parameter"><tt>path</tt></i> may be either the
+return value from one of <a href="cairo-cairo-t.html#cairo-copy-path"><tt class="function">cairo_copy_path()</tt></a> or
+<a href="cairo-cairo-t.html#cairo-copy-path-flat"><tt class="function">cairo_copy_path_flat()</tt></a> or it may be constructed manually. See
+<a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a> for details on how the path data structure should be
+initialized, and note that path-&gt;status must be initialized to
+CAIRO_STATUS_SUCCESS.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td> a cairo context
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>path</tt></i>&#160;:</span></td>
+<td> path to be appended
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993339"></a><h3>
+<a name="cairo-path-data-type-t"></a>enum cairo_path_data_type_t</h3>
+<a class="indexterm" name="id2993351"></a><pre class="programlisting">typedef enum cairo_path_data_type {
+ CAIRO_PATH_MOVE_TO,
+ CAIRO_PATH_LINE_TO,
+ CAIRO_PATH_CURVE_TO,
+ CAIRO_PATH_CLOSE_PATH
+} cairo_path_data_type_t;
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993369"></a><h3>
+<a name="cairo-path-t"></a>cairo_path_t</h3>
+<a class="indexterm" name="id2993380"></a><pre class="programlisting">typedef struct {
+ cairo_status_t status;
+ cairo_path_data_t *data;
+ int num_data;
+} cairo_path_t;
+</pre>
+<p>
+A data structure for holding a path. This data structure serves as
+the return value for <tt class="function">cairo_copy_path_data()</tt> and
+<tt class="function">cairo_copy_path_data_flat()</tt> as well the input value for
+<a href="cairo-cairo-t.html#cairo-append-path"><tt class="function">cairo_append_path()</tt></a>.
+</p>
+<p>
+See <span class="type">cairo_path_data_t</span> for hints on how to iterate over the
+actual data within the path.
+</p>
+<p>
+The num_data member gives the number of elements in the data
+array. This number is larger than the number of independent path
+portions (MOVE_TO, LINE_TO, CURVE_TO, CLOSE_PATH), since the data
+includes both headers and coordinates for each portion.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993452"></a><h3>
+<a name="cairo-path-destroy"></a>cairo_path_destroy ()</h3>
+<a class="indexterm" name="id2993463"></a><pre class="programlisting">void cairo_path_destroy (<a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);</pre>
+<p>
+Immediately releases all memory associated with <i class="parameter"><tt>path</tt></i>. After a call
+to <a href="cairo-cairo-t.html#cairo-path-destroy"><tt class="function">cairo_path_destroy()</tt></a> the <i class="parameter"><tt>path</tt></i> pointer is no longer valid and
+should not be used further.
+</p>
+<p>
+NOTE: cairo_path_destroy function should only be called with a
+pointer to a <a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a> returned by a cairo function. Any path
+that is created manually (ie. outside of cairo) should be destroyed
+manually as well.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>path</tt></i>&#160;:</span></td>
+<td> a path to destroy which was previously returned by either
+cairo_copy_path or cairo_copy_path_flat.
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993552"></a><h3>
+<a name="cairo-status-t"></a>enum cairo_status_t</h3>
+<a class="indexterm" name="id2993562"></a><pre class="programlisting">typedef enum cairo_status {
CAIRO_STATUS_SUCCESS = 0,
CAIRO_STATUS_NO_MEMORY,
CAIRO_STATUS_INVALID_RESTORE,
@@ -1215,23 +3661,191 @@ glyphs. The X and Y offsets in <i class="parameter"><tt>glyphs</tt></i> are take
CAIRO_STATUS_INVALID_MATRIX,
CAIRO_STATUS_NO_TARGET_SURFACE,
CAIRO_STATUS_NULL_POINTER,
- CAIRO_STATUS_INVALID_STRING
+ CAIRO_STATUS_INVALID_STRING,
+ CAIRO_STATUS_INVALID_PATH_DATA,
+ CAIRO_STATUS_READ_ERROR,
+ CAIRO_STATUS_WRITE_ERROR,
+ CAIRO_STATUS_SURFACE_FINISHED,
+ CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
+ CAIRO_STATUS_PATTERN_TYPE_MISMATCH
} cairo_status_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2754181"></a><h3><a name="cairo-status"></a>cairo_status ()</h3><a class="indexterm" name="id2754192"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_status (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2754242"></a><h3><a name="cairo-status-string"></a>cairo_status_string ()</h3><a class="indexterm" name="id2754254"></a><pre class="programlisting">const char* cairo_status_string (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cr</tt></i>:</span></td><td>
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>
-
-
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2754304"></a><h3><a name="cairo-filter-t"></a>enum cairo_filter_t</h3><a class="indexterm" name="id2754316"></a><pre class="programlisting">typedef enum {
+</pre>
+<p>
+<a href="cairo-cairo-t.html#cairo-status-t"><span class="type">cairo_status_t</span></a> is used to indicate errors that can occur when
+using Cairo. In some cases it is returned directly by functions.
+but when using <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>, the last error, if any, is stored in
+the context and can be retrieved with <a href="cairo-cairo-t.html#cairo-status"><tt class="function">cairo_status()</tt></a>.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_SUCCESS</tt></span></td>
+<td> no error has occurred
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_NO_MEMORY</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_INVALID_RESTORE</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_INVALID_POP_GROUP</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_NO_CURRENT_POINT</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_INVALID_MATRIX</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_NO_TARGET_SURFACE</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_NULL_POINTER</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_INVALID_STRING</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_INVALID_PATH_DATA</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_READ_ERROR</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_WRITE_ERROR</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_SURFACE_FINISHED</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_SURFACE_TYPE_MISMATCH</tt></span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><tt class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</tt></span></td>
+<td>
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993862"></a><h3>
+<a name="cairo-status"></a>cairo_status ()</h3>
+<a class="indexterm" name="id2993873"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_status (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>cr</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993930"></a><h3>
+<a name="cairo-status-string"></a>cairo_status_string</h3>
+<a class="indexterm" name="id2993941"></a><pre class="programlisting">#define cairo_status_string cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2993958"></a><h3>
+<a name="cairo-status-to-string"></a>cairo_status_to_string ()</h3>
+<a class="indexterm" name="id2993969"></a><pre class="programlisting">const char* cairo_status_to_string (<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> status);</pre>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>status</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994028"></a><h3>
+<a name="cairo-filter-t"></a>enum cairo_filter_t</h3>
+<a class="indexterm" name="id2994038"></a><pre class="programlisting">typedef enum {
CAIRO_FILTER_FAST,
CAIRO_FILTER_GOOD,
CAIRO_FILTER_BEST,
@@ -1239,43 +3853,327 @@ glyphs. The X and Y offsets in <i class="parameter"><tt>glyphs</tt></i> are take
CAIRO_FILTER_BILINEAR,
CAIRO_FILTER_GAUSSIAN
} cairo_filter_t;
-</pre><p>
-
-</p></div><hr><div class="refsect2" lang="en"><a name="id2754330"></a><h3><a name="cairo-image-surface-create"></a>cairo_image_surface_create ()</h3><a class="indexterm" name="id2754342"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create (<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
+</pre>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994057"></a><h3>
+<a name="cairo-image-surface-create"></a>cairo_image_surface_create ()</h3>
+<a class="indexterm" name="id2994069"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create (<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
int width,
- int height);</pre><p>
+ int height);</pre>
+<p>
Creates an image surface of the specified format and
dimensions. The initial contents of the surface is undefined; you
must explicitely clear the buffer, using, for example,
-<a href="cairo-cairo-t.html#cairo-rectangle"><tt class="function">cairo_rectangle()</tt></a> and <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a> if you want it cleared.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td> format of pixels in the surface to create
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td> width of the surface, in pixels
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td> height of the surface, in pixels
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> the newly created surface, or <tt class="literal">NULL</tt> if it couldn't
+<a href="cairo-cairo-t.html#cairo-rectangle"><tt class="function">cairo_rectangle()</tt></a> and <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a> if you want it cleared.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>format</tt></i>&#160;:</span></td>
+<td> format of pixels in the surface to create
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> width of the surface, in pixels
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> height of the surface, in pixels
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the newly created surface, or <tt class="literal">NULL</tt> if it couldn't
be created because of lack of memory
-</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2754457"></a><h3><a name="cairo-image-surface-create-for-data"></a>cairo_image_surface_create_for_data ()</h3><a class="indexterm" name="id2754470"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_for_data
- (char *data,
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994202"></a><h3>
+<a name="cairo-image-surface-create-for-data"></a>cairo_image_surface_create_for_data ()</h3>
+<a class="indexterm" name="id2994214"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_for_data
+ (unsigned char *data,
<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format,
int width,
int height,
- int stride);</pre><p>
+ int stride);</pre>
+<p>
Creates an image surface for the provided pixel data. The output
buffer must be kept around until the <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> is destroyed
-or <tt class="function">cairo_surface_finish()</tt> is called on the surface. The initial
+or <a href="cairo-cairo-surface-t.html#cairo-surface-finish"><tt class="function">cairo_surface_finish()</tt></a> is called on the surface. The initial
contents of <i class="parameter"><tt>buffer</tt></i> will be used as the inital image contents; you
must explicitely clear the buffer, using, for example,
-<a href="cairo-cairo-t.html#cairo-rectangle"><tt class="function">cairo_rectangle()</tt></a> and <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a> if you want it cleared.</p><p>
-
-</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>data</tt></i>:</span></td><td> a pointer to a buffer supplied by the application
+<a href="cairo-cairo-t.html#cairo-rectangle"><tt class="function">cairo_rectangle()</tt></a> and <a href="cairo-cairo-t.html#cairo-fill"><tt class="function">cairo_fill()</tt></a> if you want it cleared.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>data</tt></i>&#160;:</span></td>
+<td> a pointer to a buffer supplied by the application
in which to write contents.
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>format</tt></i>:</span></td><td> the format of pixels in the buffer
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>width</tt></i>:</span></td><td> the width of the image to be stored in the buffer
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>height</tt></i>:</span></td><td> the height of the image to be stored in the buffer
-</td></tr><tr><td><span class="term"><i class="parameter"><tt>stride</tt></i>:</span></td><td> the number of bytes between the start of rows
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>format</tt></i>&#160;:</span></td>
+<td> the format of pixels in the buffer
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>width</tt></i>&#160;:</span></td>
+<td> the width of the image to be stored in the buffer
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>height</tt></i>&#160;:</span></td>
+<td> the height of the image to be stored in the buffer
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>stride</tt></i>&#160;:</span></td>
+<td> the number of bytes between the start of rows
in the buffer. Having this be specified separate from <i class="parameter"><tt>width</tt></i>
allows for padding at the end of rows, or for writing
to a subportion of a larger image.
-</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td> the newly created surface, or <tt class="literal">NULL</tt> if it couldn't
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the newly created surface, or <tt class="literal">NULL</tt> if it couldn't
be created because of lack of memory
-</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="pt02.html"><b>&lt;&lt;PartII.Reference</b></a></td><td align="right"><a accesskey="n" href="cairo-cairo-surface-t.html"><b>cairo_surface_t&gt;&gt;</b></a></td></tr></table></body></html>
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994426"></a><h3>
+<a name="cairo-image-surface-get-width"></a>cairo_image_surface_get_width ()</h3>
+<a class="indexterm" name="id2994437"></a><pre class="programlisting">int cairo_image_surface_get_width (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
+<p>
+Get the width of the image surface in pixels.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <span class="type">cairo_image_surface_t</span>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the width of the surface in pixels.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994507"></a><h3>
+<a name="cairo-image-surface-get-height"></a>cairo_image_surface_get_height ()</h3>
+<a class="indexterm" name="id2994519"></a><pre class="programlisting">int cairo_image_surface_get_height (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
+<p>
+Get the height of the image surface in pixels.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>surface</tt></i>&#160;:</span></td>
+<td> a <span class="type">cairo_image_surface_t</span>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td> the height of the surface in pixels.
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994588"></a><h3>
+<a name="cairo-destroy-func-t"></a>cairo_destroy_func_t ()</h3>
+<a class="indexterm" name="id2994600"></a><pre class="programlisting">void (*cairo_destroy_func_t) (void *data);</pre>
+<p>
+<a href="cairo-cairo-t.html#cairo-destroy-func-t"><span class="type">cairo_destroy_func_t</span></a> the type of function which is called when a
+data element is destroyed. It is passed the pointer to the data
+element and should free any memory and resources allocated for it.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody><tr>
+<td>
+<span class="term"><i class="parameter"><tt>data</tt></i>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr></tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994660"></a><h3>
+<a name="cairo-user-data-key-t"></a>cairo_user_data_key_t</h3>
+<a class="indexterm" name="id2994671"></a><pre class="programlisting">typedef struct {
+ int unused;
+} cairo_user_data_key_t;
+</pre>
+<p>
+<a href="cairo-cairo-t.html#cairo-user-data-key-t"><span class="type">cairo_user_data_key_t</span></a> is used for attaching user data to cairo
+data structures. The actual contents of the struct is never used,
+and there is no need to initialize the object; only the unique
+address of a <span class="type">cairo_data_key_t</span> object is used. Typically, you
+would just use the address of a static <span class="type">cairo_data_key_t</span> object.</p>
+<p>
+
+</p>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994718"></a><h3>
+<a name="cairo-read-func-t"></a>cairo_read_func_t ()</h3>
+<a class="indexterm" name="id2994729"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (*cairo_read_func_t) (void *closure,
+ unsigned char *data,
+ unsigned int length);</pre>
+<p>
+<a href="cairo-cairo-t.html#cairo-read-func-t"><span class="type">cairo_read_func_t</span></a> is the type of function which is called when a
+backend needs to read data from an intput stream. It is passed the
+closure which was specified by the user at the time the read
+function was registered, the buffer to read the data into and the
+length of the data in bytes. The read function should return
+CAIRO_STATUS_SUCCESS if all the data was successfully written,
+CAIRO_STATUS_READ_ERROR otherwise.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>closure</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>data</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>length</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<hr>
+<div class="refsect2" lang="en">
+<a name="id2994845"></a><h3>
+<a name="cairo-write-func-t"></a>cairo_write_func_t ()</h3>
+<a class="indexterm" name="id2994857"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (*cairo_write_func_t) (void *closure,
+ unsigned char *data,
+ unsigned int length);</pre>
+<p>
+<a href="cairo-cairo-t.html#cairo-write-func-t"><span class="type">cairo_write_func_t</span></a> is the type of function which is called when a
+backend needs to write data to an output stream. It is passed the
+closure which was specified by the user at the time the write
+function was registered, the data to write and the length of the
+data in bytes. The write function should return
+CAIRO_STATUS_SUCCESS if all the data was successfully written,
+CAIRO_STATUS_WRITE_ERROR otherwise.</p>
+<p>
+
+</p>
+<div class="variablelist"><table border="0">
+<col align="left" valign="top">
+<tbody>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>closure</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>data</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><i class="parameter"><tt>length</tt></i>&#160;:</span></td>
+<td>
+</td>
+</tr>
+<tr>
+<td>
+<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
+<td>
+
+
+</td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="pt02.html"><b>&lt;&lt;&#160;Part&#160;II.&#160;Reference</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-cairo-surface-t.html"><b>cairo_surface_t&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/cairo.devhelp b/doc/public/html/cairo.devhelp
index 84563e3..48201b6 100644
--- a/doc/public/html/cairo.devhelp
+++ b/doc/public/html/cairo.devhelp
@@ -7,6 +7,7 @@
<sub name="cairo_surface_t" link="cairo-cairo-surface-t.html"/>
<sub name="cairo_pattern_t" link="cairo-cairo-pattern-t.html"/>
<sub name="cairo_matrix_t" link="cairo-cairo-matrix-t.html"/>
+ <sub name="Fonts" link="cairo-Fonts.html"/>
<sub name="ATSUI Fonts" link="cairo-ATSUI-Fonts.html"/>
<sub name="FreeType Fonts" link="cairo-FreeType-Fonts.html"/>
<sub name="Glitz backend" link="cairo-Glitz-backend.html"/>
@@ -18,6 +19,19 @@
<sub name="XCB Backend" link="cairo-XCB-Backend.html"/>
<sub name="XLib Backend" link="cairo-XLib-Backend.html"/>
</sub>
+ <sub name="Index" link="ix01.html"/>
+ <sub name="Creating a language binding for cairo" link="language-bindings.html">
+ <sub name="General considerations" link="language-bindings.html#bindings-general"/>
+ <sub name="Memory Management" link="bindings-memory.html"/>
+ <sub name="Multiple return values" link="bindings-return-values.html"/>
+ <sub name="Overloading and optional arguments" link="bindings-overloading.html"/>
+ <sub name="Streams and File I/O" link="bindings-streams.html"/>
+ <sub name="Error handling" link="bindings-errors.html"/>
+ <sub name="Patterns" link="bindings-patterns.html"/>
+ <sub name="Surfaces" link="bindings-surfaces.html"/>
+ <sub name="Fonts" link="bindings-fonts.html"/>
+ <sub name="cairo_path_t" link="bindings-path.html"/>
+ </sub>
</chapters>
<functions>
<function name="cairo_t" link="cairo-cairo-t.html#cairo-t"/>
@@ -26,15 +40,13 @@
<function name="cairo_destroy ()" link="cairo-cairo-t.html#cairo-destroy"/>
<function name="cairo_save ()" link="cairo-cairo-t.html#cairo-save"/>
<function name="cairo_restore ()" link="cairo-cairo-t.html#cairo-restore"/>
- <function name="cairo_copy ()" link="cairo-cairo-t.html#cairo-copy"/>
- <function name="cairo_set_target_surface ()" link="cairo-cairo-t.html#cairo-set-target-surface"/>
<function name="enum cairo_format_t" link="cairo-cairo-t.html#cairo-format-t"/>
- <function name="cairo_set_target_image ()" link="cairo-cairo-t.html#cairo-set-target-image"/>
<function name="enum cairo_operator_t" link="cairo-cairo-t.html#cairo-operator-t"/>
<function name="cairo_set_operator ()" link="cairo-cairo-t.html#cairo-set-operator"/>
- <function name="cairo_set_rgb_color ()" link="cairo-cairo-t.html#cairo-set-rgb-color"/>
- <function name="cairo_set_pattern ()" link="cairo-cairo-t.html#cairo-set-pattern"/>
- <function name="cairo_set_alpha ()" link="cairo-cairo-t.html#cairo-set-alpha"/>
+ <function name="cairo_set_source_rgb ()" link="cairo-cairo-t.html#cairo-set-source-rgb"/>
+ <function name="cairo_set_source_rgba ()" link="cairo-cairo-t.html#cairo-set-source-rgba"/>
+ <function name="cairo_set_source ()" link="cairo-cairo-t.html#cairo-set-source"/>
+ <function name="cairo_set_source_surface ()" link="cairo-cairo-t.html#cairo-set-source-surface"/>
<function name="cairo_set_tolerance ()" link="cairo-cairo-t.html#cairo-set-tolerance"/>
<function name="enum cairo_fill_rule_t" link="cairo-cairo-t.html#cairo-fill-rule-t"/>
<function name="cairo_set_fill_rule ()" link="cairo-cairo-t.html#cairo-set-fill-rule"/>
@@ -48,14 +60,13 @@
<function name="cairo_translate ()" link="cairo-cairo-t.html#cairo-translate"/>
<function name="cairo_scale ()" link="cairo-cairo-t.html#cairo-scale"/>
<function name="cairo_rotate ()" link="cairo-cairo-t.html#cairo-rotate"/>
- <function name="cairo_concat_matrix ()" link="cairo-cairo-t.html#cairo-concat-matrix"/>
+ <function name="cairo_transform ()" link="cairo-cairo-t.html#cairo-transform"/>
<function name="cairo_set_matrix ()" link="cairo-cairo-t.html#cairo-set-matrix"/>
- <function name="cairo_default_matrix ()" link="cairo-cairo-t.html#cairo-default-matrix"/>
<function name="cairo_identity_matrix ()" link="cairo-cairo-t.html#cairo-identity-matrix"/>
- <function name="cairo_transform_point ()" link="cairo-cairo-t.html#cairo-transform-point"/>
- <function name="cairo_transform_distance ()" link="cairo-cairo-t.html#cairo-transform-distance"/>
- <function name="cairo_inverse_transform_point ()" link="cairo-cairo-t.html#cairo-inverse-transform-point"/>
- <function name="cairo_inverse_transform_distance ()" link="cairo-cairo-t.html#cairo-inverse-transform-distance"/>
+ <function name="cairo_user_to_device ()" link="cairo-cairo-t.html#cairo-user-to-device"/>
+ <function name="cairo_user_to_device_distance ()" link="cairo-cairo-t.html#cairo-user-to-device-distance"/>
+ <function name="cairo_device_to_user ()" link="cairo-cairo-t.html#cairo-device-to-user"/>
+ <function name="cairo_device_to_user_distance ()" link="cairo-cairo-t.html#cairo-device-to-user-distance"/>
<function name="cairo_new_path ()" link="cairo-cairo-t.html#cairo-new-path"/>
<function name="cairo_move_to ()" link="cairo-cairo-t.html#cairo-move-to"/>
<function name="cairo_line_to ()" link="cairo-cairo-t.html#cairo-line-to"/>
@@ -67,8 +78,14 @@
<function name="cairo_rel_curve_to ()" link="cairo-cairo-t.html#cairo-rel-curve-to"/>
<function name="cairo_rectangle ()" link="cairo-cairo-t.html#cairo-rectangle"/>
<function name="cairo_close_path ()" link="cairo-cairo-t.html#cairo-close-path"/>
+ <function name="cairo_paint ()" link="cairo-cairo-t.html#cairo-paint"/>
+ <function name="cairo_paint_with_alpha ()" link="cairo-cairo-t.html#cairo-paint-with-alpha"/>
+ <function name="cairo_mask ()" link="cairo-cairo-t.html#cairo-mask"/>
+ <function name="cairo_mask_surface ()" link="cairo-cairo-t.html#cairo-mask-surface"/>
<function name="cairo_stroke ()" link="cairo-cairo-t.html#cairo-stroke"/>
+ <function name="cairo_stroke_preserve ()" link="cairo-cairo-t.html#cairo-stroke-preserve"/>
<function name="cairo_fill ()" link="cairo-cairo-t.html#cairo-fill"/>
+ <function name="cairo_fill_preserve ()" link="cairo-cairo-t.html#cairo-fill-preserve"/>
<function name="cairo_copy_page ()" link="cairo-cairo-t.html#cairo-copy-page"/>
<function name="cairo_show_page ()" link="cairo-cairo-t.html#cairo-show-page"/>
<function name="cairo_in_stroke ()" link="cairo-cairo-t.html#cairo-in-stroke"/>
@@ -76,69 +93,72 @@
<function name="cairo_bool_t" link="cairo-cairo-t.html#cairo-bool-t"/>
<function name="cairo_stroke_extents ()" link="cairo-cairo-t.html#cairo-stroke-extents"/>
<function name="cairo_fill_extents ()" link="cairo-cairo-t.html#cairo-fill-extents"/>
- <function name="cairo_init_clip ()" link="cairo-cairo-t.html#cairo-init-clip"/>
<function name="cairo_clip ()" link="cairo-cairo-t.html#cairo-clip"/>
- <function name="cairo_font_t" link="cairo-cairo-t.html#cairo-font-t"/>
+ <function name="cairo_clip_preserve ()" link="cairo-cairo-t.html#cairo-clip-preserve"/>
+ <function name="cairo_reset_clip ()" link="cairo-cairo-t.html#cairo-reset-clip"/>
<function name="cairo_glyph_t" link="cairo-cairo-t.html#cairo-glyph-t"/>
- <function name="cairo_text_extents_t" link="cairo-cairo-t.html#cairo-text-extents-t"/>
- <function name="cairo_font_extents_t" link="cairo-cairo-t.html#cairo-font-extents-t"/>
<function name="enum cairo_font_slant_t" link="cairo-cairo-t.html#cairo-font-slant-t"/>
<function name="enum cairo_font_weight_t" link="cairo-cairo-t.html#cairo-font-weight-t"/>
- <function name="cairo_select_font ()" link="cairo-cairo-t.html#cairo-select-font"/>
- <function name="cairo_scale_font ()" link="cairo-cairo-t.html#cairo-scale-font"/>
- <function name="cairo_transform_font ()" link="cairo-cairo-t.html#cairo-transform-font"/>
+ <function name="cairo_select_font_face ()" link="cairo-cairo-t.html#cairo-select-font-face"/>
+ <function name="cairo_set_font_size ()" link="cairo-cairo-t.html#cairo-set-font-size"/>
+ <function name="cairo_set_font_matrix ()" link="cairo-cairo-t.html#cairo-set-font-matrix"/>
+ <function name="cairo_get_font_matrix ()" link="cairo-cairo-t.html#cairo-get-font-matrix"/>
<function name="cairo_show_text ()" link="cairo-cairo-t.html#cairo-show-text"/>
<function name="cairo_show_glyphs ()" link="cairo-cairo-t.html#cairo-show-glyphs"/>
- <function name="cairo_current_font ()" link="cairo-cairo-t.html#cairo-current-font"/>
- <function name="cairo_current_font_extents ()" link="cairo-cairo-t.html#cairo-current-font-extents"/>
- <function name="cairo_set_font ()" link="cairo-cairo-t.html#cairo-set-font"/>
+ <function name="cairo_get_font_face ()" link="cairo-cairo-t.html#cairo-get-font-face"/>
+ <function name="cairo_font_extents ()" link="cairo-cairo-t.html#cairo-font-extents"/>
+ <function name="cairo_set_font_face ()" link="cairo-cairo-t.html#cairo-set-font-face"/>
<function name="cairo_text_extents ()" link="cairo-cairo-t.html#cairo-text-extents"/>
<function name="cairo_glyph_extents ()" link="cairo-cairo-t.html#cairo-glyph-extents"/>
<function name="cairo_text_path ()" link="cairo-cairo-t.html#cairo-text-path"/>
<function name="cairo_glyph_path ()" link="cairo-cairo-t.html#cairo-glyph-path"/>
- <function name="cairo_font_reference ()" link="cairo-cairo-t.html#cairo-font-reference"/>
- <function name="cairo_font_destroy ()" link="cairo-cairo-t.html#cairo-font-destroy"/>
- <function name="cairo_font_extents ()" link="cairo-cairo-t.html#cairo-font-extents"/>
- <function name="cairo_font_glyph_extents ()" link="cairo-cairo-t.html#cairo-font-glyph-extents"/>
- <function name="cairo_show_surface ()" link="cairo-cairo-t.html#cairo-show-surface"/>
- <function name="cairo_current_operator ()" link="cairo-cairo-t.html#cairo-current-operator"/>
- <function name="cairo_current_rgb_color ()" link="cairo-cairo-t.html#cairo-current-rgb-color"/>
- <function name="cairo_current_pattern ()" link="cairo-cairo-t.html#cairo-current-pattern"/>
- <function name="cairo_current_alpha ()" link="cairo-cairo-t.html#cairo-current-alpha"/>
- <function name="cairo_current_tolerance ()" link="cairo-cairo-t.html#cairo-current-tolerance"/>
- <function name="cairo_current_point ()" link="cairo-cairo-t.html#cairo-current-point"/>
- <function name="cairo_current_fill_rule ()" link="cairo-cairo-t.html#cairo-current-fill-rule"/>
- <function name="cairo_current_line_width ()" link="cairo-cairo-t.html#cairo-current-line-width"/>
- <function name="cairo_current_line_cap ()" link="cairo-cairo-t.html#cairo-current-line-cap"/>
- <function name="cairo_current_line_join ()" link="cairo-cairo-t.html#cairo-current-line-join"/>
- <function name="cairo_current_miter_limit ()" link="cairo-cairo-t.html#cairo-current-miter-limit"/>
- <function name="cairo_current_matrix ()" link="cairo-cairo-t.html#cairo-current-matrix"/>
- <function name="cairo_current_target_surface ()" link="cairo-cairo-t.html#cairo-current-target-surface"/>
- <function name="cairo_current_path ()" link="cairo-cairo-t.html#cairo-current-path"/>
- <function name="cairo_current_path_flat ()" link="cairo-cairo-t.html#cairo-current-path-flat"/>
+ <function name="cairo_get_operator ()" link="cairo-cairo-t.html#cairo-get-operator"/>
+ <function name="cairo_get_source ()" link="cairo-cairo-t.html#cairo-get-source"/>
+ <function name="cairo_get_tolerance ()" link="cairo-cairo-t.html#cairo-get-tolerance"/>
+ <function name="cairo_get_current_point ()" link="cairo-cairo-t.html#cairo-get-current-point"/>
+ <function name="cairo_get_fill_rule ()" link="cairo-cairo-t.html#cairo-get-fill-rule"/>
+ <function name="cairo_get_line_width ()" link="cairo-cairo-t.html#cairo-get-line-width"/>
+ <function name="cairo_get_line_cap ()" link="cairo-cairo-t.html#cairo-get-line-cap"/>
+ <function name="cairo_get_line_join ()" link="cairo-cairo-t.html#cairo-get-line-join"/>
+ <function name="cairo_get_miter_limit ()" link="cairo-cairo-t.html#cairo-get-miter-limit"/>
+ <function name="cairo_get_matrix ()" link="cairo-cairo-t.html#cairo-get-matrix"/>
+ <function name="cairo_get_target ()" link="cairo-cairo-t.html#cairo-get-target"/>
+ <function name="cairo_copy_path ()" link="cairo-cairo-t.html#cairo-copy-path"/>
+ <function name="cairo_copy_path_flat ()" link="cairo-cairo-t.html#cairo-copy-path-flat"/>
+ <function name="cairo_append_path ()" link="cairo-cairo-t.html#cairo-append-path"/>
+ <function name="enum cairo_path_data_type_t" link="cairo-cairo-t.html#cairo-path-data-type-t"/>
+ <function name="cairo_path_t" link="cairo-cairo-t.html#cairo-path-t"/>
+ <function name="cairo_path_destroy ()" link="cairo-cairo-t.html#cairo-path-destroy"/>
<function name="enum cairo_status_t" link="cairo-cairo-t.html#cairo-status-t"/>
<function name="cairo_status ()" link="cairo-cairo-t.html#cairo-status"/>
- <function name="cairo_status_string ()" link="cairo-cairo-t.html#cairo-status-string"/>
+ <function name="cairo_status_string" link="cairo-cairo-t.html#cairo-status-string"/>
+ <function name="cairo_status_to_string ()" link="cairo-cairo-t.html#cairo-status-to-string"/>
<function name="enum cairo_filter_t" link="cairo-cairo-t.html#cairo-filter-t"/>
<function name="cairo_image_surface_create ()" link="cairo-cairo-t.html#cairo-image-surface-create"/>
<function name="cairo_image_surface_create_for_data ()" link="cairo-cairo-t.html#cairo-image-surface-create-for-data"/>
+ <function name="cairo_image_surface_get_width ()" link="cairo-cairo-t.html#cairo-image-surface-get-width"/>
+ <function name="cairo_image_surface_get_height ()" link="cairo-cairo-t.html#cairo-image-surface-get-height"/>
+ <function name="cairo_destroy_func_t ()" link="cairo-cairo-t.html#cairo-destroy-func-t"/>
+ <function name="cairo_user_data_key_t" link="cairo-cairo-t.html#cairo-user-data-key-t"/>
+ <function name="cairo_read_func_t ()" link="cairo-cairo-t.html#cairo-read-func-t"/>
+ <function name="cairo_write_func_t ()" link="cairo-cairo-t.html#cairo-write-func-t"/>
<function name="cairo_surface_t" link="cairo-cairo-surface-t.html#cairo-surface-t"/>
- <function name="cairo_surface_create_for_image ()" link="cairo-cairo-surface-t.html#cairo-surface-create-for-image"/>
<function name="cairo_surface_create_similar ()" link="cairo-cairo-surface-t.html#cairo-surface-create-similar"/>
<function name="cairo_surface_reference ()" link="cairo-cairo-surface-t.html#cairo-surface-reference"/>
<function name="cairo_surface_destroy ()" link="cairo-cairo-surface-t.html#cairo-surface-destroy"/>
- <function name="cairo_surface_set_repeat ()" link="cairo-cairo-surface-t.html#cairo-surface-set-repeat"/>
- <function name="cairo_surface_set_matrix ()" link="cairo-cairo-surface-t.html#cairo-surface-set-matrix"/>
- <function name="cairo_surface_get_matrix ()" link="cairo-cairo-surface-t.html#cairo-surface-get-matrix"/>
- <function name="cairo_surface_set_filter ()" link="cairo-cairo-surface-t.html#cairo-surface-set-filter"/>
- <function name="cairo_surface_get_filter ()" link="cairo-cairo-surface-t.html#cairo-surface-get-filter"/>
+ <function name="cairo_surface_finish ()" link="cairo-cairo-surface-t.html#cairo-surface-finish"/>
+ <function name="cairo_surface_set_user_data ()" link="cairo-cairo-surface-t.html#cairo-surface-set-user-data"/>
+ <function name="cairo_surface_get_user_data ()" link="cairo-cairo-surface-t.html#cairo-surface-get-user-data"/>
+ <function name="cairo_surface_set_device_offset ()" link="cairo-cairo-surface-t.html#cairo-surface-set-device-offset"/>
<function name="cairo_pattern_t" link="cairo-cairo-pattern-t.html#cairo-pattern-t"/>
<function name="cairo_pattern_create_for_surface ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface"/>
<function name="cairo_pattern_create_linear ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-linear"/>
<function name="cairo_pattern_create_radial ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-radial"/>
<function name="cairo_pattern_reference ()" link="cairo-cairo-pattern-t.html#cairo-pattern-reference"/>
<function name="cairo_pattern_destroy ()" link="cairo-cairo-pattern-t.html#cairo-pattern-destroy"/>
- <function name="cairo_pattern_add_color_stop ()" link="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop"/>
+ <function name="cairo_pattern_status ()" link="cairo-cairo-pattern-t.html#cairo-pattern-status"/>
+ <function name="cairo_pattern_add_color_stop_rgb ()" link="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"/>
+ <function name="cairo_pattern_add_color_stop_rgba ()" link="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"/>
<function name="cairo_pattern_set_matrix ()" link="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix"/>
<function name="cairo_pattern_get_matrix ()" link="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix"/>
<function name="enum cairo_extend_t" link="cairo-cairo-pattern-t.html#cairo-extend-t"/>
@@ -147,12 +167,11 @@
<function name="cairo_pattern_set_filter ()" link="cairo-cairo-pattern-t.html#cairo-pattern-set-filter"/>
<function name="cairo_pattern_get_filter ()" link="cairo-cairo-pattern-t.html#cairo-pattern-get-filter"/>
<function name="cairo_matrix_t" link="cairo-cairo-matrix-t.html#cairo-matrix-t"/>
- <function name="cairo_matrix_create ()" link="cairo-cairo-matrix-t.html#cairo-matrix-create"/>
- <function name="cairo_matrix_destroy ()" link="cairo-cairo-matrix-t.html#cairo-matrix-destroy"/>
- <function name="cairo_matrix_copy ()" link="cairo-cairo-matrix-t.html#cairo-matrix-copy"/>
- <function name="cairo_matrix_set_identity ()" link="cairo-cairo-matrix-t.html#cairo-matrix-set-identity"/>
- <function name="cairo_matrix_set_affine ()" link="cairo-cairo-matrix-t.html#cairo-matrix-set-affine"/>
- <function name="cairo_matrix_get_affine ()" link="cairo-cairo-matrix-t.html#cairo-matrix-get-affine"/>
+ <function name="cairo_matrix_init ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init"/>
+ <function name="cairo_matrix_init_identity ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init-identity"/>
+ <function name="cairo_matrix_init_translate ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init-translate"/>
+ <function name="cairo_matrix_init_scale ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init-scale"/>
+ <function name="cairo_matrix_init_rotate ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init-rotate"/>
<function name="cairo_matrix_translate ()" link="cairo-cairo-matrix-t.html#cairo-matrix-translate"/>
<function name="cairo_matrix_scale ()" link="cairo-cairo-matrix-t.html#cairo-matrix-scale"/>
<function name="cairo_matrix_rotate ()" link="cairo-cairo-matrix-t.html#cairo-matrix-rotate"/>
@@ -160,30 +179,45 @@
<function name="cairo_matrix_multiply ()" link="cairo-cairo-matrix-t.html#cairo-matrix-multiply"/>
<function name="cairo_matrix_transform_distance ()" link="cairo-cairo-matrix-t.html#cairo-matrix-transform-distance"/>
<function name="cairo_matrix_transform_point ()" link="cairo-cairo-matrix-t.html#cairo-matrix-transform-point"/>
- <function name="cairo_atsui_font_create ()" link="cairo-ATSUI-Fonts.html#cairo-atsui-font-create"/>
- <function name="cairo_ft_font_create ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-create"/>
- <function name="cairo_ft_font_create_for_ft_face ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face"/>
- <function name="cairo_ft_font_lock_face ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-lock-face"/>
- <function name="cairo_ft_font_unlock_face ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-unlock-face"/>
- <function name="cairo_ft_font_get_pattern ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-get-pattern"/>
- <function name="cairo_set_target_glitz ()" link="cairo-Glitz-backend.html#cairo-set-target-glitz"/>
+ <function name="cairo_font_face_t" link="cairo-Fonts.html#cairo-font-face-t"/>
+ <function name="cairo_scaled_font_t" link="cairo-Fonts.html#cairo-scaled-font-t"/>
+ <function name="cairo_font_face_reference ()" link="cairo-Fonts.html#cairo-font-face-reference"/>
+ <function name="cairo_font_face_destroy ()" link="cairo-Fonts.html#cairo-font-face-destroy"/>
+ <function name="cairo_font_face_get_user_data ()" link="cairo-Fonts.html#cairo-font-face-get-user-data"/>
+ <function name="cairo_font_face_set_user_data ()" link="cairo-Fonts.html#cairo-font-face-set-user-data"/>
+ <function name="cairo_scaled_font_create ()" link="cairo-Fonts.html#cairo-scaled-font-create"/>
+ <function name="cairo_scaled_font_reference ()" link="cairo-Fonts.html#cairo-scaled-font-reference"/>
+ <function name="cairo_scaled_font_destroy ()" link="cairo-Fonts.html#cairo-scaled-font-destroy"/>
+ <function name="cairo_font_extents_t" link="cairo-Fonts.html#cairo-font-extents-t"/>
+ <function name="cairo_scaled_font_extents ()" link="cairo-Fonts.html#cairo-scaled-font-extents"/>
+ <function name="cairo_text_extents_t" link="cairo-Fonts.html#cairo-text-extents-t"/>
+ <function name="cairo_scaled_font_glyph_extents ()" link="cairo-Fonts.html#cairo-scaled-font-glyph-extents"/>
+ <function name="cairo_ft_font_face_create_for_pattern ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-pattern"/>
+ <function name="cairo_ft_font_face_create_for_ft_face ()" link="cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-ft-face"/>
+ <function name="cairo_ft_scaled_font_lock_face ()" link="cairo-FreeType-Fonts.html#cairo-ft-scaled-font-lock-face"/>
+ <function name="cairo_ft_scaled_font_unlock_face ()" link="cairo-FreeType-Fonts.html#cairo-ft-scaled-font-unlock-face"/>
<function name="cairo_glitz_surface_create ()" link="cairo-Glitz-backend.html#cairo-glitz-surface-create"/>
- <function name="cairo_set_target_pdf ()" link="cairo-PDF-Backend.html#cairo-set-target-pdf"/>
<function name="cairo_pdf_surface_create ()" link="cairo-PDF-Backend.html#cairo-pdf-surface-create"/>
- <function name="cairo_set_target_png ()" link="cairo-PNG-Backend.html#cairo-set-target-png"/>
- <function name="cairo_png_surface_create ()" link="cairo-PNG-Backend.html#cairo-png-surface-create"/>
- <function name="cairo_set_target_ps ()" link="cairo-PS-Backend.html#cairo-set-target-ps"/>
+ <function name="cairo_pdf_surface_create_for_stream ()" link="cairo-PDF-Backend.html#cairo-pdf-surface-create-for-stream"/>
+ <function name="cairo_pdf_surface_set_dpi ()" link="cairo-PDF-Backend.html#cairo-pdf-surface-set-dpi"/>
+ <function name="cairo_image_surface_create_from_png ()" link="cairo-PNG-Backend.html#cairo-image-surface-create-from-png"/>
+ <function name="cairo_image_surface_create_from_png_stream ()" link="cairo-PNG-Backend.html#cairo-image-surface-create-from-png-stream"/>
+ <function name="cairo_surface_write_to_png ()" link="cairo-PNG-Backend.html#cairo-surface-write-to-png"/>
+ <function name="cairo_surface_write_to_png_stream ()" link="cairo-PNG-Backend.html#cairo-surface-write-to-png-stream"/>
<function name="cairo_ps_surface_create ()" link="cairo-PS-Backend.html#cairo-ps-surface-create"/>
- <function name="cairo_set_target_quartz_context ()" link="cairo-Quartz-Backend.html#cairo-set-target-quartz-context"/>
+ <function name="cairo_ps_surface_create_for_stream ()" link="cairo-PS-Backend.html#cairo-ps-surface-create-for-stream"/>
+ <function name="cairo_ps_surface_set_dpi ()" link="cairo-PS-Backend.html#cairo-ps-surface-set-dpi"/>
<function name="cairo_quartz_surface_create ()" link="cairo-Quartz-Backend.html#cairo-quartz-surface-create"/>
- <function name="cairo_set_target_win32 ()" link="cairo-Microsoft-Windows-Backend.html#cairo-set-target-win32"/>
<function name="cairo_win32_surface_create ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-surface-create"/>
- <function name="cairo_win32_font_create_for_logfontw ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-create-for-logfontw"/>
- <function name="cairo_win32_font_select_font ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-select-font"/>
- <function name="cairo_win32_font_done_font ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-done-font"/>
- <function name="cairo_win32_font_get_scale_factor ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-get-scale-factor"/>
- <function name="cairo_set_target_xcb ()" link="cairo-XCB-Backend.html#cairo-set-target-xcb"/>
- <function name="cairo_set_target_drawable ()" link="cairo-XLib-Backend.html#cairo-set-target-drawable"/>
+ <function name="cairo_win32_font_face_create_for_logfontw ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-font-face-create-for-logfontw"/>
+ <function name="cairo_win32_scaled_font_select_font ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font"/>
+ <function name="cairo_win32_scaled_font_done_font ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-done-font"/>
+ <function name="cairo_win32_scaled_font_get_metrics_factor ()" link="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-get-metrics-factor"/>
+ <function name="cairo_xcb_surface_create ()" link="cairo-XCB-Backend.html#cairo-xcb-surface-create"/>
+ <function name="cairo_xcb_surface_create_for_bitmap ()" link="cairo-XCB-Backend.html#cairo-xcb-surface-create-for-bitmap"/>
+ <function name="cairo_xcb_surface_set_size ()" link="cairo-XCB-Backend.html#cairo-xcb-surface-set-size"/>
<function name="cairo_xlib_surface_create ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-create"/>
+ <function name="cairo_xlib_surface_create_for_bitmap ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-create-for-bitmap"/>
+ <function name="cairo_xlib_surface_set_size ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-set-size"/>
</functions>
</book>
diff --git a/doc/public/html/index.html b/doc/public/html/index.html
index e189c00..cfd73de 100644
--- a/doc/public/html/index.html
+++ b/doc/public/html/index.html
@@ -1,2 +1,82 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Cairo: A Vector Graphics Library</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="next" href="pt01.html" title="PartI.Tutorial"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><table class="navigation" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">Cairo: A Vector Graphics Library</p></th></tr></table></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="part"><a href="pt01.html">I. Tutorial</a></span></dt><dt><span class="part"><a href="pt02.html">II. Reference</a></span></dt><dd><dl><dt><a href="cairo-cairo-t.html">cairo_t</a> - Drawing contexts.</dt><dt><a href="cairo-cairo-surface-t.html">cairo_surface_t</a> - </dt><dt><a href="cairo-cairo-pattern-t.html">cairo_pattern_t</a> - </dt><dt><a href="cairo-cairo-matrix-t.html">cairo_matrix_t</a> -
- Transformation matrices</dt><dt><a href="cairo-ATSUI-Fonts.html">ATSUI Fonts</a> - </dt><dt><a href="cairo-FreeType-Fonts.html">FreeType Fonts</a> - </dt><dt><a href="cairo-Glitz-backend.html">Glitz backend</a> - </dt><dt><a href="cairo-PDF-Backend.html">PDF Backend</a> - </dt><dt><a href="cairo-PNG-Backend.html">PNG Backend</a> - </dt><dt><a href="cairo-PS-Backend.html">PS Backend</a> - </dt><dt><a href="cairo-Quartz-Backend.html">Quartz Backend</a> - </dt><dt><a href="cairo-Microsoft-Windows-Backend.html">Microsoft Windows Backend</a> - </dt><dt><a href="cairo-XCB-Backend.html">XCB Backend</a> - </dt><dt><a href="cairo-XLib-Backend.html">XLib Backend</a> - </dt></dl></dd></dl></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"></td><td align="right"><a accesskey="n" href="pt01.html"><b>PartI.Tutorial&gt;&gt;</b></a></td></tr></table></body></html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Cairo: A Vector Graphics Library</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="next" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<div class="book" lang="en">
+<div class="titlepage">
+<div><div><table class="navigation" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">Cairo: A Vector Graphics Library</p></th></tr></table></div></div>
+<div></div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="part"><a href="pt01.html">I. Tutorial</a></span></dt>
+<dt><span class="part"><a href="pt02.html">II. Reference</a></span></dt>
+<dd><dl>
+<dt>
+<a href="cairo-cairo-t.html">cairo_t</a> - Drawing contexts.</dt>
+<dt>
+<a href="cairo-cairo-surface-t.html">cairo_surface_t</a> - </dt>
+<dt>
+<a href="cairo-cairo-pattern-t.html">cairo_pattern_t</a> - </dt>
+<dt>
+<a href="cairo-cairo-matrix-t.html">cairo_matrix_t</a> -
+ Transformation matrices</dt>
+<dt>
+<a href="cairo-Fonts.html">Fonts</a> - Font Handling</dt>
+<dt>
+<a href="cairo-ATSUI-Fonts.html">ATSUI Fonts</a> - </dt>
+<dt>
+<a href="cairo-FreeType-Fonts.html">FreeType Fonts</a> - </dt>
+<dt>
+<a href="cairo-Glitz-backend.html">Glitz backend</a> - </dt>
+<dt>
+<a href="cairo-PDF-Backend.html">PDF Backend</a> - </dt>
+<dt>
+<a href="cairo-PNG-Backend.html">PNG Backend</a> - </dt>
+<dt>
+<a href="cairo-PS-Backend.html">PS Backend</a> - </dt>
+<dt>
+<a href="cairo-Quartz-Backend.html">Quartz Backend</a> - </dt>
+<dt>
+<a href="cairo-Microsoft-Windows-Backend.html">Microsoft Windows Backend</a> - </dt>
+<dt>
+<a href="cairo-XCB-Backend.html">XCB Backend</a> - </dt>
+<dt>
+<a href="cairo-XLib-Backend.html">XLib Backend</a> - </dt>
+</dl></dd>
+<dt><span class="index"><a href="ix01.html">Index</a></span></dt>
+<dt><span class="appendix"><a href="language-bindings.html">A. Creating a language binding for cairo</a></span></dt>
+<dd><dl>
+<dt><span class="sect1"><a href="language-bindings.html#bindings-general">General considerations</a></span></dt>
+<dt><span class="sect1"><a href="bindings-memory.html">Memory Management</a></span></dt>
+<dt><span class="sect1"><a href="bindings-return-values.html">Multiple return values</a></span></dt>
+<dt><span class="sect1"><a href="bindings-overloading.html">Overloading and optional arguments</a></span></dt>
+<dt><span class="sect1"><a href="bindings-streams.html">Streams and File I/O</a></span></dt>
+<dt><span class="sect1"><a href="bindings-errors.html">Error handling</a></span></dt>
+<dt><span class="sect1"><a href="bindings-patterns.html">Patterns</a></span></dt>
+<dt><span class="sect1"><a href="bindings-surfaces.html">Surfaces</a></span></dt>
+<dt><span class="sect1"><a href="bindings-fonts.html">Fonts</a></span></dt>
+<dt><span class="sect1"><a href="bindings-path.html">cairo_path_t</a></span></dt>
+</dl></dd>
+</dl>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"></td>
+<td align="right"><a accesskey="n" href="pt01.html"><b>Part&#160;I.&#160;Tutorial&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/index.sgml b/doc/public/html/index.sgml
index 81b09b9..43f3425 100644
--- a/doc/public/html/index.sgml
+++ b/doc/public/html/index.sgml
@@ -5,15 +5,13 @@
<ANCHOR id="cairo-destroy" href="cairo/cairo-cairo-t.html#cairo-destroy">
<ANCHOR id="cairo-save" href="cairo/cairo-cairo-t.html#cairo-save">
<ANCHOR id="cairo-restore" href="cairo/cairo-cairo-t.html#cairo-restore">
-<ANCHOR id="cairo-copy" href="cairo/cairo-cairo-t.html#cairo-copy">
-<ANCHOR id="cairo-set-target-surface" href="cairo/cairo-cairo-t.html#cairo-set-target-surface">
<ANCHOR id="cairo-format-t" href="cairo/cairo-cairo-t.html#cairo-format-t">
-<ANCHOR id="cairo-set-target-image" href="cairo/cairo-cairo-t.html#cairo-set-target-image">
<ANCHOR id="cairo-operator-t" href="cairo/cairo-cairo-t.html#cairo-operator-t">
<ANCHOR id="cairo-set-operator" href="cairo/cairo-cairo-t.html#cairo-set-operator">
-<ANCHOR id="cairo-set-rgb-color" href="cairo/cairo-cairo-t.html#cairo-set-rgb-color">
-<ANCHOR id="cairo-set-pattern" href="cairo/cairo-cairo-t.html#cairo-set-pattern">
-<ANCHOR id="cairo-set-alpha" href="cairo/cairo-cairo-t.html#cairo-set-alpha">
+<ANCHOR id="cairo-set-source-rgb" href="cairo/cairo-cairo-t.html#cairo-set-source-rgb">
+<ANCHOR id="cairo-set-source-rgba" href="cairo/cairo-cairo-t.html#cairo-set-source-rgba">
+<ANCHOR id="cairo-set-source" href="cairo/cairo-cairo-t.html#cairo-set-source">
+<ANCHOR id="cairo-set-source-surface" href="cairo/cairo-cairo-t.html#cairo-set-source-surface">
<ANCHOR id="cairo-set-tolerance" href="cairo/cairo-cairo-t.html#cairo-set-tolerance">
<ANCHOR id="cairo-fill-rule-t" href="cairo/cairo-cairo-t.html#cairo-fill-rule-t">
<ANCHOR id="cairo-set-fill-rule" href="cairo/cairo-cairo-t.html#cairo-set-fill-rule">
@@ -27,14 +25,13 @@
<ANCHOR id="cairo-translate" href="cairo/cairo-cairo-t.html#cairo-translate">
<ANCHOR id="cairo-scale" href="cairo/cairo-cairo-t.html#cairo-scale">
<ANCHOR id="cairo-rotate" href="cairo/cairo-cairo-t.html#cairo-rotate">
-<ANCHOR id="cairo-concat-matrix" href="cairo/cairo-cairo-t.html#cairo-concat-matrix">
+<ANCHOR id="cairo-transform" href="cairo/cairo-cairo-t.html#cairo-transform">
<ANCHOR id="cairo-set-matrix" href="cairo/cairo-cairo-t.html#cairo-set-matrix">
-<ANCHOR id="cairo-default-matrix" href="cairo/cairo-cairo-t.html#cairo-default-matrix">
<ANCHOR id="cairo-identity-matrix" href="cairo/cairo-cairo-t.html#cairo-identity-matrix">
-<ANCHOR id="cairo-transform-point" href="cairo/cairo-cairo-t.html#cairo-transform-point">
-<ANCHOR id="cairo-transform-distance" href="cairo/cairo-cairo-t.html#cairo-transform-distance">
-<ANCHOR id="cairo-inverse-transform-point" href="cairo/cairo-cairo-t.html#cairo-inverse-transform-point">
-<ANCHOR id="cairo-inverse-transform-distance" href="cairo/cairo-cairo-t.html#cairo-inverse-transform-distance">
+<ANCHOR id="cairo-user-to-device" href="cairo/cairo-cairo-t.html#cairo-user-to-device">
+<ANCHOR id="cairo-user-to-device-distance" href="cairo/cairo-cairo-t.html#cairo-user-to-device-distance">
+<ANCHOR id="cairo-device-to-user" href="cairo/cairo-cairo-t.html#cairo-device-to-user">
+<ANCHOR id="cairo-device-to-user-distance" href="cairo/cairo-cairo-t.html#cairo-device-to-user-distance">
<ANCHOR id="cairo-new-path" href="cairo/cairo-cairo-t.html#cairo-new-path">
<ANCHOR id="cairo-move-to" href="cairo/cairo-cairo-t.html#cairo-move-to">
<ANCHOR id="cairo-line-to" href="cairo/cairo-cairo-t.html#cairo-line-to">
@@ -46,8 +43,14 @@
<ANCHOR id="cairo-rel-curve-to" href="cairo/cairo-cairo-t.html#cairo-rel-curve-to">
<ANCHOR id="cairo-rectangle" href="cairo/cairo-cairo-t.html#cairo-rectangle">
<ANCHOR id="cairo-close-path" href="cairo/cairo-cairo-t.html#cairo-close-path">
+<ANCHOR id="cairo-paint" href="cairo/cairo-cairo-t.html#cairo-paint">
+<ANCHOR id="cairo-paint-with-alpha" href="cairo/cairo-cairo-t.html#cairo-paint-with-alpha">
+<ANCHOR id="cairo-mask" href="cairo/cairo-cairo-t.html#cairo-mask">
+<ANCHOR id="cairo-mask-surface" href="cairo/cairo-cairo-t.html#cairo-mask-surface">
<ANCHOR id="cairo-stroke" href="cairo/cairo-cairo-t.html#cairo-stroke">
+<ANCHOR id="cairo-stroke-preserve" href="cairo/cairo-cairo-t.html#cairo-stroke-preserve">
<ANCHOR id="cairo-fill" href="cairo/cairo-cairo-t.html#cairo-fill">
+<ANCHOR id="cairo-fill-preserve" href="cairo/cairo-cairo-t.html#cairo-fill-preserve">
<ANCHOR id="cairo-copy-page" href="cairo/cairo-cairo-t.html#cairo-copy-page">
<ANCHOR id="cairo-show-page" href="cairo/cairo-cairo-t.html#cairo-show-page">
<ANCHOR id="cairo-in-stroke" href="cairo/cairo-cairo-t.html#cairo-in-stroke">
@@ -55,63 +58,64 @@
<ANCHOR id="cairo-bool-t" href="cairo/cairo-cairo-t.html#cairo-bool-t">
<ANCHOR id="cairo-stroke-extents" href="cairo/cairo-cairo-t.html#cairo-stroke-extents">
<ANCHOR id="cairo-fill-extents" href="cairo/cairo-cairo-t.html#cairo-fill-extents">
-<ANCHOR id="cairo-init-clip" href="cairo/cairo-cairo-t.html#cairo-init-clip">
<ANCHOR id="cairo-clip" href="cairo/cairo-cairo-t.html#cairo-clip">
-<ANCHOR id="cairo-font-t" href="cairo/cairo-cairo-t.html#cairo-font-t">
+<ANCHOR id="cairo-clip-preserve" href="cairo/cairo-cairo-t.html#cairo-clip-preserve">
+<ANCHOR id="cairo-reset-clip" href="cairo/cairo-cairo-t.html#cairo-reset-clip">
<ANCHOR id="cairo-glyph-t" href="cairo/cairo-cairo-t.html#cairo-glyph-t">
-<ANCHOR id="cairo-text-extents-t" href="cairo/cairo-cairo-t.html#cairo-text-extents-t">
-<ANCHOR id="cairo-font-extents-t" href="cairo/cairo-cairo-t.html#cairo-font-extents-t">
<ANCHOR id="cairo-font-slant-t" href="cairo/cairo-cairo-t.html#cairo-font-slant-t">
<ANCHOR id="cairo-font-weight-t" href="cairo/cairo-cairo-t.html#cairo-font-weight-t">
-<ANCHOR id="cairo-select-font" href="cairo/cairo-cairo-t.html#cairo-select-font">
-<ANCHOR id="cairo-scale-font" href="cairo/cairo-cairo-t.html#cairo-scale-font">
-<ANCHOR id="cairo-transform-font" href="cairo/cairo-cairo-t.html#cairo-transform-font">
+<ANCHOR id="cairo-select-font-face" href="cairo/cairo-cairo-t.html#cairo-select-font-face">
+<ANCHOR id="cairo-set-font-size" href="cairo/cairo-cairo-t.html#cairo-set-font-size">
+<ANCHOR id="cairo-set-font-matrix" href="cairo/cairo-cairo-t.html#cairo-set-font-matrix">
+<ANCHOR id="cairo-get-font-matrix" href="cairo/cairo-cairo-t.html#cairo-get-font-matrix">
<ANCHOR id="cairo-show-text" href="cairo/cairo-cairo-t.html#cairo-show-text">
<ANCHOR id="cairo-show-glyphs" href="cairo/cairo-cairo-t.html#cairo-show-glyphs">
-<ANCHOR id="cairo-current-font" href="cairo/cairo-cairo-t.html#cairo-current-font">
-<ANCHOR id="cairo-current-font-extents" href="cairo/cairo-cairo-t.html#cairo-current-font-extents">
-<ANCHOR id="cairo-set-font" href="cairo/cairo-cairo-t.html#cairo-set-font">
+<ANCHOR id="cairo-get-font-face" href="cairo/cairo-cairo-t.html#cairo-get-font-face">
+<ANCHOR id="cairo-font-extents" href="cairo/cairo-cairo-t.html#cairo-font-extents">
+<ANCHOR id="cairo-set-font-face" href="cairo/cairo-cairo-t.html#cairo-set-font-face">
<ANCHOR id="cairo-text-extents" href="cairo/cairo-cairo-t.html#cairo-text-extents">
<ANCHOR id="cairo-glyph-extents" href="cairo/cairo-cairo-t.html#cairo-glyph-extents">
<ANCHOR id="cairo-text-path" href="cairo/cairo-cairo-t.html#cairo-text-path">
<ANCHOR id="cairo-glyph-path" href="cairo/cairo-cairo-t.html#cairo-glyph-path">
-<ANCHOR id="cairo-font-reference" href="cairo/cairo-cairo-t.html#cairo-font-reference">
-<ANCHOR id="cairo-font-destroy" href="cairo/cairo-cairo-t.html#cairo-font-destroy">
-<ANCHOR id="cairo-font-extents" href="cairo/cairo-cairo-t.html#cairo-font-extents">
-<ANCHOR id="cairo-font-glyph-extents" href="cairo/cairo-cairo-t.html#cairo-font-glyph-extents">
-<ANCHOR id="cairo-show-surface" href="cairo/cairo-cairo-t.html#cairo-show-surface">
-<ANCHOR id="cairo-current-operator" href="cairo/cairo-cairo-t.html#cairo-current-operator">
-<ANCHOR id="cairo-current-rgb-color" href="cairo/cairo-cairo-t.html#cairo-current-rgb-color">
-<ANCHOR id="cairo-current-pattern" href="cairo/cairo-cairo-t.html#cairo-current-pattern">
-<ANCHOR id="cairo-current-alpha" href="cairo/cairo-cairo-t.html#cairo-current-alpha">
-<ANCHOR id="cairo-current-tolerance" href="cairo/cairo-cairo-t.html#cairo-current-tolerance">
-<ANCHOR id="cairo-current-point" href="cairo/cairo-cairo-t.html#cairo-current-point">
-<ANCHOR id="cairo-current-fill-rule" href="cairo/cairo-cairo-t.html#cairo-current-fill-rule">
-<ANCHOR id="cairo-current-line-width" href="cairo/cairo-cairo-t.html#cairo-current-line-width">
-<ANCHOR id="cairo-current-line-cap" href="cairo/cairo-cairo-t.html#cairo-current-line-cap">
-<ANCHOR id="cairo-current-line-join" href="cairo/cairo-cairo-t.html#cairo-current-line-join">
-<ANCHOR id="cairo-current-miter-limit" href="cairo/cairo-cairo-t.html#cairo-current-miter-limit">
-<ANCHOR id="cairo-current-matrix" href="cairo/cairo-cairo-t.html#cairo-current-matrix">
-<ANCHOR id="cairo-current-target-surface" href="cairo/cairo-cairo-t.html#cairo-current-target-surface">
-<ANCHOR id="cairo-current-path" href="cairo/cairo-cairo-t.html#cairo-current-path">
-<ANCHOR id="cairo-current-path-flat" href="cairo/cairo-cairo-t.html#cairo-current-path-flat">
+<ANCHOR id="cairo-get-operator" href="cairo/cairo-cairo-t.html#cairo-get-operator">
+<ANCHOR id="cairo-get-source" href="cairo/cairo-cairo-t.html#cairo-get-source">
+<ANCHOR id="cairo-get-tolerance" href="cairo/cairo-cairo-t.html#cairo-get-tolerance">
+<ANCHOR id="cairo-get-current-point" href="cairo/cairo-cairo-t.html#cairo-get-current-point">
+<ANCHOR id="cairo-get-fill-rule" href="cairo/cairo-cairo-t.html#cairo-get-fill-rule">
+<ANCHOR id="cairo-get-line-width" href="cairo/cairo-cairo-t.html#cairo-get-line-width">
+<ANCHOR id="cairo-get-line-cap" href="cairo/cairo-cairo-t.html#cairo-get-line-cap">
+<ANCHOR id="cairo-get-line-join" href="cairo/cairo-cairo-t.html#cairo-get-line-join">
+<ANCHOR id="cairo-get-miter-limit" href="cairo/cairo-cairo-t.html#cairo-get-miter-limit">
+<ANCHOR id="cairo-get-matrix" href="cairo/cairo-cairo-t.html#cairo-get-matrix">
+<ANCHOR id="cairo-get-target" href="cairo/cairo-cairo-t.html#cairo-get-target">
+<ANCHOR id="cairo-copy-path" href="cairo/cairo-cairo-t.html#cairo-copy-path">
+<ANCHOR id="cairo-copy-path-flat" href="cairo/cairo-cairo-t.html#cairo-copy-path-flat">
+<ANCHOR id="cairo-append-path" href="cairo/cairo-cairo-t.html#cairo-append-path">
+<ANCHOR id="cairo-path-data-type-t" href="cairo/cairo-cairo-t.html#cairo-path-data-type-t">
+<ANCHOR id="cairo-path-t" href="cairo/cairo-cairo-t.html#cairo-path-t">
+<ANCHOR id="cairo-path-destroy" href="cairo/cairo-cairo-t.html#cairo-path-destroy">
<ANCHOR id="cairo-status-t" href="cairo/cairo-cairo-t.html#cairo-status-t">
<ANCHOR id="cairo-status" href="cairo/cairo-cairo-t.html#cairo-status">
<ANCHOR id="cairo-status-string" href="cairo/cairo-cairo-t.html#cairo-status-string">
+<ANCHOR id="cairo-status-to-string" href="cairo/cairo-cairo-t.html#cairo-status-to-string">
<ANCHOR id="cairo-filter-t" href="cairo/cairo-cairo-t.html#cairo-filter-t">
<ANCHOR id="cairo-image-surface-create" href="cairo/cairo-cairo-t.html#cairo-image-surface-create">
<ANCHOR id="cairo-image-surface-create-for-data" href="cairo/cairo-cairo-t.html#cairo-image-surface-create-for-data">
+<ANCHOR id="cairo-image-surface-get-width" href="cairo/cairo-cairo-t.html#cairo-image-surface-get-width">
+<ANCHOR id="cairo-image-surface-get-height" href="cairo/cairo-cairo-t.html#cairo-image-surface-get-height">
+<ANCHOR id="cairo-destroy-func-t" href="cairo/cairo-cairo-t.html#cairo-destroy-func-t">
+<ANCHOR id="cairo-user-data-key-t" href="cairo/cairo-cairo-t.html#cairo-user-data-key-t">
+<ANCHOR id="cairo-read-func-t" href="cairo/cairo-cairo-t.html#cairo-read-func-t">
+<ANCHOR id="cairo-write-func-t" href="cairo/cairo-cairo-t.html#cairo-write-func-t">
<ANCHOR id="cairo-cairo-surface-t" href="cairo/cairo-cairo-surface-t.html">
<ANCHOR id="cairo-surface-t" href="cairo/cairo-cairo-surface-t.html#cairo-surface-t">
-<ANCHOR id="cairo-surface-create-for-image" href="cairo/cairo-cairo-surface-t.html#cairo-surface-create-for-image">
<ANCHOR id="cairo-surface-create-similar" href="cairo/cairo-cairo-surface-t.html#cairo-surface-create-similar">
<ANCHOR id="cairo-surface-reference" href="cairo/cairo-cairo-surface-t.html#cairo-surface-reference">
<ANCHOR id="cairo-surface-destroy" href="cairo/cairo-cairo-surface-t.html#cairo-surface-destroy">
-<ANCHOR id="cairo-surface-set-repeat" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-repeat">
-<ANCHOR id="cairo-surface-set-matrix" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-matrix">
-<ANCHOR id="cairo-surface-get-matrix" href="cairo/cairo-cairo-surface-t.html#cairo-surface-get-matrix">
-<ANCHOR id="cairo-surface-set-filter" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-filter">
-<ANCHOR id="cairo-surface-get-filter" href="cairo/cairo-cairo-surface-t.html#cairo-surface-get-filter">
+<ANCHOR id="cairo-surface-finish" href="cairo/cairo-cairo-surface-t.html#cairo-surface-finish">
+<ANCHOR id="cairo-surface-set-user-data" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-user-data">
+<ANCHOR id="cairo-surface-get-user-data" href="cairo/cairo-cairo-surface-t.html#cairo-surface-get-user-data">
+<ANCHOR id="cairo-surface-set-device-offset" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-device-offset">
<ANCHOR id="cairo-cairo-pattern-t" href="cairo/cairo-cairo-pattern-t.html">
<ANCHOR id="cairo-pattern-t" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-t">
<ANCHOR id="cairo-pattern-create-for-surface" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface">
@@ -119,7 +123,9 @@
<ANCHOR id="cairo-pattern-create-radial" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-radial">
<ANCHOR id="cairo-pattern-reference" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-reference">
<ANCHOR id="cairo-pattern-destroy" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-destroy">
-<ANCHOR id="cairo-pattern-add-color-stop" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop">
+<ANCHOR id="cairo-pattern-status" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-status">
+<ANCHOR id="cairo-pattern-add-color-stop-rgb" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb">
+<ANCHOR id="cairo-pattern-add-color-stop-rgba" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba">
<ANCHOR id="cairo-pattern-set-matrix" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-matrix">
<ANCHOR id="cairo-pattern-get-matrix" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-matrix">
<ANCHOR id="cairo-extend-t" href="cairo/cairo-cairo-pattern-t.html#cairo-extend-t">
@@ -129,12 +135,11 @@
<ANCHOR id="cairo-pattern-get-filter" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-filter">
<ANCHOR id="cairo-cairo-matrix-t" href="cairo/cairo-cairo-matrix-t.html">
<ANCHOR id="cairo-matrix-t" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-t">
-<ANCHOR id="cairo-matrix-create" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-create">
-<ANCHOR id="cairo-matrix-destroy" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-destroy">
-<ANCHOR id="cairo-matrix-copy" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-copy">
-<ANCHOR id="cairo-matrix-set-identity" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-set-identity">
-<ANCHOR id="cairo-matrix-set-affine" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-set-affine">
-<ANCHOR id="cairo-matrix-get-affine" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-get-affine">
+<ANCHOR id="cairo-matrix-init" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-init">
+<ANCHOR id="cairo-matrix-init-identity" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-init-identity">
+<ANCHOR id="cairo-matrix-init-translate" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-init-translate">
+<ANCHOR id="cairo-matrix-init-scale" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-init-scale">
+<ANCHOR id="cairo-matrix-init-rotate" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-init-rotate">
<ANCHOR id="cairo-matrix-translate" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-translate">
<ANCHOR id="cairo-matrix-scale" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-scale">
<ANCHOR id="cairo-matrix-rotate" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-rotate">
@@ -142,38 +147,54 @@
<ANCHOR id="cairo-matrix-multiply" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-multiply">
<ANCHOR id="cairo-matrix-transform-distance" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-transform-distance">
<ANCHOR id="cairo-matrix-transform-point" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-transform-point">
+<ANCHOR id="cairo-Fonts" href="cairo/cairo-Fonts.html">
+<ANCHOR id="cairo-font-face-t" href="cairo/cairo-Fonts.html#cairo-font-face-t">
+<ANCHOR id="cairo-scaled-font-t" href="cairo/cairo-Fonts.html#cairo-scaled-font-t">
+<ANCHOR id="cairo-font-face-reference" href="cairo/cairo-Fonts.html#cairo-font-face-reference">
+<ANCHOR id="cairo-font-face-destroy" href="cairo/cairo-Fonts.html#cairo-font-face-destroy">
+<ANCHOR id="cairo-font-face-get-user-data" href="cairo/cairo-Fonts.html#cairo-font-face-get-user-data">
+<ANCHOR id="cairo-font-face-set-user-data" href="cairo/cairo-Fonts.html#cairo-font-face-set-user-data">
+<ANCHOR id="cairo-scaled-font-create" href="cairo/cairo-Fonts.html#cairo-scaled-font-create">
+<ANCHOR id="cairo-scaled-font-reference" href="cairo/cairo-Fonts.html#cairo-scaled-font-reference">
+<ANCHOR id="cairo-scaled-font-destroy" href="cairo/cairo-Fonts.html#cairo-scaled-font-destroy">
+<ANCHOR id="cairo-font-extents-t" href="cairo/cairo-Fonts.html#cairo-font-extents-t">
+<ANCHOR id="cairo-scaled-font-extents" href="cairo/cairo-Fonts.html#cairo-scaled-font-extents">
+<ANCHOR id="cairo-text-extents-t" href="cairo/cairo-Fonts.html#cairo-text-extents-t">
+<ANCHOR id="cairo-scaled-font-glyph-extents" href="cairo/cairo-Fonts.html#cairo-scaled-font-glyph-extents">
<ANCHOR id="cairo-ATSUI-Fonts" href="cairo/cairo-ATSUI-Fonts.html">
-<ANCHOR id="cairo-atsui-font-create" href="cairo/cairo-ATSUI-Fonts.html#cairo-atsui-font-create">
<ANCHOR id="cairo-FreeType-Fonts" href="cairo/cairo-FreeType-Fonts.html">
-<ANCHOR id="cairo-ft-font-create" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-create">
-<ANCHOR id="cairo-ft-font-create-for-ft-face" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-create-for-ft-face">
-<ANCHOR id="cairo-ft-font-lock-face" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-lock-face">
-<ANCHOR id="cairo-ft-font-unlock-face" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-unlock-face">
-<ANCHOR id="cairo-ft-font-get-pattern" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-get-pattern">
+<ANCHOR id="cairo-ft-font-face-create-for-pattern" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-pattern">
+<ANCHOR id="cairo-ft-font-face-create-for-ft-face" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-font-face-create-for-ft-face">
+<ANCHOR id="cairo-ft-scaled-font-lock-face" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-scaled-font-lock-face">
+<ANCHOR id="cairo-ft-scaled-font-unlock-face" href="cairo/cairo-FreeType-Fonts.html#cairo-ft-scaled-font-unlock-face">
<ANCHOR id="cairo-Glitz-backend" href="cairo/cairo-Glitz-backend.html">
-<ANCHOR id="cairo-set-target-glitz" href="cairo/cairo-Glitz-backend.html#cairo-set-target-glitz">
<ANCHOR id="cairo-glitz-surface-create" href="cairo/cairo-Glitz-backend.html#cairo-glitz-surface-create">
<ANCHOR id="cairo-PDF-Backend" href="cairo/cairo-PDF-Backend.html">
-<ANCHOR id="cairo-set-target-pdf" href="cairo/cairo-PDF-Backend.html#cairo-set-target-pdf">
<ANCHOR id="cairo-pdf-surface-create" href="cairo/cairo-PDF-Backend.html#cairo-pdf-surface-create">
+<ANCHOR id="cairo-pdf-surface-create-for-stream" href="cairo/cairo-PDF-Backend.html#cairo-pdf-surface-create-for-stream">
+<ANCHOR id="cairo-pdf-surface-set-dpi" href="cairo/cairo-PDF-Backend.html#cairo-pdf-surface-set-dpi">
<ANCHOR id="cairo-PNG-Backend" href="cairo/cairo-PNG-Backend.html">
-<ANCHOR id="cairo-set-target-png" href="cairo/cairo-PNG-Backend.html#cairo-set-target-png">
-<ANCHOR id="cairo-png-surface-create" href="cairo/cairo-PNG-Backend.html#cairo-png-surface-create">
+<ANCHOR id="cairo-image-surface-create-from-png" href="cairo/cairo-PNG-Backend.html#cairo-image-surface-create-from-png">
+<ANCHOR id="cairo-image-surface-create-from-png-stream" href="cairo/cairo-PNG-Backend.html#cairo-image-surface-create-from-png-stream">
+<ANCHOR id="cairo-surface-write-to-png" href="cairo/cairo-PNG-Backend.html#cairo-surface-write-to-png">
+<ANCHOR id="cairo-surface-write-to-png-stream" href="cairo/cairo-PNG-Backend.html#cairo-surface-write-to-png-stream">
<ANCHOR id="cairo-PS-Backend" href="cairo/cairo-PS-Backend.html">
-<ANCHOR id="cairo-set-target-ps" href="cairo/cairo-PS-Backend.html#cairo-set-target-ps">
<ANCHOR id="cairo-ps-surface-create" href="cairo/cairo-PS-Backend.html#cairo-ps-surface-create">
+<ANCHOR id="cairo-ps-surface-create-for-stream" href="cairo/cairo-PS-Backend.html#cairo-ps-surface-create-for-stream">
+<ANCHOR id="cairo-ps-surface-set-dpi" href="cairo/cairo-PS-Backend.html#cairo-ps-surface-set-dpi">
<ANCHOR id="cairo-Quartz-Backend" href="cairo/cairo-Quartz-Backend.html">
-<ANCHOR id="cairo-set-target-quartz-context" href="cairo/cairo-Quartz-Backend.html#cairo-set-target-quartz-context">
<ANCHOR id="cairo-quartz-surface-create" href="cairo/cairo-Quartz-Backend.html#cairo-quartz-surface-create">
<ANCHOR id="cairo-Microsoft-Windows-Backend" href="cairo/cairo-Microsoft-Windows-Backend.html">
-<ANCHOR id="cairo-set-target-win32" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-set-target-win32">
<ANCHOR id="cairo-win32-surface-create" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-surface-create">
-<ANCHOR id="cairo-win32-font-create-for-logfontw" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-font-create-for-logfontw">
-<ANCHOR id="cairo-win32-font-select-font" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-font-select-font">
-<ANCHOR id="cairo-win32-font-done-font" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-font-done-font">
-<ANCHOR id="cairo-win32-font-get-scale-factor" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-font-get-scale-factor">
+<ANCHOR id="cairo-win32-font-face-create-for-logfontw" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-font-face-create-for-logfontw">
+<ANCHOR id="cairo-win32-scaled-font-select-font" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font">
+<ANCHOR id="cairo-win32-scaled-font-done-font" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-done-font">
+<ANCHOR id="cairo-win32-scaled-font-get-metrics-factor" href="cairo/cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-get-metrics-factor">
<ANCHOR id="cairo-XCB-Backend" href="cairo/cairo-XCB-Backend.html">
-<ANCHOR id="cairo-set-target-xcb" href="cairo/cairo-XCB-Backend.html#cairo-set-target-xcb">
+<ANCHOR id="cairo-xcb-surface-create" href="cairo/cairo-XCB-Backend.html#cairo-xcb-surface-create">
+<ANCHOR id="cairo-xcb-surface-create-for-bitmap" href="cairo/cairo-XCB-Backend.html#cairo-xcb-surface-create-for-bitmap">
+<ANCHOR id="cairo-xcb-surface-set-size" href="cairo/cairo-XCB-Backend.html#cairo-xcb-surface-set-size">
<ANCHOR id="cairo-XLib-Backend" href="cairo/cairo-XLib-Backend.html">
-<ANCHOR id="cairo-set-target-drawable" href="cairo/cairo-XLib-Backend.html#cairo-set-target-drawable">
<ANCHOR id="cairo-xlib-surface-create" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-create">
+<ANCHOR id="cairo-xlib-surface-create-for-bitmap" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-create-for-bitmap">
+<ANCHOR id="cairo-xlib-surface-set-size" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-set-size">
diff --git a/doc/public/html/ix01.html b/doc/public/html/ix01.html
new file mode 100644
index 0000000..e8018a3
--- /dev/null
+++ b/doc/public/html/ix01.html
@@ -0,0 +1,426 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Index</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="previous" href="cairo-XLib-Backend.html" title="XLib Backend">
+<link rel="next" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="cairo-XLib-Backend.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="language-bindings.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="index">
+<div class="titlepage">
+<div><div><h2 class="title">
+<a name="id2879289"></a>Index</h2></div></div>
+<div></div>
+</div>
+<div class="index">
+<div class="indexdiv">
+<h3></h3>
+<dl><dt>, <a href="cairo-cairo-matrix-t.html#id2938599">Description</a>
+</dt></dl>
+</div>
+<div class="indexdiv">
+<h3>C</h3>
+<dl>
+<dt>cairo_append_path, <a href="cairo-cairo-t.html#id2993214">cairo_append_path ()</a>
+</dt>
+<dt>cairo_arc, <a href="cairo-cairo-t.html#id2987241">cairo_arc ()</a>
+</dt>
+<dt>cairo_arc_negative, <a href="cairo-cairo-t.html#id2987489">cairo_arc_negative ()</a>
+</dt>
+<dt>cairo_bool_t, <a href="cairo-cairo-t.html#id2989431">cairo_bool_t</a>
+</dt>
+<dt>cairo_clip, <a href="cairo-cairo-t.html#id2989776">cairo_clip ()</a>
+</dt>
+<dt>cairo_clip_preserve, <a href="cairo-cairo-t.html#id2989924">cairo_clip_preserve ()</a>
+</dt>
+<dt>cairo_close_path, <a href="cairo-cairo-t.html#id2988201">cairo_close_path ()</a>
+</dt>
+<dt>cairo_copy_page, <a href="cairo-cairo-t.html#id2989099">cairo_copy_page ()</a>
+</dt>
+<dt>cairo_copy_path, <a href="cairo-cairo-t.html#id2992971">cairo_copy_path ()</a>
+</dt>
+<dt>cairo_copy_path_flat, <a href="cairo-cairo-t.html#id2993083">cairo_copy_path_flat ()</a>
+</dt>
+<dt>cairo_create, <a href="cairo-cairo-t.html#id2983254">cairo_create ()</a>
+</dt>
+<dt>cairo_curve_to, <a href="cairo-cairo-t.html#id2987059">cairo_curve_to ()</a>
+</dt>
+<dt>cairo_destroy, <a href="cairo-cairo-t.html#id2983588">cairo_destroy ()</a>
+</dt>
+<dt>cairo_destroy_func_t, <a href="cairo-cairo-t.html#id2994588">cairo_destroy_func_t ()</a>
+</dt>
+<dt>cairo_device_to_user, <a href="cairo-cairo-t.html#id2986570">cairo_device_to_user ()</a>
+</dt>
+<dt>cairo_device_to_user_distance, <a href="cairo-cairo-t.html#id2986676">cairo_device_to_user_distance ()</a>
+</dt>
+<dt>cairo_extend_t, <a href="cairo-cairo-pattern-t.html#id2938213">enum cairo_extend_t</a>
+</dt>
+<dt>cairo_fill, <a href="cairo-cairo-t.html#id2988922">cairo_fill ()</a>
+</dt>
+<dt>cairo_fill_extents, <a href="cairo-cairo-t.html#id2989635">cairo_fill_extents ()</a>
+</dt>
+<dt>cairo_fill_preserve, <a href="cairo-cairo-t.html#id2989004">cairo_fill_preserve ()</a>
+</dt>
+<dt>cairo_fill_rule_t, <a href="cairo-cairo-t.html#id2984835">enum cairo_fill_rule_t</a>
+</dt>
+<dt>cairo_filter_t, <a href="cairo-cairo-t.html#id2994028">enum cairo_filter_t</a>
+</dt>
+<dt>cairo_font_extents, <a href="cairo-cairo-t.html#id2991184">cairo_font_extents ()</a>
+</dt>
+<dt>cairo_font_extents_t, <a href="cairo-Fonts.html#id2974404">cairo_font_extents_t</a>
+</dt>
+<dt>cairo_font_face_destroy, <a href="cairo-Fonts.html#id2931100">cairo_font_face_destroy ()</a>
+</dt>
+<dt>cairo_font_face_get_user_data, <a href="cairo-Fonts.html#id2931186">cairo_font_face_get_user_data ()</a>
+</dt>
+<dt>cairo_font_face_reference, <a href="cairo-Fonts.html#id2931013">cairo_font_face_reference ()</a>
+</dt>
+<dt>cairo_font_face_set_user_data, <a href="cairo-Fonts.html#id2931311">cairo_font_face_set_user_data ()</a>
+</dt>
+<dt>cairo_font_face_t, <a href="cairo-Fonts.html#id2954886">cairo_font_face_t</a>
+</dt>
+<dt>cairo_font_slant_t, <a href="cairo-cairo-t.html#id2990345">enum cairo_font_slant_t</a>
+</dt>
+<dt>cairo_font_weight_t, <a href="cairo-cairo-t.html#id2990374">enum cairo_font_weight_t</a>
+</dt>
+<dt>cairo_format_t, <a href="cairo-cairo-t.html#id2983936">enum cairo_format_t</a>
+</dt>
+<dt>cairo_ft_font_face_create_for_ft_face, <a href="cairo-FreeType-Fonts.html#id2930778">cairo_ft_font_face_create_for_ft_face ()</a>
+</dt>
+<dt>cairo_ft_font_face_create_for_pattern, <a href="cairo-FreeType-Fonts.html#id2936855">cairo_ft_font_face_create_for_pattern ()</a>
+</dt>
+<dt>cairo_ft_scaled_font_lock_face, <a href="cairo-FreeType-Fonts.html#id2944636">cairo_ft_scaled_font_lock_face ()</a>
+</dt>
+<dt>cairo_ft_scaled_font_unlock_face, <a href="cairo-FreeType-Fonts.html#id2973551">cairo_ft_scaled_font_unlock_face ()</a>
+</dt>
+<dt>cairo_get_current_point, <a href="cairo-cairo-t.html#id2992133">cairo_get_current_point ()</a>
+</dt>
+<dt>cairo_get_fill_rule, <a href="cairo-cairo-t.html#id2992371">cairo_get_fill_rule ()</a>
+</dt>
+<dt>cairo_get_font_face, <a href="cairo-cairo-t.html#id2991079">cairo_get_font_face ()</a>
+</dt>
+<dt>cairo_get_font_matrix, <a href="cairo-cairo-t.html#id2990797">cairo_get_font_matrix ()</a>
+</dt>
+<dt>cairo_get_line_cap, <a href="cairo-cairo-t.html#id2992535">cairo_get_line_cap ()</a>
+</dt>
+<dt>cairo_get_line_join, <a href="cairo-cairo-t.html#id2992618">cairo_get_line_join ()</a>
+</dt>
+<dt>cairo_get_line_width, <a href="cairo-cairo-t.html#id2992453">cairo_get_line_width ()</a>
+</dt>
+<dt>cairo_get_matrix, <a href="cairo-cairo-t.html#id2992782">cairo_get_matrix ()</a>
+</dt>
+<dt>cairo_get_miter_limit, <a href="cairo-cairo-t.html#id2992700">cairo_get_miter_limit ()</a>
+</dt>
+<dt>cairo_get_operator, <a href="cairo-cairo-t.html#id2991890">cairo_get_operator ()</a>
+</dt>
+<dt>cairo_get_source, <a href="cairo-cairo-t.html#id2991962">cairo_get_source ()</a>
+</dt>
+<dt>cairo_get_target, <a href="cairo-cairo-t.html#id2992871">cairo_get_target ()</a>
+</dt>
+<dt>cairo_get_tolerance, <a href="cairo-cairo-t.html#id2992051">cairo_get_tolerance ()</a>
+</dt>
+<dt>cairo_glitz_surface_create, <a href="cairo-Glitz-backend.html#id2975519">cairo_glitz_surface_create ()</a>
+</dt>
+<dt>cairo_glyph_extents, <a href="cairo-cairo-t.html#id2991548">cairo_glyph_extents ()</a>
+</dt>
+<dt>cairo_glyph_path, <a href="cairo-cairo-t.html#id2991790">cairo_glyph_path ()</a>
+</dt>
+<dt>cairo_glyph_t, <a href="cairo-cairo-t.html#id2990201">cairo_glyph_t</a>
+</dt>
+<dt>cairo_identity_matrix, <a href="cairo-cairo-t.html#id2986270">cairo_identity_matrix ()</a>
+</dt>
+<dt>cairo_image_surface_create, <a href="cairo-cairo-t.html#id2994057">cairo_image_surface_create ()</a>
+</dt>
+<dt>cairo_image_surface_create_for_data, <a href="cairo-cairo-t.html#id2994202">cairo_image_surface_create_for_data ()</a>
+</dt>
+<dt>cairo_image_surface_create_from_png, <a href="cairo-PNG-Backend.html#id2972242">cairo_image_surface_create_from_png ()</a>
+</dt>
+<dt>cairo_image_surface_create_from_png_stream, <a href="cairo-PNG-Backend.html#id2973862">cairo_image_surface_create_from_png_stream ()</a>
+</dt>
+<dt>cairo_image_surface_get_height, <a href="cairo-cairo-t.html#id2994507">cairo_image_surface_get_height ()</a>
+</dt>
+<dt>cairo_image_surface_get_width, <a href="cairo-cairo-t.html#id2994426">cairo_image_surface_get_width ()</a>
+</dt>
+<dt>cairo_in_fill, <a href="cairo-cairo-t.html#id2989322">cairo_in_fill ()</a>
+</dt>
+<dt>cairo_in_stroke, <a href="cairo-cairo-t.html#id2989212">cairo_in_stroke ()</a>
+</dt>
+<dt>cairo_line_cap_t, <a href="cairo-cairo-t.html#id2985161">enum cairo_line_cap_t</a>
+</dt>
+<dt>cairo_line_join_t, <a href="cairo-cairo-t.html#id2985390">enum cairo_line_join_t</a>
+</dt>
+<dt>cairo_line_to, <a href="cairo-cairo-t.html#id2986960">cairo_line_to ()</a>
+</dt>
+<dt>cairo_mask, <a href="cairo-cairo-t.html#id2988421">cairo_mask ()</a>
+</dt>
+<dt>cairo_mask_surface, <a href="cairo-cairo-t.html#id2988524">cairo_mask_surface ()</a>
+</dt>
+<dt>cairo_matrix_init, <a href="cairo-cairo-matrix-t.html#id2971462">cairo_matrix_init ()</a>
+</dt>
+<dt>cairo_matrix_init_identity, <a href="cairo-cairo-matrix-t.html#id2971695">cairo_matrix_init_identity ()</a>
+</dt>
+<dt>cairo_matrix_init_rotate, <a href="cairo-cairo-matrix-t.html#id2932034">cairo_matrix_init_rotate ()</a>
+</dt>
+<dt>cairo_matrix_init_scale, <a href="cairo-cairo-matrix-t.html#id2931915">cairo_matrix_init_scale ()</a>
+</dt>
+<dt>cairo_matrix_init_translate, <a href="cairo-cairo-matrix-t.html#id2931794">cairo_matrix_init_translate ()</a>
+</dt>
+<dt>cairo_matrix_invert, <a href="cairo-cairo-matrix-t.html#id2932516">cairo_matrix_invert ()</a>
+</dt>
+<dt>cairo_matrix_multiply, <a href="cairo-cairo-matrix-t.html#id2932631">cairo_matrix_multiply ()</a>
+</dt>
+<dt>cairo_matrix_rotate, <a href="cairo-cairo-matrix-t.html#id2932405">cairo_matrix_rotate ()</a>
+</dt>
+<dt>cairo_matrix_scale, <a href="cairo-cairo-matrix-t.html#id2932264">cairo_matrix_scale ()</a>
+</dt>
+<dt>cairo_matrix_t, <a href="cairo-cairo-matrix-t.html#id2938749">cairo_matrix_t</a>
+</dt>
+<dt>cairo_matrix_transform_distance, <a href="cairo-cairo-matrix-t.html#id2973056">cairo_matrix_transform_distance ()</a>
+</dt>
+<dt>cairo_matrix_transform_point, <a href="cairo-cairo-matrix-t.html#id2973295">cairo_matrix_transform_point ()</a>
+</dt>
+<dt>cairo_matrix_translate, <a href="cairo-cairo-matrix-t.html#id2932130">cairo_matrix_translate ()</a>
+</dt>
+<dt>cairo_move_to, <a href="cairo-cairo-t.html#id2986862">cairo_move_to ()</a>
+</dt>
+<dt>cairo_new_path, <a href="cairo-cairo-t.html#id2986805">cairo_new_path ()</a>
+</dt>
+<dt>cairo_operator_t, <a href="cairo-cairo-t.html#id2984056">enum cairo_operator_t</a>
+</dt>
+<dt>cairo_paint, <a href="cairo-cairo-t.html#id2988258">cairo_paint ()</a>
+</dt>
+<dt>cairo_paint_with_alpha, <a href="cairo-cairo-t.html#id2988319">cairo_paint_with_alpha ()</a>
+</dt>
+<dt>cairo_path_data_type_t, <a href="cairo-cairo-t.html#id2993339">enum cairo_path_data_type_t</a>
+</dt>
+<dt>cairo_path_destroy, <a href="cairo-cairo-t.html#id2993452">cairo_path_destroy ()</a>
+</dt>
+<dt>cairo_path_t, <a href="cairo-cairo-t.html#id2993369">cairo_path_t</a>
+</dt>
+<dt>cairo_pattern_add_color_stop_rgb, <a href="cairo-cairo-pattern-t.html#id2944950">cairo_pattern_add_color_stop_rgb ()</a>
+</dt>
+<dt>cairo_pattern_add_color_stop_rgba, <a href="cairo-cairo-pattern-t.html#id2945092">cairo_pattern_add_color_stop_rgba ()</a>
+</dt>
+<dt>cairo_pattern_create_for_surface, <a href="cairo-cairo-pattern-t.html#id2934264">cairo_pattern_create_for_surface ()</a>
+</dt>
+<dt>cairo_pattern_create_linear, <a href="cairo-cairo-pattern-t.html#id2934331">cairo_pattern_create_linear ()</a>
+</dt>
+<dt>cairo_pattern_create_radial, <a href="cairo-cairo-pattern-t.html#id2972519">cairo_pattern_create_radial ()</a>
+</dt>
+<dt>cairo_pattern_destroy, <a href="cairo-cairo-pattern-t.html#id2944809">cairo_pattern_destroy ()</a>
+</dt>
+<dt>cairo_pattern_get_extend, <a href="cairo-cairo-pattern-t.html#id2938316">cairo_pattern_get_extend ()</a>
+</dt>
+<dt>cairo_pattern_get_filter, <a href="cairo-cairo-pattern-t.html#id2938457">cairo_pattern_get_filter ()</a>
+</dt>
+<dt>cairo_pattern_get_matrix, <a href="cairo-cairo-pattern-t.html#id2938138">cairo_pattern_get_matrix ()</a>
+</dt>
+<dt>cairo_pattern_reference, <a href="cairo-cairo-pattern-t.html#id2972691">cairo_pattern_reference ()</a>
+</dt>
+<dt>cairo_pattern_set_extend, <a href="cairo-cairo-pattern-t.html#id2938241">cairo_pattern_set_extend ()</a>
+</dt>
+<dt>cairo_pattern_set_filter, <a href="cairo-cairo-pattern-t.html#id2938381">cairo_pattern_set_filter ()</a>
+</dt>
+<dt>cairo_pattern_set_matrix, <a href="cairo-cairo-pattern-t.html#id2938063">cairo_pattern_set_matrix ()</a>
+</dt>
+<dt>cairo_pattern_status, <a href="cairo-cairo-pattern-t.html#id2944862">cairo_pattern_status ()</a>
+</dt>
+<dt>cairo_pattern_t, <a href="cairo-cairo-pattern-t.html#id2934238">cairo_pattern_t</a>
+</dt>
+<dt>cairo_pdf_surface_create, <a href="cairo-PDF-Backend.html#id2975175">cairo_pdf_surface_create ()</a>
+</dt>
+<dt>cairo_pdf_surface_create_for_stream, <a href="cairo-PDF-Backend.html#id2944378">cairo_pdf_surface_create_for_stream ()</a>
+</dt>
+<dt>cairo_pdf_surface_set_dpi, <a href="cairo-PDF-Backend.html#id2973720">cairo_pdf_surface_set_dpi ()</a>
+</dt>
+<dt>cairo_ps_surface_create, <a href="cairo-PS-Backend.html#id2975378">cairo_ps_surface_create ()</a>
+</dt>
+<dt>cairo_ps_surface_create_for_stream, <a href="cairo-PS-Backend.html#id2975614">cairo_ps_surface_create_for_stream ()</a>
+</dt>
+<dt>cairo_ps_surface_set_dpi, <a href="cairo-PS-Backend.html#id2970062">cairo_ps_surface_set_dpi ()</a>
+</dt>
+<dt>cairo_quartz_surface_create, <a href="cairo-Quartz-Backend.html#id2969829">cairo_quartz_surface_create ()</a>
+</dt>
+<dt>cairo_read_func_t, <a href="cairo-cairo-t.html#id2994718">cairo_read_func_t ()</a>
+</dt>
+<dt>cairo_rectangle, <a href="cairo-cairo-t.html#id2988060">cairo_rectangle ()</a>
+</dt>
+<dt>cairo_reference, <a href="cairo-cairo-t.html#id2983498">cairo_reference ()</a>
+</dt>
+<dt>cairo_rel_curve_to, <a href="cairo-cairo-t.html#id2987878">cairo_rel_curve_to ()</a>
+</dt>
+<dt>cairo_rel_line_to, <a href="cairo-cairo-t.html#id2987780">cairo_rel_line_to ()</a>
+</dt>
+<dt>cairo_rel_move_to, <a href="cairo-cairo-t.html#id2987681">cairo_rel_move_to ()</a>
+</dt>
+<dt>cairo_reset_clip, <a href="cairo-cairo-t.html#id2990082">cairo_reset_clip ()</a>
+</dt>
+<dt>cairo_restore, <a href="cairo-cairo-t.html#id2983852">cairo_restore ()</a>
+</dt>
+<dt>cairo_rotate, <a href="cairo-cairo-t.html#id2985995">cairo_rotate ()</a>
+</dt>
+<dt>cairo_save, <a href="cairo-cairo-t.html#id2983679">cairo_save ()</a>
+</dt>
+<dt>cairo_scale, <a href="cairo-cairo-t.html#id2985877">cairo_scale ()</a>
+</dt>
+<dt>cairo_scaled_font_create, <a href="cairo-Fonts.html#id2974065">cairo_scaled_font_create ()</a>
+</dt>
+<dt>cairo_scaled_font_destroy, <a href="cairo-Fonts.html#id2974314">cairo_scaled_font_destroy ()</a>
+</dt>
+<dt>cairo_scaled_font_extents, <a href="cairo-Fonts.html#id2974621">cairo_scaled_font_extents ()</a>
+</dt>
+<dt>cairo_scaled_font_glyph_extents, <a href="cairo-Fonts.html#id2974934">cairo_scaled_font_glyph_extents ()</a>
+</dt>
+<dt>cairo_scaled_font_reference, <a href="cairo-Fonts.html#id2974225">cairo_scaled_font_reference ()</a>
+</dt>
+<dt>cairo_scaled_font_t, <a href="cairo-Fonts.html#id2930972">cairo_scaled_font_t</a>
+</dt>
+<dt>cairo_select_font_face, <a href="cairo-cairo-t.html#id2990402">cairo_select_font_face ()</a>
+</dt>
+<dt>cairo_set_dash, <a href="cairo-cairo-t.html#id2985559">cairo_set_dash ()</a>
+</dt>
+<dt>cairo_set_fill_rule, <a href="cairo-cairo-t.html#id2984926">cairo_set_fill_rule ()</a>
+</dt>
+<dt>cairo_set_font_face, <a href="cairo-cairo-t.html#id2991282">cairo_set_font_face ()</a>
+</dt>
+<dt>cairo_set_font_matrix, <a href="cairo-cairo-t.html#id2990678">cairo_set_font_matrix ()</a>
+</dt>
+<dt>cairo_set_font_size, <a href="cairo-cairo-t.html#id2990542">cairo_set_font_size ()</a>
+</dt>
+<dt>cairo_set_line_cap, <a href="cairo-cairo-t.html#id2985249">cairo_set_line_cap ()</a>
+</dt>
+<dt>cairo_set_line_join, <a href="cairo-cairo-t.html#id2985418">cairo_set_line_join ()</a>
+</dt>
+<dt>cairo_set_line_width, <a href="cairo-cairo-t.html#id2985035">cairo_set_line_width ()</a>
+</dt>
+<dt>cairo_set_matrix, <a href="cairo-cairo-t.html#id2986179">cairo_set_matrix ()</a>
+</dt>
+<dt>cairo_set_miter_limit, <a href="cairo-cairo-t.html#id2985679">cairo_set_miter_limit ()</a>
+</dt>
+<dt>cairo_set_operator, <a href="cairo-cairo-t.html#id2984090">cairo_set_operator ()</a>
+</dt>
+<dt>cairo_set_source, <a href="cairo-cairo-t.html#id2984503">cairo_set_source ()</a>
+</dt>
+<dt>cairo_set_source_rgb, <a href="cairo-cairo-t.html#id2984203">cairo_set_source_rgb ()</a>
+</dt>
+<dt>cairo_set_source_rgba, <a href="cairo-cairo-t.html#id2984342">cairo_set_source_rgba ()</a>
+</dt>
+<dt>cairo_set_source_surface, <a href="cairo-cairo-t.html#id2984613">cairo_set_source_surface ()</a>
+</dt>
+<dt>cairo_set_tolerance, <a href="cairo-cairo-t.html#id2984733">cairo_set_tolerance ()</a>
+</dt>
+<dt>cairo_show_glyphs, <a href="cairo-cairo-t.html#id2990980">cairo_show_glyphs ()</a>
+</dt>
+<dt>cairo_show_page, <a href="cairo-cairo-t.html#id2989156">cairo_show_page ()</a>
+</dt>
+<dt>cairo_show_text, <a href="cairo-cairo-t.html#id2990903">cairo_show_text ()</a>
+</dt>
+<dt>cairo_status, <a href="cairo-cairo-t.html#id2993862">cairo_status ()</a>
+</dt>
+<dt>cairo_status_string, <a href="cairo-cairo-t.html#id2993930">cairo_status_string</a>
+</dt>
+<dt>cairo_status_t, <a href="cairo-cairo-t.html#id2993552">enum cairo_status_t</a>
+</dt>
+<dt>cairo_status_to_string, <a href="cairo-cairo-t.html#id2993958">cairo_status_to_string ()</a>
+</dt>
+<dt>cairo_stroke, <a href="cairo-cairo-t.html#id2988683">cairo_stroke ()</a>
+</dt>
+<dt>cairo_stroke_extents, <a href="cairo-cairo-t.html#id2989494">cairo_stroke_extents ()</a>
+</dt>
+<dt>cairo_stroke_preserve, <a href="cairo-cairo-t.html#id2988796">cairo_stroke_preserve ()</a>
+</dt>
+<dt>cairo_surface_create_similar, <a href="cairo-cairo-surface-t.html#id2933393">cairo_surface_create_similar ()</a>
+</dt>
+<dt>cairo_surface_destroy, <a href="cairo-cairo-surface-t.html#id2969202">cairo_surface_destroy ()</a>
+</dt>
+<dt>cairo_surface_finish, <a href="cairo-cairo-surface-t.html#id2968003">cairo_surface_finish ()</a>
+</dt>
+<dt>cairo_surface_get_user_data, <a href="cairo-cairo-surface-t.html#id2935377">cairo_surface_get_user_data ()</a>
+</dt>
+<dt>cairo_surface_reference, <a href="cairo-cairo-surface-t.html#id2969148">cairo_surface_reference ()</a>
+</dt>
+<dt>cairo_surface_set_device_offset, <a href="cairo-cairo-surface-t.html#id2935499">cairo_surface_set_device_offset ()</a>
+</dt>
+<dt>cairo_surface_set_user_data, <a href="cairo-cairo-surface-t.html#id2968120">cairo_surface_set_user_data ()</a>
+</dt>
+<dt>cairo_surface_t, <a href="cairo-cairo-surface-t.html#id2933315">cairo_surface_t</a>
+</dt>
+<dt>cairo_surface_write_to_png, <a href="cairo-PNG-Backend.html#id2970718">cairo_surface_write_to_png ()</a>
+</dt>
+<dt>cairo_surface_write_to_png_stream, <a href="cairo-PNG-Backend.html#id2970831">cairo_surface_write_to_png_stream ()</a>
+</dt>
+<dt>cairo_t, <a href="cairo-cairo-t.html#id2983216">cairo_t</a>
+</dt>
+<dt>cairo_text_extents, <a href="cairo-cairo-t.html#id2991414">cairo_text_extents ()</a>
+</dt>
+<dt>cairo_text_extents_t, <a href="cairo-Fonts.html#id2974745">cairo_text_extents_t</a>
+</dt>
+<dt>cairo_text_path, <a href="cairo-cairo-t.html#id2991712">cairo_text_path ()</a>
+</dt>
+<dt>cairo_transform, <a href="cairo-cairo-t.html#id2986088">cairo_transform ()</a>
+</dt>
+<dt>cairo_translate, <a href="cairo-cairo-t.html#id2985757">cairo_translate ()</a>
+</dt>
+<dt>cairo_user_data_key_t, <a href="cairo-cairo-t.html#id2994660">cairo_user_data_key_t</a>
+</dt>
+<dt>cairo_user_to_device, <a href="cairo-cairo-t.html#id2986334">cairo_user_to_device ()</a>
+</dt>
+<dt>cairo_user_to_device_distance, <a href="cairo-cairo-t.html#id2986440">cairo_user_to_device_distance ()</a>
+</dt>
+<dt>cairo_win32_font_face_create_for_logfontw, <a href="cairo-Microsoft-Windows-Backend.html#id2943496">cairo_win32_font_face_create_for_logfontw ()</a>
+</dt>
+<dt>cairo_win32_scaled_font_done_font, <a href="cairo-Microsoft-Windows-Backend.html#id2926866">cairo_win32_scaled_font_done_font ()</a>
+</dt>
+<dt>cairo_win32_scaled_font_get_metrics_factor, <a href="cairo-Microsoft-Windows-Backend.html#id2970197">cairo_win32_scaled_font_get_metrics_factor ()</a>
+</dt>
+<dt>cairo_win32_scaled_font_select_font, <a href="cairo-Microsoft-Windows-Backend.html#id2926688">cairo_win32_scaled_font_select_font ()</a>
+</dt>
+<dt>cairo_win32_surface_create, <a href="cairo-Microsoft-Windows-Backend.html#id2937449">cairo_win32_surface_create ()</a>
+</dt>
+<dt>cairo_write_func_t, <a href="cairo-cairo-t.html#id2994845">cairo_write_func_t ()</a>
+</dt>
+<dt>cairo_xcb_surface_create, <a href="cairo-XCB-Backend.html#id2970385">cairo_xcb_surface_create ()</a>
+</dt>
+<dt>cairo_xcb_surface_create_for_bitmap, <a href="cairo-XCB-Backend.html#id2978879">cairo_xcb_surface_create_for_bitmap ()</a>
+</dt>
+<dt>cairo_xcb_surface_set_size, <a href="cairo-XCB-Backend.html#id2979025">cairo_xcb_surface_set_size ()</a>
+</dt>
+<dt>cairo_xlib_surface_create, <a href="cairo-XLib-Backend.html#id2979144">cairo_xlib_surface_create ()</a>
+</dt>
+<dt>cairo_xlib_surface_create_for_bitmap, <a href="cairo-XLib-Backend.html#id2927399">cairo_xlib_surface_create_for_bitmap ()</a>
+</dt>
+<dt>cairo_xlib_surface_set_size, <a href="cairo-XLib-Backend.html#id2926098">cairo_xlib_surface_set_size ()</a>
+</dt>
+</dl>
+</div>
+<div class="indexdiv">
+<h3>T</h3>
+<dl>
+<dt>types</dt>
+<dd><dl><dt>cairo_matrix, <a href="cairo-cairo-matrix-t.html#id2938599">Description</a>
+</dt></dl></dd>
+</dl>
+</div>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="cairo-XLib-Backend.html"><b>&lt;&lt;&#160;XLib Backend</b></a></td>
+<td align="right"><a accesskey="n" href="language-bindings.html"><b>Appendix&#160;A.&#160;Creating a language binding for cairo&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/language-bindings.html b/doc/public/html/language-bindings.html
new file mode 100644
index 0000000..04cd441
--- /dev/null
+++ b/doc/public/html/language-bindings.html
@@ -0,0 +1,82 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Appendix&#160;A.&#160;Creating a language binding for cairo</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="previous" href="ix01.html" title="Index">
+<link rel="next" href="bindings-memory.html" title="Memory Management">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="ix01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="bindings-memory.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="appendix" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title">
+<a name="language-bindings"></a>Appendix&#160;A.&#160;Creating a language binding for cairo</h2></div></div>
+<div></div>
+</div>
+<p>
+ While cairo is implemented and C, and has a C API, it is expected
+ that many users of cairo will be using it from languages other
+ than C. The glue that connects the core cairo library to another
+ language is known as a <i class="firstterm">language
+ binding</i>. This appendix attempts to collect together
+ issues that come up when creating a language bindings for cairo
+ and present standardized solutions to promote consistency among
+ the different language bindings.
+ </p>
+<div class="sect1" lang="en">
+<div class="titlepage">
+<div><div><h2 class="title" style="clear: both">
+<a name="bindings-general"></a>General considerations</h2></div></div>
+<div></div>
+</div>
+<p>
+ The naming of the central <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> type is a
+ special exception. The object is &#8220;a cairo context&#8221; not &#8220;a
+ cairo&#8221;, and names such as <span class="type">cairo_t</span> rather than
+ <span class="type">cairo_context_t</span> and
+ <tt class="function">cairo_set_source()</tt> rather than
+ <tt class="function">cairo_context_set_source()</tt> are simply
+ abbreviations to make the C API more palatable. In languages
+ which have object-oriented syntax, this abbreviation is much
+ less useful. In fact, if &#8216;Cairo&#8217; is used as a namespace, then
+ in many languages, you'd end up with a ridiculous type name
+ like &#8216;Cairo.Cairo&#8217;. For this reason, and for inter-language
+ consistency all object-oriented languages should name this
+ type as if it were <span class="type">cairo_context_t</span>.
+ </p>
+<p>
+ The punctuation and casing of the type names and
+ method names of cairo should be changed to match the general
+ convention of the language. In Java, where type names are written
+ in StudlyCaps and method names in javaCaps, cairo_font_extents_t
+ will become FontExtents and
+ <tt class="literal">cairo_set_source(cr,source)</tt>,
+ <tt class="literal">cr.setSource(source)</tt>.
+ As compared to changing the punctuation, and casing, much
+ more reluctance should be used in changing the method names
+ themselves. Even if get is usually omitted from getters in
+ your language, you shouldn't bind cairo_get_source() as
+ cr.source().
+ </p>
+</div>
+</div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="ix01.html"><b>&lt;&lt;&#160;Index</b></a></td>
+<td align="right"><a accesskey="n" href="bindings-memory.html"><b>Memory Management&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/pt01.html b/doc/public/html/pt01.html
index 37ed228..9bf43c6 100644
--- a/doc/public/html/pt01.html
+++ b/doc/public/html/pt01.html
@@ -1 +1,34 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>PartI.Tutorial</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="previous" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="next" href="pt02.html" title="PartII.Reference"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="index.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="pt02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="part" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2677864"></a>Tutorial</h1></div></div><div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="index.html"><b>&lt;&lt;Cairo: A Vector Graphics Library</b></a></td><td align="right"><a accesskey="n" href="pt02.html"><b>PartII.Reference&gt;&gt;</b></a></td></tr></table></body></html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Part&#160;I.&#160;Tutorial</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="previous" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="next" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="index.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="pt02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="part" lang="en"><div class="titlepage">
+<div><div><h1 class="title">
+<a name="id2915378"></a>Tutorial</h1></div></div>
+<div></div>
+</div></div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="index.html"><b>&lt;&lt;&#160;Cairo: A Vector Graphics Library</b></a></td>
+<td align="right"><a accesskey="n" href="pt02.html"><b>Part&#160;II.&#160;Reference&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/html/pt02.html b/doc/public/html/pt02.html
index e906eef..e8a45cd 100644
--- a/doc/public/html/pt02.html
+++ b/doc/public/html/pt02.html
@@ -1 +1,34 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>PartII.Reference</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="up" href="index.html" title="Cairo: A Vector Graphics Library"><link rel="previous" href="pt01.html" title="PartI.Tutorial"><link rel="next" href="cairo-cairo-t.html" title="cairo_t"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="PartI.Tutorial"><link rel="part" href="pt02.html" title="PartII.Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="pt01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">Cairo: A Vector Graphics Library</th><td><a accesskey="n" href="cairo-cairo-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="part" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2618448"></a>Reference</h1></div></div><div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="pt01.html"><b>&lt;&lt;PartI.Tutorial</b></a></td><td align="right"><a accesskey="n" href="cairo-cairo-t.html"><b>cairo_t&gt;&gt;</b></a></td></tr></table></body></html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>Part&#160;II.&#160;Reference</title>
+<meta name="generator" content="DocBook XSL Stylesheets V1.65.1">
+<link rel="home" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="up" href="index.html" title="Cairo: A Vector Graphics Library">
+<link rel="previous" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="next" href="cairo-cairo-t.html" title="cairo_t">
+<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
+<link rel="stylesheet" href="style.css" type="text/css">
+<link rel="part" href="pt01.html" title="Part&#160;I.&#160;Tutorial">
+<link rel="part" href="pt02.html" title="Part&#160;II.&#160;Reference">
+<link rel="index" href="ix01.html" title="Index">
+<link rel="appendix" href="language-bindings.html" title="Appendix&#160;A.&#160;Creating a language binding for cairo">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
+<td><a accesskey="p" href="pt01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
+<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
+<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
+<td><a accesskey="n" href="cairo-cairo-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
+</tr></table>
+<div class="part" lang="en"><div class="titlepage">
+<div><div><h1 class="title">
+<a name="id2915351"></a>Reference</h1></div></div>
+<div></div>
+</div></div>
+<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
+<td align="left"><a accesskey="p" href="pt01.html"><b>&lt;&lt;&#160;Part&#160;I.&#160;Tutorial</b></a></td>
+<td align="right"><a accesskey="n" href="cairo-cairo-t.html"><b>cairo_t&#160;&gt;&gt;</b></a></td>
+</tr></table>
+</body>
+</html>
diff --git a/doc/public/language-bindings.xml b/doc/public/language-bindings.xml
new file mode 100644
index 0000000..1b999d8
--- /dev/null
+++ b/doc/public/language-bindings.xml
@@ -0,0 +1,726 @@
+<appendix id="language-bindings">
+ <title>Creating a language binding for cairo</title>
+ <para>
+ While cairo is implemented and C, and has a C API, it is expected
+ that many users of cairo will be using it from languages other
+ than C. The glue that connects the core cairo library to another
+ language is known as a <firstterm>language
+ binding</firstterm>. This appendix attempts to collect together
+ issues that come up when creating a language bindings for cairo
+ and present standardized solutions to promote consistency among
+ the different language bindings.
+ </para>
+ <sect1 id="bindings-general">
+ <title>General considerations</title>
+ <para>
+ The naming of the central <link
+ linkend="cairo-t"><type>cairo_t</type></link> type is a
+ special exception. The object is “a cairo context” not “a
+ cairo”, and names such as <type>cairo_t</type> rather than
+ <type>cairo_context_t</type> and
+ <function>cairo_set_source()</function> rather than
+ <function>cairo_context_set_source()</function> are simply
+ abbreviations to make the C API more palatable. In languages
+ which have object-oriented syntax, this abbreviation is much
+ less useful. In fact, if ‘Cairo’ is used as a namespace, then
+ in many languages, you'd end up with a ridiculous type name
+ like ‘Cairo.Cairo’. For this reason, and for inter-language
+ consistency all object-oriented languages should name this
+ type as if it were <type>cairo_context_t</type>.
+ </para>
+ <para>
+ The punctuation and casing of the type names and
+ method names of cairo should be changed to match the general
+ convention of the language. In Java, where type names are written
+ in StudlyCaps and method names in javaCaps, cairo_font_extents_t
+ will become FontExtents and
+ <literal>cairo_set_source(cr,source)</literal>,
+ <literal>cr.setSource(source)</literal>.
+ As compared to changing the punctuation, and casing, much
+ more reluctance should be used in changing the method names
+ themselves. Even if get is usually omitted from getters in
+ your language, you shouldn't bind cairo_get_source() as
+ cr.source().
+ </para>
+ </sect1>
+ <sect1 id="bindings-memory">
+ <title>Memory Management</title>
+ <para>
+ The objects in cairo can roughly be divided into two types:
+ refcounted opaque types like
+ <link
+ linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
+ and plain structures like
+ <link
+ linkend="cairo-glyph-t"><type>cairo_glyph_t</type></link>.
+ <link
+ linkend="cairo-path-t"><type>cairo_path_t</type></link>
+ and
+ <link
+ linkend="cairo-path-data-t"><type>cairo_path_data_t</type></link>
+ are special cases and are treated separately in this appendix.
+ </para>
+ <para>
+ Refcounted opaque types all have a
+ <function>..._reference()</function>
+ function to increase the refcount by one and a
+ <function>..._destroy()</function> to decrease the refcount
+ by one. These should not be exposed to the user of the language
+ binding, but rather used to implement memory management within
+ the language binding. The simplest way to do memory management
+ for a language binding is to treat the language binding object
+ as a simple handle to the cairo object. The language binding
+ object references the cairo object, and unreferences it when
+ finalized. This is the recommended method, though there are
+ a couple of caveats to be noted:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Equality won't work as expected. You can have two language
+ objects for the same cairo and they won't necessarily
+ compare equal. If the language allows customizing the
+ equality operation, then this is fixable by comparing
+ the underlying pointers. It also can be fixed by creating
+ at most one language object per cairo object, and
+ uniquifying via a <firstterm>pin table</firstterm> (a hash
+ table that goes from cairo object to language object).
+ For <type>cairo_surface_t</type> you can use also
+ <link
+ linkend="cairo-surface-set-user-data"><function>cairo_surface_set_user_data()</function></link>
+ instead of a separate pin table.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Derivation from the language object doesn't work because
+ you can lose the language object while keeping the Cairo
+ object. Code like:
+ </para>
+<programlisting>
+public class MySurface (ImageSurface) {
+ public MySurface (width, height) {
+ super (Format.ARGB32, width, height);
+ }
+ public int get42 () {
+ return 42;
+ }
+}
+
+ cr = Cairo(MySurface(width, height));
+ surface = cr.getTarget();
+</programlisting>
+ <para>
+ Can result in <varname>surface</varname> containing an
+ <classname>ImageSurface</classname> not a <classname>MySurface</classname>.
+ This is not easily fixable without creating memory leaks,
+ and it's probably best to simply forbid deriving from the
+ language objects.
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ When a plain structure is used as a return value from cairo,
+ this is done by passing it as a “out parameter”.
+ </para>
+<programlisting>
+cairo_font_extents_t extents;
+
+cairo_font_extents (cr, &amp;extents);</programlisting>
+ <para>
+ In a language binding, this should typically be treated
+ as a return value:
+ </para>
+<programlisting>
+FontExtents extents = cr.fontExtents ();</programlisting>
+ <para>
+ A language binding has a choice in how it implements the
+ language objects for plain structures. It can use a pure
+ language object with fields corresponding to those of the C
+ structure, and convert from and to the C structure when calling
+ cairo functions or converting cairo return values. Or it
+ can keep a pointer to the C structure internally and wrap
+ it inside a language object much like occurs for refcounted
+ objects. The choice should be invisible to the user: they should
+ be able to imagine that it is implemented as a pure language
+ object.
+ </para>
+ </sect1>
+ <sect1 id="bindings-return-values">
+ <title>Multiple return values</title>
+ <para>
+ There are a number of functions in the cairo API that have
+ multiple <firstterm>out parameters</firstterm> or
+ <firstterm>in-out parameters</firstterm>. In some languages
+ these can be translated into multiple return values. In Python,
+ what is:
+ </para>
+ <programlisting>
+cairo_user_to_device (cr, &amp;x, &amp;y);</programlisting>
+ <para>
+ can by mapped to:
+ </para>
+ <programlisting>
+(x, y) = cr.user_to_device (cr, x, y);</programlisting>
+ <para>
+ but many languages don't have provisions for multiple return
+ values, so it is necessary to introduce auxiliary types.
+ Most of the functions that require the auxiliary types
+ require a type that would, in C, look like
+ </para>
+ <programlisting>
+typedef struct _cairo_point cairo_point_t;
+struct _cairo_point {
+ double x;
+ double y;
+}</programlisting>
+ <para>
+ The same type should be used both for functions that use a pair
+ of coordinates as an absolute position, and functions that use
+ a pair of coordinates as a displacement. While an argument could
+ be made that having a separate “distance” type is more correct,
+ it is more likely just to confuse users.
+ </para>
+ <programlisting>
+void
+cairo_user_to_device (cairo_t *cr, double *x, double *y);
+
+void
+cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
+
+void
+cairo_device_to_user (cairo_t *cr, double *x, double *y);
+
+void
+cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
+
+void
+cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy);
+
+void
+cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y);
+
+void
+cairo_get_current_point (cairo_t *cr, double *x, double *y);
+ </programlisting>
+ <para>
+ There are also a couple of functions that return four values
+ representing a rectangle. These should be mapped to a
+ “rectangle” type that looks like:
+ </para>
+ <programlisting>
+typedef struct _cairo_rectangle cairo_rectangle_t;
+struct _cairo_rectangle {
+ double x;
+ double y;
+ double width;
+ double height;
+}</programlisting>
+ <para>
+ The C function returns the rectangle as a set of two points to
+ facilitate rounding to integral extents, but this isn't worth
+ adding a “box” type to go along with the more obvious
+ “rectangle” representation.
+ </para>
+ <remark>
+ Q: Would it make sense here to define a standard
+ <function>cairo_rectangle_round()</function> method
+ that language bindings should map?
+ </remark>
+ <programlisting>
+void
+cairo_stroke_extents (cairo_t *cr,
+ double *x1, double *y1,
+ double *x2, double *y2);
+
+void
+cairo_fill_extents (cairo_t *cr,
+ double *x1, double *y1,
+ double *x2, double *y2);
+ </programlisting>
+ </sect1>
+ <sect1 id="bindings-overloading">
+ <title>Overloading and optional arguments</title>
+ <para>
+ Function overloading (having a several variants of a function
+ with the same name and different arguments) is a language
+ feature available in many languages but not in C.
+ </para>
+ <para>
+ In general, language binding authors should use restraint in
+ combining functions in the cairo API via function
+ overloading. What may seem like an obvious overload now may
+ turn out to be strange with future additions to cairo.
+ It might seem logical to make
+ <link
+ linkend="cairo-set-source-rgb"><function>cairo_set_source_rgb()</function></link>
+ an overload of <function>cairo_set_source()</function>, but future plans to add
+ <function>cairo_set_source_rgb_premultiplied()</function>,
+ which will also take three doubles make this a bad idea. For
+ this reason, only the following pairs of functions should
+ be combined via overloading
+ </para>
+ <programlisting>
+void
+cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
+
+void
+cairo_set_source_surface (cairo_t *cr,
+ cairo_surface_t *source,
+ double surface_x,
+ double surface_y);
+
+void
+cairo_mask (cairo_t *cr,
+ cairo_pattern_t *pattern);
+
+void
+cairo_mask_surface (cairo_t *cr,
+ cairo_surface_t *surface,
+ double surface_x,
+ double surface_y);
+
+cairo_surface_t *
+cairo_image_surface_create (cairo_format_t format,
+ int width,
+ int height);
+cairo_surface_t *
+cairo_image_surface_create_for_data (unsigned char *data,
+ cairo_format_t format,
+ int width,
+ int height,
+ int stride);
+
+cairo_status_t
+cairo_surface_write_to_png (cairo_surface_t *surface,
+ const char *filename);
+
+cairo_status_t
+cairo_surface_write_to_png_stream (cairo_surface_t *surface,
+ cairo_write_func_t write_func,
+ void *closure);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png (const char *filename);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ void *closure);
+ </programlisting>
+ <para>
+ Note that there are cases where all constructors for a type
+ aren't overloaded together. For example
+ <link
+ linkend="cairo-image-surface-create-from-png"><function>cairo_image_surface_create_from_png()</function></link>
+ should <emphasis>not</emphasis> be overloaded together with
+ <link
+ linkend="cairo-image-surface-create"><function>cairo_image_surface_create()</function></link>.
+ In such cases, the remaining constructors will typically need to
+ be bound as static methods. In Java, for example, we might have:
+ </para>
+<programlisting>
+Surface surface1 = ImageSurface(Format.RGB24, 100, 100);
+Surface surface2 = ImageSurface.createFromPNG("camera.png");</programlisting>
+ <para>
+ Some other overloads that add combinations not found in C may be
+ convenient for users for language bindings that provide
+ <type>cairo_point_t</type> and <type>cairo_rectangle_t</type>
+ types, for example:
+ </para>
+ <programlisting>
+void
+cairo_move_to (cairo_t *cr,
+ cairo_point_t *point);
+void
+cairo_rectangle (cairo_t *cr,
+ cairo_rectangle_t *rectangle);
+ </programlisting>
+ </sect1>
+ <sect1 id="bindings-streams">
+ <title>Streams and File I/O</title>
+ <para>
+ Various places in the cairo API deal with reading and writing
+ data, whether from and to files, or to other sources and
+ destinations. In these cases, what is typically provided in the
+ C API is a simple version that just takes a filename, and a
+ complex version that takes a callback function.
+ An example is the PNG handling functions:
+ </para>
+<programlisting>
+cairo_surface_t *
+cairo_image_surface_create_from_png (const char *filename);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ void *closure);
+
+cairo_status_t
+cairo_surface_write_to_png (cairo_surface_t *surface,
+ const char *filename);
+
+cairo_status_t
+cairo_surface_write_to_png_stream (cairo_surface_t *surface,
+ cairo_write_func_t write_func,
+ void *closure);</programlisting>
+ <para>
+ The expectation is that the filename version will be mapped
+ literally in the language binding, but the callback version
+ will be mapped to a version that takes a language stream
+ object. For example, in Java, the four functions above
+ might be mapped to:
+ </para>
+<programlisting>
+static public ImageSurface createFromPNG (String filename) throws IOException;
+static public ImageSurface createFromPNG (InputStream stream) throws IOException;
+public void writeToPNG (String filename) throws IOException;
+public void writeToPNG (OutputStream stream) throws IOException;
+</programlisting>
+ <para>
+ In many cases, it will be better to
+ implement the filename version internally
+ using the stream version, rather than building it on top of the
+ filename version in C. The reason for this is that will
+ naturally give a more standard handling of file errors for
+ the language, as seen in the above Java example, where
+ <methodname>createFromPNG()</methodname> is marked as raising
+ an exception. Propagating exceptions from inside the callback
+ function to the caller will pose a challenge to the language
+ binding implementor, since an exception must not propagate
+ through the Cairo code. A technique that will be useful in
+ some cases is to catch the exception in the callback,
+ store the exception object inside a structure pointed to by
+ <parameter>closure</parameter>, and then rethrow it once
+ the function returns.
+ </para>
+ <remark>
+ I'm not sure how to handle this for
+ <link
+ linkend="cairo-pdf-surface-create-for-callback"><function>cairo_pdf_surface_create_for_callback()</function></link>.
+ Other than keep a “exception to rethrow” thread-specific
+ variable
+ that is checked after <emphasis>every</emphasis> call to a Cairo
+ function.
+ </remark>
+ </sect1>
+ <sect1 id="bindings-errors">
+ <title>Error handling</title>
+ <para>
+ The error handling approach in C for Cairo has multiple
+ elements:
+ </para>
+ <itemizedlist>
+ <listitem><para>
+ When a method on an object fails, the object is put into
+ an error state. Subsequent operations on the object do
+ nothing. The status of the object can be queried with
+ a function like <link
+ linkend="cairo-status"><function>status()</function></link>.
+ </para></listitem>
+ <listitem><para>
+ Constructors, rather than
+ returning<constant>NULL</constant> on out-of-memory failure,
+ return a special singleton object on which all
+ operations do nothing. Retrieving the status of the
+ singleton object returns <constant>CAIRO_STATUS_NO_MEMORY</constant>
+ </para>
+ <remark>
+ Is this going to apply to
+ <type>cairo_surface_t</type> as well?
+ </remark>
+ <remark>
+ What about cairo_copy_path_data()? It's probably going to
+ have to return <constant>NULL</constant>.
+ </remark>
+ </listitem>
+ <listitem><para>
+ Errors propagate from object to object. Setting a pattern
+ in an out-of-memory state as the source of a
+ <type>cairo_t</type> puts the type into an error state.
+ </para></listitem>
+ </itemizedlist>
+ <remark>Much of the above is not yet implemented at the time of
+ this writing</remark>
+ <para>
+ A language binding could copy the C approach, and for a
+ language without exceptions, this is likely the right thing
+ to do. However, for a language with exceptions, exposing
+ a completely different style of error handling for cairo
+ would be strange. So, instead, status should be checked
+ after every call to cairo, and exceptions thrown as necessary.
+ </para>
+ <para>
+ One problem that can arise with this, in languages
+ where handling exceptions is mandatory (like Java), is that almost
+ every cairo function can result in a status being set,
+ usually because of an out-of-memory condition. This could make
+ cairo hard to use. To resolve this problem, let's classify then
+ cairo status codes:
+ </para>
+<programlisting>
+/* Memory */
+CAIRO_STATUS_NO_MEMORY,
+
+/* Programmer error */
+CAIRO_STATUS_INVALID_RESTORE
+CAIRO_STATUS_INVALID_POP_GROUP
+CAIRO_STATUS_NO_CURRENT_POINT
+CAIRO_STATUS_INVALID_MATRIX
+CAIRO_STATUS_NO_TARGET_SURFACE
+CAIRO_STATUS_INVALID_STRING
+CAIRO_STATUS_SURFACE_FINISHED
+CAIRO_STATUS_BAD_NESTING
+
+/* Language binding implementation */
+CAIRO_STATUS_NULL_POINTER
+CAIRO_STATUS_INVALID_PATH_DATA
+CAIRO_STATUS_SURFACE_TYPE_MISMATCH
+
+/* Other */
+CAIRO_STATUS_READ_ERROR
+CAIRO_STATUS_WRITE_ERROR
+</programlisting>
+ <para>
+ If we look at these, the
+ <constant>CAIRO_STATUS_NO_MEMORY</constant>
+ should map to the native out-of-memory exception, which could
+ happen at any point in any case. Most of the others indicate
+ programmer error, and handling them in user code would be
+ silly. These should be mapped into whatever the language uses
+ for assertion failures, rather than errors that are normally
+ handled. (In Java, a subclass of Error rather than Exception,
+ perhaps.) And <constant>CAIRO_STATUS_READ_ERROR</constant>,
+ and <constant>CAIRO_STATUS_WRITE_ERROR</constant> can occur
+ only in very specific places. (In fact, as described
+ in <xref linkend="bindings-streams"/>, these errors may be
+ mapped into the language's native I/O error types.)
+ So, there really aren't exceptions that the programmer must
+ handle at most points in the Cairo API.
+ </para>
+ </sect1>
+ <sect1 id="bindings-patterns">
+ <title>Patterns</title>
+ <para>
+ The cairo C API allows for creating a number of different types
+ of patterns. All of these different types of patterns map to
+ <link
+ linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link>
+ in C, but in an object oriented language, there should instead
+ be a hierarchy of types. (The functions that should map to
+ constructors for the various types are listed after the type,
+ methods on that type are listed below)
+ </para>
+ <programlisting>
+cairo_pattern_t
+ <link linkend="cairo-pattern-set-matrix"><function>cairo_pattern_set_matrix()</function></link>
+ <link linkend="cairo-pattern-get-matrix"><function>cairo_pattern_get_matrix()</function></link>
+ cairo_solid_pattern_t
+ cairo_surface_pattern_t (<link linkend="cairo-pattern-create-for-surface"><function>cairo_pattern_create_for_surface()</function></link>)
+ <link linkend="cairo-pattern-set-extend"><function>cairo_pattern_set_extend()</function></link>
+ <link linkend="cairo-pattern-get-extend"><function>cairo_pattern_get_extend()</function></link>
+ <link linkend="cairo-pattern-set-filter"><function>cairo_pattern_set_filter()</function></link>
+ <link linkend="cairo-pattern-get-filter"><function>cairo_pattern_get_filter()</function></link>
+ cairo_gradient_t
+ <link linkend="cairo-pattern-add-color-stop-rgb"><function>cairo_pattern_add_color_stop_rgb()</function></link>
+ <link linkend="cairo-pattern-add-color-stop-rgba"><function>cairo_pattern_add_color_stop_rgba()</function></link>
+ cairo_linear_gradient_t (<link linkend="cairo-pattern-create-linear"><function>cairo_pattern_create_linear()</function></link>)
+ cairo_radial_gradient_t (<link linkend="cairo-pattern-create-radial"><function>cairo_pattern_create_radial()</function></link>)
+ </programlisting>
+ <para>
+ </para>
+ </sect1>
+ <sect1 id="bindings-surfaces">
+ <title>Surfaces</title>
+ <para>
+ Like patterns, surfaces, which use only the
+ <link
+ linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
+ type in the C API should be broken up into a heirarchy of types
+ in a language binding.
+ </para>
+ <programlisting>
+cairo_surface_t
+ cairo_image_surface_t
+ cairo_atsui_surface_t
+ cairo_win32_surface_t
+ cairo_xlib_surface_t
+ </programlisting>
+ <para>
+ Unlike patterns, the constructors and methods on these types are
+ clearly named, and can be trivially associated with the
+ appropriate subtype. Many language bindings will want to avoid
+ binding the platform-specific subtypes at all, since the
+ methods on these types are not useful without passing in native
+ C types. Unless there is a language binding for Xlib available,
+ there is no way to represent a XLib <type>Display</type> * in
+ that language.
+ </para>
+ <para>
+ This doesn't mean that platform-specific surface types can't
+ be used in a language binding that doesn't bind the constructor.
+ A very common situation is to use a cairo language binding in
+ combination with a binding for a higher level system like
+ the <ulink url="http://www.gtk.org/">GTK+</ulink> widget
+ toolkit. In such a situation, the higher level toolkit provides
+ ways to get references to platform specific surfaces.
+ </para>
+ <para>
+ The <link
+ linkend="cairo-surface-set-user-data"><function>cairo_surface_set_user_data()</function></link>,
+ and <link
+ linkend="cairo-surface-get-user-data"><function>cairo_surface_get_user_data()</function></link>
+ methods are provided for use in language bindings, and should
+ not be directly exposed to applications. One example of the use
+ of these functions in a language binding is creating a binding for:
+ </para>
+<programlisting>
+cairo_surface_t *
+<link linkend="cairo-image-surface-create-for-data"><function>cairo_image_surface_create_for_data</function></link> (unsigned char *data,
+ cairo_format_t format,
+ int width,
+ int height,
+ int stride);
+</programlisting>
+ <para>
+ The memory block passed in for <parameter>data</parameter> must be
+ kept around until the surface is destroyed, so the language
+ binding must have some way of determining when that happens. The
+ way to do this is to use the <parameter>destroy</parameter>
+ argument to <function>cairo_surface_set_user_data()</function>.
+ </para>
+ <remark>
+ Some languages may not have a suitable “pointer to a block of
+ data” type to pass in for <parameter>data</parameter>. And even
+ where a language does have such a type, the user will be
+ frequently able to cause the backing store to be reallocated
+ to a different location or truncated. Should we recommend a
+ standard type name and binding for a buffer object here?
+ </remark>
+ </sect1>
+ <sect1 id="bindings-fonts">
+ <title>Fonts</title>
+ <para>
+ Fonts are once more an area where there is a hierarchy of types:
+ </para>
+<programlisting>
+cairo_font_face_t
+ cairo_ft_font_face_t
+ cairo_win32_font_face_t
+cairo_scaled_font_t
+ cairo_ft_scaled_font_t
+ cairo_win32_scaled_font_t
+</programlisting>
+ <para>
+ The methods on the subtypes are, however, not useful without
+ bindings for fontconfig and FreeType or for the Win32 GDI,
+ so most language bindings will choose not to bind these
+ types.
+ </para>
+ <para>
+ The <link
+ linkend="cairo-font-face-set-user-data"><function>cairo_font_face_set_user_data()</function></link>,
+ and <link
+ linkend="cairo-font-face-get-user-data"><function>cairo_font_face_get_user_data()</function></link>
+ methods are provided for use in language bindings, and should
+ not be directly exposed to applications.
+ </para>
+ </sect1>
+ <sect1 id="bindings-path">
+ <title>cairo_path_t</title>
+ <para>
+ The <link linkend="cairo-path-t"><type>cairo_path_t</type></link> type is one
+ area in which most language bindings will differ significantly
+ from the C API. The C API for <type>cairo_path_t</type> is
+ designed for efficiency and to avoid auxiliary objects that
+ would be have to be manually memory managed by the
+ application. However,
+ a language binding should not present <type>cairo_path_t</type> as an
+ array, but rather as an opaque that can be iterated
+ over. Different languages have quite different conventions for
+ how iterators work, so it is impossible to give an exact
+ specification for how this API should work, but the type names
+ and methods should be similar to the language's mapping of the following:
+ </para>
+ <programlisting>
+typedef struct cairo_path_iterator cairo_path_iterator_t;
+typedef struct cairo_path_element cairo_path_element_t;
+
+cairo_path_iterator_t *
+cairo_path_get_iterator (cairo_path_t *path);
+
+cairo_bool_t
+cairo_path_iterator_has_next (cairo_path_iterator_t *iterator);
+
+cairo_path_element_t *
+cairo_path_iterator_next (cairo_path_iterator_t *iterator);
+
+cairo_path_element_type_t
+cairo_path_element_get_type (cairo_path_element_t *element);
+
+void
+cairo_path_element_get_point (cairo_path_element_t *element,
+ int index,
+ double *x,
+ double *y);
+ </programlisting>
+ <para>
+ The above is written using the Java conventions for
+ iterators. To illustrate how the API for PathIterator might
+ depend on the native iteration conventions of the API, examine
+ three versions of the loop, first written in a hypothetical Java
+ binding:
+ </para>
+ <programlisting>
+PathIterator iter = cr.copyPath().iterator();
+while (cr.hasNext()) {
+ PathElement element = iter.next();
+ if (element.getType() == PathElementType.MOVE_TO) {
+ Point p = element.getPoint(0);
+ doMoveTo (p.x, p.y);
+ }
+}</programlisting>
+ <para>
+ And then in a hypothetical C++ binding:
+ </para>
+ <programlisting>
+Path path = cr.copyPath();
+for (PathIterator iter = path.begin(); iter != path.end(); iter++) {
+ PathElement element = *iter;
+ if (element.getType() == PathElementType.MOVE_TO) {
+ Point p = element.getPoint(0);
+ doMoveTo (p.x, p.y);
+ }
+}</programlisting>
+ <para>
+ And then finally in a Python binding:
+ </para>
+<programlisting>
+for element in cr.copy_path():
+ if element.getType == cairo.PATH_ELEMENT_MOVE_TO:
+ (x, y) = element.getPoint(0)
+ doMoveTo (x, y);</programlisting>
+ <para>
+ While many of the API elements stay the same in the three
+ examples, the exact iteration mechanism is quite different, to
+ match how users of the language would expect to iterate over
+ a container.
+ </para>
+ <para>
+ You should not present an API for mutating or for creating new
+ <type>cairo_path_t</type> objects. In the future, these
+ guidelines may be extended to present an API for creating a
+ <type>cairo_path_t</type> from scratch for use with
+ <link
+ linkend="cairo-append-path"><function>cairo_append_path()</function></link>
+ but the current expectation is that <function>cairo_append_path()</function> will
+ mostly be used with paths from
+ <link
+ linkend="cairo-append-path"><function>cairo_copy_path()</function></link>.
+ </para>
+ </sect1>
+</appendix>
+<!--
+Local variables:
+mode: sgml
+sgml-parent-document: ("cairo-docs.xml" "book" "book" "appendix")
+End:
+-->
diff --git a/doc/public/tmpl/cairo-atsui.sgml b/doc/public/tmpl/cairo-atsui.sgml
index 0d957ec..4a8b35a 100644
--- a/doc/public/tmpl/cairo-atsui.sgml
+++ b/doc/public/tmpl/cairo-atsui.sgml
@@ -14,12 +14,6 @@ ATSUI Fonts
</para>
-<!-- ##### FUNCTION cairo_atsui_font_create ##### -->
-<para>
-
-</para>
-
-@style:
-@Returns:
+<!-- ##### SECTION Stability_Level ##### -->
diff --git a/doc/public/tmpl/cairo-font.sgml b/doc/public/tmpl/cairo-font.sgml
new file mode 100644
index 0000000..d6c7043
--- /dev/null
+++ b/doc/public/tmpl/cairo-font.sgml
@@ -0,0 +1,140 @@
+<!-- ##### SECTION Title ##### -->
+Fonts
+
+<!-- ##### SECTION Short_Description ##### -->
+Font Handling
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### TYPEDEF cairo_font_face_t ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### TYPEDEF cairo_scaled_font_t ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION cairo_font_face_reference ##### -->
+<para>
+
+</para>
+
+@font_face:
+
+
+<!-- ##### FUNCTION cairo_font_face_destroy ##### -->
+<para>
+
+</para>
+
+@font_face:
+
+
+<!-- ##### FUNCTION cairo_font_face_get_user_data ##### -->
+<para>
+
+</para>
+
+@font_face:
+@key:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_font_face_set_user_data ##### -->
+<para>
+
+</para>
+
+@font_face:
+@key:
+@user_data:
+@destroy:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_scaled_font_create ##### -->
+<para>
+
+</para>
+
+@font_face:
+@font_matrix:
+@ctm:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_scaled_font_reference ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+
+
+<!-- ##### FUNCTION cairo_scaled_font_destroy ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+
+
+<!-- ##### STRUCT cairo_font_extents_t ##### -->
+<para>
+
+</para>
+
+@ascent:
+@descent:
+@height:
+@max_x_advance:
+@max_y_advance:
+
+<!-- ##### FUNCTION cairo_scaled_font_extents ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+@extents:
+@Returns:
+
+
+<!-- ##### STRUCT cairo_text_extents_t ##### -->
+<para>
+
+</para>
+
+@x_bearing:
+@y_bearing:
+@width:
+@height:
+@x_advance:
+@y_advance:
+
+<!-- ##### FUNCTION cairo_scaled_font_glyph_extents ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+@glyphs:
+@num_glyphs:
+@extents:
+
+
diff --git a/doc/public/tmpl/cairo-ft.sgml b/doc/public/tmpl/cairo-ft.sgml
index bcf52ac..d9f7cbf 100644
--- a/doc/public/tmpl/cairo-ft.sgml
+++ b/doc/public/tmpl/cairo-ft.sgml
@@ -14,50 +14,42 @@ FreeType Fonts
</para>
-<!-- ##### FUNCTION cairo_ft_font_create ##### -->
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_ft_font_face_create_for_pattern ##### -->
<para>
</para>
@pattern:
-@scale:
@Returns:
-<!-- ##### FUNCTION cairo_ft_font_create_for_ft_face ##### -->
+<!-- ##### FUNCTION cairo_ft_font_face_create_for_ft_face ##### -->
<para>
</para>
@face:
@load_flags:
-@scale:
@Returns:
-<!-- ##### FUNCTION cairo_ft_font_lock_face ##### -->
+<!-- ##### FUNCTION cairo_ft_scaled_font_lock_face ##### -->
<para>
</para>
-@ft_font:
+@scaled_font:
@Returns:
-<!-- ##### FUNCTION cairo_ft_font_unlock_face ##### -->
+<!-- ##### FUNCTION cairo_ft_scaled_font_unlock_face ##### -->
<para>
</para>
-@ft_font:
-
-
-<!-- ##### FUNCTION cairo_ft_font_get_pattern ##### -->
-<para>
-
-</para>
-
-@ft_font:
-@Returns:
+@scaled_font:
diff --git a/doc/public/tmpl/cairo-glitz.sgml b/doc/public/tmpl/cairo-glitz.sgml
index 101eb9e..9594d87 100644
--- a/doc/public/tmpl/cairo-glitz.sgml
+++ b/doc/public/tmpl/cairo-glitz.sgml
@@ -14,13 +14,7 @@ Glitz backend
</para>
-<!-- ##### FUNCTION cairo_set_target_glitz ##### -->
-<para>
-
-</para>
-
-@cr:
-@surface:
+<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### FUNCTION cairo_glitz_surface_create ##### -->
diff --git a/doc/public/tmpl/cairo-matrix.sgml b/doc/public/tmpl/cairo-matrix.sgml
index dc24c57..d9549b4 100644
--- a/doc/public/tmpl/cairo-matrix.sgml
+++ b/doc/public/tmpl/cairo-matrix.sgml
@@ -38,77 +38,70 @@ cairo_matrix_t
</para>
-<!-- ##### TYPEDEF cairo_matrix_t ##### -->
-<para>
-
-</para>
+<!-- ##### SECTION Stability_Level ##### -->
-<!-- ##### FUNCTION cairo_matrix_create ##### -->
+<!-- ##### STRUCT cairo_matrix_t ##### -->
<para>
</para>
-@Returns:
-
+@xx:
+@yx:
+@xy:
+@yy:
+@x0:
+@y0:
-<!-- ##### FUNCTION cairo_matrix_destroy ##### -->
+<!-- ##### FUNCTION cairo_matrix_init ##### -->
<para>
</para>
@matrix:
+@xx:
+@yx:
+@xy:
+@yy:
+@x0:
+@y0:
-<!-- ##### FUNCTION cairo_matrix_copy ##### -->
+<!-- ##### FUNCTION cairo_matrix_init_identity ##### -->
<para>
</para>
@matrix:
-@other:
-@Returns:
-<!-- ##### FUNCTION cairo_matrix_set_identity ##### -->
+<!-- ##### FUNCTION cairo_matrix_init_translate ##### -->
<para>
</para>
@matrix:
-@Returns:
+@tx:
+@ty:
-<!-- ##### FUNCTION cairo_matrix_set_affine ##### -->
+<!-- ##### FUNCTION cairo_matrix_init_scale ##### -->
<para>
</para>
@matrix:
-@a:
-@b:
-@c:
-@d:
-@tx:
-@ty:
-@Returns:
-<!-- # Unused Parameters # -->
-@cr:
+@sx:
+@sy:
-<!-- ##### FUNCTION cairo_matrix_get_affine ##### -->
+<!-- ##### FUNCTION cairo_matrix_init_rotate ##### -->
<para>
</para>
@matrix:
-@a:
-@b:
-@c:
-@d:
-@tx:
-@ty:
-@Returns:
+@radians:
<!-- ##### FUNCTION cairo_matrix_translate ##### -->
@@ -119,7 +112,6 @@ cairo_matrix_t
@matrix:
@tx:
@ty:
-@Returns:
<!-- ##### FUNCTION cairo_matrix_scale ##### -->
@@ -130,7 +122,6 @@ cairo_matrix_t
@matrix:
@sx:
@sy:
-@Returns:
<!-- ##### FUNCTION cairo_matrix_rotate ##### -->
@@ -140,7 +131,6 @@ cairo_matrix_t
@matrix:
@radians:
-@Returns:
<!-- ##### FUNCTION cairo_matrix_invert ##### -->
@@ -160,7 +150,6 @@ cairo_matrix_t
@result:
@a:
@b:
-@Returns:
<!-- ##### FUNCTION cairo_matrix_transform_distance ##### -->
@@ -171,23 +160,15 @@ cairo_matrix_t
@matrix:
@dx:
@dy:
-@Returns:
<!-- ##### FUNCTION cairo_matrix_transform_point ##### -->
<para>
+
</para>
@matrix:
@x:
@y:
-@Returns:
-
-<!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../cairo-docs.xml" "book" "refsect2" "")
-End:
--->
diff --git a/doc/public/tmpl/cairo-pattern.sgml b/doc/public/tmpl/cairo-pattern.sgml
index 8472821..dadd787 100644
--- a/doc/public/tmpl/cairo-pattern.sgml
+++ b/doc/public/tmpl/cairo-pattern.sgml
@@ -14,6 +14,9 @@ cairo_pattern_t
</para>
+<!-- ##### SECTION Stability_Level ##### -->
+
+
<!-- ##### TYPEDEF cairo_pattern_t ##### -->
<para>
@@ -71,7 +74,28 @@ cairo_pattern_t
@pattern:
-<!-- ##### FUNCTION cairo_pattern_add_color_stop ##### -->
+<!-- ##### FUNCTION cairo_pattern_status ##### -->
+<para>
+
+</para>
+
+@pattern:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_pattern_add_color_stop_rgb ##### -->
+<para>
+
+</para>
+
+@pattern:
+@offset:
+@red:
+@green:
+@blue:
+
+
+<!-- ##### FUNCTION cairo_pattern_add_color_stop_rgba ##### -->
<para>
</para>
@@ -82,7 +106,6 @@ cairo_pattern_t
@green:
@blue:
@alpha:
-@Returns:
<!-- ##### FUNCTION cairo_pattern_set_matrix ##### -->
@@ -92,7 +115,6 @@ cairo_pattern_t
@pattern:
@matrix:
-@Returns:
<!-- ##### FUNCTION cairo_pattern_get_matrix ##### -->
@@ -102,6 +124,7 @@ cairo_pattern_t
@pattern:
@matrix:
+<!-- # Unused Parameters # -->
@Returns:
@@ -121,7 +144,6 @@ cairo_pattern_t
@pattern:
@extend:
-@Returns:
<!-- ##### FUNCTION cairo_pattern_get_extend ##### -->
@@ -140,7 +162,6 @@ cairo_pattern_t
@pattern:
@filter:
-@Returns:
<!-- ##### FUNCTION cairo_pattern_get_filter ##### -->
diff --git a/doc/public/tmpl/cairo-pdf.sgml b/doc/public/tmpl/cairo-pdf.sgml
index e627c23..d29ed0e 100644
--- a/doc/public/tmpl/cairo-pdf.sgml
+++ b/doc/public/tmpl/cairo-pdf.sgml
@@ -14,29 +14,39 @@ PDF Backend
</para>
-<!-- ##### FUNCTION cairo_set_target_pdf ##### -->
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_pdf_surface_create ##### -->
<para>
</para>
-@cr:
-@file:
-@width_inches:
-@height_inches:
-@x_pixels_per_inch:
-@y_pixels_per_inch:
+@filename:
+@width_in_points:
+@height_in_points:
+@Returns:
-<!-- ##### FUNCTION cairo_pdf_surface_create ##### -->
+<!-- ##### FUNCTION cairo_pdf_surface_create_for_stream ##### -->
<para>
</para>
-@file:
-@width_inches:
-@height_inches:
-@x_pixels_per_inch:
-@y_pixels_per_inch:
+@write_func:
+@closure:
+@width_in_points:
+@height_in_points:
@Returns:
+<!-- ##### FUNCTION cairo_pdf_surface_set_dpi ##### -->
+<para>
+
+</para>
+
+@surface:
+@x_dpi:
+@y_dpi:
+
+
diff --git a/doc/public/tmpl/cairo-png.sgml b/doc/public/tmpl/cairo-png.sgml
index d4d5a66..dd4486c 100644
--- a/doc/public/tmpl/cairo-png.sgml
+++ b/doc/public/tmpl/cairo-png.sgml
@@ -14,27 +14,46 @@ PNG Backend
</para>
-<!-- ##### FUNCTION cairo_set_target_png ##### -->
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_image_surface_create_from_png ##### -->
+<para>
+
+</para>
+
+@filename:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_image_surface_create_from_png_stream ##### -->
<para>
</para>
-@cr:
-@file:
-@format:
-@width:
-@height:
+@read_func:
+@closure:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_surface_write_to_png ##### -->
+<para>
+
+</para>
+
+@surface:
+@filename:
+@Returns:
-<!-- ##### FUNCTION cairo_png_surface_create ##### -->
+<!-- ##### FUNCTION cairo_surface_write_to_png_stream ##### -->
<para>
</para>
-@file:
-@format:
-@width:
-@height:
+@surface:
+@write_func:
+@closure:
@Returns:
diff --git a/doc/public/tmpl/cairo-ps.sgml b/doc/public/tmpl/cairo-ps.sgml
index 70b2e7e..4c5e8b3 100644
--- a/doc/public/tmpl/cairo-ps.sgml
+++ b/doc/public/tmpl/cairo-ps.sgml
@@ -14,29 +14,39 @@ PS Backend
</para>
-<!-- ##### FUNCTION cairo_set_target_ps ##### -->
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_ps_surface_create ##### -->
<para>
</para>
-@cr:
-@file:
-@width_inches:
-@height_inches:
-@x_pixels_per_inch:
-@y_pixels_per_inch:
+@filename:
+@width_in_points:
+@height_in_points:
+@Returns:
-<!-- ##### FUNCTION cairo_ps_surface_create ##### -->
+<!-- ##### FUNCTION cairo_ps_surface_create_for_stream ##### -->
<para>
</para>
-@file:
-@width_inches:
-@height_inches:
-@x_pixels_per_inch:
-@y_pixels_per_inch:
+@write_func:
+@closure:
+@width_in_points:
+@height_in_points:
@Returns:
+<!-- ##### FUNCTION cairo_ps_surface_set_dpi ##### -->
+<para>
+
+</para>
+
+@surface:
+@x_dpi:
+@y_dpi:
+
+
diff --git a/doc/public/tmpl/cairo-quartz.sgml b/doc/public/tmpl/cairo-quartz.sgml
index 04c9bc6..c83de6c 100644
--- a/doc/public/tmpl/cairo-quartz.sgml
+++ b/doc/public/tmpl/cairo-quartz.sgml
@@ -14,15 +14,7 @@ Quartz Backend
</para>
-<!-- ##### FUNCTION cairo_set_target_quartz_context ##### -->
-<para>
-
-</para>
-
-@cr:
-@context:
-@width:
-@height:
+<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### FUNCTION cairo_quartz_surface_create ##### -->
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index 2f8ad47..fab1306 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -14,24 +14,14 @@ cairo_surface_t
</para>
-<!-- ##### TYPEDEF cairo_surface_t ##### -->
-<para>
+<!-- ##### SECTION Stability_Level ##### -->
-</para>
-
-<!-- ##### FUNCTION cairo_surface_create_for_image ##### -->
+<!-- ##### TYPEDEF cairo_surface_t ##### -->
<para>
</para>
-@data:
-@format:
-@width:
-@height:
-@stride:
-@Returns:
-
<!-- ##### FUNCTION cairo_surface_create_similar ##### -->
<para>
@@ -61,52 +51,44 @@ cairo_surface_t
@surface:
-<!-- ##### FUNCTION cairo_surface_set_repeat ##### -->
+<!-- ##### FUNCTION cairo_surface_finish ##### -->
<para>
</para>
@surface:
-@repeat:
@Returns:
-<!-- ##### FUNCTION cairo_surface_set_matrix ##### -->
+<!-- ##### FUNCTION cairo_surface_set_user_data ##### -->
<para>
</para>
@surface:
-@matrix:
+@key:
+@user_data:
+@destroy:
@Returns:
-<!-- ##### FUNCTION cairo_surface_get_matrix ##### -->
+<!-- ##### FUNCTION cairo_surface_get_user_data ##### -->
<para>
</para>
@surface:
-@matrix:
+@key:
@Returns:
-<!-- ##### FUNCTION cairo_surface_set_filter ##### -->
+<!-- ##### FUNCTION cairo_surface_set_device_offset ##### -->
<para>
</para>
@surface:
-@filter:
-@Returns:
-
-
-<!-- ##### FUNCTION cairo_surface_get_filter ##### -->
-<para>
-
-</para>
-
-@surface:
-@Returns:
+@x_offset:
+@y_offset:
diff --git a/doc/public/tmpl/cairo-unused.sgml b/doc/public/tmpl/cairo-unused.sgml
new file mode 100644
index 0000000..ca3bc3e
--- /dev/null
+++ b/doc/public/tmpl/cairo-unused.sgml
@@ -0,0 +1,153 @@
+<!-- ##### SECTION ./tmpl/cairo-atsui.sgml:Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/cairo-atsui.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/cairo-atsui.sgml:Short_Description ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/cairo-atsui.sgml:Stability_Level ##### -->
+
+
+
+<!-- ##### SECTION ./tmpl/cairo-atsui.sgml:Title ##### -->
+ATSUI Fonts
+
+
+<!-- ##### MACRO cairo_copy ##### -->
+<para>
+
+</para>
+
+@dest:
+@src:
+
+<!-- ##### MACRO cairo_default_matrix ##### -->
+<para>
+
+</para>
+
+@cr:
+
+<!-- ##### USER_FUNCTION cairo_error_notify_func_t ##### -->
+<para>
+
+</para>
+
+@closure:
+@status:
+
+<!-- ##### MACRO cairo_get_path ##### -->
+<para>
+
+</para>
+
+@cr:
+@move_to:
+@line_to:
+@curve_to:
+@close_path:
+@closure:
+
+<!-- ##### MACRO cairo_get_path_flat ##### -->
+<para>
+
+</para>
+
+@cr:
+@move_to:
+@line_to:
+@close_path:
+@closure:
+
+<!-- ##### MACRO cairo_set_alpha ##### -->
+<para>
+
+</para>
+
+@cr:
+@alpha:
+
+<!-- ##### FUNCTION cairo_set_error_notify ##### -->
+<para>
+
+</para>
+
+@cr:
+@error_notify:
+@closure:
+
+<!-- ##### MACRO cairo_show_surface ##### -->
+<para>
+
+</para>
+
+@cr:
+@surface:
+@width:
+@height:
+
+<!-- ##### MACRO cairo_surface_create_for_image ##### -->
+<para>
+
+</para>
+
+@Returns:
+@data:
+@format:
+@width:
+@height:
+@stride:
+
+<!-- ##### MACRO cairo_surface_get_filter ##### -->
+<para>
+
+</para>
+
+@Returns:
+@surface:
+
+<!-- ##### MACRO cairo_surface_get_matrix ##### -->
+<para>
+
+</para>
+
+@Returns:
+@surface:
+@matrix:
+
+<!-- ##### MACRO cairo_surface_set_filter ##### -->
+<para>
+
+</para>
+
+@Returns:
+@surface:
+@filter:
+
+<!-- ##### MACRO cairo_surface_set_matrix ##### -->
+<para>
+
+</para>
+
+@Returns:
+@surface:
+@matrix:
+
+<!-- ##### MACRO cairo_surface_set_repeat ##### -->
+<para>
+
+</para>
+
+@Returns:
+@surface:
+@repeat:
+
diff --git a/doc/public/tmpl/cairo-win32.sgml b/doc/public/tmpl/cairo-win32.sgml
new file mode 100644
index 0000000..4976ea0
--- /dev/null
+++ b/doc/public/tmpl/cairo-win32.sgml
@@ -0,0 +1,64 @@
+<!-- ##### SECTION Title ##### -->
+Microsoft Windows Backend
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_win32_surface_create ##### -->
+<para>
+
+</para>
+
+@hdc:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_win32_font_face_create_for_logfontw ##### -->
+<para>
+
+</para>
+
+@logfont:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_win32_scaled_font_select_font ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+@hdc:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_win32_scaled_font_done_font ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+
+
+<!-- ##### FUNCTION cairo_win32_scaled_font_get_metrics_factor ##### -->
+<para>
+
+</para>
+
+@scaled_font:
+@Returns:
+
+
diff --git a/doc/public/tmpl/cairo-xcb-xrender.sgml b/doc/public/tmpl/cairo-xcb-xrender.sgml
new file mode 100644
index 0000000..892967e
--- /dev/null
+++ b/doc/public/tmpl/cairo-xcb-xrender.sgml
@@ -0,0 +1,32 @@
+<!-- ##### SECTION Title ##### -->
+XCB Backend
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_xcb_surface_create_with_xrender_format ##### -->
+<para>
+
+</para>
+
+@c:
+@drawable:
+@format:
+@width:
+@height:
+@Returns:
+
+
diff --git a/doc/public/tmpl/cairo-xcb.sgml b/doc/public/tmpl/cairo-xcb.sgml
index e5e1ee9..a58912c 100644
--- a/doc/public/tmpl/cairo-xcb.sgml
+++ b/doc/public/tmpl/cairo-xcb.sgml
@@ -14,15 +14,41 @@ XCB Backend
</para>
-<!-- ##### FUNCTION cairo_set_target_xcb ##### -->
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_xcb_surface_create ##### -->
<para>
</para>
-@cr:
-@dpy:
+@c:
@drawable:
@visual:
-@format:
+@width:
+@height:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_xcb_surface_create_for_bitmap ##### -->
+<para>
+
+</para>
+
+@c:
+@bitmap:
+@width:
+@height:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_xcb_surface_set_size ##### -->
+<para>
+
+</para>
+
+@surface:
+@width:
+@height:
diff --git a/doc/public/tmpl/cairo-xlib-xrender.sgml b/doc/public/tmpl/cairo-xlib-xrender.sgml
new file mode 100644
index 0000000..4ceab19
--- /dev/null
+++ b/doc/public/tmpl/cairo-xlib-xrender.sgml
@@ -0,0 +1,32 @@
+<!-- ##### SECTION Title ##### -->
+XLib/Xrender Backend
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_xlib_surface_create_with_xrender_format ##### -->
+<para>
+
+</para>
+
+@dpy:
+@drawable:
+@format:
+@width:
+@height:
+@Returns:
+
+
diff --git a/doc/public/tmpl/cairo-xlib.sgml b/doc/public/tmpl/cairo-xlib.sgml
index b18e76a..ae8bb78 100644
--- a/doc/public/tmpl/cairo-xlib.sgml
+++ b/doc/public/tmpl/cairo-xlib.sgml
@@ -14,26 +14,41 @@ XLib Backend
</para>
-<!-- ##### FUNCTION cairo_set_target_drawable ##### -->
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION cairo_xlib_surface_create ##### -->
<para>
</para>
-@cr:
@dpy:
@drawable:
+@visual:
+@width:
+@height:
+@Returns:
-<!-- ##### FUNCTION cairo_xlib_surface_create ##### -->
+<!-- ##### FUNCTION cairo_xlib_surface_create_for_bitmap ##### -->
<para>
</para>
@dpy:
-@drawable:
-@visual:
-@format:
-@colormap:
+@bitmap:
+@width:
+@height:
@Returns:
+<!-- ##### FUNCTION cairo_xlib_surface_set_size ##### -->
+<para>
+
+</para>
+
+@surface:
+@width:
+@height:
+
+
diff --git a/doc/public/tmpl/cairo.sgml b/doc/public/tmpl/cairo.sgml
index a9e195c..992ace5 100644
--- a/doc/public/tmpl/cairo.sgml
+++ b/doc/public/tmpl/cairo.sgml
@@ -24,6 +24,9 @@ Drawing contexts.
</para>
+<!-- ##### SECTION Stability_Level ##### -->
+
+
<!-- ##### TYPEDEF cairo_t ##### -->
<para>
@@ -35,6 +38,7 @@ Drawing contexts.
</para>
+@target:
@Returns:
@@ -70,24 +74,6 @@ Drawing contexts.
@cr:
-<!-- ##### FUNCTION cairo_copy ##### -->
-<para>
-
-</para>
-
-@dest:
-@src:
-
-
-<!-- ##### FUNCTION cairo_set_target_surface ##### -->
-<para>
-
-</para>
-
-@cr:
-@surface:
-
-
<!-- ##### ENUM cairo_format_t ##### -->
<para>
@@ -98,35 +84,22 @@ Drawing contexts.
@CAIRO_FORMAT_A8:
@CAIRO_FORMAT_A1:
-<!-- ##### FUNCTION cairo_set_target_image ##### -->
-<para>
-
-</para>
-
-@cr:
-@data:
-@format:
-@width:
-@height:
-@stride:
-
-
<!-- ##### ENUM cairo_operator_t ##### -->
<para>
</para>
@CAIRO_OPERATOR_CLEAR:
-@CAIRO_OPERATOR_SRC:
-@CAIRO_OPERATOR_DST:
+@CAIRO_OPERATOR_SOURCE:
@CAIRO_OPERATOR_OVER:
-@CAIRO_OPERATOR_OVER_REVERSE:
@CAIRO_OPERATOR_IN:
-@CAIRO_OPERATOR_IN_REVERSE:
@CAIRO_OPERATOR_OUT:
-@CAIRO_OPERATOR_OUT_REVERSE:
@CAIRO_OPERATOR_ATOP:
-@CAIRO_OPERATOR_ATOP_REVERSE:
+@CAIRO_OPERATOR_DEST:
+@CAIRO_OPERATOR_DEST_OVER:
+@CAIRO_OPERATOR_DEST_IN:
+@CAIRO_OPERATOR_DEST_OUT:
+@CAIRO_OPERATOR_DEST_ATOP:
@CAIRO_OPERATOR_XOR:
@CAIRO_OPERATOR_ADD:
@CAIRO_OPERATOR_SATURATE:
@@ -140,7 +113,7 @@ Drawing contexts.
@op:
-<!-- ##### FUNCTION cairo_set_rgb_color ##### -->
+<!-- ##### FUNCTION cairo_set_source_rgb ##### -->
<para>
</para>
@@ -151,22 +124,36 @@ Drawing contexts.
@blue:
-<!-- ##### FUNCTION cairo_set_pattern ##### -->
+<!-- ##### FUNCTION cairo_set_source_rgba ##### -->
<para>
</para>
@cr:
-@pattern:
+@red:
+@green:
+@blue:
+@alpha:
-<!-- ##### FUNCTION cairo_set_alpha ##### -->
+<!-- ##### FUNCTION cairo_set_source ##### -->
<para>
</para>
@cr:
-@alpha:
+@source:
+
+
+<!-- ##### FUNCTION cairo_set_source_surface ##### -->
+<para>
+
+</para>
+
+@cr:
+@surface:
+@x:
+@y:
<!-- ##### FUNCTION cairo_set_tolerance ##### -->
@@ -289,7 +276,7 @@ Drawing contexts.
@angle:
-<!-- ##### FUNCTION cairo_concat_matrix ##### -->
+<!-- ##### FUNCTION cairo_transform ##### -->
<para>
</para>
@@ -307,14 +294,6 @@ Drawing contexts.
@matrix:
-<!-- ##### FUNCTION cairo_default_matrix ##### -->
-<para>
-
-</para>
-
-@cr:
-
-
<!-- ##### FUNCTION cairo_identity_matrix ##### -->
<para>
@@ -323,7 +302,7 @@ Drawing contexts.
@cr:
-<!-- ##### FUNCTION cairo_transform_point ##### -->
+<!-- ##### FUNCTION cairo_user_to_device ##### -->
<para>
</para>
@@ -333,7 +312,7 @@ Drawing contexts.
@y:
-<!-- ##### FUNCTION cairo_transform_distance ##### -->
+<!-- ##### FUNCTION cairo_user_to_device_distance ##### -->
<para>
</para>
@@ -343,7 +322,7 @@ Drawing contexts.
@dy:
-<!-- ##### FUNCTION cairo_inverse_transform_point ##### -->
+<!-- ##### FUNCTION cairo_device_to_user ##### -->
<para>
</para>
@@ -353,7 +332,7 @@ Drawing contexts.
@y:
-<!-- ##### FUNCTION cairo_inverse_transform_distance ##### -->
+<!-- ##### FUNCTION cairo_device_to_user_distance ##### -->
<para>
</para>
@@ -485,6 +464,43 @@ Drawing contexts.
@cr:
+<!-- ##### FUNCTION cairo_paint ##### -->
+<para>
+
+</para>
+
+@cr:
+
+
+<!-- ##### FUNCTION cairo_paint_with_alpha ##### -->
+<para>
+
+</para>
+
+@cr:
+@alpha:
+
+
+<!-- ##### FUNCTION cairo_mask ##### -->
+<para>
+
+</para>
+
+@cr:
+@pattern:
+
+
+<!-- ##### FUNCTION cairo_mask_surface ##### -->
+<para>
+
+</para>
+
+@cr:
+@surface:
+@surface_x:
+@surface_y:
+
+
<!-- ##### FUNCTION cairo_stroke ##### -->
<para>
@@ -493,6 +509,14 @@ Drawing contexts.
@cr:
+<!-- ##### FUNCTION cairo_stroke_preserve ##### -->
+<para>
+
+</para>
+
+@cr:
+
+
<!-- ##### FUNCTION cairo_fill ##### -->
<para>
@@ -501,6 +525,14 @@ Drawing contexts.
@cr:
+<!-- ##### FUNCTION cairo_fill_preserve ##### -->
+<para>
+
+</para>
+
+@cr:
+
+
<!-- ##### FUNCTION cairo_copy_page ##### -->
<para>
@@ -569,7 +601,7 @@ Drawing contexts.
@y2:
-<!-- ##### FUNCTION cairo_init_clip ##### -->
+<!-- ##### FUNCTION cairo_clip ##### -->
<para>
</para>
@@ -577,7 +609,7 @@ Drawing contexts.
@cr:
-<!-- ##### FUNCTION cairo_clip ##### -->
+<!-- ##### FUNCTION cairo_clip_preserve ##### -->
<para>
</para>
@@ -585,11 +617,13 @@ Drawing contexts.
@cr:
-<!-- ##### TYPEDEF cairo_font_t ##### -->
+<!-- ##### FUNCTION cairo_reset_clip ##### -->
<para>
</para>
+@cr:
+
<!-- ##### STRUCT cairo_glyph_t ##### -->
<para>
@@ -600,29 +634,6 @@ Drawing contexts.
@x:
@y:
-<!-- ##### STRUCT cairo_text_extents_t ##### -->
-<para>
-
-</para>
-
-@x_bearing:
-@y_bearing:
-@width:
-@height:
-@x_advance:
-@y_advance:
-
-<!-- ##### STRUCT cairo_font_extents_t ##### -->
-<para>
-
-</para>
-
-@ascent:
-@descent:
-@height:
-@max_x_advance:
-@max_y_advance:
-
<!-- ##### ENUM cairo_font_slant_t ##### -->
<para>
@@ -640,7 +651,7 @@ Drawing contexts.
@CAIRO_FONT_WEIGHT_NORMAL:
@CAIRO_FONT_WEIGHT_BOLD:
-<!-- ##### FUNCTION cairo_select_font ##### -->
+<!-- ##### FUNCTION cairo_select_font_face ##### -->
<para>
</para>
@@ -651,16 +662,25 @@ Drawing contexts.
@weight:
-<!-- ##### FUNCTION cairo_scale_font ##### -->
+<!-- ##### FUNCTION cairo_set_font_size ##### -->
<para>
</para>
@cr:
-@scale:
+@size:
-<!-- ##### FUNCTION cairo_transform_font ##### -->
+<!-- ##### FUNCTION cairo_set_font_matrix ##### -->
+<para>
+
+</para>
+
+@cr:
+@matrix:
+
+
+<!-- ##### FUNCTION cairo_get_font_matrix ##### -->
<para>
</para>
@@ -688,7 +708,7 @@ Drawing contexts.
@num_glyphs:
-<!-- ##### FUNCTION cairo_current_font ##### -->
+<!-- ##### FUNCTION cairo_get_font_face ##### -->
<para>
</para>
@@ -697,7 +717,7 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_font_extents ##### -->
+<!-- ##### FUNCTION cairo_font_extents ##### -->
<para>
</para>
@@ -706,13 +726,13 @@ Drawing contexts.
@extents:
-<!-- ##### FUNCTION cairo_set_font ##### -->
+<!-- ##### FUNCTION cairo_set_font_face ##### -->
<para>
</para>
@cr:
-@font:
+@font_face:
<!-- ##### FUNCTION cairo_text_extents ##### -->
@@ -755,46 +775,25 @@ Drawing contexts.
@num_glyphs:
-<!-- ##### FUNCTION cairo_font_reference ##### -->
-<para>
-
-</para>
-
-@font:
-
-
-<!-- ##### FUNCTION cairo_font_destroy ##### -->
-<para>
-
-</para>
-
-@font:
-
-
-<!-- ##### FUNCTION cairo_font_glyph_extents ##### -->
+<!-- ##### FUNCTION cairo_get_operator ##### -->
<para>
</para>
-@font:
-@font_matrix:
-@glyphs:
-@num_glyphs:
-@extents:
+@cr:
+@Returns:
-<!-- ##### FUNCTION cairo_show_surface ##### -->
+<!-- ##### FUNCTION cairo_get_source ##### -->
<para>
</para>
@cr:
-@surface:
-@width:
-@height:
+@Returns:
-<!-- ##### FUNCTION cairo_current_operator ##### -->
+<!-- ##### FUNCTION cairo_get_tolerance ##### -->
<para>
</para>
@@ -803,18 +802,17 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_rgb_color ##### -->
+<!-- ##### FUNCTION cairo_get_current_point ##### -->
<para>
</para>
@cr:
-@red:
-@green:
-@blue:
+@x:
+@y:
-<!-- ##### FUNCTION cairo_current_pattern ##### -->
+<!-- ##### FUNCTION cairo_get_fill_rule ##### -->
<para>
</para>
@@ -823,7 +821,7 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_alpha ##### -->
+<!-- ##### FUNCTION cairo_get_line_width ##### -->
<para>
</para>
@@ -832,7 +830,7 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_tolerance ##### -->
+<!-- ##### FUNCTION cairo_get_line_cap ##### -->
<para>
</para>
@@ -841,17 +839,16 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_point ##### -->
+<!-- ##### FUNCTION cairo_get_line_join ##### -->
<para>
</para>
@cr:
-@x:
-@y:
+@Returns:
-<!-- ##### FUNCTION cairo_current_fill_rule ##### -->
+<!-- ##### FUNCTION cairo_get_miter_limit ##### -->
<para>
</para>
@@ -860,16 +857,18 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_line_width ##### -->
+<!-- ##### FUNCTION cairo_get_matrix ##### -->
<para>
</para>
@cr:
+@matrix:
+<!-- # Unused Parameters # -->
@Returns:
-<!-- ##### FUNCTION cairo_current_line_cap ##### -->
+<!-- ##### FUNCTION cairo_get_target ##### -->
<para>
</para>
@@ -878,7 +877,7 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_line_join ##### -->
+<!-- ##### FUNCTION cairo_copy_path ##### -->
<para>
</para>
@@ -887,7 +886,7 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_miter_limit ##### -->
+<!-- ##### FUNCTION cairo_copy_path_flat ##### -->
<para>
</para>
@@ -896,47 +895,40 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_current_matrix ##### -->
+<!-- ##### FUNCTION cairo_append_path ##### -->
<para>
</para>
@cr:
-@matrix:
+@path:
-<!-- ##### FUNCTION cairo_current_target_surface ##### -->
+<!-- ##### ENUM cairo_path_data_type_t ##### -->
<para>
</para>
-@cr:
-@Returns:
-
+@CAIRO_PATH_MOVE_TO:
+@CAIRO_PATH_LINE_TO:
+@CAIRO_PATH_CURVE_TO:
+@CAIRO_PATH_CLOSE_PATH:
-<!-- ##### FUNCTION cairo_current_path ##### -->
+<!-- ##### STRUCT cairo_path_t ##### -->
<para>
</para>
-@cr:
-@move_to:
-@line_to:
-@curve_to:
-@close_path:
-@closure:
-
+@status:
+@data:
+@num_data:
-<!-- ##### FUNCTION cairo_current_path_flat ##### -->
+<!-- ##### FUNCTION cairo_path_destroy ##### -->
<para>
</para>
-@cr:
-@move_to:
-@line_to:
-@close_path:
-@closure:
+@path:
<!-- ##### ENUM cairo_status_t ##### -->
@@ -953,6 +945,12 @@ Drawing contexts.
@CAIRO_STATUS_NO_TARGET_SURFACE:
@CAIRO_STATUS_NULL_POINTER:
@CAIRO_STATUS_INVALID_STRING:
+@CAIRO_STATUS_INVALID_PATH_DATA:
+@CAIRO_STATUS_READ_ERROR:
+@CAIRO_STATUS_WRITE_ERROR:
+@CAIRO_STATUS_SURFACE_FINISHED:
+@CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
+@CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
<!-- ##### FUNCTION cairo_status ##### -->
<para>
@@ -963,12 +961,19 @@ Drawing contexts.
@Returns:
-<!-- ##### FUNCTION cairo_status_string ##### -->
+<!-- ##### MACRO cairo_status_string ##### -->
<para>
</para>
-@cr:
+
+
+<!-- ##### FUNCTION cairo_status_to_string ##### -->
+<para>
+
+</para>
+
+@status:
@Returns:
@@ -1008,12 +1013,58 @@ Drawing contexts.
@Returns:
+<!-- ##### FUNCTION cairo_image_surface_get_width ##### -->
+<para>
+
+</para>
+
+@surface:
+@Returns:
+
+
+<!-- ##### FUNCTION cairo_image_surface_get_height ##### -->
+<para>
+
+</para>
+
+@surface:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION cairo_destroy_func_t ##### -->
+<para>
+
+</para>
+
+@data:
+
+
+<!-- ##### STRUCT cairo_user_data_key_t ##### -->
+<para>
+
+</para>
+
+@unused:
+
+<!-- ##### USER_FUNCTION cairo_read_func_t ##### -->
+<para>
+
+</para>
+
+@closure:
+@data:
+@length:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION cairo_write_func_t ##### -->
+<para>
+
+</para>
-<!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../cairo-docs.xml" "book" "refsect2" "")
-End:
--->
+@closure:
+@data:
+@length:
+@Returns:
diff --git a/doc/public/xml/cairo-atsui.xml b/doc/public/xml/cairo-atsui.xml
index 3186ba8..0a5461e 100644
--- a/doc/public/xml/cairo-atsui.xml
+++ b/doc/public/xml/cairo-atsui.xml
@@ -18,7 +18,6 @@
-<link linkend="cairo-font-t">cairo_font_t</link>* <link linkend="cairo-atsui-font-create">cairo_atsui_font_create</link> (<link linkend="ATSUStyle">ATSUStyle</link> style);
</synopsis>
</refsynopsisdiv>
@@ -39,20 +38,6 @@
<refsect1>
<title>Details</title>
-<refsect2>
-<title><anchor id="cairo-atsui-font-create"/>cairo_atsui_font_create ()</title>
-<indexterm><primary>cairo_atsui_font_create</primary></indexterm><programlisting><link linkend="cairo-font-t">cairo_font_t</link>* cairo_atsui_font_create (<link linkend="ATSUStyle">ATSUStyle</link> style);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>style</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
</refsect1>
diff --git a/doc/public/xml/cairo-font.xml b/doc/public/xml/cairo-font.xml
new file mode 100644
index 0000000..4435bcc
--- /dev/null
+++ b/doc/public/xml/cairo-font.xml
@@ -0,0 +1,419 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<refentry id="cairo-Fonts">
+<refmeta>
+<refentrytitle>Fonts</refentrytitle>
+<manvolnum>3</manvolnum>
+<refmiscinfo>CAIRO Library</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+<refname>Fonts</refname><refpurpose>Font Handling</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><title>Synopsis</title>
+
+<synopsis>
+
+
+
+typedef <link linkend="cairo-font-face-t">cairo_font_face_t</link>;
+typedef <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>;
+<link linkend="void">void</link> <link linkend="cairo-font-face-reference">cairo_font_face_reference</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);
+<link linkend="void">void</link> <link linkend="cairo-font-face-destroy">cairo_font_face_destroy</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);
+<link linkend="void">void</link>* <link linkend="cairo-font-face-get-user-data">cairo_font_face_get_user_data</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key);
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-font-face-set-user-data">cairo_font_face_set_user_data</link>
+ (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key,
+ <link linkend="void">void</link> *user_data,
+ <link linkend="cairo-destroy-func-t">cairo_destroy_func_t</link> destroy);
+<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* <link linkend="cairo-scaled-font-create">cairo_scaled_font_create</link>
+ (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *ctm);
+<link linkend="void">void</link> <link linkend="cairo-scaled-font-reference">cairo_scaled_font_reference</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
+<link linkend="void">void</link> <link linkend="cairo-scaled-font-destroy">cairo_scaled_font_destroy</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
+ <link linkend="cairo-font-extents-t">cairo_font_extents_t</link>;
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-scaled-font-extents">cairo_scaled_font_extents</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
+ <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);
+ <link linkend="cairo-text-extents-t">cairo_text_extents_t</link>;
+<link linkend="void">void</link> <link linkend="cairo-scaled-font-glyph-extents">cairo_scaled_font_glyph_extents</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
+ <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
+ <link linkend="int">int</link> num_glyphs,
+ <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
+</synopsis>
+</refsynopsisdiv>
+
+
+
+
+
+
+
+
+
+<refsect1>
+<title>Description</title>
+<para>
+
+</para>
+</refsect1>
+
+<refsect1>
+<title>Details</title>
+<refsect2>
+<title><anchor id="cairo-font-face-t"/>cairo_font_face_t</title>
+<indexterm><primary>cairo_font_face_t</primary></indexterm><programlisting>typedef struct _cairo_font_face cairo_font_face_t;
+</programlisting>
+<para>
+A <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link> specifies all aspects of a font other
+than the size or font matrix (a font matrix is used to distort
+a font by sheering it or scaling it unequally in the two
+directions) . A font face can be set on a <link linkend="cairo-t"><type>cairo_t</type></link> by using
+<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link>; the size and font matrix are set with
+<link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link> and <link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>.</para>
+<para>
+
+</para></refsect2>
+<refsect2>
+<title><anchor id="cairo-scaled-font-t"/>cairo_scaled_font_t</title>
+<indexterm><primary>cairo_scaled_font_t</primary></indexterm><programlisting>typedef struct _cairo_scaled_font cairo_scaled_font_t;
+</programlisting>
+<para>
+A <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> is a font scaled to a particular size and device
+resolution. A cairo_scaled_font_t is most useful for low-level font
+usage where a library or application wants to cache a reference
+to a scaled font to speed up the computation of metrics.</para>
+<para>
+
+</para></refsect2>
+<refsect2>
+<title><anchor id="cairo-font-face-reference"/>cairo_font_face_reference ()</title>
+<indexterm><primary>cairo_font_face_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_face_reference (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting>
+<para>
+Increases the reference count on <parameter>font_face</parameter> by one. This prevents
+<parameter>font_face</parameter> from being destroyed until a matching call to
+<link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> is made.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>, (may be NULL in which case this
+function does nothing).
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-font-face-destroy"/>cairo_font_face_destroy ()</title>
+<indexterm><primary>cairo_font_face_destroy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_face_destroy (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting>
+<para>
+Decreases the reference count on <parameter>font_face</parameter> by one. If the result
+is zero, then <parameter>font_face</parameter> and all associated resources are freed.
+See <link linkend="cairo-font-face-reference"><function>cairo_font_face_reference()</function></link>.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-font-face-get-user-data"/>cairo_font_face_get_user_data ()</title>
+<indexterm><primary>cairo_font_face_get_user_data</primary></indexterm><programlisting><link linkend="void">void</link>* cairo_font_face_get_user_data (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key);</programlisting>
+<para>
+Return user data previously attached to <parameter>font_face</parameter> using the specified
+key. If no user data has been attached with the given key this
+function returns <literal>NULL</literal>.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
+<listitem><simpara> the address of the <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> the user data was
+attached to
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the user data previously attached or <literal>NULL</literal>.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-font-face-set-user-data"/>cairo_font_face_set_user_data ()</title>
+<indexterm><primary>cairo_font_face_set_user_data</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_font_face_set_user_data
+ (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key,
+ <link linkend="void">void</link> *user_data,
+ <link linkend="cairo-destroy-func-t">cairo_destroy_func_t</link> destroy);</programlisting>
+<para>
+Attach user data to <parameter>font_face</parameter>. To remove user data from a font face,
+call this function with the key that was used to set it and <literal>NULL</literal>
+for <parameter>data</parameter>.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
+<listitem><simpara> the address of a <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> to attach the user data to
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
+<listitem><simpara> the user data to attach to the font face
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>destroy</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> which will be called when the
+font face is destroyed or when new user data is attached using the
+same key.
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> or <literal>CAIRO_STATUS_NO_MEMORY</literal> if a
+slot could not be allocated for the user data.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-scaled-font-create"/>cairo_scaled_font_create ()</title>
+<indexterm><primary>cairo_scaled_font_create</primary></indexterm><programlisting><link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* cairo_scaled_font_create
+ (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *ctm);</programlisting>
+<para>
+Creates a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> object from a font face and matrices that
+describe the size of the font and the environment in which it will
+be used.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>font_matrix</parameter>&nbsp;:</term>
+<listitem><simpara> font space to user space transformation matrix for the
+ font. In the simplest case of a N point font, this matrix is
+ just a scale by N, but it can also be used to shear the font
+ or stretch it unequally along the two axes. See
+ <link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>ctm</parameter>&nbsp;:</term>
+<listitem><simpara> user to device transformation matrix with which the font will
+ be used.
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>. Destroy with
+ <link linkend="cairo-scaled-font-destroy"><function>cairo_scaled_font_destroy()</function></link>
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-scaled-font-reference"/>cairo_scaled_font_reference ()</title>
+<indexterm><primary>cairo_scaled_font_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_scaled_font_reference (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
+<para>
+Increases the reference count on <parameter>scaled_font</parameter> by one. This prevents
+<parameter>scaled_font</parameter> from being destroyed until a matching call to
+<link linkend="cairo-scaled-font-destroy"><function>cairo_scaled_font_destroy()</function></link> is made.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>, (may be NULL in which case
+this function does nothing)
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-scaled-font-destroy"/>cairo_scaled_font_destroy ()</title>
+<indexterm><primary>cairo_scaled_font_destroy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_scaled_font_destroy (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
+<para>
+Decreases the reference count on <parameter>font</parameter> by one. If the result
+is zero, then <parameter>font</parameter> and all associated resources are freed.
+See <link linkend="cairo-scaled-font-reference"><function>cairo_scaled_font_reference()</function></link>.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-font-extents-t"/>cairo_font_extents_t</title>
+<indexterm><primary>cairo_font_extents_t</primary></indexterm><programlisting>typedef struct {
+ double ascent;
+ double descent;
+ double height;
+ double max_x_advance;
+ double max_y_advance;
+} cairo_font_extents_t;
+</programlisting>
+<para>
+The <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> structure stores metric information for
+a font. Values are given in the current user-space coordinate
+system.
+</para>
+<para>
+Because font metrics are in user-space coordinates, they are
+mostly, but not entirely, independent of the current transformation
+matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
+text will be drawn twice as big, but the reported text extents will
+not be doubled. They will change slightly due to hinting (so you
+can't assume that metrics are independent of the transformation
+matrix), but otherwise will remain unchanged.</para>
+<para>
+
+</para><variablelist role="struct">
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>ascent</structfield>;</term>
+<listitem><simpara> the distance that the font extends above the baseline.
+ Note that this is not always exactly equal to the maximum
+ of the extents of all the glyphs in the font, but rather
+ is picked to express the font designer's intent as to
+ how the font should align with elements above it.
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>descent</structfield>;</term>
+<listitem><simpara> the distance that the font extends below the baseline.
+ This value is positive for typical fonts that include
+ portions below the baseline. Note that this is not always
+ exactly equal to the maximum of the extents of all the
+ glyphs in the font, but rather is picked to express the
+ font designer's intent as to how the the font should
+ align with elements below it.
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>height</structfield>;</term>
+<listitem><simpara> the recommended vertical distance between baselines when
+ setting consecutive lines of text with the font. This
+ is greater than <parameter>ascent</parameter>+<parameter>descent</parameter> by a
+ quantity known as the <firstterm>line spacing</firstterm>
+ or <firstterm>external leading</firstterm>. When space
+ is at a premium, most fonts can be set with only
+ a distance of <parameter>ascent</parameter>+<parameter>descent</parameter> between lines.
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>max_x_advance</structfield>;</term>
+<listitem><simpara> the maximum distance in the X direction that
+ the the origin is advanced for any glyph in the font.
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>max_y_advance</structfield>;</term>
+<listitem><simpara> the maximum distance in the Y direction that
+ the the origin is advanced for any glyph in the font.
+ this will be zero for normal fonts used for horizontal
+ writing. (The scripts of East Asia are sometimes written
+ vertically.)
+</simpara></listitem>
+</varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-scaled-font-extents"/>cairo_scaled_font_extents ()</title>
+<indexterm><primary>cairo_scaled_font_extents</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_scaled_font_extents (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
+ <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);</programlisting>
+<para>
+Gets the metrics for a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-extents-t"><type>cairo_font_extents_t</type></link> which to store the retrieved extents.
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> on success. Otherwise, an
+ error such as <literal>CAIRO_STATUS_NO_MEMORY</literal>.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-text-extents-t"/>cairo_text_extents_t</title>
+<indexterm><primary>cairo_text_extents_t</primary></indexterm><programlisting>typedef struct {
+ double x_bearing;
+ double y_bearing;
+ double width;
+ double height;
+ double x_advance;
+ double y_advance;
+} cairo_text_extents_t;
+</programlisting>
+<para>
+The <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> structure stores the extents of a single
+glyph or a string of glyphs in user-space coordinates. Because text
+extents are in user-space coordinates, they are mostly, but not
+entirely, independent of the current transformation matrix. If you call
+<literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
+be drawn twice as big, but the reported text extents will not be
+doubled. They will change slightly due to hinting (so you can't
+assume that metrics are independent of the transformation matrix),
+but otherwise will remain unchanged.</para>
+<para>
+
+</para><variablelist role="struct">
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>x_bearing</structfield>;</term>
+<listitem><simpara> the horizontal distance from the origin to the
+ leftmost part of the glyphs as drawn. Positive if the
+ glyphs lie entirely to the right of the origin.
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>y_bearing</structfield>;</term>
+<listitem><simpara> the vertical distance from the origin to the
+ topmost part of the glyphs as drawn. Positive only if the
+ glyphs lie completely below the origin; will usually be
+ negative.
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>width</structfield>;</term>
+<listitem><simpara> width of the glyphs as drawn
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>height</structfield>;</term>
+<listitem><simpara> height of the glyphs as drawn
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>x_advance</structfield>;</term>
+<listitem><simpara>distance to advance in the X direction
+ after drawing these glyphs
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><link linkend="double">double</link>&nbsp;<structfield>y_advance</structfield>;</term>
+<listitem><simpara> distance to advance in the Y direction
+ after drawing these glyphs. Will typically be zero except
+ for vertical text layout as found in East-Asian languages.
+</simpara></listitem>
+</varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-scaled-font-glyph-extents"/>cairo_scaled_font_glyph_extents ()</title>
+<indexterm><primary>cairo_scaled_font_glyph_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_scaled_font_glyph_extents (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
+ <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
+ <link linkend="int">int</link> num_glyphs,
+ <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>num_glyphs</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
+<listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+
+</refsect1>
+
+
+
+
+</refentry>
diff --git a/doc/public/xml/cairo-ft.xml b/doc/public/xml/cairo-ft.xml
index de92f34..8f9b45e 100644
--- a/doc/public/xml/cairo-ft.xml
+++ b/doc/public/xml/cairo-ft.xml
@@ -18,15 +18,14 @@
-<link linkend="cairo-font-t">cairo_font_t</link>* <link linkend="cairo-ft-font-create">cairo_ft_font_create</link> (<link linkend="FcPattern">FcPattern</link> *pattern,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);
-<link linkend="cairo-font-t">cairo_font_t</link>* <link linkend="cairo-ft-font-create-for-ft-face">cairo_ft_font_create_for_ft_face</link>
+<link linkend="cairo-font-face-t">cairo_font_face_t</link>* <link linkend="cairo-ft-font-face-create-for-pattern">cairo_ft_font_face_create_for_pattern</link>
+ (<link linkend="FcPattern">FcPattern</link> *pattern);
+<link linkend="cairo-font-face-t">cairo_font_face_t</link>* <link linkend="cairo-ft-font-face-create-for-ft-face">cairo_ft_font_face_create_for_ft_face</link>
(<link linkend="FT-Face">FT_Face</link> face,
- <link linkend="int">int</link> load_flags,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);
-<link linkend="FT-Face">FT_Face</link> <link linkend="cairo-ft-font-lock-face">cairo_ft_font_lock_face</link> (<link linkend="cairo-font-t">cairo_font_t</link> *ft_font);
-<link linkend="void">void</link> <link linkend="cairo-ft-font-unlock-face">cairo_ft_font_unlock_face</link> (<link linkend="cairo-font-t">cairo_font_t</link> *ft_font);
-<link linkend="FcPattern">FcPattern</link>* <link linkend="cairo-ft-font-get-pattern">cairo_ft_font_get_pattern</link> (<link linkend="cairo-font-t">cairo_font_t</link> *ft_font);
+ <link linkend="int">int</link> load_flags);
+<link linkend="FT-Face">FT_Face</link> <link linkend="cairo-ft-scaled-font-lock-face">cairo_ft_scaled_font_lock_face</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
+<link linkend="void">void</link> <link linkend="cairo-ft-scaled-font-unlock-face">cairo_ft_scaled_font_unlock_face</link>
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
</synopsis>
</refsynopsisdiv>
@@ -48,14 +47,15 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-ft-font-create"/>cairo_ft_font_create ()</title>
-<indexterm><primary>cairo_ft_font_create</primary></indexterm><programlisting><link linkend="cairo-font-t">cairo_font_t</link>* cairo_ft_font_create (<link linkend="FcPattern">FcPattern</link> *pattern,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);</programlisting>
+<title><anchor id="cairo-ft-font-face-create-for-pattern"/>cairo_ft_font_face_create_for_pattern ()</title>
+<indexterm><primary>cairo_ft_font_face_create_for_pattern</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link>* cairo_ft_font_face_create_for_pattern
+ (<link linkend="FcPattern">FcPattern</link> *pattern);</programlisting>
<para>
-Creates a new font for the FreeType font backend based on a
+Creates a new font face for the FreeType font backend based on a
fontconfig pattern. This font can then be used with
-<link linkend="cairo-set-font"><function>cairo_set_font()</function></link>, <link linkend="cairo-font-glyph-extents"><function>cairo_font_glyph_extents()</function></link>, or FreeType backend
-specific functions like <link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link>.</para>
+<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> or <link linkend="cairo-font-create"><function>cairo_font_create()</function></link>. The <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
+returned from <link linkend="cairo-font-create"><function>cairo_font_create()</function></link> is also for the FreeType backend
+and can be used with functions such as <link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link>.</para>
<para>
</para><variablelist role="params">
@@ -68,38 +68,31 @@ specific functions like <link linkend="cairo-ft-font-lock-face"><function>cairo_
release your reference to the pattern with <link linkend="FcPatternDestroy"><function>FcPatternDestroy()</function></link> if
you no longer need to access it.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>scale</parameter>&nbsp;:</term>
-<listitem><simpara> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-t"><type>cairo_font_t</type></link>. Free with
- <link linkend="cairo-font-destroy"><function>cairo_font_destroy()</function></link> when you are done using it.
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. Free with
+ <link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> when you are done using it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-ft-font-create-for-ft-face"/>cairo_ft_font_create_for_ft_face ()</title>
-<indexterm><primary>cairo_ft_font_create_for_ft_face</primary></indexterm><programlisting><link linkend="cairo-font-t">cairo_font_t</link>* cairo_ft_font_create_for_ft_face
+<title><anchor id="cairo-ft-font-face-create-for-ft-face"/>cairo_ft_font_face_create_for_ft_face ()</title>
+<indexterm><primary>cairo_ft_font_face_create_for_ft_face</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link>* cairo_ft_font_face_create_for_ft_face
(<link linkend="FT-Face">FT_Face</link> face,
- <link linkend="int">int</link> load_flags,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);</programlisting>
+ <link linkend="int">int</link> load_flags);</programlisting>
<para>
-Creates a new font forthe FreeType font backend from a pre-opened
-FreeType face. This font can then be used with <link linkend="cairo-set-font"><function>cairo_set_font()</function></link>,
-<link linkend="cairo-font-glyph-extents"><function>cairo_font_glyph_extents()</function></link>, or FreeType backend specific
-functions like <link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link> Cairo will determine the
-pixel size and transformation from the <parameter>scale</parameter> parameter and call
-<link linkend="FT-Set-Transform"><function>FT_Set_Transform()</function></link> and <link linkend="FT-Set-Pixel-Sizes"><function>FT_Set_Pixel_Sizes()</function></link>.</para>
+Creates a new font face for the FreeType font backend from a pre-opened
+FreeType face. This font can then be used with
+<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> or <link linkend="cairo-font-create"><function>cairo_font_create()</function></link>. The <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
+returned from <link linkend="cairo-font-create"><function>cairo_font_create()</function></link> is also for the FreeType backend
+and can be used with functions such as <link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>face</parameter>&nbsp;:</term>
<listitem><simpara> A FreeType face object, already opened. This must
- be kept around until the font object's refcount drops to
- zero and it is freed. The font object can be kept alive by
- internal caching, so it's safest to keep the face object
- around forever.
+ be kept around until the face's refcount drops to
+ zero and it is freed. Since the face may be referenced
+ internally to Cairo, the best way to determine when it
+ is safe to free the face is to pass a
+ <link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> to <link linkend="cairo-font-face-set-user-data"><function>cairo_font_face_set_user_data()</function></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>load_flags</parameter>&nbsp;:</term>
<listitem><simpara> The flags to pass to FT_Load_Glyph when loading
@@ -107,25 +100,19 @@ pixel size and transformation from the <parameter>scale</parameter> parameter an
rendering such as hinting and antialiasing. See the FreeType
docs for full information.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>scale</parameter>&nbsp;:</term>
-<listitem><simpara> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-t"><type>cairo_font_t</type></link>. Free with
- <link linkend="cairo-font-destroy"><function>cairo_font_destroy()</function></link> when you are done using it.
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. Free with
+ <link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> when you are done using it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-ft-font-lock-face"/>cairo_ft_font_lock_face ()</title>
-<indexterm><primary>cairo_ft_font_lock_face</primary></indexterm><programlisting><link linkend="FT-Face">FT_Face</link> cairo_ft_font_lock_face (<link linkend="cairo-font-t">cairo_font_t</link> *ft_font);</programlisting>
+<title><anchor id="cairo-ft-scaled-font-lock-face"/>cairo_ft_scaled_font_lock_face ()</title>
+<indexterm><primary>cairo_ft_scaled_font_lock_face</primary></indexterm><programlisting><link linkend="FT-Face">FT_Face</link> cairo_ft_scaled_font_lock_face (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
<link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link> gets the <link linkend="FT-Face"><type>FT_Face</type></link> object from a FreeType
backend font and scales it appropriately for the font. You must
release the face with <link linkend="cairo-ft-font-unlock-face"><function>cairo_ft_font_unlock_face()</function></link>
when you are done using it. Since the <link linkend="FT-Face"><type>FT_Face</type></link> object can be
-shared between multiple <link linkend="cairo-font-t"><type>cairo_font_t</type></link> objects, you must not
+shared between multiple <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> objects, you must not
lock any other font objects until you unlock this one. A count is
kept of the number of times <link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link> is
called. <link linkend="cairo-ft-font-unlock-face"><function>cairo_ft_font_unlock_face()</function></link> must be called the same number
@@ -142,59 +129,30 @@ threaded application.)</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>ft_font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the FreeType font backend. Such an
- object can be created with <link linkend="cairo-ft-font-create"><function>cairo_ft_font_create()</function></link> or
- <link linkend="cairo-ft-font-create-for-ft-face"><function>cairo_ft_font_create_for_ft_face()</function></link>. On some platforms the font from
- <link linkend="cairo-current-font"><function>cairo_current_font()</function></link> will also be a FreeType font, but using this
- functionality with fonts you don't create yourself is not
- recommended.
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> A <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> from the FreeType font backend. Such an
+ object can be created by calling <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link> on a
+ FreeType backend font face (see <link linkend="cairo-ft-font-face-create-for-pattern"><function>cairo_ft_font_face_create_for_pattern()</function></link>,
+ <link linkend="cairo-ft-font-face-create-for-face"><function>cairo_ft_font_face_create_for_face()</function></link>).
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> The <link linkend="FT-Face"><type>FT_Face</type></link> object for <parameter>font</parameter>, scaled appropriately.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-ft-font-unlock-face"/>cairo_ft_font_unlock_face ()</title>
-<indexterm><primary>cairo_ft_font_unlock_face</primary></indexterm><programlisting><link linkend="void">void</link> cairo_ft_font_unlock_face (<link linkend="cairo-font-t">cairo_font_t</link> *ft_font);</programlisting>
+<title><anchor id="cairo-ft-scaled-font-unlock-face"/>cairo_ft_scaled_font_unlock_face ()</title>
+<indexterm><primary>cairo_ft_scaled_font_unlock_face</primary></indexterm><programlisting><link linkend="void">void</link> cairo_ft_scaled_font_unlock_face
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
Releases a face obtained with <link linkend="cairo-ft-font-lock-face"><function>cairo_ft_font_lock_face()</function></link>. See the
documentation for that function for full details.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>ft_font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the FreeType font backend. Such an
- object can be created with <link linkend="cairo-ft-font-create"><function>cairo_ft_font_create()</function></link> or
- <link linkend="cairo-ft-font-create-for-ft-face"><function>cairo_ft_font_create_for_ft_face()</function></link>. On some platforms the font from
- <link linkend="cairo-current-font"><function>cairo_current_font()</function></link> will also be a FreeType font, but using this
- functionality with fonts you don't create yourself is not
- recommended.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-ft-font-get-pattern"/>cairo_ft_font_get_pattern ()</title>
-<indexterm><primary>cairo_ft_font_get_pattern</primary></indexterm><programlisting><link linkend="FcPattern">FcPattern</link>* cairo_ft_font_get_pattern (<link linkend="cairo-font-t">cairo_font_t</link> *ft_font);</programlisting>
-<para>
-<link linkend="cairo-ft-font-get-pattern"><function>cairo_ft_font_get_pattern()</function></link> gets the <link linkend="FcPattern"><type>FcPattern</type></link> for a FreeType
-backend font.
-</para>
-<para>
-Return value: The <link linkend="FcPattenr"><type>FcPattenr</type></link> for <parameter>font</parameter>. The return value is owned
- by the font, so you must not modify it, and must call
- <link linkend="FcPatternReference"><function>FcPatternReference()</function></link> to keep a persistant reference to the
- pattern. If the font was created with <link linkend="cairo-ft-font-create-for-ft-face"><function>cairo_ft_font_create_for_ft_face()</function></link></para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>ft_font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the FreeType font backend. Such an
- object can be created with <link linkend="cairo-ft-font-create"><function>cairo_ft_font_create()</function></link> or
- <link linkend="cairo-ft-font-create-for-ft-face"><function>cairo_ft_font_create_for_ft_face()</function></link>. On some platforms the font from
- <link linkend="cairo-current-font"><function>cairo_current_font()</function></link> will also be a FreeType font, but using this
- functionality with fonts you don't create yourself is not
- recommended.
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara><literal>NULL</literal>.
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> A <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> from the FreeType font backend. Such an
+ object can be created by calling <link linkend="cairo-scaled-font-create"><function>cairo_scaled_font_create()</function></link> on a
+ FreeType backend font face (see <link linkend="cairo-ft-font-face-create-for-pattern"><function>cairo_ft_font_face_create_for_pattern()</function></link>,
+ <link linkend="cairo-ft-font-face-create-for-face"><function>cairo_ft_font_face_create_for_face()</function></link>).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
diff --git a/doc/public/xml/cairo-glitz.xml b/doc/public/xml/cairo-glitz.xml
index 48a6a72..14994ff 100644
--- a/doc/public/xml/cairo-glitz.xml
+++ b/doc/public/xml/cairo-glitz.xml
@@ -18,8 +18,6 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-glitz">cairo_set_target_glitz</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="glitz-surface-t">glitz_surface_t</link> *surface);
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-glitz-surface-create">cairo_glitz_surface_create</link> (<link linkend="glitz-surface-t">glitz_surface_t</link> *surface);
</synopsis>
</refsynopsisdiv>
@@ -42,22 +40,6 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-glitz"/>cairo_set_target_glitz ()</title>
-<indexterm><primary>cairo_set_target_glitz</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_glitz (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="glitz-surface-t">glitz_surface_t</link> *surface);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
<title><anchor id="cairo-glitz-surface-create"/>cairo_glitz_surface_create ()</title>
<indexterm><primary>cairo_glitz_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_glitz_surface_create (<link linkend="glitz-surface-t">glitz_surface_t</link> *surface);</programlisting>
<para>
diff --git a/doc/public/xml/cairo-matrix.xml b/doc/public/xml/cairo-matrix.xml
index 8f22a40..e92b533 100644
--- a/doc/public/xml/cairo-matrix.xml
+++ b/doc/public/xml/cairo-matrix.xml
@@ -19,43 +19,39 @@
-typedef <link linkend="cairo-matrix-t">cairo_matrix_t</link>;
-<link linkend="cairo-matrix-t">cairo_matrix_t</link>* <link linkend="cairo-matrix-create">cairo_matrix_create</link> (void);
-<link linkend="void">void</link> <link linkend="cairo-matrix-destroy">cairo_matrix_destroy</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-copy">cairo_matrix_copy</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
- const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *other);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-set-identity">cairo_matrix_set_identity</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-set-affine">cairo_matrix_set_affine</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
- <link linkend="double">double</link> a,
- <link linkend="double">double</link> b,
- <link linkend="double">double</link> c,
- <link linkend="double">double</link> d,
+ <link linkend="cairo-matrix-t">cairo_matrix_t</link>;
+<link linkend="void">void</link> <link linkend="cairo-matrix-init">cairo_matrix_init</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+ <link linkend="double">double</link> xx,
+ <link linkend="double">double</link> yx,
+ <link linkend="double">double</link> xy,
+ <link linkend="double">double</link> yy,
+ <link linkend="double">double</link> x0,
+ <link linkend="double">double</link> y0);
+<link linkend="void">void</link> <link linkend="cairo-matrix-init-identity">cairo_matrix_init_identity</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
+<link linkend="void">void</link> <link linkend="cairo-matrix-init-translate">cairo_matrix_init_translate</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> tx,
<link linkend="double">double</link> ty);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-get-affine">cairo_matrix_get_affine</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
- <link linkend="double">double</link> *a,
- <link linkend="double">double</link> *b,
- <link linkend="double">double</link> *c,
- <link linkend="double">double</link> *d,
- <link linkend="double">double</link> *tx,
- <link linkend="double">double</link> *ty);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-translate">cairo_matrix_translate</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<link linkend="void">void</link> <link linkend="cairo-matrix-init-scale">cairo_matrix_init_scale</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+ <link linkend="double">double</link> sx,
+ <link linkend="double">double</link> sy);
+<link linkend="void">void</link> <link linkend="cairo-matrix-init-rotate">cairo_matrix_init_rotate</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+ <link linkend="double">double</link> radians);
+<link linkend="void">void</link> <link linkend="cairo-matrix-translate">cairo_matrix_translate</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> tx,
<link linkend="double">double</link> ty);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-scale">cairo_matrix_scale</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<link linkend="void">void</link> <link linkend="cairo-matrix-scale">cairo_matrix_scale</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> sx,
<link linkend="double">double</link> sy);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-rotate">cairo_matrix_rotate</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<link linkend="void">void</link> <link linkend="cairo-matrix-rotate">cairo_matrix_rotate</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> radians);
<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-invert">cairo_matrix_invert</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-multiply">cairo_matrix_multiply</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *result,
+<link linkend="void">void</link> <link linkend="cairo-matrix-multiply">cairo_matrix_multiply</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *result,
const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *a,
const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *b);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-transform-distance">cairo_matrix_transform_distance</link>
- (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<link linkend="void">void</link> <link linkend="cairo-matrix-transform-distance">cairo_matrix_transform_distance</link> (const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> *dx,
<link linkend="double">double</link> *dy);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-matrix-transform-point">cairo_matrix_transform_point</link> (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<link linkend="void">void</link> <link linkend="cairo-matrix-transform-point">cairo_matrix_transform_point</link> (const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);
</synopsis>
@@ -103,7 +99,11 @@ typedef <link linkend="cairo-matrix-t">cairo_matrix_t</link>;
<title>Details</title>
<refsect2>
<title><anchor id="cairo-matrix-t"/>cairo_matrix_t</title>
-<indexterm><primary>cairo_matrix_t</primary></indexterm><programlisting>typedef struct _cairo_matrix cairo_matrix_t;
+<indexterm><primary>cairo_matrix_t</primary></indexterm><programlisting>typedef struct {
+ double xx; double yx;
+ double xy; double yy;
+ double x0; double y0;
+} cairo_matrix_t;
</programlisting>
<para>
A <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link> holds an affine transformation, such as a scale,
@@ -112,50 +112,50 @@ rotation, or shear, or a combination of those.</para>
</para></refsect2>
<refsect2>
-<title><anchor id="cairo-matrix-create"/>cairo_matrix_create ()</title>
-<indexterm><primary>cairo_matrix_create</primary></indexterm><programlisting><link linkend="cairo-matrix-t">cairo_matrix_t</link>* cairo_matrix_create (void);</programlisting>
-<para>
-Creates a new identity matrix.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created matrix; free with <link linkend="cairo-matrix-destroy"><function>cairo_matrix_destroy()</function></link>,
- or <literal>NULL</literal> if memory couldn't be allocated.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-matrix-destroy"/>cairo_matrix_destroy ()</title>
-<indexterm><primary>cairo_matrix_destroy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_destroy (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<title><anchor id="cairo-matrix-init"/>cairo_matrix_init ()</title>
+<indexterm><primary>cairo_matrix_init</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_init (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+ <link linkend="double">double</link> xx,
+ <link linkend="double">double</link> yx,
+ <link linkend="double">double</link> xy,
+ <link linkend="double">double</link> yy,
+ <link linkend="double">double</link> x0,
+ <link linkend="double">double</link> y0);</programlisting>
<para>
-Frees a matrix created with cairo_matrix_create.</para>
+Sets <parameter>matrix</parameter> to be the affine transformation given by
+<parameter>xx</parameter>, <parameter>yx</parameter>, <parameter>xy</parameter>, <parameter>yy</parameter>, <parameter>x0</parameter>, <parameter>y0</parameter>. The transformation is given
+by:
+<programlisting>
+ x_new = xx * x + xy * y + x0;
+ y_new = yx * x + yy * y + y0;
+</programlisting></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link>
+<listitem><simpara> a cairo_matrix_t
</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-matrix-copy"/>cairo_matrix_copy ()</title>
-<indexterm><primary>cairo_matrix_copy</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_copy (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
- const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *other);</programlisting>
-<para>
-Modifies <parameter>matrix</parameter> to be identical to <parameter>other</parameter>.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link>
+<varlistentry><term><parameter>xx</parameter>&nbsp;:</term>
+<listitem><simpara> xx component of the affine transformation
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>other</parameter>&nbsp;:</term>
-<listitem><simpara> another <link linkend="cairo-"><type>cairo_</type></link>
+<varlistentry><term><parameter>yx</parameter>&nbsp;:</term>
+<listitem><simpara> yx component of the affine transformation
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<varlistentry><term><parameter>xy</parameter>&nbsp;:</term>
+<listitem><simpara> xy component of the affine transformation
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>yy</parameter>&nbsp;:</term>
+<listitem><simpara> yy component of the affine transformation
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>x0</parameter>&nbsp;:</term>
+<listitem><simpara> X translation component of the affine transformation
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>y0</parameter>&nbsp;:</term>
+<listitem><simpara> Y translation component of the affine transformation
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-matrix-set-identity"/>cairo_matrix_set_identity ()</title>
-<indexterm><primary>cairo_matrix_set_identity</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_set_identity (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<title><anchor id="cairo-matrix-init-identity"/>cairo_matrix_init_identity ()</title>
+<indexterm><primary>cairo_matrix_init_identity</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_init_identity (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
<para>
Modifies <parameter>matrix</parameter> to be an identity transformation.</para>
<para>
@@ -164,101 +164,79 @@ Modifies <parameter>matrix</parameter> to be an identity transformation.</para>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link>
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
-</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-matrix-set-affine"/>cairo_matrix_set_affine ()</title>
-<indexterm><primary>cairo_matrix_set_affine</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_set_affine (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
- <link linkend="double">double</link> a,
- <link linkend="double">double</link> b,
- <link linkend="double">double</link> c,
- <link linkend="double">double</link> d,
+<title><anchor id="cairo-matrix-init-translate"/>cairo_matrix_init_translate ()</title>
+<indexterm><primary>cairo_matrix_init_translate</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_init_translate (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> tx,
<link linkend="double">double</link> ty);</programlisting>
<para>
-Sets <parameter>matrix</parameter> to be the affine transformation given by
-<parameter>a</parameter>, b, <parameter>c</parameter>, <parameter>d</parameter>, <parameter>tx</parameter>, <parameter>ty</parameter>. The transformation is given
-by:
-<programlisting>
- x_new = x * a + y * c + tx;
- y_new = x * b + y * d + ty;
-</programlisting></para>
+Initializes <parameter>matrix</parameter> to a transformation that translates by <parameter>tx</parameter> and
+<parameter>ty</parameter> in the X and Y dimensions, respectively.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara> a cairo_matrix_t
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>a</parameter>&nbsp;:</term>
-<listitem><simpara> a component of the affine transformation
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>b</parameter>&nbsp;:</term>
-<listitem><simpara> b component of the affine transformation
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>c</parameter>&nbsp;:</term>
-<listitem><simpara> c component of the affine transformation
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>d</parameter>&nbsp;:</term>
-<listitem><simpara> d component of the affine transformation
-</simpara></listitem></varlistentry>
<varlistentry><term><parameter>tx</parameter>&nbsp;:</term>
-<listitem><simpara> X translation component of the affine transformation
+<listitem><simpara> amount to translate in the X direction
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ty</parameter>&nbsp;:</term>
-<listitem><simpara> Y translation component of the affine transformation
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<listitem><simpara> amount to translate in the Y direction
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-matrix-get-affine"/>cairo_matrix_get_affine ()</title>
-<indexterm><primary>cairo_matrix_get_affine</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_get_affine (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
- <link linkend="double">double</link> *a,
- <link linkend="double">double</link> *b,
- <link linkend="double">double</link> *c,
- <link linkend="double">double</link> *d,
- <link linkend="double">double</link> *tx,
- <link linkend="double">double</link> *ty);</programlisting>
+<title><anchor id="cairo-matrix-init-scale"/>cairo_matrix_init_scale ()</title>
+<indexterm><primary>cairo_matrix_init_scale</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_init_scale (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+ <link linkend="double">double</link> sx,
+ <link linkend="double">double</link> sy);</programlisting>
<para>
-Gets the matrix values for the affine tranformation that <parameter>matrix</parameter> represents.
-See <link linkend="cairo-matrix-set-affine"><function>cairo_matrix_set_affine()</function></link>.</para>
+Initializes <parameter>matrix</parameter> to a transformation that scales by <parameter>sx</parameter> and <parameter>sy</parameter>
+in the X and Y dimensions, respectively.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara> a <parameter>cairo_matrix_t</parameter>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>a</parameter>&nbsp;:</term>
-<listitem><simpara> location to store a component of affine transformation, or <literal>NULL</literal>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>b</parameter>&nbsp;:</term>
-<listitem><simpara> location to store b component of affine transformation, or <literal>NULL</literal>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>c</parameter>&nbsp;:</term>
-<listitem><simpara> location to store c component of affine transformation, or <literal>NULL</literal>
+<listitem><simpara> a cairo_matrix_t
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>d</parameter>&nbsp;:</term>
-<listitem><simpara> location to store d component of affine transformation, or <literal>NULL</literal>
+<varlistentry><term><parameter>sx</parameter>&nbsp;:</term>
+<listitem><simpara> scale factor in the X direction
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>tx</parameter>&nbsp;:</term>
-<listitem><simpara> location to store X-translation component of affine transformation, or <literal>NULL</literal>
+<varlistentry><term><parameter>sy</parameter>&nbsp;:</term>
+<listitem><simpara> scale factor in the Y direction
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>ty</parameter>&nbsp;:</term>
-<listitem><simpara> location to store Y-translation component of affine transformation, or <literal>NULL</literal>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-matrix-init-rotate"/>cairo_matrix_init_rotate ()</title>
+<indexterm><primary>cairo_matrix_init_rotate</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_init_rotate (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+ <link linkend="double">double</link> radians);</programlisting>
+<para>
+Initialized <parameter>matrix</parameter> to a transformation that rotates by <parameter>radians</parameter>.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo_matrix_t
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<varlistentry><term><parameter>radians</parameter>&nbsp;:</term>
+<listitem><simpara> angle of rotation, in radians. The direction of rotation
+is defined such that positive angles rotate in the direction from
+the positive X axis toward the positive Y axis. With the default
+axis orientation of cairo, positive angles rotate in a clockwise
+direction.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-matrix-translate"/>cairo_matrix_translate ()</title>
-<indexterm><primary>cairo_matrix_translate</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_translate (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<indexterm><primary>cairo_matrix_translate</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_translate (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> tx,
<link linkend="double">double</link> ty);</programlisting>
<para>
Applies a translation by <parameter>tx</parameter>, <parameter>ty</parameter> to the transformation in
-<parameter>matrix</parameter>. The new transformation is given by first translating by
-<parameter>tx</parameter>, <parameter>ty</parameter> then applying the original transformation</para>
+<parameter>matrix</parameter>. The effect of the new transformation is to first translate
+the coordinates by <parameter>tx</parameter> and <parameter>ty</parameter>, then apply the original transformation
+to the coordinates.</para>
<para>
</para><variablelist role="params">
@@ -266,23 +244,21 @@ Applies a translation by <parameter>tx</parameter>, <parameter>ty</parameter> to
<listitem><simpara> a cairo_matrix_t
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>tx</parameter>&nbsp;:</term>
-<listitem><simpara> amount to rotate in the X direction
+<listitem><simpara> amount to translate in the X direction
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ty</parameter>&nbsp;:</term>
-<listitem><simpara> amount to rotate in the Y direction
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<listitem><simpara> amount to translate in the Y direction
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-matrix-scale"/>cairo_matrix_scale ()</title>
-<indexterm><primary>cairo_matrix_scale</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_scale (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<indexterm><primary>cairo_matrix_scale</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_scale (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> sx,
<link linkend="double">double</link> sy);</programlisting>
<para>
-Applies scaling by <parameter>tx</parameter>, <parameter>ty</parameter> to the transformation in
-<parameter>matrix</parameter>. The new transformation is given by first scaling by <parameter>sx</parameter>
-and <parameter>sy</parameter> then applying the original transformation</para>
+Applies scaling by <parameter>tx</parameter>, <parameter>ty</parameter> to the transformation in <parameter>matrix</parameter>. The
+effect of the new transformation is to first scale the coordinates
+by <parameter>sx</parameter> and <parameter>sy</parameter>, then apply the original transformation to the coordinates.</para>
<para>
</para><variablelist role="params">
@@ -290,22 +266,21 @@ and <parameter>sy</parameter> then applying the original transformation</para>
<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sx</parameter>&nbsp;:</term>
-<listitem><simpara> Scale factor in the X direction
+<listitem><simpara> scale factor in the X direction
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sy</parameter>&nbsp;:</term>
-<listitem><simpara> Scale factor in the Y direction
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<listitem><simpara> scale factor in the Y direction
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-matrix-rotate"/>cairo_matrix_rotate ()</title>
-<indexterm><primary>cairo_matrix_rotate</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_rotate (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<indexterm><primary>cairo_matrix_rotate</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_rotate (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> radians);</programlisting>
<para>
Applies rotation by <parameter>radians</parameter> to the transformation in
-<parameter>matrix</parameter>. The new transformation is given by first rotating by
-<parameter>radians</parameter> then applying the original transformation</para>
+<parameter>matrix</parameter>. The effect of the new transformation is to first rotate the
+coordinates by <parameter>radians</parameter>, then apply the original transformation
+to the coordinates.</para>
<para>
</para><variablelist role="params">
@@ -313,13 +288,11 @@ Applies rotation by <parameter>radians</parameter> to the transformation in
<listitem><simpara> a <parameter>cairo_matrix_t</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>radians</parameter>&nbsp;:</term>
-<listitem><simpara> angle of rotation, in radians. Angles are defined
- so that an angle of 90 degrees (<literal>M_PI</literal> radians) rotates the
- positive X axis into the positive Y axis. With the default
- Cairo choice of axis orientation, positive rotations are
- clockwise.
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<listitem><simpara> angle of rotation, in radians. The direction of rotation
+is defined such that positive angles rotate in the direction from
+the positive X axis toward the positive Y axis. With the default
+axis orientation of cairo, positive angles rotate in a clockwise
+direction.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -345,14 +318,18 @@ Returns: If <parameter>matrix</parameter> has an inverse, modifies <parameter>ma
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-matrix-multiply"/>cairo_matrix_multiply ()</title>
-<indexterm><primary>cairo_matrix_multiply</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_multiply (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *result,
+<indexterm><primary>cairo_matrix_multiply</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_multiply (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *result,
const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *a,
const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *b);</programlisting>
<para>
Multiplies the affine transformations in <parameter>a</parameter> and <parameter>b</parameter> together
-and stores the result in <parameter>result</parameter>. The resulting transformation
-is given by first applying the transformation in <parameter>b</parameter> then
-applying the transformation in <parameter>a</parameter>.</para>
+and stores the result in <parameter>result</parameter>. The effect of the resulting
+transformation is to first apply the transformation in <parameter>a</parameter> to the
+coordinates and then apply the transformation in <parameter>b</parameter> to the
+coordinates.
+</para>
+<para>
+It is allowable for <parameter>result</parameter> to be identical to either <parameter>a</parameter> or <parameter>b</parameter>.</para>
<para>
</para><variablelist role="params">
@@ -365,18 +342,17 @@ applying the transformation in <parameter>a</parameter>.</para>
<varlistentry><term><parameter>b</parameter>&nbsp;:</term>
<listitem><simpara> a <parameter>cairo_matrix_t</parameter>
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
-</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-matrix-transform-distance"/>cairo_matrix_transform_distance ()</title>
-<indexterm><primary>cairo_matrix_transform_distance</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_transform_distance
- (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<indexterm><primary>cairo_matrix_transform_distance</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_transform_distance (const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> *dx,
<link linkend="double">double</link> *dy);</programlisting>
<para>
-Transforms the vector (<parameter>dx</parameter>,<parameter>dy</parameter>) by <parameter>matrix</parameter>. Translation is
-ignored. In terms of the components of the affine transformation:
+Transforms the distance vector (<parameter>dx</parameter>,<parameter>dy</parameter>) by <parameter>matrix</parameter>. This is
+similar to <link linkend="cairo-matrix-transform"><function>cairo_matrix_transform()</function></link> except that the translation
+components of the transformation are ignored. The calculation of
+the returned vector is as follows:
</para>
<para>
<programlisting>
@@ -396,22 +372,21 @@ to (<parameter>x2</parameter>,<parameter>y2</parameter>) then (<parameter>x1</pa
<listitem><simpara> a <parameter>cairo_matrix_t</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dx</parameter>&nbsp;:</term>
-<listitem><simpara> a distance in the X direction. An in/out parameter
+<listitem><simpara> X component of a distance vector. An in/out parameter
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dy</parameter>&nbsp;:</term>
-<listitem><simpara> a distance in the Y direction. An in/out parameter
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
+<listitem><simpara> Y component of a distance vector. An in/out parameter
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-matrix-transform-point"/>cairo_matrix_transform_point ()</title>
-<indexterm><primary>cairo_matrix_transform_point</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_matrix_transform_point (<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
+<indexterm><primary>cairo_matrix_transform_point</primary></indexterm><programlisting><link linkend="void">void</link> cairo_matrix_transform_point (const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);</programlisting>
<para>
Transforms the point (<parameter>x</parameter>, <parameter>y</parameter>) by <parameter>matrix</parameter>.</para>
<para>
+
</para><variablelist role="params">
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara> a <parameter>cairo_matrix_t</parameter>
@@ -422,8 +397,6 @@ Transforms the point (<parameter>x</parameter>, <parameter>y</parameter>) by <pa
<varlistentry><term><parameter>y</parameter>&nbsp;:</term>
<listitem><simpara> Y position. An in/out parameter
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, always.
-</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
diff --git a/doc/public/xml/cairo-pattern.xml b/doc/public/xml/cairo-pattern.xml
index 307dabd..95103d5 100644
--- a/doc/public/xml/cairo-pattern.xml
+++ b/doc/public/xml/cairo-pattern.xml
@@ -35,21 +35,29 @@ typedef <link linkend="cairo-pattern-t">cairo_pattern_t</link>;
<link linkend="double">double</link> radius1);
<link linkend="void">void</link> <link linkend="cairo-pattern-reference">cairo_pattern_reference</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
<link linkend="void">void</link> <link linkend="cairo-pattern-destroy">cairo_pattern_destroy</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-add-color-stop">cairo_pattern_add_color_stop</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-status">cairo_pattern_status</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
+<link linkend="void">void</link> <link linkend="cairo-pattern-add-color-stop-rgb">cairo_pattern_add_color_stop_rgb</link>
+ (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+ <link linkend="double">double</link> offset,
+ <link linkend="double">double</link> red,
+ <link linkend="double">double</link> green,
+ <link linkend="double">double</link> blue);
+<link linkend="void">void</link> <link linkend="cairo-pattern-add-color-stop-rgba">cairo_pattern_add_color_stop_rgba</link>
+ (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="double">double</link> offset,
<link linkend="double">double</link> red,
<link linkend="double">double</link> green,
<link linkend="double">double</link> blue,
<link linkend="double">double</link> alpha);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-set-matrix">cairo_pattern_set_matrix</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-get-matrix">cairo_pattern_get_matrix</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<link linkend="void">void</link> <link linkend="cairo-pattern-set-matrix">cairo_pattern_set_matrix</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
+<link linkend="void">void</link> <link linkend="cairo-pattern-get-matrix">cairo_pattern_get_matrix</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-set-extend">cairo_pattern_set_extend</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<link linkend="void">void</link> <link linkend="cairo-pattern-set-extend">cairo_pattern_set_extend</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="cairo-extend-t">cairo_extend_t</link> extend);
<link linkend="cairo-extend-t">cairo_extend_t</link> <link linkend="cairo-pattern-get-extend">cairo_pattern_get_extend</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-set-filter">cairo_pattern_set_filter</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<link linkend="void">void</link> <link linkend="cairo-pattern-set-filter">cairo_pattern_set_filter</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="cairo-filter-t">cairo_filter_t</link> filter);
<link linkend="cairo-filter-t">cairo_filter_t</link> <link linkend="cairo-pattern-get-filter">cairo_pattern_get_filter</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
</synopsis>
@@ -181,8 +189,53 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-pattern-add-color-stop"/>cairo_pattern_add_color_stop ()</title>
-<indexterm><primary>cairo_pattern_add_color_stop</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_pattern_add_color_stop (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<title><anchor id="cairo-pattern-status"/>cairo_pattern_status ()</title>
+<indexterm><primary>cairo_pattern_status</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_pattern_status (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);</programlisting>
+<para>
+Checks whether an error has previously occurred for this
+pattern.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>pattern</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> or <literal>CAIRO_STATUS_NO_MEMORY</literal>
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-pattern-add-color-stop-rgb"/>cairo_pattern_add_color_stop_rgb ()</title>
+<indexterm><primary>cairo_pattern_add_color_stop_rgb</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_add_color_stop_rgb
+ (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+ <link linkend="double">double</link> offset,
+ <link linkend="double">double</link> red,
+ <link linkend="double">double</link> green,
+ <link linkend="double">double</link> blue);</programlisting>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>pattern</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>offset</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>red</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>green</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>blue</parameter>&nbsp;:</term>
+<listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-pattern-add-color-stop-rgba"/>cairo_pattern_add_color_stop_rgba ()</title>
+<indexterm><primary>cairo_pattern_add_color_stop_rgba</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_add_color_stop_rgba
+ (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="double">double</link> offset,
<link linkend="double">double</link> red,
<link linkend="double">double</link> green,
@@ -208,16 +261,14 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter>&nbsp;:</term>
<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-pattern-set-matrix"/>cairo_pattern_set_matrix ()</title>
-<indexterm><primary>cairo_pattern_set_matrix</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_pattern_set_matrix (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<indexterm><primary>cairo_pattern_set_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_set_matrix (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
<para>
</para><variablelist role="params">
@@ -226,15 +277,13 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-pattern-get-matrix"/>cairo_pattern_get_matrix ()</title>
-<indexterm><primary>cairo_pattern_get_matrix</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_pattern_get_matrix (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<indexterm><primary>cairo_pattern_get_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_get_matrix (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
<para>
@@ -245,10 +294,6 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-extend-t"/>enum cairo_extend_t</title>
@@ -263,7 +308,7 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</para></refsect2>
<refsect2>
<title><anchor id="cairo-pattern-set-extend"/>cairo_pattern_set_extend ()</title>
-<indexterm><primary>cairo_pattern_set_extend</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_pattern_set_extend (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<indexterm><primary>cairo_pattern_set_extend</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_set_extend (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="cairo-extend-t">cairo_extend_t</link> extend);</programlisting>
<para>
@@ -273,8 +318,6 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extend</parameter>&nbsp;:</term>
<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
@@ -295,7 +338,7 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-pattern-set-filter"/>cairo_pattern_set_filter ()</title>
-<indexterm><primary>cairo_pattern_set_filter</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_pattern_set_filter (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
+<indexterm><primary>cairo_pattern_set_filter</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_set_filter (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern,
<link linkend="cairo-filter-t">cairo_filter_t</link> filter);</programlisting>
<para>
@@ -305,8 +348,6 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>;
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>filter</parameter>&nbsp;:</term>
<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
diff --git a/doc/public/xml/cairo-pdf.xml b/doc/public/xml/cairo-pdf.xml
index 6d5801a..7f775da 100644
--- a/doc/public/xml/cairo-pdf.xml
+++ b/doc/public/xml/cairo-pdf.xml
@@ -18,17 +18,17 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-pdf">cairo_set_target_pdf</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);
-<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-pdf-surface-create">cairo_pdf_surface_create</link> (<link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-pdf-surface-create">cairo_pdf_surface_create</link> (const <link linkend="char">char</link> *filename,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-pdf-surface-create-for-stream">cairo_pdf_surface_create_for_stream</link>
+ (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
+ <link linkend="void">void</link> *closure,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);
+<link linkend="void">void</link> <link linkend="cairo-pdf-surface-set-dpi">cairo_pdf_surface_set_dpi</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x_dpi,
+ <link linkend="double">double</link> y_dpi);
</synopsis>
</refsynopsisdiv>
@@ -50,63 +50,70 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-pdf"/>cairo_set_target_pdf ()</title>
-<indexterm><primary>cairo_set_target_pdf</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_pdf (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);</programlisting>
+<title><anchor id="cairo-pdf-surface-create"/>cairo_pdf_surface_create ()</title>
+<indexterm><primary>cairo_pdf_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_pdf_surface_create (const <link linkend="char">char</link> *filename,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);</programlisting>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width_inches</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>width_in_points</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height_inches</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>height_in_points</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>x_pixels_per_inch</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>y_pixels_per_inch</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-pdf-surface-create"/>cairo_pdf_surface_create ()</title>
-<indexterm><primary>cairo_pdf_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_pdf_surface_create (<link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);</programlisting>
+<title><anchor id="cairo-pdf-surface-create-for-stream"/>cairo_pdf_surface_create_for_stream ()</title>
+<indexterm><primary>cairo_pdf_surface_create_for_stream</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_pdf_surface_create_for_stream
+ (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
+ <link linkend="void">void</link> *closure,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);</programlisting>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>write_func</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width_inches</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height_inches</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>width_in_points</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>x_pixels_per_inch</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>height_in_points</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>y_pixels_per_inch</parameter>&nbsp;:</term>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-pdf-surface-set-dpi"/>cairo_pdf_surface_set_dpi ()</title>
+<indexterm><primary>cairo_pdf_surface_set_dpi</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pdf_surface_set_dpi (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x_dpi,
+ <link linkend="double">double</link> y_dpi);</programlisting>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+<varlistentry><term><parameter>x_dpi</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>y_dpi</parameter>&nbsp;:</term>
+<listitem><simpara>
</simpara></listitem></varlistentry>
diff --git a/doc/public/xml/cairo-png.xml b/doc/public/xml/cairo-png.xml
index f4021b4..0de5dea 100644
--- a/doc/public/xml/cairo-png.xml
+++ b/doc/public/xml/cairo-png.xml
@@ -18,15 +18,17 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-png">cairo_set_target_png</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);
-<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-png-surface-create">cairo_png_surface_create</link> (<link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-image-surface-create-from-png">cairo_image_surface_create_from_png</link>
+ (const <link linkend="char">char</link> *filename);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-image-surface-create-from-png-stream">cairo_image_surface_create_from_png_stream</link>
+ (<link linkend="cairo-read-func-t">cairo_read_func_t</link> read_func,
+ <link linkend="void">void</link> *closure);
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-write-to-png">cairo_surface_write_to_png</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ const <link linkend="char">char</link> *filename);
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-write-to-png-stream">cairo_surface_write_to_png_stream</link>
+ (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
+ <link linkend="void">void</link> *closure);
</synopsis>
</refsynopsisdiv>
@@ -48,57 +50,94 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-png"/>cairo_set_target_png ()</title>
-<indexterm><primary>cairo_set_target_png</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_png (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);</programlisting>
+<title><anchor id="cairo-image-surface-create-from-png"/>cairo_image_surface_create_from_png ()</title>
+<indexterm><primary>cairo_image_surface_create_from_png</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_image_surface_create_from_png
+ (const <link linkend="char">char</link> *filename);</programlisting>
+<para>
+Creates a new image surface and initializes the contents to the
+given PNG file.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
+<listitem><simpara> name of PNG file to load
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> initialized with the contents
+of the PNG file or <literal>NULL</literal> if the file is not a valid PNG file or
+memory could not be allocated for the operation.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
-<listitem><simpara>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-image-surface-create-from-png-stream"/>cairo_image_surface_create_from_png_stream ()</title>
+<indexterm><primary>cairo_image_surface_create_from_png_stream</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_image_surface_create_from_png_stream
+ (<link linkend="cairo-read-func-t">cairo_read_func_t</link> read_func,
+ <link linkend="void">void</link> *closure);</programlisting>
+<para>
+Creates a new image surface from PNG data read incrementally
+via the <parameter>read_func</parameter> function.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>read_func</parameter>&nbsp;:</term>
+<listitem><simpara> function called to read the data of the file
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
+<listitem><simpara> data to pass to <parameter>read_func</parameter>.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> initialized with the contents
+of the PNG file or <literal>NULL</literal> if the data read is not a valid PNG image or
+memory could not be allocated for the operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-png-surface-create"/>cairo_png_surface_create ()</title>
-<indexterm><primary>cairo_png_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_png_surface_create (<link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);</programlisting>
+<title><anchor id="cairo-surface-write-to-png"/>cairo_surface_write_to_png ()</title>
+<indexterm><primary>cairo_surface_write_to_png</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_write_to_png (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ const <link linkend="char">char</link> *filename);</programlisting>
+<para>
+Writes the contents of <parameter>surface</parameter> to a new file <parameter>filename</parameter> as a PNG
+image.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> with pixel contents
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
+<listitem><simpara> the name of a file to write to
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> CAIRO_STATUS_SUCCESS if the PNG file was written
+successfully. Otherwise, CAIRO_STATUS_NO_MEMORY if memory could not
+be allocated for the operation or
+CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
+pixel contents, or CAIRO_STATUS_WRITE_ERROR if an I/O error occurs
+while attempting to write the file.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-surface-write-to-png-stream"/>cairo_surface_write_to_png_stream ()</title>
+<indexterm><primary>cairo_surface_write_to_png_stream</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_write_to_png_stream
+ (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
+ <link linkend="void">void</link> *closure);</programlisting>
+<para>
+Writes the image surface to the write function.</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> with pixel contents
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>write_func</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
+<listitem><simpara> closure data for the write function
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> CAIRO_STATUS_SUCCESS if the PNG file was written
+successfully. Otherwise, CAIRO_STATUS_NO_MEMORY is returned if
+memory could not be allocated for the operation,
+CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
+pixel contents.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
diff --git a/doc/public/xml/cairo-ps.xml b/doc/public/xml/cairo-ps.xml
index 7d7219c..5c17f9f 100644
--- a/doc/public/xml/cairo-ps.xml
+++ b/doc/public/xml/cairo-ps.xml
@@ -18,17 +18,17 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-ps">cairo_set_target_ps</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);
-<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-ps-surface-create">cairo_ps_surface_create</link> (<link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-ps-surface-create">cairo_ps_surface_create</link> (const <link linkend="char">char</link> *filename,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-ps-surface-create-for-stream">cairo_ps_surface_create_for_stream</link>
+ (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
+ <link linkend="void">void</link> *closure,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);
+<link linkend="void">void</link> <link linkend="cairo-ps-surface-set-dpi">cairo_ps_surface_set_dpi</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x_dpi,
+ <link linkend="double">double</link> y_dpi);
</synopsis>
</refsynopsisdiv>
@@ -50,68 +50,70 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-ps"/>cairo_set_target_ps ()</title>
-<indexterm><primary>cairo_set_target_ps</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_ps (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);</programlisting>
-<para>
-Directs output for a <link linkend="cairo-t"><type>cairo_t</type></link> to a postscript file. The file must
-be kept open until the <link linkend="cairo-t"><type>cairo_t</type></link> is destroyed or set to have a
-different target, and then must be closed by the application.</para>
+<title><anchor id="cairo-ps-surface-create"/>cairo_ps_surface_create ()</title>
+<indexterm><primary>cairo_ps_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_ps_surface_create (const <link linkend="char">char</link> *filename,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);</programlisting>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
-<listitem><simpara> an open, writeable file
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width_inches</parameter>&nbsp;:</term>
-<listitem><simpara> width of the output page, in inches
+<varlistentry><term><parameter>filename</parameter>&nbsp;:</term>
+<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height_inches</parameter>&nbsp;:</term>
-<listitem><simpara> height of the output page, in inches
+<varlistentry><term><parameter>width_in_points</parameter>&nbsp;:</term>
+<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>x_pixels_per_inch</parameter>&nbsp;:</term>
-<listitem><simpara> X resolution to use for image fallbacks;
- not all Cairo drawing can be represented in a postscript
- file, so Cairo will write out images for some portions
- of the output.
+<varlistentry><term><parameter>height_in_points</parameter>&nbsp;:</term>
+<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>y_pixels_per_inch</parameter>&nbsp;:</term>
-<listitem><simpara> Y resolution to use for image fallbacks.
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+
+
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-ps-surface-create"/>cairo_ps_surface_create ()</title>
-<indexterm><primary>cairo_ps_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_ps_surface_create (<link linkend="FILE:CAPS">FILE</link> *file,
- <link linkend="double">double</link> width_inches,
- <link linkend="double">double</link> height_inches,
- <link linkend="double">double</link> x_pixels_per_inch,
- <link linkend="double">double</link> y_pixels_per_inch);</programlisting>
+<title><anchor id="cairo-ps-surface-create-for-stream"/>cairo_ps_surface_create_for_stream ()</title>
+<indexterm><primary>cairo_ps_surface_create_for_stream</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_ps_surface_create_for_stream
+ (<link linkend="cairo-write-func-t">cairo_write_func_t</link> write_func,
+ <link linkend="void">void</link> *closure,
+ <link linkend="double">double</link> width_in_points,
+ <link linkend="double">double</link> height_in_points);</programlisting>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>write_func</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width_inches</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>width_in_points</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height_inches</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>height_in_points</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>x_pixels_per_inch</parameter>&nbsp;:</term>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-ps-surface-set-dpi"/>cairo_ps_surface_set_dpi ()</title>
+<indexterm><primary>cairo_ps_surface_set_dpi</primary></indexterm><programlisting><link linkend="void">void</link> cairo_ps_surface_set_dpi (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x_dpi,
+ <link linkend="double">double</link> y_dpi);</programlisting>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>y_pixels_per_inch</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>x_dpi</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+<varlistentry><term><parameter>y_dpi</parameter>&nbsp;:</term>
+<listitem><simpara>
</simpara></listitem></varlistentry>
diff --git a/doc/public/xml/cairo-quartz.xml b/doc/public/xml/cairo-quartz.xml
index eda822f..21c597c 100644
--- a/doc/public/xml/cairo-quartz.xml
+++ b/doc/public/xml/cairo-quartz.xml
@@ -18,10 +18,6 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-quartz-context">cairo_set_target_quartz_context</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="CGContextRef">CGContextRef</link> context,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-quartz-surface-create">cairo_quartz_surface_create</link>
(<link linkend="CGContextRef">CGContextRef</link> context,
<link linkend="int">int</link> width,
@@ -47,30 +43,6 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-quartz-context"/>cairo_set_target_quartz_context ()</title>
-<indexterm><primary>cairo_set_target_quartz_context</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_quartz_context (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="CGContextRef">CGContextRef</link> context,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>context</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
<title><anchor id="cairo-quartz-surface-create"/>cairo_quartz_surface_create ()</title>
<indexterm><primary>cairo_quartz_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_quartz_surface_create
(<link linkend="CGContextRef">CGContextRef</link> context,
diff --git a/doc/public/xml/cairo-surface.xml b/doc/public/xml/cairo-surface.xml
index a029810..931efe2 100644
--- a/doc/public/xml/cairo-surface.xml
+++ b/doc/public/xml/cairo-surface.xml
@@ -19,12 +19,6 @@
typedef <link linkend="cairo-surface-t">cairo_surface_t</link>;
-<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-surface-create-for-image">cairo_surface_create_for_image</link>
- (<link linkend="char">char</link> *data,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height,
- <link linkend="int">int</link> stride);
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-surface-create-similar">cairo_surface_create_similar</link>
(<link linkend="cairo-surface-t">cairo_surface_t</link> *other,
<link linkend="cairo-format-t">cairo_format_t</link> format,
@@ -32,15 +26,16 @@ typedef <link linkend="cairo-surface-t">cairo_surface_t</link>;
<link linkend="int">int</link> height);
<link linkend="void">void</link> <link linkend="cairo-surface-reference">cairo_surface_reference</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
<link linkend="void">void</link> <link linkend="cairo-surface-destroy">cairo_surface_destroy</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-set-repeat">cairo_surface_set_repeat</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="int">int</link> repeat);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-set-matrix">cairo_surface_set_matrix</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-get-matrix">cairo_surface_get_matrix</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-set-filter">cairo_surface_set_filter</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="cairo-filter-t">cairo_filter_t</link> filter);
-<link linkend="cairo-filter-t">cairo_filter_t</link> <link linkend="cairo-surface-get-filter">cairo_surface_get_filter</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-finish">cairo_surface_finish</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-set-user-data">cairo_surface_set_user_data</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key,
+ <link linkend="void">void</link> *user_data,
+ <link linkend="cairo-destroy-func-t">cairo_destroy_func_t</link> destroy);
+<link linkend="void">void</link>* <link linkend="cairo-surface-get-user-data">cairo_surface_get_user_data</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key);
+<link linkend="void">void</link> <link linkend="cairo-surface-set-device-offset">cairo_surface_set_device_offset</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x_offset,
+ <link linkend="double">double</link> y_offset);
</synopsis>
</refsynopsisdiv>
@@ -79,37 +74,6 @@ Memory management of <link linkend="cairo-surface-t"><type>cairo_surface_t</type
</para></refsect2>
<refsect2>
-<title><anchor id="cairo-surface-create-for-image"/>cairo_surface_create_for_image ()</title>
-<indexterm><primary>cairo_surface_create_for_image</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_surface_create_for_image
- (<link linkend="char">char</link> *data,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height,
- <link linkend="int">int</link> stride);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>stride</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
<title><anchor id="cairo-surface-create-similar"/>cairo_surface_create_similar ()</title>
<indexterm><primary>cairo_surface_create_similar</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_surface_create_similar
(<link linkend="cairo-surface-t">cairo_surface_t</link> *other,
@@ -161,89 +125,115 @@ Memory management of <link linkend="cairo-surface-t"><type>cairo_surface_t</type
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-surface-set-repeat"/>cairo_surface_set_repeat ()</title>
-<indexterm><primary>cairo_surface_set_repeat</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_set_repeat (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="int">int</link> repeat);</programlisting>
+<title><anchor id="cairo-surface-finish"/>cairo_surface_finish ()</title>
+<indexterm><primary>cairo_surface_finish</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_finish (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
+<para>
+This function finishes the surface and drops all references to
+external resources. For example, for the Xlib backend it means
+that cairo will no longer access the drawable, which can be freed.
+After calling <link linkend="cairo-surface-finish"><function>cairo_surface_finish()</function></link> the only valid operations on a
+surface are getting and setting user data and referencing and
+destroying it. Further drawing the the surface will not affect the
+surface but set the surface status to
+CAIRO_STATUS_SURFACE_FINISHED.
+</para>
+<para>
+When the last call to <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> decreases the
+reference count to zero, cairo will call <link linkend="cairo-surface-finish"><function>cairo_surface_finish()</function></link> if
+it hasn't been called already, before freeing the resources
+associated with the surface.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> the <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> to finish
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>repeat</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> CAIRO_STATUS_SUCCESS if the surface was finished
+successfully, otherwise CAIRO_STATUS_NO_MEMORY or
+CAIRO_STATUS_WRITE_ERROR.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-surface-set-matrix"/>cairo_surface_set_matrix ()</title>
-<indexterm><primary>cairo_surface_set_matrix</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_set_matrix (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<title><anchor id="cairo-surface-set-user-data"/>cairo_surface_set_user_data ()</title>
+<indexterm><primary>cairo_surface_set_user_data</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_set_user_data (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key,
+ <link linkend="void">void</link> *user_data,
+ <link linkend="cairo-destroy-func-t">cairo_destroy_func_t</link> destroy);</programlisting>
+<para>
+Attach user data to <parameter>surface</parameter>. To remove user data from a surface,
+call this function with the key that was used to set it and <literal>NULL</literal>
+for <parameter>data</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
+<listitem><simpara> the address of a <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> to attach the user data to
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
+<listitem><simpara> the user data to attach to the surface
</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-surface-get-matrix"/>cairo_surface_get_matrix ()</title>
-<indexterm><primary>cairo_surface_get_matrix</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_get_matrix (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>destroy</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> which will be called when the
+surface is destroyed or when new user data is attached using the
+same key.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> or <literal>CAIRO_STATUS_NO_MEMORY</literal> if a
+slot could not be allocated for the user data.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-surface-set-filter"/>cairo_surface_set_filter ()</title>
-<indexterm><primary>cairo_surface_set_filter</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_set_filter (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="cairo-filter-t">cairo_filter_t</link> filter);</programlisting>
+<title><anchor id="cairo-surface-get-user-data"/>cairo_surface_get_user_data ()</title>
+<indexterm><primary>cairo_surface_get_user_data</primary></indexterm><programlisting><link linkend="void">void</link>* cairo_surface_get_user_data (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key);</programlisting>
+<para>
+Return user data previously attached to <parameter>surface</parameter> using the specified
+key. If no user data has been attached with the given key this
+function returns <literal>NULL</literal>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>filter</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>key</parameter>&nbsp;:</term>
+<listitem><simpara> the address of the <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> the user data was
+attached to
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the user data previously attached or <literal>NULL</literal>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-surface-get-filter"/>cairo_surface_get_filter ()</title>
-<indexterm><primary>cairo_surface_get_filter</primary></indexterm><programlisting><link linkend="cairo-filter-t">cairo_filter_t</link> cairo_surface_get_filter (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
+<title><anchor id="cairo-surface-set-device-offset"/>cairo_surface_set_device_offset ()</title>
+<indexterm><primary>cairo_surface_set_device_offset</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_set_device_offset (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x_offset,
+ <link linkend="double">double</link> y_offset);</programlisting>
+<para>
+Sets an offset that is added to the device coordinates determined
+by the CTM when drawing to <parameter>surface</parameter>. One use case for this function
+is when we want to create a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> that redirects drawing
+for a portion of an onscreen surface to an offscreen surface in a
+way that is completely invisible to the user of the cairo
+API. Setting a transformation via <link linkend="cairo-translate"><function>cairo_translate()</function></link> isn't
+sufficient to do this, since functions like
+<link linkend="cairo-device-to-user"><function>cairo_device_to_user()</function></link> will expose the hidden offset.
+</para>
+<para>
+Note that the offset only affects drawing to the surface, not using
+the surface in a surface pattern.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><parameter>x_offset</parameter>&nbsp;:</term>
+<listitem><simpara> the offset in the X direction, in device units
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>y_offset</parameter>&nbsp;:</term>
+<listitem><simpara> the offset in the Y direction, in device units
</simpara></listitem></varlistentry>
</variablelist></refsect2>
diff --git a/doc/public/xml/cairo-win3.xml b/doc/public/xml/cairo-win3.xml
deleted file mode 100644
index 91cbcd6..0000000
--- a/doc/public/xml/cairo-win3.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
-<refentry id="cairo-Microsoft-Windows-Backend">
-<refmeta>
-<refentrytitle>Microsoft Windows Backend</refentrytitle>
-<manvolnum>3</manvolnum>
-<refmiscinfo>CAIRO Library</refmiscinfo>
-</refmeta>
-
-<refnamediv>
-<refname>Microsoft Windows Backend</refname><refpurpose></refpurpose>
-</refnamediv>
-
-<refsynopsisdiv><title>Synopsis</title>
-
-<synopsis>
-
-
-
-<link linkend="void">void</link> <link linkend="cairo-set-target-win32">cairo_set_target_win32</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="HDC:CAPS">HDC</link> hdc);
-<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-win32-surface-create">cairo_win32_surface_create</link> (<link linkend="HDC:CAPS">HDC</link> hdc);
-<link linkend="cairo-font-t">cairo_font_t</link>* <link linkend="cairo-win32-font-create-for-logfontw">cairo_win32_font_create_for_logfontw</link>
- (<link linkend="LOGFONTW:CAPS">LOGFONTW</link> *logfont,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-win32-font-select-font">cairo_win32_font_select_font</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font,
- <link linkend="HDC:CAPS">HDC</link> hdc);
-<link linkend="void">void</link> <link linkend="cairo-win32-font-done-font">cairo_win32_font_done_font</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font);
-<link linkend="double">double</link> <link linkend="cairo-win32-font-get-scale-factor">cairo_win32_font_get_scale_factor</link>
- (<link linkend="cairo-font-t">cairo_font_t</link> *font);
-</synopsis>
-</refsynopsisdiv>
-
-
-
-
-
-
-
-
-
-<refsect1>
-<title>Description</title>
-<para>
-
-</para>
-</refsect1>
-
-<refsect1>
-<title>Details</title>
-<refsect2>
-<title><anchor id="cairo-set-target-win32"/>cairo_set_target_win32 ()</title>
-<indexterm><primary>cairo_set_target_win32</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_win32 (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="HDC:CAPS">HDC</link> hdc);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>hdc</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-win32-surface-create"/>cairo_win32_surface_create ()</title>
-<indexterm><primary>cairo_win32_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_win32_surface_create (<link linkend="HDC:CAPS">HDC</link> hdc);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>hdc</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-win32-font-create-for-logfontw"/>cairo_win32_font_create_for_logfontw ()</title>
-<indexterm><primary>cairo_win32_font_create_for_logfontw</primary></indexterm><programlisting><link linkend="cairo-font-t">cairo_font_t</link>* cairo_win32_font_create_for_logfontw
- (<link linkend="LOGFONTW:CAPS">LOGFONTW</link> *logfont,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);</programlisting>
-<para>
-Creates a new font for the Win32 font backend based on a
-<link linkend="LOGFONT:CAPS"><type>LOGFONT</type></link>. This font can then be used with
-<link linkend="cairo-set-font"><function>cairo_set_font()</function></link>, <link linkend="cairo-font-glyph-extents"><function>cairo_font_glyph_extents()</function></link>, or FreeType backend
-specific functions like <link linkend="cairo-win32-font-select-font"><function>cairo_win32_font_select_font()</function></link>.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>logfont</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="LOGFONTW:CAPS"><type>LOGFONTW</type></link> structure specifying the font to use.
- The lfHeight, lfWidth, lfOrientation and lfEscapement
- fields of this structure are ignored; information from
- <parameter>scale</parameter> will be used instead.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>scale</parameter>&nbsp;:</term>
-<listitem><simpara> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-t"><type>cairo_font_t</type></link>. Free with
- <link linkend="cairo-font-destroy"><function>cairo_font_destroy()</function></link> when you are done using it.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-win32-font-select-font"/>cairo_win32_font_select_font ()</title>
-<indexterm><primary>cairo_win32_font_select_font</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_win32_font_select_font (<link linkend="cairo-font-t">cairo_font_t</link> *font,
- <link linkend="HDC:CAPS">HDC</link> hdc);</programlisting>
-<para>
-Selects the font into the given device context and changes the
-map mode and world transformation of the device context to match
-that of the font. This function is intended for use when using
-layout APIs such as Uniscribe to do text layout with the
-Cairo font. After finishing using the device context, you must call
-<link linkend="cairo-win32-font-done-font"><function>cairo_win32_font_done_font()</function></link> to release any resources allocated
-by this function.
-</para>
-<para>
-See <link linkend="cairo-win32-font-get-scale-factor"><function>cairo_win32_font_get_scale_factor()</function></link> for converting logical
-coordinates from the device context to font space.
-</para>
-<para>
-Normally, calls to <link linkend="SaveDC"><function>SaveDC()</function></link> and <link linkend="RestoreDC"><function>RestoreDC()</function></link> would be made around
-the use of this function to preserve the original graphics state.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the Win32 font backend. Such an
- object can be created with <link linkend="cairo-win32-font-create-for-logfontw"><function>cairo_win32_font_create_for_logfontw()</function></link>.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>hdc</parameter>&nbsp;:</term>
-<listitem><simpara> a device context
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> if the operation succeeded.
- otherwise an error such as <literal>CAIRO_STATUS_NO_MEMORY</literal> and
- the device context is unchanged.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-win32-font-done-font"/>cairo_win32_font_done_font ()</title>
-<indexterm><primary>cairo_win32_font_done_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_win32_font_done_font (<link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
-<para>
-Releases any resources allocated by <link linkend="cairo-win32-font-select-font"><function>cairo_win32_font_select_font()</function></link></para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the Win32 font backend.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-win32-font-get-scale-factor"/>cairo_win32_font_get_scale_factor ()</title>
-<indexterm><primary>cairo_win32_font_get_scale_factor</primary></indexterm><programlisting><link linkend="double">double</link> cairo_win32_font_get_scale_factor
- (<link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
-<para>
-Gets a scale factor between logical coordinates in the coordinate
-space used by <link linkend="cairo-win32-font-select-font"><function>cairo_win32_font_select_font()</function></link> and font space coordinates.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the Win32 font backend
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> factor to multiply logical units by to get font space
- coordinates.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-
-</refsect1>
-
-
-
-
-</refentry>
diff --git a/doc/public/xml/cairo-win32.xml b/doc/public/xml/cairo-win32.xml
index 4c31db5..222afd9 100644
--- a/doc/public/xml/cairo-win32.xml
+++ b/doc/public/xml/cairo-win32.xml
@@ -18,17 +18,16 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-win32">cairo_set_target_win32</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="HDC:CAPS">HDC</link> hdc);
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-win32-surface-create">cairo_win32_surface_create</link> (<link linkend="HDC:CAPS">HDC</link> hdc);
-<link linkend="cairo-font-t">cairo_font_t</link>* <link linkend="cairo-win32-font-create-for-logfontw">cairo_win32_font_create_for_logfontw</link>
- (<link linkend="LOGFONTW:CAPS">LOGFONTW</link> *logfont,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-win32-font-select-font">cairo_win32_font_select_font</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font,
+<link linkend="cairo-font-face-t">cairo_font_face_t</link>* <link linkend="cairo-win32-font-face-create-for-logfontw">cairo_win32_font_face_create_for_logfontw</link>
+ (<link linkend="LOGFONTW:CAPS">LOGFONTW</link> *logfont);
+<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-win32-scaled-font-select-font">cairo_win32_scaled_font_select_font</link>
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
<link linkend="HDC:CAPS">HDC</link> hdc);
-<link linkend="void">void</link> <link linkend="cairo-win32-font-done-font">cairo_win32_font_done_font</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font);
-<link linkend="double">double</link> <link linkend="cairo-win32-font-get-scale-factor">cairo_win32_font_get_scale_factor</link>
- (<link linkend="cairo-font-t">cairo_font_t</link> *font);
+<link linkend="void">void</link> <link linkend="cairo-win32-scaled-font-done-font">cairo_win32_scaled_font_done_font</link>
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
+<link linkend="double">double</link> <link linkend="cairo-win32-scaled-font-get-metrics-factor">cairo_win32_scaled_font_get_metrics_factor</link>
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);
</synopsis>
</refsynopsisdiv>
@@ -50,22 +49,6 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-win32"/>cairo_set_target_win32 ()</title>
-<indexterm><primary>cairo_set_target_win32</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_win32 (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="HDC:CAPS">HDC</link> hdc);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>hdc</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
<title><anchor id="cairo-win32-surface-create"/>cairo_win32_surface_create ()</title>
<indexterm><primary>cairo_win32_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_win32_surface_create (<link linkend="HDC:CAPS">HDC</link> hdc);</programlisting>
<para>
@@ -80,49 +63,43 @@
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-win32-font-create-for-logfontw"/>cairo_win32_font_create_for_logfontw ()</title>
-<indexterm><primary>cairo_win32_font_create_for_logfontw</primary></indexterm><programlisting><link linkend="cairo-font-t">cairo_font_t</link>* cairo_win32_font_create_for_logfontw
- (<link linkend="LOGFONTW:CAPS">LOGFONTW</link> *logfont,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *scale);</programlisting>
+<title><anchor id="cairo-win32-font-face-create-for-logfontw"/>cairo_win32_font_face_create_for_logfontw ()</title>
+<indexterm><primary>cairo_win32_font_face_create_for_logfontw</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link>* cairo_win32_font_face_create_for_logfontw
+ (<link linkend="LOGFONTW:CAPS">LOGFONTW</link> *logfont);</programlisting>
<para>
Creates a new font for the Win32 font backend based on a
<link linkend="LOGFONT:CAPS"><type>LOGFONT</type></link>. This font can then be used with
-<link linkend="cairo-set-font"><function>cairo_set_font()</function></link>, <link linkend="cairo-font-glyph-extents"><function>cairo_font_glyph_extents()</function></link>, or FreeType backend
-specific functions like <link linkend="cairo-win32-font-select-font"><function>cairo_win32_font_select_font()</function></link>.</para>
+<link linkend="cairo-set-font-face"><function>cairo_set_font_face()</function></link> or <link linkend="cairo-font-create"><function>cairo_font_create()</function></link>. The <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>
+returned from <link linkend="cairo-font-create"><function>cairo_font_create()</function></link> is also for the Win32 backend
+and can be used with functions such as <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>logfont</parameter>&nbsp;:</term>
<listitem><simpara> A <link linkend="LOGFONTW:CAPS"><type>LOGFONTW</type></link> structure specifying the font to use.
The lfHeight, lfWidth, lfOrientation and lfEscapement
- fields of this structure are ignored; information from
- <parameter>scale</parameter> will be used instead.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>scale</parameter>&nbsp;:</term>
-<listitem><simpara> The scale at which this font will be used. The
- scale is given by multiplying the font matrix (see
- <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link>) by the current transformation matrix.
- The translation elements of the resulting matrix are ignored.
+ fields of this structure are ignored.
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-t"><type>cairo_font_t</type></link>. Free with
- <link linkend="cairo-font-destroy"><function>cairo_font_destroy()</function></link> when you are done using it.
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly created <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. Free with
+ <link linkend="cairo-font-face-destroy"><function>cairo_font_face_destroy()</function></link> when you are done using it.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-win32-font-select-font"/>cairo_win32_font_select_font ()</title>
-<indexterm><primary>cairo_win32_font_select_font</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_win32_font_select_font (<link linkend="cairo-font-t">cairo_font_t</link> *font,
+<title><anchor id="cairo-win32-scaled-font-select-font"/>cairo_win32_scaled_font_select_font ()</title>
+<indexterm><primary>cairo_win32_scaled_font_select_font</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_win32_scaled_font_select_font
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font,
<link linkend="HDC:CAPS">HDC</link> hdc);</programlisting>
<para>
Selects the font into the given device context and changes the
map mode and world transformation of the device context to match
that of the font. This function is intended for use when using
layout APIs such as Uniscribe to do text layout with the
-Cairo font. After finishing using the device context, you must call
-<link linkend="cairo-win32-font-done-font"><function>cairo_win32_font_done_font()</function></link> to release any resources allocated
+cairo font. After finishing using the device context, you must call
+<link linkend="cairo-win32-scaled-font-done-font"><function>cairo_win32_scaled_font_done_font()</function></link> to release any resources allocated
by this function.
</para>
<para>
-See <link linkend="cairo-win32-font-get-scale-factor"><function>cairo_win32_font_get_scale_factor()</function></link> for converting logical
+See <link linkend="cairo-win32-scaled-font-get-metrics-factor"><function>cairo_win32_scaled_font_get_metrics_factor()</function></link> for converting logical
coordinates from the device context to font space.
</para>
<para>
@@ -131,9 +108,9 @@ the use of this function to preserve the original graphics state.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the Win32 font backend. Such an
- object can be created with <link linkend="cairo-win32-font-create-for-logfontw"><function>cairo_win32_font_create_for_logfontw()</function></link>.
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> A <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> from the Win32 font backend. Such an
+ object can be created with <link linkend="cairo-win32-scaled-font-create-for-logfontw"><function>cairo_win32_scaled_font_create_for_logfontw()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>hdc</parameter>&nbsp;:</term>
<listitem><simpara> a device context
@@ -144,29 +121,32 @@ the use of this function to preserve the original graphics state.</para>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-win32-font-done-font"/>cairo_win32_font_done_font ()</title>
-<indexterm><primary>cairo_win32_font_done_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_win32_font_done_font (<link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
+<title><anchor id="cairo-win32-scaled-font-done-font"/>cairo_win32_scaled_font_done_font ()</title>
+<indexterm><primary>cairo_win32_scaled_font_done_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_win32_scaled_font_done_font
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
-Releases any resources allocated by <link linkend="cairo-win32-font-select-font"><function>cairo_win32_font_select_font()</function></link></para>
+Releases any resources allocated by <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link></para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the Win32 font backend.
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> A <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> from the Win32 font backend.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-win32-font-get-scale-factor"/>cairo_win32_font_get_scale_factor ()</title>
-<indexterm><primary>cairo_win32_font_get_scale_factor</primary></indexterm><programlisting><link linkend="double">double</link> cairo_win32_font_get_scale_factor
- (<link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
+<title><anchor id="cairo-win32-scaled-font-get-metrics-factor"/>cairo_win32_scaled_font_get_metrics_factor ()</title>
+<indexterm><primary>cairo_win32_scaled_font_get_metrics_factor</primary></indexterm><programlisting><link linkend="double">double</link> cairo_win32_scaled_font_get_metrics_factor
+ (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting>
<para>
Gets a scale factor between logical coordinates in the coordinate
-space used by <link linkend="cairo-win32-font-select-font"><function>cairo_win32_font_select_font()</function></link> and font space coordinates.</para>
+space used by <link linkend="cairo-win32-scaled-font-select-font"><function>cairo_win32_scaled_font_select_font()</function></link> (that is, the
+coordinate system used by the Windows functions to return metrics) and
+font space coordinates.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-font-t"><type>cairo_font_t</type></link> from the Win32 font backend
+<varlistentry><term><parameter>scaled_font</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> from the Win32 font backend
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> factor to multiply logical units by to get font space
coordinates.
diff --git a/doc/public/xml/cairo-xcb-xrender.xml b/doc/public/xml/cairo-xcb-xrender.xml
new file mode 100644
index 0000000..de2356d
--- /dev/null
+++ b/doc/public/xml/cairo-xcb-xrender.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<refentry id="cairo-XCB-Backend">
+<refmeta>
+<refentrytitle>XCB Backend</refentrytitle>
+<manvolnum>3</manvolnum>
+<refmiscinfo>CAIRO Library</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+<refname>XCB Backend</refname><refpurpose></refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><title>Synopsis</title>
+
+<synopsis>
+
+
+
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-xcb-surface-create-with-xrender-format">cairo_xcb_surface_create_with_xrender_format</link>
+ (<link linkend="XCBConnection">XCBConnection</link> *c,
+ <link linkend="XCBDRAWABLE:CAPS">XCBDRAWABLE</link> drawable,
+ <link linkend="XCBRenderPICTFORMINFO">XCBRenderPICTFORMINFO</link> *format,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
+</synopsis>
+</refsynopsisdiv>
+
+
+
+
+
+
+
+
+
+<refsect1>
+<title>Description</title>
+<para>
+
+</para>
+</refsect1>
+
+<refsect1>
+<title>Details</title>
+<refsect2>
+<title><anchor id="cairo-xcb-surface-create-with-xrender-format"/>cairo_xcb_surface_create_with_xrender_format ()</title>
+<indexterm><primary>cairo_xcb_surface_create_with_xrender_format</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xcb_surface_create_with_xrender_format
+ (<link linkend="XCBConnection">XCBConnection</link> *c,
+ <link linkend="XCBDRAWABLE:CAPS">XCBDRAWABLE</link> drawable,
+ <link linkend="XCBRenderPICTFORMINFO">XCBRenderPICTFORMINFO</link> *format,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Creates an XCB surface that draws to the given drawable.
+The way that colors are represented in the drawable is specified
+by the provided picture format.
+</para>
+<para>
+NOTE: If <parameter>drawable</parameter> is a Window, then the function
+cairo_xlib_surface_set_size must be called whenever the size of the
+window changes.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>c</parameter>&nbsp;:</term>
+<listitem><simpara> an XCB connection
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>drawable</parameter>&nbsp;:</term>
+<listitem><simpara> an XCB drawable
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
+<listitem><simpara> the picture format to use for drawing to <parameter>drawable</parameter>. The
+ depth of <parameter>format</parameter> mush match the depth of the drawable.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the current width of <parameter>drawable</parameter>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the current height of <parameter>drawable</parameter>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the newly created surface.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+
+</refsect1>
+
+
+
+
+</refentry>
diff --git a/doc/public/xml/cairo-xcb.xml b/doc/public/xml/cairo-xcb.xml
index 4f904d8..cb7a752 100644
--- a/doc/public/xml/cairo-xcb.xml
+++ b/doc/public/xml/cairo-xcb.xml
@@ -18,11 +18,19 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-xcb">cairo_set_target_xcb</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="XCBConnection">XCBConnection</link> *dpy,
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-xcb-surface-create">cairo_xcb_surface_create</link> (<link linkend="XCBConnection">XCBConnection</link> *c,
<link linkend="XCBDRAWABLE:CAPS">XCBDRAWABLE</link> drawable,
<link linkend="XCBVISUALTYPE:CAPS">XCBVISUALTYPE</link> *visual,
- <link linkend="cairo-format-t">cairo_format_t</link> format);
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-xcb-surface-create-for-bitmap">cairo_xcb_surface_create_for_bitmap</link>
+ (<link linkend="XCBConnection">XCBConnection</link> *c,
+ <link linkend="XCBPIXMAP:CAPS">XCBPIXMAP</link> bitmap,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
+<link linkend="void">void</link> <link linkend="cairo-xcb-surface-set-size">cairo_xcb_surface_set_size</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
</synopsis>
</refsynopsisdiv>
@@ -44,31 +52,99 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-xcb"/>cairo_set_target_xcb ()</title>
-<indexterm><primary>cairo_set_target_xcb</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_xcb (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="XCBConnection">XCBConnection</link> *dpy,
+<title><anchor id="cairo-xcb-surface-create"/>cairo_xcb_surface_create ()</title>
+<indexterm><primary>cairo_xcb_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xcb_surface_create (<link linkend="XCBConnection">XCBConnection</link> *c,
<link linkend="XCBDRAWABLE:CAPS">XCBDRAWABLE</link> drawable,
<link linkend="XCBVISUALTYPE:CAPS">XCBVISUALTYPE</link> *visual,
- <link linkend="cairo-format-t">cairo_format_t</link> format);</programlisting>
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Creates an XCB surface that draws to the given drawable.
+The way that colors are represented in the drawable is specified
+by the provided visual.
+</para>
+<para>
+NOTE: If <parameter>drawable</parameter> is a window, then the function
+cairo_xcb_surface_set_size must be called whenever the size of the
+window changes.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>dpy</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>c</parameter>&nbsp;:</term>
+<listitem><simpara> an XCB connection
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>drawable</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> an XCB drawable
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>visual</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> the visual to use for drawing to <parameter>drawable</parameter>. The depth
+ of the visual must match the depth of the drawable.
+ Currently, only TrueColor visuals are fully supported.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the current width of <parameter>drawable</parameter>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the current height of <parameter>drawable</parameter>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the newly created surface
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
-<listitem><simpara>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-xcb-surface-create-for-bitmap"/>cairo_xcb_surface_create_for_bitmap ()</title>
+<indexterm><primary>cairo_xcb_surface_create_for_bitmap</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xcb_surface_create_for_bitmap
+ (<link linkend="XCBConnection">XCBConnection</link> *c,
+ <link linkend="XCBPIXMAP:CAPS">XCBPIXMAP</link> bitmap,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Creates an XCB surface that draws to the given bitmap.
+This will be drawn to as a CAIRO_FORMAT_A1 object.</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>c</parameter>&nbsp;:</term>
+<listitem><simpara> an XCB connection
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>bitmap</parameter>&nbsp;:</term>
+<listitem><simpara> an XCB Pixmap (a depth-1 pixmap)
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the current width of <parameter>bitmap</parameter>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the current height of <parameter>bitmap</parameter>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the newly created surface
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-xcb-surface-set-size"/>cairo_xcb_surface_set_size ()</title>
+<indexterm><primary>cairo_xcb_surface_set_size</primary></indexterm><programlisting><link linkend="void">void</link> cairo_xcb_surface_set_size (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Informs cairo of the new size of the XCB drawable underlying the
+surface. For a surface created for a window (rather than a pixmap),
+this function must be called each time the size of the window
+changes. (For a subwindow, you are normally resizing the window
+yourself, but for a toplevel window, it is necessary to listen for
+ConfigureNotify events.)
+</para>
+<para>
+A pixmap can never change size, so it is never necessary to call
+this function on a surface created for a pixmap.</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> for the XCB backend
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the new width of the surface
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the new height of the surface
</simpara></listitem></varlistentry>
</variablelist></refsect2>
diff --git a/doc/public/xml/cairo-xlib-xrender.xml b/doc/public/xml/cairo-xlib-xrender.xml
new file mode 100644
index 0000000..c7bffc4
--- /dev/null
+++ b/doc/public/xml/cairo-xlib-xrender.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<refentry id="cairo-XLib/Xrender-Backend">
+<refmeta>
+<refentrytitle>XLib/Xrender Backend</refentrytitle>
+<manvolnum>3</manvolnum>
+<refmiscinfo>CAIRO Library</refmiscinfo>
+</refmeta>
+
+<refnamediv>
+<refname>XLib/Xrender Backend</refname><refpurpose></refpurpose>
+</refnamediv>
+
+<refsynopsisdiv><title>Synopsis</title>
+
+<synopsis>
+
+
+
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-xlib-surface-create-with-xrender-format">cairo_xlib_surface_create_with_xrender_format</link>
+ (<link linkend="Display">Display</link> *dpy,
+ <link linkend="Drawable">Drawable</link> drawable,
+ <link linkend="XRenderPictFormat">XRenderPictFormat</link> *format,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
+</synopsis>
+</refsynopsisdiv>
+
+
+
+
+
+
+
+
+
+<refsect1>
+<title>Description</title>
+<para>
+
+</para>
+</refsect1>
+
+<refsect1>
+<title>Details</title>
+<refsect2>
+<title><anchor id="cairo-xlib-surface-create-with-xrender-format"/>cairo_xlib_surface_create_with_xrender_format ()</title>
+<indexterm><primary>cairo_xlib_surface_create_with_xrender_format</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xlib_surface_create_with_xrender_format
+ (<link linkend="Display">Display</link> *dpy,
+ <link linkend="Drawable">Drawable</link> drawable,
+ <link linkend="XRenderPictFormat">XRenderPictFormat</link> *format,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Creates an Xlib surface that draws to the given drawable.
+The way that colors are represented in the drawable is specified
+by the provided picture format.
+</para>
+<para>
+NOTE: If <parameter>drawable</parameter> is a Window, then the function
+cairo_xlib_surface_set_size must be called whenever the size of the
+window changes.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>dpy</parameter>&nbsp;:</term>
+<listitem><simpara> an X Display
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>drawable</parameter>&nbsp;:</term>
+<listitem><simpara> an X Drawable, (a Pixmap or a Window)
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
+<listitem><simpara> the picture format to use for drawing to <parameter>drawable</parameter>. The depth
+ of <parameter>format</parameter> must match the depth of the drawable.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the current width of <parameter>drawable</parameter>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the current height of <parameter>drawable</parameter>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the newly created surface
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+
+</refsect1>
+
+
+
+
+</refentry>
diff --git a/doc/public/xml/cairo-xlib.xml b/doc/public/xml/cairo-xlib.xml
index dbb59a6..5ab5b4a 100644
--- a/doc/public/xml/cairo-xlib.xml
+++ b/doc/public/xml/cairo-xlib.xml
@@ -18,14 +18,19 @@
-<link linkend="void">void</link> <link linkend="cairo-set-target-drawable">cairo_set_target_drawable</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="Display">Display</link> *dpy,
- <link linkend="Drawable">Drawable</link> drawable);
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-xlib-surface-create">cairo_xlib_surface_create</link> (<link linkend="Display">Display</link> *dpy,
<link linkend="Drawable">Drawable</link> drawable,
<link linkend="Visual">Visual</link> *visual,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="Colormap">Colormap</link> colormap);
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-xlib-surface-create-for-bitmap">cairo_xlib_surface_create_for_bitmap</link>
+ (<link linkend="Display">Display</link> *dpy,
+ <link linkend="Pixmap">Pixmap</link> bitmap,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
+<link linkend="void">void</link> <link linkend="cairo-xlib-surface-set-size">cairo_xlib_surface_set_size</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);
</synopsis>
</refsynopsisdiv>
@@ -47,61 +52,99 @@
<refsect1>
<title>Details</title>
<refsect2>
-<title><anchor id="cairo-set-target-drawable"/>cairo_set_target_drawable ()</title>
-<indexterm><primary>cairo_set_target_drawable</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_drawable (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="Display">Display</link> *dpy,
- <link linkend="Drawable">Drawable</link> drawable);</programlisting>
+<title><anchor id="cairo-xlib-surface-create"/>cairo_xlib_surface_create ()</title>
+<indexterm><primary>cairo_xlib_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xlib_surface_create (<link linkend="Display">Display</link> *dpy,
+ <link linkend="Drawable">Drawable</link> drawable,
+ <link linkend="Visual">Visual</link> *visual,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
<para>
-Directs output for a <link linkend="cairo-t"><type>cairo_t</type></link> to an Xlib drawable. <parameter>drawable</parameter> must
-be a Window or Pixmap on the default screen of <parameter>dpy</parameter> using the
-default colormap and visual. Using this function is slow because
-the function must retrieve information about <parameter>drawable</parameter> from the X
-server.
-
-The combination of <link linkend="cairo-xlib-surface-create"><function>cairo_xlib_surface_create()</function></link> and
-<link linkend="cairo-set-target-surface"><function>cairo_set_target_surface()</function></link> is somewhat more flexible, although
-it still is slow.</para>
+Creates an Xlib surface that draws to the given drawable.
+The way that colors are represented in the drawable is specified
+by the provided visual.
+</para>
+<para>
+NOTE: If <parameter>drawable</parameter> is a Window, then the function
+cairo_xlib_surface_set_size must be called whenever the size of the
+window changes.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
-</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dpy</parameter>&nbsp;:</term>
-<listitem><simpara> an X display
+<listitem><simpara> an X Display
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>drawable</parameter>&nbsp;:</term>
-<listitem><simpara> a window or pixmap on the default screen of <parameter>dpy</parameter>
+<listitem><simpara> an X Drawable, (a Pixmap or a Window)
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>visual</parameter>&nbsp;:</term>
+<listitem><simpara> the visual to use for drawing to <parameter>drawable</parameter>. The depth
+ of the visual must match the depth of the drawable.
+ Currently, only TrueColor visuals are fully supported.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the current width of <parameter>drawable</parameter>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the current height of <parameter>drawable</parameter>.
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the newly created surface
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-xlib-surface-create"/>cairo_xlib_surface_create ()</title>
-<indexterm><primary>cairo_xlib_surface_create</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xlib_surface_create (<link linkend="Display">Display</link> *dpy,
- <link linkend="Drawable">Drawable</link> drawable,
- <link linkend="Visual">Visual</link> *visual,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="Colormap">Colormap</link> colormap);</programlisting>
+<title><anchor id="cairo-xlib-surface-create-for-bitmap"/>cairo_xlib_surface_create_for_bitmap ()</title>
+<indexterm><primary>cairo_xlib_surface_create_for_bitmap</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_xlib_surface_create_for_bitmap
+ (<link linkend="Display">Display</link> *dpy,
+ <link linkend="Pixmap">Pixmap</link> bitmap,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Creates an Xlib surface that draws to the given bitmap.
+This will be drawn to as a CAIRO_FORMAT_A1 object.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>dpy</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> an X Display
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>drawable</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>bitmap</parameter>&nbsp;:</term>
+<listitem><simpara> an X Drawable, (a depth-1 Pixmap)
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>visual</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the current width of <parameter>bitmap</parameter>.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the current height of <parameter>bitmap</parameter>.
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>colormap</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the newly created surface
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-xlib-surface-set-size"/>cairo_xlib_surface_set_size ()</title>
+<indexterm><primary>cairo_xlib_surface_set_size</primary></indexterm><programlisting><link linkend="void">void</link> cairo_xlib_surface_set_size (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="int">int</link> width,
+ <link linkend="int">int</link> height);</programlisting>
+<para>
+Informs cairo of the new size of the X Drawable underlying the
+surface. For a surface created for a Window (rather than a Pixmap),
+this function must be called each time the size of the window
+changes. (For a subwindow, you are normally resizing the window
+yourself, but for a toplevel window, it is necessary to listen for
+ConfigureNotify events.)
+</para>
+<para>
+A Pixmap can never change size, so it is never necessary to call
+this function on a surface created for a Pixmap.</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> for the XLib backend
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
+<listitem><simpara> the new width of the surface
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
+<listitem><simpara> the new height of the surface
</simpara></listitem></varlistentry>
</variablelist></refsect2>
diff --git a/doc/public/xml/cairo.xml b/doc/public/xml/cairo.xml
index 8148cee..d848bca 100644
--- a/doc/public/xml/cairo.xml
+++ b/doc/public/xml/cairo.xml
@@ -19,33 +19,30 @@
typedef <link linkend="cairo-t">cairo_t</link>;
-<link linkend="cairo-t">cairo_t</link>* <link linkend="cairo-create">cairo_create</link> (void);
+<link linkend="cairo-t">cairo_t</link>* <link linkend="cairo-create">cairo_create</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *target);
<link linkend="void">void</link> <link linkend="cairo-reference">cairo_reference</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-destroy">cairo_destroy</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-save">cairo_save</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-restore">cairo_restore</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-copy">cairo_copy</link> (<link linkend="cairo-t">cairo_t</link> *dest,
- <link linkend="cairo-t">cairo_t</link> *src);
-<link linkend="void">void</link> <link linkend="cairo-set-target-surface">cairo_set_target_surface</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
enum <link linkend="cairo-format-t">cairo_format_t</link>;
-<link linkend="void">void</link> <link linkend="cairo-set-target-image">cairo_set_target_image</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="char">char</link> *data,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height,
- <link linkend="int">int</link> stride);
enum <link linkend="cairo-operator-t">cairo_operator_t</link>;
<link linkend="void">void</link> <link linkend="cairo-set-operator">cairo_set_operator</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-operator-t">cairo_operator_t</link> op);
-<link linkend="void">void</link> <link linkend="cairo-set-rgb-color">cairo_set_rgb_color</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-set-source-rgb">cairo_set_source_rgb</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> red,
<link linkend="double">double</link> green,
<link linkend="double">double</link> blue);
-<link linkend="void">void</link> <link linkend="cairo-set-pattern">cairo_set_pattern</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
-<link linkend="void">void</link> <link linkend="cairo-set-alpha">cairo_set_alpha</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-set-source-rgba">cairo_set_source_rgba</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> red,
+ <link linkend="double">double</link> green,
+ <link linkend="double">double</link> blue,
<link linkend="double">double</link> alpha);
+<link linkend="void">void</link> <link linkend="cairo-set-source">cairo_set_source</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-pattern-t">cairo_pattern_t</link> *source);
+<link linkend="void">void</link> <link linkend="cairo-set-source-surface">cairo_set_source_surface</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x,
+ <link linkend="double">double</link> y);
<link linkend="void">void</link> <link linkend="cairo-set-tolerance">cairo_set_tolerance</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> tolerance);
enum <link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link>;
@@ -73,23 +70,21 @@ enum <link linkend="cairo-line-join-t">cairo_line_join_t</link>;
<link linkend="double">double</link> sy);
<link linkend="void">void</link> <link linkend="cairo-rotate">cairo_rotate</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> angle);
-<link linkend="void">void</link> <link linkend="cairo-concat-matrix">cairo_concat_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
+<link linkend="void">void</link> <link linkend="cairo-transform">cairo_transform</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
<link linkend="void">void</link> <link linkend="cairo-set-matrix">cairo_set_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="void">void</link> <link linkend="cairo-default-matrix">cairo_default_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
<link linkend="void">void</link> <link linkend="cairo-identity-matrix">cairo_identity_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-transform-point">cairo_transform_point</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-user-to-device">cairo_user_to_device</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);
-<link linkend="void">void</link> <link linkend="cairo-transform-distance">cairo_transform_distance</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-user-to-device-distance">cairo_user_to_device_distance</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *dx,
<link linkend="double">double</link> *dy);
-<link linkend="void">void</link> <link linkend="cairo-inverse-transform-point">cairo_inverse_transform_point</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-device-to-user">cairo_device_to_user</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);
-<link linkend="void">void</link> <link linkend="cairo-inverse-transform-distance">cairo_inverse_transform_distance</link>
- (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-device-to-user-distance">cairo_device_to_user_distance</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *dx,
<link linkend="double">double</link> *dy);
<link linkend="void">void</link> <link linkend="cairo-new-path">cairo_new_path</link> (<link linkend="cairo-t">cairo_t</link> *cr);
@@ -137,8 +132,19 @@ enum <link linkend="cairo-line-join-t">cairo_line_join_t</link>;
<link linkend="double">double</link> width,
<link linkend="double">double</link> height);
<link linkend="void">void</link> <link linkend="cairo-close-path">cairo_close_path</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-paint">cairo_paint</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-paint-with-alpha">cairo_paint_with_alpha</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> alpha);
+<link linkend="void">void</link> <link linkend="cairo-mask">cairo_mask</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);
+<link linkend="void">void</link> <link linkend="cairo-mask-surface">cairo_mask_surface</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> surface_x,
+ <link linkend="double">double</link> surface_y);
<link linkend="void">void</link> <link linkend="cairo-stroke">cairo_stroke</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-stroke-preserve">cairo_stroke_preserve</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-fill">cairo_fill</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-fill-preserve">cairo_fill_preserve</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-copy-page">cairo_copy_page</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-show-page">cairo_show_page</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="cairo-bool-t">cairo_bool_t</link> <link linkend="cairo-in-stroke">cairo_in_stroke</link> (<link linkend="cairo-t">cairo_t</link> *cr,
@@ -158,102 +164,89 @@ typedef <link linkend="cairo-bool-t">cairo_bool_t</link>;
<link linkend="double">double</link> *y1,
<link linkend="double">double</link> *x2,
<link linkend="double">double</link> *y2);
-<link linkend="void">void</link> <link linkend="cairo-init-clip">cairo_init_clip</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="void">void</link> <link linkend="cairo-clip">cairo_clip</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-typedef <link linkend="cairo-font-t">cairo_font_t</link>;
+<link linkend="void">void</link> <link linkend="cairo-clip-preserve">cairo_clip_preserve</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-reset-clip">cairo_reset_clip</link> (<link linkend="cairo-t">cairo_t</link> *cr);
<link linkend="cairo-glyph-t">cairo_glyph_t</link>;
- <link linkend="cairo-text-extents-t">cairo_text_extents_t</link>;
- <link linkend="cairo-font-extents-t">cairo_font_extents_t</link>;
enum <link linkend="cairo-font-slant-t">cairo_font_slant_t</link>;
enum <link linkend="cairo-font-weight-t">cairo_font_weight_t</link>;
-<link linkend="void">void</link> <link linkend="cairo-select-font">cairo_select_font</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-select-font-face">cairo_select_font_face</link> (<link linkend="cairo-t">cairo_t</link> *cr,
const <link linkend="char">char</link> *family,
<link linkend="cairo-font-slant-t">cairo_font_slant_t</link> slant,
<link linkend="cairo-font-weight-t">cairo_font_weight_t</link> weight);
-<link linkend="void">void</link> <link linkend="cairo-scale-font">cairo_scale_font</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="double">double</link> scale);
-<link linkend="void">void</link> <link linkend="cairo-transform-font">cairo_transform_font</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="void">void</link> <link linkend="cairo-set-font-size">cairo_set_font_size</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> size);
+<link linkend="void">void</link> <link linkend="cairo-set-font-matrix">cairo_set_font_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
+<link linkend="void">void</link> <link linkend="cairo-get-font-matrix">cairo_get_font_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
<link linkend="void">void</link> <link linkend="cairo-show-text">cairo_show_text</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- unsigned <link linkend="char">char</link> *utf8);
+ const <link linkend="char">char</link> *utf8);
<link linkend="void">void</link> <link linkend="cairo-show-glyphs">cairo_show_glyphs</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
<link linkend="int">int</link> num_glyphs);
-<link linkend="cairo-font-t">cairo_font_t</link>* <link linkend="cairo-current-font">cairo_current_font</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-current-font-extents">cairo_current_font_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="cairo-font-face-t">cairo_font_face_t</link>* <link linkend="cairo-get-font-face">cairo_get_font_face</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-font-extents">cairo_font_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);
-<link linkend="void">void</link> <link linkend="cairo-set-font">cairo_set_font</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-font-t">cairo_font_t</link> *font);
+<link linkend="void">void</link> <link linkend="cairo-set-font-face">cairo_set_font_face</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);
<link linkend="void">void</link> <link linkend="cairo-text-extents">cairo_text_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- unsigned <link linkend="char">char</link> *utf8,
+ const <link linkend="char">char</link> *utf8,
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
<link linkend="void">void</link> <link linkend="cairo-glyph-extents">cairo_glyph_extents</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
<link linkend="int">int</link> num_glyphs,
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
<link linkend="void">void</link> <link linkend="cairo-text-path">cairo_text_path</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- unsigned <link linkend="char">char</link> *utf8);
+ const <link linkend="char">char</link> *utf8);
<link linkend="void">void</link> <link linkend="cairo-glyph-path">cairo_glyph_path</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
<link linkend="int">int</link> num_glyphs);
-<link linkend="void">void</link> <link linkend="cairo-font-reference">cairo_font_reference</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font);
-<link linkend="void">void</link> <link linkend="cairo-font-destroy">cairo_font_destroy</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font);
-<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-font-extents">cairo_font_extents</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix,
- <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);
-<link linkend="void">void</link> <link linkend="cairo-font-glyph-extents">cairo_font_glyph_extents</link> (<link linkend="cairo-font-t">cairo_font_t</link> *font,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix,
- <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
- <link linkend="int">int</link> num_glyphs,
- <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);
-<link linkend="void">void</link> <link linkend="cairo-show-surface">cairo_show_surface</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);
-<link linkend="cairo-operator-t">cairo_operator_t</link> <link linkend="cairo-current-operator">cairo_current_operator</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-current-rgb-color">cairo_current_rgb_color</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="double">double</link> *red,
- <link linkend="double">double</link> *green,
- <link linkend="double">double</link> *blue);
-<link linkend="cairo-pattern-t">cairo_pattern_t</link>* <link linkend="cairo-current-pattern">cairo_current_pattern</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="double">double</link> <link linkend="cairo-current-alpha">cairo_current_alpha</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="double">double</link> <link linkend="cairo-current-tolerance">cairo_current_tolerance</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-current-point">cairo_current_point</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="cairo-operator-t">cairo_operator_t</link> <link linkend="cairo-get-operator">cairo_get_operator</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="cairo-pattern-t">cairo_pattern_t</link>* <link linkend="cairo-get-source">cairo_get_source</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="double">double</link> <link linkend="cairo-get-tolerance">cairo_get_tolerance</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-get-current-point">cairo_get_current_point</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);
-<link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link> <link linkend="cairo-current-fill-rule">cairo_current_fill_rule</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="double">double</link> <link linkend="cairo-current-line-width">cairo_current_line_width</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="cairo-line-cap-t">cairo_line_cap_t</link> <link linkend="cairo-current-line-cap">cairo_current_line_cap</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="cairo-line-join-t">cairo_line_join_t</link> <link linkend="cairo-current-line-join">cairo_current_line_join</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="double">double</link> <link linkend="cairo-current-miter-limit">cairo_current_miter_limit</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-current-matrix">cairo_current_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+<link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link> <link linkend="cairo-get-fill-rule">cairo_get_fill_rule</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="double">double</link> <link linkend="cairo-get-line-width">cairo_get_line_width</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="cairo-line-cap-t">cairo_line_cap_t</link> <link linkend="cairo-get-line-cap">cairo_get_line_cap</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="cairo-line-join-t">cairo_line_join_t</link> <link linkend="cairo-get-line-join">cairo_get_line_join</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="double">double</link> <link linkend="cairo-get-miter-limit">cairo_get_miter_limit</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-get-matrix">cairo_get_matrix</link> (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);
-<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-current-target-surface">cairo_current_target_surface</link>
- (<link linkend="cairo-t">cairo_t</link> *cr);
-<link linkend="void">void</link> <link linkend="cairo-current-path">cairo_current_path</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-move-to-func-t">cairo_move_to_func_t</link> *move_to,
- <link linkend="cairo-line-to-func-t">cairo_line_to_func_t</link> *line_to,
- <link linkend="cairo-curve-to-func-t">cairo_curve_to_func_t</link> *curve_to,
- <link linkend="cairo-close-path-func-t">cairo_close_path_func_t</link> *close_path,
- <link linkend="void">void</link> *closure);
-<link linkend="void">void</link> <link linkend="cairo-current-path-flat">cairo_current_path_flat</link> (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-move-to-func-t">cairo_move_to_func_t</link> *move_to,
- <link linkend="cairo-line-to-func-t">cairo_line_to_func_t</link> *line_to,
- <link linkend="cairo-close-path-func-t">cairo_close_path_func_t</link> *close_path,
- <link linkend="void">void</link> *closure);
+<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-get-target">cairo_get_target</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="cairo-path-t">cairo_path_t</link>* <link linkend="cairo-copy-path">cairo_copy_path</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="cairo-path-t">cairo_path_t</link>* <link linkend="cairo-copy-path-flat">cairo_copy_path_flat</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+<link linkend="void">void</link> <link linkend="cairo-append-path">cairo_append_path</link> (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-path-t">cairo_path_t</link> *path);
+enum <link linkend="cairo-path-data-type-t">cairo_path_data_type_t</link>;
+ <link linkend="cairo-path-t">cairo_path_t</link>;
+<link linkend="void">void</link> <link linkend="cairo-path-destroy">cairo_path_destroy</link> (<link linkend="cairo-path-t">cairo_path_t</link> *path);
enum <link linkend="cairo-status-t">cairo_status_t</link>;
<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-status">cairo_status</link> (<link linkend="cairo-t">cairo_t</link> *cr);
-const <link linkend="char">char</link>* <link linkend="cairo-status-string">cairo_status_string</link> (<link linkend="cairo-t">cairo_t</link> *cr);
+#define <link linkend="cairo-status-string">cairo_status_string</link>
+const <link linkend="char">char</link>* <link linkend="cairo-status-to-string">cairo_status_to_string</link> (<link linkend="cairo-status-t">cairo_status_t</link> status);
enum <link linkend="cairo-filter-t">cairo_filter_t</link>;
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-image-surface-create">cairo_image_surface_create</link> (<link linkend="cairo-format-t">cairo_format_t</link> format,
<link linkend="int">int</link> width,
<link linkend="int">int</link> height);
<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-image-surface-create-for-data">cairo_image_surface_create_for_data</link>
- (<link linkend="char">char</link> *data,
+ (unsigned <link linkend="char">char</link> *data,
<link linkend="cairo-format-t">cairo_format_t</link> format,
<link linkend="int">int</link> width,
<link linkend="int">int</link> height,
<link linkend="int">int</link> stride);
+<link linkend="int">int</link> <link linkend="cairo-image-surface-get-width">cairo_image_surface_get_width</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
+<link linkend="int">int</link> <link linkend="cairo-image-surface-get-height">cairo_image_surface_get_height</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);
+<link linkend="void">void</link> (<link linkend="cairo-destroy-func-t">*cairo_destroy_func_t</link>) (<link linkend="void">void</link> *data);
+ <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link>;
+<link linkend="cairo-status-t">cairo_status_t</link> (<link linkend="cairo-read-func-t">*cairo_read_func_t</link>) (<link linkend="void">void</link> *closure,
+ unsigned <link linkend="char">char</link> *data,
+ unsigned <link linkend="int">int</link> length);
+<link linkend="cairo-status-t">cairo_status_t</link> (<link linkend="cairo-write-func-t">*cairo_write_func_t</link>) (<link linkend="void">void</link> *closure,
+ unsigned <link linkend="char">char</link> *data,
+ unsigned <link linkend="int">int</link> length);
</synopsis>
</refsynopsisdiv>
@@ -297,18 +290,43 @@ including coordinates of yet to be drawn shapes.</para>
</para></refsect2>
<refsect2>
<title><anchor id="cairo-create"/>cairo_create ()</title>
-<indexterm><primary>cairo_create</primary></indexterm><programlisting><link linkend="cairo-t">cairo_t</link>* cairo_create (void);</programlisting>
+<indexterm><primary>cairo_create</primary></indexterm><programlisting><link linkend="cairo-t">cairo_t</link>* cairo_create (<link linkend="cairo-surface-t">cairo_surface_t</link> *target);</programlisting>
+<para>
+Creates a new <link linkend="cairo-t"><type>cairo_t</type></link> with all graphics state parameters set to
+default values and with <parameter>target</parameter> as a target surface. The target
+surface should be constructed with a backend-specific function such
+as cairo_image_surface_create (or any other
+cairo_&lt;backend&gt;_surface_create variant).
+</para>
<para>
-Creates a new <link linkend="cairo-t"><type>cairo_t</type></link> with default values. The target
-surface must be set on the <link linkend="cairo-t"><type>cairo_t</type></link> with <link linkend="cairo-set-target-surface"><function>cairo_set_target_surface()</function></link>,
-or a backend-specific function like <link linkend="cairo-set-target-image"><function>cairo_set_target_image()</function></link> before
-drawing with the <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
+This function references <parameter>target</parameter>, so you can immediately
+call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> on it if you don't need to
+maintain a separate reference to it.
+</para>
+<para>
+Note that there are restrictions on using the same surface in
+multiple contexts at the same time. If, after creating <parameter>cr_a</parameter> with
+<parameter>surface</parameter> you also create <parameter>cr_b</parameter> with the same surface, you must
+ensure that <parameter>cr_b</parameter> has finished using <parameter>surface</parameter> before resuming use
+of <parameter>cr_a</parameter>. Currently, the only way time at which this is guaranteed
+is when the the last reference to <parameter>cr_b</parameter> is released with
+<link linkend="cairo-destroy"><function>cairo_destroy()</function></link>. (XXX: We need to add a <link linkend="cairo-finish"><function>cairo_finish()</function></link> call to
+provide a way to achieve this explicitly). See also the
+<literal>CAIRO_STATUS_BAD_NESTING</literal> status.</para>
<para>
</para><variablelist role="params">
+<varlistentry><term><parameter>target</parameter>&nbsp;:</term>
+<listitem><simpara> target surface for the context
+</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a newly allocated <link linkend="cairo-t"><type>cairo_t</type></link> with a reference
count of 1. The initial reference count should be released
with <link linkend="cairo-destroy"><function>cairo_destroy()</function></link> when you are done using the <link linkend="cairo-t"><type>cairo_t</type></link>.
+ This function never returns <literal>NULL</literal>. If memory cannot be
+ allocated, a special <link linkend="cairo-t"><type>cairo_t</type></link> object will be returned on
+ which <link linkend="cairo-status"><function>cairo_status()</function></link> returns <literal>CAIRO_STATUS_NO_MEMORY</literal>.
+ You can use this object normally, but no drawing will
+ be done.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -331,7 +349,7 @@ is made.</para>
<para>
Decreases the reference count on <parameter>cr</parameter> by one. If the result
is zero, then <parameter>cr</parameter> and all associated resources are freed.
-See <link linkend="cairo-destroy"><function>cairo_destroy()</function></link>.</para>
+See <link linkend="cairo-reference"><function>cairo_reference()</function></link>.</para>
<para>
</para><variablelist role="params">
@@ -377,49 +395,6 @@ saved states.</para>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-copy"/>cairo_copy ()</title>
-<indexterm><primary>cairo_copy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_copy (<link linkend="cairo-t">cairo_t</link> *dest,
- <link linkend="cairo-t">cairo_t</link> *src);</programlisting>
-<para>
-This function copies all current state information from src to
-dest. This includes the current point and path, the target surface,
-the transformation matrix, and so forth.
-</para>
-<para>
-The stack of states saved with <link linkend="cairo-save"><function>cairo_save()</function></link> is <emphasis>not</emphasis>
-not copied; nor are any saved states on <parameter>dest</parameter> cleared. The
-operation only copies the current state of <parameter>src</parameter> to the current
-state of <parameter>dest</parameter>.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>dest</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>src</parameter>&nbsp;:</term>
-<listitem><simpara> another <link linkend="cairo-t"><type>cairo_t</type></link>
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-set-target-surface"/>cairo_set_target_surface ()</title>
-<indexterm><primary>cairo_set_target_surface</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_surface (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
-<para>
-Directs output for a <link linkend="cairo-t"><type>cairo_t</type></link> to a given surface. The surface
-will be referenced by the <link linkend="cairo-t"><type>cairo_t</type></link>, so you can immediately
-call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> on it if you don't need to
-keep a reference to it around.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
<title><anchor id="cairo-format-t"/>enum cairo_format_t</title>
<indexterm><primary>cairo_format_t</primary></indexterm><programlisting>typedef enum cairo_format {
CAIRO_FORMAT_ARGB32,
@@ -438,7 +413,7 @@ image data.</para>
<term><literal>CAIRO_FORMAT_ARGB32</literal></term>
<listitem><simpara> each pixel is a 32-bit quantity, with
alpha in the upper 8 bits, then red, then green, then blue.
- The 32-bit quanties are stored native-endian. Pre-multiplied
+ The 32-bit quantities are stored native-endian. Pre-multiplied
alpha is used. (That is, 50% transparent red is 0x80800000,
not 0x80ff0000.)
</simpara></listitem>
@@ -468,60 +443,22 @@ image data.</para>
</varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-set-target-image"/>cairo_set_target_image ()</title>
-<indexterm><primary>cairo_set_target_image</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_target_image (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="char">char</link> *data,
- <link linkend="cairo-format-t">cairo_format_t</link> format,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height,
- <link linkend="int">int</link> stride);</programlisting>
-<para>
-Directs output for a <link linkend="cairo-t"><type>cairo_t</type></link> to an in-memory image. The output
-buffer must be kept around until the <link linkend="cairo-t"><type>cairo_t</type></link> is destroyed or set
-to to have a different target. The initial contents of <parameter>buffer</parameter>
-will be used as the inital image contents; you must explicitely
-clear the buffer, using, for example, <link linkend="cairo-rectangle"><function>cairo_rectangle()</function></link> and
-<link linkend="cairo-fill"><function>cairo_fill()</function></link> if you want it cleared.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
-<listitem><simpara> a pointer to a buffer supplied by the application
- in which to write contents.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>format</parameter>&nbsp;:</term>
-<listitem><simpara> the format of pixels in the buffer
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara> the width of the image to be stored in the buffer
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
-<listitem><simpara> the eight of the image to be stored in the buffer
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>stride</parameter>&nbsp;:</term>
-<listitem><simpara> the number of bytes between the start of rows
- in the buffer. Having this be specified separate from <parameter>width</parameter>
- allows for padding at the end of rows, or for writing
- to a subportion of a larger image.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
<title><anchor id="cairo-operator-t"/>enum cairo_operator_t</title>
-<indexterm><primary>cairo_operator_t</primary></indexterm><programlisting>typedef enum cairo_operator {
+<indexterm><primary>cairo_operator_t</primary></indexterm><programlisting>typedef enum cairo_operator {
CAIRO_OPERATOR_CLEAR,
- CAIRO_OPERATOR_SRC,
- CAIRO_OPERATOR_DST,
+
+ CAIRO_OPERATOR_SOURCE,
CAIRO_OPERATOR_OVER,
- CAIRO_OPERATOR_OVER_REVERSE,
CAIRO_OPERATOR_IN,
- CAIRO_OPERATOR_IN_REVERSE,
CAIRO_OPERATOR_OUT,
- CAIRO_OPERATOR_OUT_REVERSE,
CAIRO_OPERATOR_ATOP,
- CAIRO_OPERATOR_ATOP_REVERSE,
+
+ CAIRO_OPERATOR_DEST,
+ CAIRO_OPERATOR_DEST_OVER,
+ CAIRO_OPERATOR_DEST_IN,
+ CAIRO_OPERATOR_DEST_OUT,
+ CAIRO_OPERATOR_DEST_ATOP,
+
CAIRO_OPERATOR_XOR,
CAIRO_OPERATOR_ADD,
CAIRO_OPERATOR_SATURATE
@@ -535,33 +472,44 @@ clear the buffer, using, for example, <link linkend="cairo-rectangle"><function>
<indexterm><primary>cairo_set_operator</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_operator (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-operator-t">cairo_operator_t</link> op);</programlisting>
<para>
+Sets the compositing operator to be used for all drawing
+operations. See <link linkend="cairo-operator-t"><type>cairo_operator_t</type></link> for details on the semantics of
+each available drawing operator.
+</para>
+<para>
+XXX: I'd also like to direct the reader's attention to some
+(not-yet-written) section on cairo's imaging model. How would I do
+that if such a section existed? (cworth).</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>op</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a compositing operator, specified as a <link linkend="cairo-operator-t"><type>cairo_operator_t</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-set-rgb-color"/>cairo_set_rgb_color ()</title>
-<indexterm><primary>cairo_set_rgb_color</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_rgb_color (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-set-source-rgb"/>cairo_set_source_rgb ()</title>
+<indexterm><primary>cairo_set_source_rgb</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_source_rgb (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> red,
<link linkend="double">double</link> green,
<link linkend="double">double</link> blue);</programlisting>
<para>
-Sets a constant color for filling and stroking. This replaces any
-pattern set with <link linkend="cairo-set-pattern"><function>cairo_set_pattern()</function></link>. The color components are
-floating point numbers in the range 0 to 1. If the values passed in
-are outside that range, they will be clamped.</para>
+Sets the source pattern within <parameter>cr</parameter> to an opaque color. This opaque
+color will then be used for any subsequent drawing operation until
+a new source pattern is set.
+</para>
+<para>
+The color components are floating point numbers in the range 0 to
+1. If the values passed in are outside that range, they will be
+clamped.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>red</parameter>&nbsp;:</term>
<listitem><simpara> red component of color
@@ -574,39 +522,86 @@ are outside that range, they will be clamped.</para>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-set-pattern"/>cairo_set_pattern ()</title>
-<indexterm><primary>cairo_set_pattern</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_pattern (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);</programlisting>
+<title><anchor id="cairo-set-source-rgba"/>cairo_set_source_rgba ()</title>
+<indexterm><primary>cairo_set_source_rgba</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_source_rgba (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> red,
+ <link linkend="double">double</link> green,
+ <link linkend="double">double</link> blue,
+ <link linkend="double">double</link> alpha);</programlisting>
+<para>
+Sets the source pattern within <parameter>cr</parameter> to a translucent color. This
+color will then be used for any subsequent drawing operation until
+a new source pattern is set.
+</para>
+<para>
+The color and alpha components are floating point numbers in the
+range 0 to 1. If the values passed in are outside that range, they
+will be clamped.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>pattern</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><parameter>red</parameter>&nbsp;:</term>
+<listitem><simpara> red component of color
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>green</parameter>&nbsp;:</term>
+<listitem><simpara> green component of color
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>blue</parameter>&nbsp;:</term>
+<listitem><simpara> blue component of color
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>alpha</parameter>&nbsp;:</term>
+<listitem><simpara> alpha component of color
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-set-alpha"/>cairo_set_alpha ()</title>
-<indexterm><primary>cairo_set_alpha</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_alpha (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="double">double</link> alpha);</programlisting>
+<title><anchor id="cairo-set-source"/>cairo_set_source ()</title>
+<indexterm><primary>cairo_set_source</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_source (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-pattern-t">cairo_pattern_t</link> *source);</programlisting>
+<para>
+Sets the source pattern within <parameter>cr</parameter> to <parameter>source</parameter>. This pattern
+will then be used for any subsequent drawing operation until a new
+source pattern is set.
+</para>
<para>
-Sets an overall alpha value used for stroking and filling. This
-value is multiplied with any alpha value coming from a gradient or
-image pattern.</para>
+XXX: I'd also like to direct the reader's attention to some
+(not-yet-written) section on cairo's imaging model. How would I do
+that if such a section existed? (cworth).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>alpha</parameter>&nbsp;:</term>
-<listitem><simpara> the alpha value. 0 is transparent, 1 fully opaque.
- if the value is outside the range 0 to 1, it will be
- clamped to that range.
+<varlistentry><term><parameter>source</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> to be used as the source for
+subsequent drawing operations.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-set-source-surface"/>cairo_set_source_surface ()</title>
+<indexterm><primary>cairo_set_source_surface</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_source_surface (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> x,
+ <link linkend="double">double</link> y);</programlisting>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>x</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>y</parameter>&nbsp;:</term>
+<listitem><simpara>
+
+
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -673,15 +668,19 @@ filled.
<indexterm><primary>cairo_set_fill_rule</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_fill_rule (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link> fill_rule);</programlisting>
<para>
+Set the current fill rule within the cairo context. The fill rule
+is used to determine which regions are inside or outside a complex
+(potentially self-intersecting) path. The current fill rule affects
+both cairo_fill and cairo_clip. See <link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link> for details
+on the semantics of each available fill rule.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fill_rule</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a fill rule, specified as a <link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -689,15 +688,23 @@ filled.
<indexterm><primary>cairo_set_line_width</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_line_width (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> width);</programlisting>
<para>
+Sets the current line width within the cairo context. The line
+width specifies the diameter of a pen that is circular in
+user-space.
+</para>
+<para>
+As with the other stroke parameters, the current line cap style is
+examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
+<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
+construction.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a line width, as a user-space value
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -734,15 +741,23 @@ enumeration for style of line-endings</para>
<indexterm><primary>cairo_set_line_cap</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_line_cap (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-line-cap-t">cairo_line_cap_t</link> line_cap);</programlisting>
<para>
+Sets the current line cap style within the cairo context. See
+<link linkend="cairo-line-cap-t"><type>cairo_line_cap_t</type></link> for details about how the available line cap
+styles are drawn.
+</para>
+<para>
+As with the other stroke parameters, the current line cap style is
+examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
+<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
+construction.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context, as a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>line_cap</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a line cap style, as a <link linkend="cairo-line-cap-t"><type>cairo_line_cap_t</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -761,15 +776,23 @@ enumeration for style of line-endings</para>
<indexterm><primary>cairo_set_line_join</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_line_join (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-line-join-t">cairo_line_join_t</link> line_join);</programlisting>
<para>
+Sets the current line join style within the cairo context. See
+<link linkend="cairo-line-join-t"><type>cairo_line_join_t</type></link> for details about how the available line join
+styles are drawn.
+</para>
+<para>
+As with the other stroke parameters, the current line join style is
+examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
+<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
+construction.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context, as a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>line_join</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a line joint style, as a <link linkend="cairo-line-join-t"><type>cairo_line_join_t</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -818,18 +841,22 @@ enumeration for style of line-endings</para>
<link linkend="double">double</link> tx,
<link linkend="double">double</link> ty);</programlisting>
<para>
+Modifies the current transformation matrix (CTM) by tanslating the
+user-space origin by (<parameter>tx</parameter>, <parameter>ty</parameter>). This offset is interpreted as a
+user-space coordinate according to the CTM in place before the new
+call to cairo_translate. In other words, the translation of the
+user-space origin takes place after any existing transformation.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>tx</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> amount to translate in the X direction
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ty</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> amount to translate in the Y direction
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -838,18 +865,21 @@ enumeration for style of line-endings</para>
<link linkend="double">double</link> sx,
<link linkend="double">double</link> sy);</programlisting>
<para>
+Modifies the current transformation matrix (CTM) by scaling the X
+and Y user-space axes by <parameter>sx</parameter> and <parameter>sy</parameter> respectively. The scaling of
+the axes takes place after any existing transformation of user
+space.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sx</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> scale factor for the X dimension
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>sy</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> scale factor for the Y dimension
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -857,152 +887,160 @@ enumeration for style of line-endings</para>
<indexterm><primary>cairo_rotate</primary></indexterm><programlisting><link linkend="void">void</link> cairo_rotate (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> angle);</programlisting>
<para>
+Modifies the current transformation matrix (CTM) by rotating the
+user-space axes by <parameter>angle</parameter> radians. The rotation of the axes takes
+places after any existing transformation of user space. The
+rotation direction for positive angles is from the positive X axis
+toward the positive Y axis.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>angle</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> angle (in radians) by which the user-space axes will be
+rotated
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-concat-matrix"/>cairo_concat_matrix ()</title>
-<indexterm><primary>cairo_concat_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_concat_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<title><anchor id="cairo-transform"/>cairo_transform ()</title>
+<indexterm><primary>cairo_transform</primary></indexterm><programlisting><link linkend="void">void</link> cairo_transform (<link linkend="cairo-t">cairo_t</link> *cr,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<para>
+Modifies the current transformation matrix (CTM) by applying
+<parameter>matrix</parameter> as an additional transformation. The new transformation of
+user space takes place after any existing transformation.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a transformation to be applied to the user-space axes
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-set-matrix"/>cairo_set_matrix ()</title>
<indexterm><primary>cairo_set_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<para>
+Modifies the current transformation matrix (CTM) by setting it
+equal to <parameter>matrix</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-default-matrix"/>cairo_default_matrix ()</title>
-<indexterm><primary>cairo_default_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_default_matrix (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a transformation matrix from user space to device space
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-identity-matrix"/>cairo_identity_matrix ()</title>
<indexterm><primary>cairo_identity_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_identity_matrix (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
<para>
+Resets the current transformation matrix (CTM) by setting it equal
+to the identity matrix. That is, the user-space and device-space
+axes will be aligned and one user-space unit will transform to one
+device-space unit.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-transform-point"/>cairo_transform_point ()</title>
-<indexterm><primary>cairo_transform_point</primary></indexterm><programlisting><link linkend="void">void</link> cairo_transform_point (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-user-to-device"/>cairo_user_to_device ()</title>
+<indexterm><primary>cairo_user_to_device</primary></indexterm><programlisting><link linkend="void">void</link> cairo_user_to_device (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);</programlisting>
<para>
+Transform a coordinate from user space to device space by
+multiplying the given point by the current transformation matrix
+(CTM).</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> X value of coordinate (in/out parameter)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> Y value of coordinate (in/out parameter)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-transform-distance"/>cairo_transform_distance ()</title>
-<indexterm><primary>cairo_transform_distance</primary></indexterm><programlisting><link linkend="void">void</link> cairo_transform_distance (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-user-to-device-distance"/>cairo_user_to_device_distance ()</title>
+<indexterm><primary>cairo_user_to_device_distance</primary></indexterm><programlisting><link linkend="void">void</link> cairo_user_to_device_distance (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *dx,
<link linkend="double">double</link> *dy);</programlisting>
<para>
+Transform a distance vector from user space to device space. This
+function is similar to <link linkend="cairo-user-to-device"><function>cairo_user_to_device()</function></link> except that the
+translation components of the CTM will be ignored when transforming
+(<parameter>dx</parameter>,<parameter>dy</parameter>).</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dx</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> X component of a distance vector (in/out parameter)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dy</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> Y component of a distance vector (in/out parameter)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-inverse-transform-point"/>cairo_inverse_transform_point ()</title>
-<indexterm><primary>cairo_inverse_transform_point</primary></indexterm><programlisting><link linkend="void">void</link> cairo_inverse_transform_point (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-device-to-user"/>cairo_device_to_user ()</title>
+<indexterm><primary>cairo_device_to_user</primary></indexterm><programlisting><link linkend="void">void</link> cairo_device_to_user (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *x,
<link linkend="double">double</link> *y);</programlisting>
<para>
+Transform a coordinate from device space to user space by
+multiplying the given point by the inverse of the current
+transformation matrix (CTM).</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> X value of coordinate (in/out parameter)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> Y value of coordinate (in/out parameter)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-inverse-transform-distance"/>cairo_inverse_transform_distance ()</title>
-<indexterm><primary>cairo_inverse_transform_distance</primary></indexterm><programlisting><link linkend="void">void</link> cairo_inverse_transform_distance
- (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-device-to-user-distance"/>cairo_device_to_user_distance ()</title>
+<indexterm><primary>cairo_device_to_user_distance</primary></indexterm><programlisting><link linkend="void">void</link> cairo_device_to_user_distance (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="double">double</link> *dx,
<link linkend="double">double</link> *dy);</programlisting>
<para>
+Transform a distance vector from device space to user space. This
+function is similar to <link linkend="cairo-device-to-user"><function>cairo_device_to_user()</function></link> except that the
+translation components of the inverse CTM will be ignored when
+transforming (<parameter>dx</parameter>,<parameter>dy</parameter>).</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dx</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> X component of a distance vector (in/out parameter)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dy</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> Y component of a distance vector (in/out parameter)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -1130,7 +1168,7 @@ cairo_restore (cr);
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a Cairo context
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xc</parameter>&nbsp;:</term>
<listitem><simpara> X position of the center of the arc
@@ -1165,7 +1203,7 @@ the arc in the direction of decreasing angle.</para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara> a Cairo context
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xc</parameter>&nbsp;:</term>
<listitem><simpara> X position of the center of the arc
@@ -1300,27 +1338,150 @@ the arc in the direction of decreasing angle.</para>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
+<title><anchor id="cairo-paint"/>cairo_paint ()</title>
+<indexterm><primary>cairo_paint</primary></indexterm><programlisting><link linkend="void">void</link> cairo_paint (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+A drawing operator that paints the current source everywhere within
+the current clip region.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-paint-with-alpha"/>cairo_paint_with_alpha ()</title>
+<indexterm><primary>cairo_paint_with_alpha</primary></indexterm><programlisting><link linkend="void">void</link> cairo_paint_with_alpha (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> alpha);</programlisting>
+<para>
+A drawing operator that paints the current source everywhere within
+the current clip region using a mask of constant alpha value
+<parameter>alpha</parameter>. The effect is similar to <link linkend="cairo-paint"><function>cairo_paint()</function></link>, but the drawing
+is faded out using the alpha value.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>alpha</parameter>&nbsp;:</term>
+<listitem><simpara> alpha value, between 0 (transparent) and 1 (opaque)
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-mask"/>cairo_mask ()</title>
+<indexterm><primary>cairo_mask</primary></indexterm><programlisting><link linkend="void">void</link> cairo_mask (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);</programlisting>
+<para>
+A drawing operator that paints the current source
+using the alpha channel of <parameter>pattern</parameter> as a mask. (Opaque
+areas of <parameter>mask</parameter> are painted with the source, transparent
+areas are not painted.)</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>pattern</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link>
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-mask-surface"/>cairo_mask_surface ()</title>
+<indexterm><primary>cairo_mask_surface</primary></indexterm><programlisting><link linkend="void">void</link> cairo_mask_surface (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
+ <link linkend="double">double</link> surface_x,
+ <link linkend="double">double</link> surface_y);</programlisting>
+<para>
+A drawing operator that paints the current source
+using the alpha channel of <parameter>surface</parameter> as a mask. (Opaque
+areas of <parameter>surface</parameter> are painted with the source, transparent
+areas are not painted.)</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>surface_x</parameter>&nbsp;:</term>
+<listitem><simpara> X coordinate at which to place the origin of <parameter>surface</parameter>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>surface_y</parameter>&nbsp;:</term>
+<listitem><simpara> Y coordinate at which to place the origin of <parameter>surface</parameter>
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
<title><anchor id="cairo-stroke"/>cairo_stroke ()</title>
<indexterm><primary>cairo_stroke</primary></indexterm><programlisting><link linkend="void">void</link> cairo_stroke (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
<para>
+A drawing operator that strokes the current path according to the
+current line width, line join, line cap, and dash settings. After
+cairo_stroke, the current path will be cleared from the cairo
+context. See <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>, <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>,
+<link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>, <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>, and
+<link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link>.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-stroke-preserve"/>cairo_stroke_preserve ()</title>
+<indexterm><primary>cairo_stroke_preserve</primary></indexterm><programlisting><link linkend="void">void</link> cairo_stroke_preserve (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+A drawing operator that strokes the current path according to the
+current line width, line join, line cap, and dash settings. Unlike
+<link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, cairo_stroke_preserve preserves the path within the
+cairo context.
+</para>
+<para>
+See <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>, <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>,
+<link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>, <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>, and
+<link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link>.</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-fill"/>cairo_fill ()</title>
<indexterm><primary>cairo_fill</primary></indexterm><programlisting><link linkend="void">void</link> cairo_fill (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
<para>
+A drawing operator that fills the current path according to the
+current fill rule. After cairo_fill, the current path will be
+cleared from the cairo context. See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and
+<link linkend="cairo-fill-preserve"><function>cairo_fill_preserve()</function></link>.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-fill-preserve"/>cairo_fill_preserve ()</title>
+<indexterm><primary>cairo_fill_preserve</primary></indexterm><programlisting><link linkend="void">void</link> cairo_fill_preserve (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+A drawing operator that fills the current path according to the
+current fill rule. Unlike <link linkend="cairo-fill"><function>cairo_fill()</function></link>, cairo_fill_preserve
+preserves the path within the cairo context.
+</para>
+<para>
+See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and <link linkend="cairo-fill"><function>cairo_fill()</function></link>.</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -1398,7 +1559,7 @@ the arc in the direction of decreasing angle.</para>
<para>
<link linkend="cairo-bool-t"><type>cairo_bool_t</type></link> is used for boolean values. Returns of type
<link linkend="cairo-bool-t"><type>cairo_bool_t</type></link> will always be either 0 or 1, but testing against
-these values explicitely is not encouraged; just use the
+these values explicitly is not encouraged; just use the
value as a boolean condition.
</para>
<para>
@@ -1467,43 +1628,90 @@ value as a boolean condition.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-init-clip"/>cairo_init_clip ()</title>
-<indexterm><primary>cairo_init_clip</primary></indexterm><programlisting><link linkend="void">void</link> cairo_init_clip (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-clip"/>cairo_clip ()</title>
+<indexterm><primary>cairo_clip</primary></indexterm><programlisting><link linkend="void">void</link> cairo_clip (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Establishes a new clip region by intersecting the current clip
+region with the current path as it would be filled by <link linkend="cairo-fill"><function>cairo_fill()</function></link>
+and according to the current fill rule (see <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link>).
+</para>
+<para>
+After cairo_clip, the current path will be cleared from the cairo
+context.
+</para>
+<para>
+The current clip region affects all drawing operations by
+effectively masking out any changes to the surface that are outside
+the current clip region.
+</para>
+<para>
+Calling <link linkend="cairo-clip"><function>cairo_clip()</function></link> can only make the clip region smaller, never
+larger. But the current clip is part of the graphics state, so a
+tempoarary restriction of the clip region can be achieved by
+calling <link linkend="cairo-clip"><function>cairo_clip()</function></link> within a <link linkend="cairo-save"><function>cairo_save()</function></link>/<link linkend="cairo-restore"><function>cairo_restore()</function></link>
+pair. The only other means of increasing the size of the clip
+region is <link linkend="cairo-reset-clip"><function>cairo_reset_clip()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-clip"/>cairo_clip ()</title>
-<indexterm><primary>cairo_clip</primary></indexterm><programlisting><link linkend="void">void</link> cairo_clip (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-clip-preserve"/>cairo_clip_preserve ()</title>
+<indexterm><primary>cairo_clip_preserve</primary></indexterm><programlisting><link linkend="void">void</link> cairo_clip_preserve (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Establishes a new clip region by intersecting the current clip
+region with the current path as it would be filled by <link linkend="cairo-fill"><function>cairo_fill()</function></link>
+and according to the current fill rule (see <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link>).
+</para>
+<para>
+Unlike <link linkend="cairo-clip"><function>cairo_clip()</function></link>, cairo_clip_preserve preserves the path within
+the cairo context.
+</para>
+<para>
+The current clip region affects all drawing operations by
+effectively masking out any changes to the surface that are outside
+the current clip region.
+</para>
+<para>
+Calling <link linkend="cairo-clip"><function>cairo_clip()</function></link> can only make the clip region smaller, never
+larger. But the current clip is part of the graphics state, so a
+tempoarary restriction of the clip region can be achieved by
+calling <link linkend="cairo-clip"><function>cairo_clip()</function></link> within a <link linkend="cairo-save"><function>cairo_save()</function></link>/<link linkend="cairo-restore"><function>cairo_restore()</function></link>
+pair. The only other means of increasing the size of the clip
+region is <link linkend="cairo-reset-clip"><function>cairo_reset_clip()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-font-t"/>cairo_font_t</title>
-<indexterm><primary>cairo_font_t</primary></indexterm><programlisting>typedef struct _cairo_font cairo_font_t;
-</programlisting>
+<title><anchor id="cairo-reset-clip"/>cairo_reset_clip ()</title>
+<indexterm><primary>cairo_reset_clip</primary></indexterm><programlisting><link linkend="void">void</link> cairo_reset_clip (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Reset the current clip region to its original, unrestricted
+state. That is, set the clip region to an infinitely large shape
+containing the target surface. Equivalently, if infinity is too
+hard to grasp, one can imagine the clip region being reset to the
+exact bounds of the target surface.
+</para>
<para>
-A <link linkend="cairo-font-t"><type>cairo_font_t</type></link> is a font scaled to a particular size and device
-resolution. A font can be set on a <link linkend="cairo-t"><type>cairo_t</type></link> by using
-<link linkend="cairo-set-font"><function>cairo_set_font()</function></link> assuming that the current transformation and
-target surface of the <link linkend="cairo-t"><type>cairo_t</type></link> match that for which the
-<link linkend="cairo-font-t"><type>cairo_font_t</type></link> was created. The effect of using a mismatched
-<link linkend="cairo-font-t"><type>cairo_font_t</type></link> will be incorrect font metrics.</para>
+Note that code meant to be reusable should not call
+<link linkend="cairo-reset-clip"><function>cairo_reset_clip()</function></link> as it will cause results unexpected by
+higher-level code which calls <link linkend="cairo-clip"><function>cairo_clip()</function></link>. Consider using
+<link linkend="cairo-save"><function>cairo_save()</function></link> and <link linkend="cairo-restore"><function>cairo_restore()</function></link> around <link linkend="cairo-clip"><function>cairo_clip()</function></link> as a more
+robust means of temporarily restricting the clip region.</para>
<para>
-</para></refsect2>
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-glyph-t"/>cairo_glyph_t</title>
<indexterm><primary>cairo_glyph_t</primary></indexterm><programlisting>typedef struct {
@@ -1551,82 +1759,6 @@ with respect to the overall origin</para>
</varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-text-extents-t"/>cairo_text_extents_t</title>
-<indexterm><primary>cairo_text_extents_t</primary></indexterm><programlisting>typedef struct {
- double x_bearing;
- double y_bearing;
- double width;
- double height;
- double x_advance;
- double y_advance;
-} cairo_text_extents_t;
-</programlisting>
-<para>
-The <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link>&lt; structure stores the extents of a single
-glyph or a string of glyphs in user-space coordinates. Because text
-extents are in user-space coordinates, they don't scale along with
-the current transformation matrix. If you call
-<literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
-be drawn twice as big, but the reported text extents will not be
-doubled. They will change slightly due to hinting (so you can't
-assume that metrics are independent of the transformation matrix),
-but otherwise will remain unchanged.</para>
-<para>
-
-</para><variablelist role="struct">
-<varlistentry>
-<term><link linkend="double">double</link>&nbsp;<structfield>x_bearing</structfield>;</term>
-<listitem><simpara> the horizontal distance from the origin to the
- leftmost part of the glyphs as drawn. Positive if the
- glyphs lie entirely to the right of the origin.
-</simpara></listitem>
-</varlistentry>
-<varlistentry>
-<term><link linkend="double">double</link>&nbsp;<structfield>y_bearing</structfield>;</term>
-<listitem><simpara> the vertical distance from the origin to the
- topmost part of the glyphs as drawn. Positive only if the
- glyphs lie completely below the origin; will usually be
- negative.
-</simpara></listitem>
-</varlistentry>
-<varlistentry>
-<term><link linkend="double">double</link>&nbsp;<structfield>width</structfield>;</term>
-<listitem><simpara> width of the glyphs as drawn
-</simpara></listitem>
-</varlistentry>
-<varlistentry>
-<term><link linkend="double">double</link>&nbsp;<structfield>height</structfield>;</term>
-<listitem><simpara> height of the glyphs as drawn
-</simpara></listitem>
-</varlistentry>
-<varlistentry>
-<term><link linkend="double">double</link>&nbsp;<structfield>x_advance</structfield>;</term>
-<listitem><simpara>distance to advance in the X direction
- after drawing these glyphs
-</simpara></listitem>
-</varlistentry>
-<varlistentry>
-<term><link linkend="double">double</link>&nbsp;<structfield>y_advance</structfield>;</term>
-<listitem><simpara> distance to advance in the Y direction
- after drawing these glyphs. Will typically be zero except
- for vertical text layout as found in East-Asian languages.
-</simpara></listitem>
-</varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-font-extents-t"/>cairo_font_extents_t</title>
-<indexterm><primary>cairo_font_extents_t</primary></indexterm><programlisting>typedef struct {
- double ascent;
- double descent;
- double height;
- double max_x_advance;
- double max_y_advance;
-} cairo_font_extents_t;
-</programlisting>
-<para>
-
-</para></refsect2>
-<refsect2>
<title><anchor id="cairo-font-slant-t"/>enum cairo_font_slant_t</title>
<indexterm><primary>cairo_font_slant_t</primary></indexterm><programlisting>typedef enum cairo_font_slant {
CAIRO_FONT_SLANT_NORMAL,
@@ -1648,65 +1780,98 @@ but otherwise will remain unchanged.</para>
</para></refsect2>
<refsect2>
-<title><anchor id="cairo-select-font"/>cairo_select_font ()</title>
-<indexterm><primary>cairo_select_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_select_font (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-select-font-face"/>cairo_select_font_face ()</title>
+<indexterm><primary>cairo_select_font_face</primary></indexterm><programlisting><link linkend="void">void</link> cairo_select_font_face (<link linkend="cairo-t">cairo_t</link> *cr,
const <link linkend="char">char</link> *family,
<link linkend="cairo-font-slant-t">cairo_font_slant_t</link> slant,
<link linkend="cairo-font-weight-t">cairo_font_weight_t</link> weight);</programlisting>
<para>
+Selects a family and style of font from a simplified description as
+a family name, slant and weight. This function is meant to be used
+only for applications with simple font needs: Cairo doesn't provide
+for operations such as listing all available fonts on the system,
+and it is expected that most applications will need to use a more
+comprehensive font handling and text layout library in addition to
+Cairo.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>family</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a font family name, encoded in UTF-8
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>slant</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> the slant for the font
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>weight</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> the weight for the font
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-scale-font"/>cairo_scale_font ()</title>
-<indexterm><primary>cairo_scale_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_scale_font (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="double">double</link> scale);</programlisting>
+<title><anchor id="cairo-set-font-size"/>cairo_set_font_size ()</title>
+<indexterm><primary>cairo_set_font_size</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_size (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> size);</programlisting>
+<para>
+Sets the current font matrix to a scale by a factor of <parameter>size</parameter>, replacing
+any font matrix previously set with <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link> or
+<link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>. This results in a font size of <parameter>size</parameter> user space
+units. (More precisely, this matrix will result in the font's
+em-square being a <parameter>size</parameter> by <parameter>size</parameter> square in user space.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>scale</parameter>&nbsp;:</term>
-<listitem><simpara>
-
+<varlistentry><term><parameter>size</parameter>&nbsp;:</term>
+<listitem><simpara> the new font size, in user space units
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-set-font-matrix"/>cairo_set_font_matrix ()</title>
+<indexterm><primary>cairo_set_font_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
+ const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<para>
+Sets the current font matrix to <parameter>matrix</parameter>. The font matrix gives a
+transformation from the design space of the font (in this space,
+the em-square is 1 unit by 1 unit) to user space. Normally, a
+simple scale is used (see <link linkend="cairo-set-font-size"><function>cairo_set_font_size()</function></link>), but a more
+complex font matrix can be used to shear the font
+or stretch it unequally along the two axes</para>
+<para>
+</para><variablelist role="params">
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link> describing a transform to be applied to
+the current font.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-transform-font"/>cairo_transform_font ()</title>
-<indexterm><primary>cairo_transform_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_transform_font (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-get-font-matrix"/>cairo_get_font_matrix ()</title>
+<indexterm><primary>cairo_get_font_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_get_font_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
<para>
+Stores the current font matrix into <parameter>matrix</parameter>. See
+<link linkend="cairo-set-font-matrix"><function>cairo_set_font_matrix()</function></link>.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> return value for the matrix
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-show-text"/>cairo_show_text ()</title>
<indexterm><primary>cairo_show_text</primary></indexterm><programlisting><link linkend="void">void</link> cairo_show_text (<link linkend="cairo-t">cairo_t</link> *cr,
- unsigned <link linkend="char">char</link> *utf8);</programlisting>
+ const <link linkend="char">char</link> *utf8);</programlisting>
<para>
</para><variablelist role="params">
@@ -1740,13 +1905,10 @@ but otherwise will remain unchanged.</para>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-font"/>cairo_current_font ()</title>
-<indexterm><primary>cairo_current_font</primary></indexterm><programlisting><link linkend="cairo-font-t">cairo_font_t</link>* cairo_current_font (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-font-face"/>cairo_get_font_face ()</title>
+<indexterm><primary>cairo_get_font_face</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link>* cairo_get_font_face (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
<para>
-Gets the current font object for a <link linkend="cairo-t"><type>cairo_t</type></link>. If there is no current
-font object, because the font parameters, transform, or target
-surface has been changed since a font was last used, a font object
-will be created and stored in in the <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
+Gets the current font face for a <link linkend="cairo-t"><type>cairo_t</type></link>.</para>
<para>
</para><variablelist role="params">
@@ -1755,69 +1917,76 @@ will be created and stored in in the <link linkend="cairo-t"><type>cairo_t</type
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current font object. Can return <literal>NULL</literal>
on out-of-memory or if the context is already in
- an error state. This object is owned by Cairo. To keep
- a reference to it, you must call <link linkend="cairo-font-reference"><function>cairo_font_reference()</function></link>.
+ an error state. This object is owned by cairo. To keep
+ a reference to it, you must call <link linkend="cairo-font-face-reference"><function>cairo_font_face_reference()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-font-extents"/>cairo_current_font_extents ()</title>
-<indexterm><primary>cairo_current_font_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_current_font_extents (<link linkend="cairo-t">cairo_t</link> *cr,
+<title><anchor id="cairo-font-extents"/>cairo_font_extents ()</title>
+<indexterm><primary>cairo_font_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_extents (<link linkend="cairo-t">cairo_t</link> *cr,
<link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);</programlisting>
<para>
+Gets the font extents for the currently selected font.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a <link linkend="cairo-font-extents-t"><type>cairo_font_extents_t</type></link> object into which the results
+will be stored.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-set-font"/>cairo_set_font ()</title>
-<indexterm><primary>cairo_set_font</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
+<title><anchor id="cairo-set-font-face"/>cairo_set_font_face ()</title>
+<indexterm><primary>cairo_set_font_face</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_font_face (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting>
<para>
-Replaces the current <link linkend="cairo-font-t"><type>cairo_font_t</type></link> object in the <link linkend="cairo-t"><type>cairo_t</type></link> with
-<parameter>font</parameter>. The replaced font in the <link linkend="cairo-t"><type>cairo_t</type></link> will be destroyed if there
-are no other references to it. Since a <link linkend="cairo-font-t"><type>cairo_font_t</type></link> is specific to
-a particular output device and size, changing the transformation,
-font transformation, or target surfaces of a <link linkend="cairo-t"><type>cairo_t</type></link> will clear
-any previously set font. Setting the font using <link linkend="cairo-set-font"><function>cairo_set_font()</function></link> is
-exclusive with the simple font selection API provided by
-<link linkend="cairo-select-font"><function>cairo_select_font()</function></link>. The size and transformation set by
-<link linkend="cairo-scale-font"><function>cairo_scale_font()</function></link> and <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link> are ignored unless
-they were taken into account when creating <parameter>font</parameter>.</para>
+Replaces the current <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link> object in the <link linkend="cairo-t"><type>cairo_t</type></link> with
+<parameter>font_face</parameter>. The replaced font face in the <link linkend="cairo-t"><type>cairo_t</type></link> will be
+destroyed if there are no other references to it.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-font-t"><type>cairo_font_t</type></link>, or <literal>NULL</literal> to unset any previously set font.
+<varlistentry><term><parameter>font_face</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>, or <literal>NULL</literal> to restore to the default font
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-text-extents"/>cairo_text_extents ()</title>
<indexterm><primary>cairo_text_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_text_extents (<link linkend="cairo-t">cairo_t</link> *cr,
- unsigned <link linkend="char">char</link> *utf8,
+ const <link linkend="char">char</link> *utf8,
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
<para>
+Gets the extents for a string of text. The extents describe a
+user-space rectangle that encloses the "inked" portion of the text,
+(as it would be drawn by cairo_show_text). Additionally, the
+x_advance and y_advance values indicate the amount by which the
+current point would be advanced by cairo_show_text.
+</para>
+<para>
+Note that whitespace characters do not directly contribute to the
+size of the rectangle (extents.width and extents.height). They do
+contribute indirectly by changing the position of non-whitespace
+characters. In particular, trailing whitespace characters are
+likely to not affect the size of the rectangle, though they will
+affect the x_advance and y_advance values.</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>utf8</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a string of text, encoded in utf-8
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
+will be stored.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -1827,27 +1996,37 @@ they were taken into account when creating <parameter>font</parameter>.</para>
<link linkend="int">int</link> num_glyphs,
<link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
<para>
+Gets the extents for an array of glyphs. The extents describe a
+user-space rectangle that encloses the "inked" portion of the
+glyphs, (as they would be drawn by cairo_show_glyphs).
+Additionally, the x_advance and y_advance values indicate the
+amount by which the current point would be advanced by
+cairo_show_glyphs.
+</para>
+<para>
+Note that whitespace glyphs do not contribute to the size of the
+rectangle (extents.width and extents.height).</para>
+<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> an array of <link linkend="cairo-glyph-t"><type>cairo_glyph_t</type></link> objects
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_glyphs</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> the number of elements in <parameter>glyphs</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> object into which the results
+will be stored
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-text-path"/>cairo_text_path ()</title>
<indexterm><primary>cairo_text_path</primary></indexterm><programlisting><link linkend="void">void</link> cairo_text_path (<link linkend="cairo-t">cairo_t</link> *cr,
- unsigned <link linkend="char">char</link> *utf8);</programlisting>
+ const <link linkend="char">char</link> *utf8);</programlisting>
<para>
</para><variablelist role="params">
@@ -1881,368 +2060,332 @@ they were taken into account when creating <parameter>font</parameter>.</para>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-font-reference"/>cairo_font_reference ()</title>
-<indexterm><primary>cairo_font_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_reference (<link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
+<title><anchor id="cairo-get-operator"/>cairo_get_operator ()</title>
+<indexterm><primary>cairo_get_operator</primary></indexterm><programlisting><link linkend="cairo-operator-t">cairo_operator_t</link> cairo_get_operator (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-font-destroy"/>cairo_font_destroy ()</title>
-<indexterm><primary>cairo_font_destroy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_destroy (<link linkend="cairo-font-t">cairo_font_t</link> *font);</programlisting>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-font-extents"/>cairo_font_extents ()</title>
-<indexterm><primary>cairo_font_extents</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_font_extents (<link linkend="cairo-font-t">cairo_font_t</link> *font,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix,
- <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents);</programlisting>
-<para>
-Gets the metrics for a <link linkend="cairo-font-t"><type>cairo_font_t</type></link>.</para>
+Gets the current compositing operator for a cairo context.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-font-t"><type>cairo_font_t</type></link>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>font_matrix</parameter>&nbsp;:</term>
-<listitem><simpara> the font transformation for which this font was
- created. (See <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link>). This is needed
- properly convert the metrics from the font into user space.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-font-extents-t"><type>cairo_font_extents_t</type></link> which to store the retrieved extents.
+<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> on success. Otherwise, an
- error such as <literal>CAIRO_STATUS_NO_MEMORY</literal>.
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current compositing operator.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-font-glyph-extents"/>cairo_font_glyph_extents ()</title>
-<indexterm><primary>cairo_font_glyph_extents</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_glyph_extents (<link linkend="cairo-font-t">cairo_font_t</link> *font,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix,
- <link linkend="cairo-glyph-t">cairo_glyph_t</link> *glyphs,
- <link linkend="int">int</link> num_glyphs,
- <link linkend="cairo-text-extents-t">cairo_text_extents_t</link> *extents);</programlisting>
+<title><anchor id="cairo-get-source"/>cairo_get_source ()</title>
+<indexterm><primary>cairo_get_source</primary></indexterm><programlisting><link linkend="cairo-pattern-t">cairo_pattern_t</link>* cairo_get_source (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
<para>
-<link linkend="cairo-font-glyph-extents"><function>cairo_font_glyph_extents()</function></link> gets the overall metrics for a string of
-glyphs. The X and Y offsets in <parameter>glyphs</parameter> are taken from an origin of 0,0.</para>
-<para>
-
-</para><variablelist role="params">
-<varlistentry><term><parameter>font</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-font-t"><type>cairo_font_t</type></link>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>font_matrix</parameter>&nbsp;:</term>
-<listitem><simpara> the font transformation for which this font was
- created. (See <link linkend="cairo-transform-font"><function>cairo_transform_font()</function></link>). This is needed
- properly convert the metrics from the font into user space.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>glyphs</parameter>&nbsp;:</term>
-<listitem><simpara> an array of glyph IDs with X and Y offsets.
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>num_glyphs</parameter>&nbsp;:</term>
-<listitem><simpara> the number of glyphs in the <parameter>glyphs</parameter> array
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>extents</parameter>&nbsp;:</term>
-<listitem><simpara> a <link linkend="cairo-text-extents-t"><type>cairo_text_extents_t</type></link> which to store the retrieved extents.
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
-<refsect2>
-<title><anchor id="cairo-show-surface"/>cairo_show_surface ()</title>
-<indexterm><primary>cairo_show_surface</primary></indexterm><programlisting><link linkend="void">void</link> cairo_show_surface (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-surface-t">cairo_surface_t</link> *surface,
- <link linkend="int">int</link> width,
- <link linkend="int">int</link> height);</programlisting>
+Gets the current source pattern for <parameter>cr</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>width</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>height</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current source pattern. This object is owned by
+cairo. To keep a reference to it, you must call
+<link linkend="cairo-pattern-reference"><function>cairo_pattern_reference()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-operator"/>cairo_current_operator ()</title>
-<indexterm><primary>cairo_current_operator</primary></indexterm><programlisting><link linkend="cairo-operator-t">cairo_operator_t</link> cairo_current_operator (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-tolerance"/>cairo_get_tolerance ()</title>
+<indexterm><primary>cairo_get_tolerance</primary></indexterm><programlisting><link linkend="double">double</link> cairo_get_tolerance (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the current tolerance value, as set by <link linkend="cairo-set-tolerance"><function>cairo_set_tolerance()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current tolerance value.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-rgb-color"/>cairo_current_rgb_color ()</title>
-<indexterm><primary>cairo_current_rgb_color</primary></indexterm><programlisting><link linkend="void">void</link> cairo_current_rgb_color (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="double">double</link> *red,
- <link linkend="double">double</link> *green,
- <link linkend="double">double</link> *blue);</programlisting>
+<title><anchor id="cairo-get-current-point"/>cairo_get_current_point ()</title>
+<indexterm><primary>cairo_get_current_point</primary></indexterm><programlisting><link linkend="void">void</link> cairo_get_current_point (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="double">double</link> *x,
+ <link linkend="double">double</link> *y);</programlisting>
+<para>
+Gets the current point of the current path, which is
+conceptually the final point reached by the path so far.
+</para>
+<para>
+The current point is returned in the user-space coordinate
+system. If there is no defined current point then <parameter>x</parameter> and <parameter>y</parameter> will
+both be set to 0.0.
+</para>
+<para>
+Most path construction functions alter the current point. See the
+following for details on how they affect the current point:
+</para>
+<para>
+<link linkend="cairo-new-path"><function>cairo_new_path()</function></link>, <link linkend="cairo-move-to"><function>cairo_move_to()</function></link>, <link linkend="cairo-line-to"><function>cairo_line_to()</function></link>,
+<link linkend="cairo-curve-to"><function>cairo_curve_to()</function></link>, <link linkend="cairo-arc"><function>cairo_arc()</function></link>, <link linkend="cairo-rel-move-to"><function>cairo_rel_move_to()</function></link>,
+<link linkend="cairo-rel-line-to"><function>cairo_rel_line_to()</function></link>, <link linkend="cairo-rel-curve-to"><function>cairo_rel_curve_to()</function></link>, <link linkend="cairo-arc"><function>cairo_arc()</function></link>,
+<link linkend="cairo-text-path"><function>cairo_text_path()</function></link>, <link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link></para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>red</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>green</parameter>&nbsp;:</term>
-<listitem><simpara>
+<varlistentry><term><parameter>x</parameter>&nbsp;:</term>
+<listitem><simpara> return value for X coordinate of the current point
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>blue</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><parameter>y</parameter>&nbsp;:</term>
+<listitem><simpara> return value for Y coordinate of the current point
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-pattern"/>cairo_current_pattern ()</title>
-<indexterm><primary>cairo_current_pattern</primary></indexterm><programlisting><link linkend="cairo-pattern-t">cairo_pattern_t</link>* cairo_current_pattern (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-fill-rule"/>cairo_get_fill_rule ()</title>
+<indexterm><primary>cairo_get_fill_rule</primary></indexterm><programlisting><link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link> cairo_get_fill_rule (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the current fill rule, as set by <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current fill rule.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-alpha"/>cairo_current_alpha ()</title>
-<indexterm><primary>cairo_current_alpha</primary></indexterm><programlisting><link linkend="double">double</link> cairo_current_alpha (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-line-width"/>cairo_get_line_width ()</title>
+<indexterm><primary>cairo_get_line_width</primary></indexterm><programlisting><link linkend="double">double</link> cairo_get_line_width (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the current line width, as set by <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current line width, in user-space units.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-tolerance"/>cairo_current_tolerance ()</title>
-<indexterm><primary>cairo_current_tolerance</primary></indexterm><programlisting><link linkend="double">double</link> cairo_current_tolerance (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-line-cap"/>cairo_get_line_cap ()</title>
+<indexterm><primary>cairo_get_line_cap</primary></indexterm><programlisting><link linkend="cairo-line-cap-t">cairo_line_cap_t</link> cairo_get_line_cap (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the current line cap style, as set by <link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current line cap style.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-point"/>cairo_current_point ()</title>
-<indexterm><primary>cairo_current_point</primary></indexterm><programlisting><link linkend="void">void</link> cairo_current_point (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="double">double</link> *x,
- <link linkend="double">double</link> *y);</programlisting>
+<title><anchor id="cairo-get-line-join"/>cairo_get_line_join ()</title>
+<indexterm><primary>cairo_get_line_join</primary></indexterm><programlisting><link linkend="cairo-line-join-t">cairo_line_join_t</link> cairo_get_line_join (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the current line join style, as set by <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>x</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>y</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current line join style.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-fill-rule"/>cairo_current_fill_rule ()</title>
-<indexterm><primary>cairo_current_fill_rule</primary></indexterm><programlisting><link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link> cairo_current_fill_rule (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-miter-limit"/>cairo_get_miter_limit ()</title>
+<indexterm><primary>cairo_get_miter_limit</primary></indexterm><programlisting><link linkend="double">double</link> cairo_get_miter_limit (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the current miter limit, as set by <link linkend="cairo-set-miter-limit"><function>cairo_set_miter_limit()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the current miter limit.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-line-width"/>cairo_current_line_width ()</title>
-<indexterm><primary>cairo_current_line_width</primary></indexterm><programlisting><link linkend="double">double</link> cairo_current_line_width (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-matrix"/>cairo_get_matrix ()</title>
+<indexterm><primary>cairo_get_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_get_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<para>
+Stores the current transformation matrix (CTM) into <parameter>matrix</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
+<listitem><simpara> return value for the matrix
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-line-cap"/>cairo_current_line_cap ()</title>
-<indexterm><primary>cairo_current_line_cap</primary></indexterm><programlisting><link linkend="cairo-line-cap-t">cairo_line_cap_t</link> cairo_current_line_cap (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-get-target"/>cairo_get_target ()</title>
+<indexterm><primary>cairo_get_target</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_get_target (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets the target surface for the cairo context as passed to
+<link linkend="cairo-create"><function>cairo_create()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the target surface, (or NULL if <parameter>cr</parameter> is in an error
+state). This object is owned by cairo. To keep a reference to it,
+you must call <link linkend="cairo-surface-reference"><function>cairo_surface_reference()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-line-join"/>cairo_current_line_join ()</title>
-<indexterm><primary>cairo_current_line_join</primary></indexterm><programlisting><link linkend="cairo-line-join-t">cairo_line_join_t</link> cairo_current_line_join (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-copy-path"/>cairo_copy_path ()</title>
+<indexterm><primary>cairo_copy_path</primary></indexterm><programlisting><link linkend="cairo-path-t">cairo_path_t</link>* cairo_copy_path (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Creates a copy of the current path and returns it to the user as a
+<link linkend="cairo-path-t"><type>cairo_path_t</type></link>. See <link linkend="cairo-path-data-t"><type>cairo_path_data_t</type></link> for hints on how to iterate
+over the returned data structure.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the copy of the current path. The caller owns the
+returned object and should call <link linkend="cairo-path-destroy"><function>cairo_path_destroy()</function></link> when finished
+with it.
+This function will always return a valid pointer, but the result
+will have no data, (data==NULL and num_data==0), if either of the
+following conditions hold:
+1) If there is insufficient memory to copy the path. In this case
+ path->status will be set to CAIRO_STATUS_NO_MEMORY.
+
+2) If <parameter>cr</parameter> is already in an error state. In this case path->status
+ will contain the same status that would be returned by
+ cairo_status(cr).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-miter-limit"/>cairo_current_miter_limit ()</title>
-<indexterm><primary>cairo_current_miter_limit</primary></indexterm><programlisting><link linkend="double">double</link> cairo_current_miter_limit (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-copy-path-flat"/>cairo_copy_path_flat ()</title>
+<indexterm><primary>cairo_copy_path_flat</primary></indexterm><programlisting><link linkend="cairo-path-t">cairo_path_t</link>* cairo_copy_path_flat (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<para>
+Gets a flattened copy of the current path and returns it to the
+user as a <link linkend="cairo-path-t"><type>cairo_path_t</type></link>. See <link linkend="cairo-path-data-t"><type>cairo_path_data_t</type></link> for hints on
+how to iterate over the returned data structure.
+</para>
+<para>
+This function is like <link linkend="cairo-copy-path"><function>cairo_copy_path()</function></link> except that any curves
+in the path will be approximated with piecewise-linear
+approximations, (accurate to within the current tolerance
+value). That is, the result is guaranteed to not have any elements
+of type CAIRO_PATH_CURVE_TO which will instead be replaced by a
+series of CAIRO_PATH_LINE_TO elements.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the copy of the current path. The caller owns the
+returned object and should call <link linkend="cairo-path-destroy"><function>cairo_path_destroy()</function></link> when finished
+with it.
+This function will always return a valid pointer, but the result
+will have no data, (data==NULL and num_data==0), if either of the
+following conditions hold:
+1) If there is insufficient memory to copy the path. In this case
+ path->status will be set to CAIRO_STATUS_NO_MEMORY.
+
+2) If <parameter>cr</parameter> is already in an error state. In this case path->status
+ will contain the same status that would be returned by
+ cairo_status(cr).
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-matrix"/>cairo_current_matrix ()</title>
-<indexterm><primary>cairo_current_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_current_matrix (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting>
+<title><anchor id="cairo-append-path"/>cairo_append_path ()</title>
+<indexterm><primary>cairo_append_path</primary></indexterm><programlisting><link linkend="void">void</link> cairo_append_path (<link linkend="cairo-t">cairo_t</link> *cr,
+ <link linkend="cairo-path-t">cairo_path_t</link> *path);</programlisting>
+<para>
+Append the <parameter>path</parameter> onto the current path. The <parameter>path</parameter> may be either the
+return value from one of <link linkend="cairo-copy-path"><function>cairo_copy_path()</function></link> or
+<link linkend="cairo-copy-path-flat"><function>cairo_copy_path_flat()</function></link> or it may be constructed manually. See
+<link linkend="cairo-path-t"><type>cairo_path_t</type></link> for details on how the path data structure should be
+initialized, and note that path->status must be initialized to
+CAIRO_STATUS_SUCCESS.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
+<listitem><simpara> a cairo context
</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>matrix</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><parameter>path</parameter>&nbsp;:</term>
+<listitem><simpara> path to be appended
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-current-target-surface"/>cairo_current_target_surface ()</title>
-<indexterm><primary>cairo_current_target_surface</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_current_target_surface
- (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-path-data-type-t"/>enum cairo_path_data_type_t</title>
+<indexterm><primary>cairo_path_data_type_t</primary></indexterm><programlisting>typedef enum cairo_path_data_type {
+ CAIRO_PATH_MOVE_TO,
+ CAIRO_PATH_LINE_TO,
+ CAIRO_PATH_CURVE_TO,
+ CAIRO_PATH_CLOSE_PATH
+} cairo_path_data_type_t;
+</programlisting>
<para>
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
+</para></refsect2>
<refsect2>
-<title><anchor id="cairo-current-path"/>cairo_current_path ()</title>
-<indexterm><primary>cairo_current_path</primary></indexterm><programlisting><link linkend="void">void</link> cairo_current_path (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-move-to-func-t">cairo_move_to_func_t</link> *move_to,
- <link linkend="cairo-line-to-func-t">cairo_line_to_func_t</link> *line_to,
- <link linkend="cairo-curve-to-func-t">cairo_curve_to_func_t</link> *curve_to,
- <link linkend="cairo-close-path-func-t">cairo_close_path_func_t</link> *close_path,
- <link linkend="void">void</link> *closure);</programlisting>
+<title><anchor id="cairo-path-t"/>cairo_path_t</title>
+<indexterm><primary>cairo_path_t</primary></indexterm><programlisting>typedef struct {
+ cairo_status_t status;
+ cairo_path_data_t *data;
+ int num_data;
+} cairo_path_t;
+</programlisting>
+<para>
+A data structure for holding a path. This data structure serves as
+the return value for <link linkend="cairo-copy-path-data"><function>cairo_copy_path_data()</function></link> and
+<link linkend="cairo-copy-path-data-flat"><function>cairo_copy_path_data_flat()</function></link> as well the input value for
+<link linkend="cairo-append-path"><function>cairo_append_path()</function></link>.
+</para>
+<para>
+See <link linkend="cairo-path-data-t"><type>cairo_path_data_t</type></link> for hints on how to iterate over the
+actual data within the path.
+</para>
+<para>
+The num_data member gives the number of elements in the data
+array. This number is larger than the number of independent path
+portions (MOVE_TO, LINE_TO, CURVE_TO, CLOSE_PATH), since the data
+includes both headers and coordinates for each portion.</para>
<para>
-</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>move_to</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>line_to</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>curve_to</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>close_path</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
-</simpara></listitem></varlistentry>
-</variablelist></refsect2>
+</para></refsect2>
<refsect2>
-<title><anchor id="cairo-current-path-flat"/>cairo_current_path_flat ()</title>
-<indexterm><primary>cairo_current_path_flat</primary></indexterm><programlisting><link linkend="void">void</link> cairo_current_path_flat (<link linkend="cairo-t">cairo_t</link> *cr,
- <link linkend="cairo-move-to-func-t">cairo_move_to_func_t</link> *move_to,
- <link linkend="cairo-line-to-func-t">cairo_line_to_func_t</link> *line_to,
- <link linkend="cairo-close-path-func-t">cairo_close_path_func_t</link> *close_path,
- <link linkend="void">void</link> *closure);</programlisting>
+<title><anchor id="cairo-path-destroy"/>cairo_path_destroy ()</title>
+<indexterm><primary>cairo_path_destroy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_path_destroy (<link linkend="cairo-path-t">cairo_path_t</link> *path);</programlisting>
+<para>
+Immediately releases all memory associated with <parameter>path</parameter>. After a call
+to <link linkend="cairo-path-destroy"><function>cairo_path_destroy()</function></link> the <parameter>path</parameter> pointer is no longer valid and
+should not be used further.
+</para>
+<para>
+NOTE: cairo_path_destroy function should only be called with a
+pointer to a <link linkend="cairo-path-t"><type>cairo_path_t</type></link> returned by a cairo function. Any path
+that is created manually (ie. outside of cairo) should be destroyed
+manually as well.</para>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>move_to</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>line_to</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>close_path</parameter>&nbsp;:</term>
-<listitem><simpara>
-</simpara></listitem></varlistentry>
-<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
-<listitem><simpara>
-
-
+<varlistentry><term><parameter>path</parameter>&nbsp;:</term>
+<listitem><simpara> a path to destroy which was previously returned by either
+cairo_copy_path or cairo_copy_path_flat.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
@@ -2256,12 +2399,100 @@ glyphs. The X and Y offsets in <parameter>glyphs</parameter> are taken from an o
CAIRO_STATUS_INVALID_MATRIX,
CAIRO_STATUS_NO_TARGET_SURFACE,
CAIRO_STATUS_NULL_POINTER,
- CAIRO_STATUS_INVALID_STRING
+ CAIRO_STATUS_INVALID_STRING,
+ CAIRO_STATUS_INVALID_PATH_DATA,
+ CAIRO_STATUS_READ_ERROR,
+ CAIRO_STATUS_WRITE_ERROR,
+ CAIRO_STATUS_SURFACE_FINISHED,
+ CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
+ CAIRO_STATUS_PATTERN_TYPE_MISMATCH
} cairo_status_t;
</programlisting>
<para>
+<link linkend="cairo-status-t"><type>cairo_status_t</type></link> is used to indicate errors that can occur when
+using Cairo. In some cases it is returned directly by functions.
+but when using <link linkend="cairo-t"><type>cairo_t</type></link>, the last error, if any, is stored in
+the context and can be retrieved with <link linkend="cairo-status"><function>cairo_status()</function></link>.</para>
+<para>
-</para></refsect2>
+</para><variablelist role="enum">
+<varlistentry>
+<term><literal>CAIRO_STATUS_SUCCESS</literal></term>
+<listitem><simpara> no error has occurred
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_NO_MEMORY</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_INVALID_RESTORE</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_INVALID_POP_GROUP</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_NO_CURRENT_POINT</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_INVALID_MATRIX</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_NO_TARGET_SURFACE</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_NULL_POINTER</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_INVALID_STRING</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_INVALID_PATH_DATA</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_READ_ERROR</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_WRITE_ERROR</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_SURFACE_FINISHED</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_SURFACE_TYPE_MISMATCH</literal></term>
+<listitem><simpara>
+</simpara></listitem>
+</varlistentry>
+<varlistentry>
+<term><literal>CAIRO_STATUS_PATTERN_TYPE_MISMATCH</literal></term>
+<listitem><simpara>
+
+</simpara></listitem>
+</varlistentry>
+</variablelist></refsect2>
<refsect2>
<title><anchor id="cairo-status"/>cairo_status ()</title>
<indexterm><primary>cairo_status</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_status (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
@@ -2277,12 +2508,19 @@ glyphs. The X and Y offsets in <parameter>glyphs</parameter> are taken from an o
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
-<title><anchor id="cairo-status-string"/>cairo_status_string ()</title>
-<indexterm><primary>cairo_status_string</primary></indexterm><programlisting>const <link linkend="char">char</link>* cairo_status_string (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting>
+<title><anchor id="cairo-status-string"/>cairo_status_string</title>
+<indexterm><primary>cairo_status_string</primary></indexterm><programlisting>#define cairo_status_string cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
+</programlisting>
+<para>
+
+</para></refsect2>
+<refsect2>
+<title><anchor id="cairo-status-to-string"/>cairo_status_to_string ()</title>
+<indexterm><primary>cairo_status_to_string</primary></indexterm><programlisting>const <link linkend="char">char</link>* cairo_status_to_string (<link linkend="cairo-status-t">cairo_status_t</link> status);</programlisting>
<para>
</para><variablelist role="params">
-<varlistentry><term><parameter>cr</parameter>&nbsp;:</term>
+<varlistentry><term><parameter>status</parameter>&nbsp;:</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
@@ -2333,7 +2571,7 @@ must explicitely clear the buffer, using, for example,
<refsect2>
<title><anchor id="cairo-image-surface-create-for-data"/>cairo_image_surface_create_for_data ()</title>
<indexterm><primary>cairo_image_surface_create_for_data</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_image_surface_create_for_data
- (<link linkend="char">char</link> *data,
+ (unsigned <link linkend="char">char</link> *data,
<link linkend="cairo-format-t">cairo_format_t</link> format,
<link linkend="int">int</link> width,
<link linkend="int">int</link> height,
@@ -2371,6 +2609,125 @@ must explicitely clear the buffer, using, for example,
be created because of lack of memory
</simpara></listitem></varlistentry>
</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-image-surface-get-width"/>cairo_image_surface_get_width ()</title>
+<indexterm><primary>cairo_image_surface_get_width</primary></indexterm><programlisting><link linkend="int">int</link> cairo_image_surface_get_width (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
+<para>
+Get the width of the image surface in pixels.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-image-surface-t"><type>cairo_image_surface_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the width of the surface in pixels.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-image-surface-get-height"/>cairo_image_surface_get_height ()</title>
+<indexterm><primary>cairo_image_surface_get_height</primary></indexterm><programlisting><link linkend="int">int</link> cairo_image_surface_get_height (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting>
+<para>
+Get the height of the image surface in pixels.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>surface</parameter>&nbsp;:</term>
+<listitem><simpara> a <link linkend="cairo-image-surface-t"><type>cairo_image_surface_t</type></link>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the height of the surface in pixels.
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-destroy-func-t"/>cairo_destroy_func_t ()</title>
+<indexterm><primary>cairo_destroy_func_t</primary></indexterm><programlisting><link linkend="void">void</link> (*cairo_destroy_func_t) (<link linkend="void">void</link> *data);</programlisting>
+<para>
+<link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> the type of function which is called when a
+data element is destroyed. It is passed the pointer to the data
+element and should free any memory and resources allocated for it.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
+<listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-user-data-key-t"/>cairo_user_data_key_t</title>
+<indexterm><primary>cairo_user_data_key_t</primary></indexterm><programlisting>typedef struct {
+ int unused;
+} cairo_user_data_key_t;
+</programlisting>
+<para>
+<link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> is used for attaching user data to cairo
+data structures. The actual contents of the struct is never used,
+and there is no need to initialize the object; only the unique
+address of a <link linkend="cairo-data-key-t"><type>cairo_data_key_t</type></link> object is used. Typically, you
+would just use the address of a static <link linkend="cairo-data-key-t"><type>cairo_data_key_t</type></link> object.</para>
+<para>
+
+</para></refsect2>
+<refsect2>
+<title><anchor id="cairo-read-func-t"/>cairo_read_func_t ()</title>
+<indexterm><primary>cairo_read_func_t</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> (*cairo_read_func_t) (<link linkend="void">void</link> *closure,
+ unsigned <link linkend="char">char</link> *data,
+ unsigned <link linkend="int">int</link> length);</programlisting>
+<para>
+<link linkend="cairo-read-func-t"><type>cairo_read_func_t</type></link> is the type of function which is called when a
+backend needs to read data from an intput stream. It is passed the
+closure which was specified by the user at the time the read
+function was registered, the buffer to read the data into and the
+length of the data in bytes. The read function should return
+CAIRO_STATUS_SUCCESS if all the data was successfully written,
+CAIRO_STATUS_READ_ERROR otherwise.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
+<refsect2>
+<title><anchor id="cairo-write-func-t"/>cairo_write_func_t ()</title>
+<indexterm><primary>cairo_write_func_t</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> (*cairo_write_func_t) (<link linkend="void">void</link> *closure,
+ unsigned <link linkend="char">char</link> *data,
+ unsigned <link linkend="int">int</link> length);</programlisting>
+<para>
+<link linkend="cairo-write-func-t"><type>cairo_write_func_t</type></link> is the type of function which is called when a
+backend needs to write data to an output stream. It is passed the
+closure which was specified by the user at the time the write
+function was registered, the data to write and the length of the
+data in bytes. The write function should return
+CAIRO_STATUS_SUCCESS if all the data was successfully written,
+CAIRO_STATUS_WRITE_ERROR otherwise.</para>
+<para>
+
+</para><variablelist role="params">
+<varlistentry><term><parameter>closure</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>data</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
+<listitem><simpara>
+</simpara></listitem></varlistentry>
+<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara>
+
+
+</simpara></listitem></varlistentry>
+</variablelist></refsect2>
</refsect1>
diff --git a/gtk-doc.make b/gtk-doc.make
index 18c60c2..91cdd34 100644
--- a/gtk-doc.make
+++ b/gtk-doc.make
@@ -1,9 +1,3 @@
-#
-# *** NOTE *** this file is checked into CVS for convenience only.
-# DO NOT EDIT. Rather get changes into upstream gtk-doc and then
-# update this version from the gtk-doc version.
-#
-
# -*- mode: makefile -*-
####################################
@@ -31,7 +25,6 @@ EXTRA_DIST = \
$(content_files) \
$(HTML_IMAGES) \
$(DOC_MAIN_SGML_FILE) \
- $(DOC_MODULE).types \
$(DOC_MODULE)-sections.txt \
$(DOC_MODULE)-overrides.txt
@@ -55,7 +48,7 @@ all-local: html-build.stamp
scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
@echo '*** Scanning header files ***'
@-chmod -R u+w $(srcdir)
- if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
+ if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
else \
cd $(srcdir) ; \
@@ -75,7 +68,7 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
@echo '*** Rebuilding template files ***'
@-chmod -R u+w $(srcdir)
- cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
+ cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
touch tmpl-build.stamp
tmpl.stamp: tmpl-build.stamp
@@ -83,11 +76,11 @@ tmpl.stamp: tmpl-build.stamp
#### xml ####
-sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
+sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml $(expand_content_files)
@echo '*** Building XML ***'
@-chmod -R u+w $(srcdir)
cd $(srcdir) && \
- gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml $(MKDB_OPTIONS)
+ gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" $(MKDB_OPTIONS)
touch sgml-build.stamp
sgml.stamp: sgml-build.stamp
@@ -146,18 +139,15 @@ dist-check-gtkdoc:
@false
endif
-# XXX: Before this was:
-# dist-hook: dist-check-gtkdoc dist-hook-local
-# which seems reasonable, but for some reason the dist-check-gtkdoc
-# was always failing on me, even though I do have gtk-doc installed
-# and it is successfully building the documentation.
-
-dist-hook: dist-hook-local
+dist-hook: dist-check-gtkdoc dist-hook-local
mkdir $(distdir)/tmpl
mkdir $(distdir)/xml
mkdir $(distdir)/html
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
-cp $(srcdir)/xml/*.xml $(distdir)/xml
-cp $(srcdir)/html/* $(distdir)/html
+ if test -f $(srcdir)/$(DOC_MODULE).types; then \
+ cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \
+ fi
.PHONY : dist-hook-local
diff --git a/install-sh b/install-sh
index 6ce63b9..dd97db7 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,8 @@
#!/bin/sh
-#
# install - install a program, script, or datafile
-#
+
+scriptversion=2004-09-10.20
+
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
@@ -41,13 +42,11 @@
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
-
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
-
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
@@ -59,236 +58,265 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+chowncmd=
+chgrpcmd=
+stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd=$cpprog
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "$0: no input file specified" >&2
- exit 1
-else
- :
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d "$dst" ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=$mkdirprog
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f "$src" ] || [ -d "$src" ]
- then
- :
- else
- echo "$0: $src does not exist" >&2
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "$0: no destination specified" >&2
- exit 1
- else
- :
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d "$dst" ]
- then
- dst=$dst/`basename "$src"`
- else
- :
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
- '
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp=$pathcomp$1
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit 0;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
shift
+ shift
+ continue;;
- if [ ! -d "$pathcomp" ] ;
- then
- $mkdirprog "$pathcomp"
- else
- :
- fi
-
- pathcomp=$pathcomp/
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit 0;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd "$dst" &&
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename "$dst"`
- else
- dstfile=`basename "$dst" $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename "$dst"`
- else
- :
- fi
-
-# Make a couple of temp file names in the proper directory.
-
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
-# Trap to clean up temp files at exit.
-
- trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
- trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location. We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons. In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
- if [ -f "$dstdir/$dstfile" ]
- then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
- $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
- {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit
- }
- else
- :
- fi
-} &&
-
-# Now rename the file to the real destination.
+if test -z "$1"; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
-fi &&
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $cpprog "$src" "$dsttmp" &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit; }
+done
# The final little trick to "correctly" pass the exit status to the exit trap.
-
{
- (exit 0); exit
+ (exit 0); exit
}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/ltmain.sh b/ltmain.sh
index 23f82e3..0b54f84 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,7 +1,7 @@
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun configure.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
@@ -33,9 +33,6 @@ basename="s,^.*/,,g"
# function.
progpath="$0"
-# RH: define SED for historic ltconfig's generated by Libtool 1.3
-[ -z "$SED" ] && SED=sed
-
# The name of this program:
progname=`echo "$progpath" | $SED $basename`
modename="$progname"
@@ -46,9 +43,14 @@ EXIT_FAILURE=1
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.6
-TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
+VERSION=1.5.14
+TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)"
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
@@ -130,6 +132,7 @@ show_help=
execute_dlfiles=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
+quote_scanset='[[~#^*{};<>?'"'"' ]'
#####################################
# Shell function definitions:
@@ -141,7 +144,8 @@ o2lo="s/\\.${objext}\$/.lo/"
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
-func_win32_libid () {
+func_win32_libid ()
+{
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
@@ -181,12 +185,13 @@ func_win32_libid () {
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
-func_infer_tag () {
+func_infer_tag ()
+{
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -207,7 +212,7 @@ func_infer_tag () {
for arg in $CC; do
# Double-quote args containing other shell metacharacters.
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -238,6 +243,131 @@ func_infer_tag () {
esac
fi
}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'`
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+ $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+ $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib"
+ $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
+ $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \
+ | $EGREP -v '^[ ]*1[ ]' | while read count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib"
+ $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xdir="$my_gentop/$my_xlib"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
# End of Shell function definitions
#####################################
@@ -308,10 +438,10 @@ do
--version)
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
$echo
- $echo "Copyright (C) 2003 Free Software Foundation, Inc."
+ $echo "Copyright (C) 2005 Free Software Foundation, Inc."
$echo "This is free software; see the source for copying conditions. There is NO"
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
- exit $EXIT_SUCCESS
+ exit $?
;;
--config)
@@ -320,7 +450,7 @@ do
for tagname in $taglist; do
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
done
- exit $EXIT_SUCCESS
+ exit $?
;;
--debug)
@@ -345,7 +475,7 @@ do
else
$echo "disable static libraries"
fi
- exit $EXIT_SUCCESS
+ exit $?
;;
--finish) mode="finish" ;;
@@ -402,7 +532,7 @@ if test -z "$show_help"; then
# Infer the operation mode.
if test -z "$mode"; then
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
case $nonopt in
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
mode=link
@@ -519,7 +649,7 @@ if test -z "$show_help"; then
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -550,8 +680,11 @@ if test -z "$show_help"; then
case $lastarg in
# Double-quote args containing other shell metacharacters.
# Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
lastarg="\"$lastarg\""
;;
esac
@@ -986,7 +1119,7 @@ EOF
arg="$1"
shift
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
;;
*) qarg=$arg ;;
@@ -1230,6 +1363,11 @@ EOF
prev=
continue
;;
+ darwin_framework)
+ compiler_flags="$compiler_flags $arg"
+ prev=
+ continue
+ ;;
*)
eval "$prev=\"\$arg\""
prev=
@@ -1288,6 +1426,12 @@ EOF
continue
;;
+ -framework)
+ prev=darwin_framework
+ compiler_flags="$compiler_flags $arg"
+ continue
+ ;;
+
-inst-prefix-dir)
prev=inst_prefix
continue
@@ -1348,7 +1492,7 @@ EOF
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
@@ -1359,7 +1503,7 @@ EOF
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
@@ -1369,8 +1513,20 @@ EOF
continue
;;
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- deplibs="$deplibs $arg"
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
continue
;;
@@ -1379,18 +1535,19 @@ EOF
continue
;;
- # gcc -m* arguments should be passed to the linker via $compiler_flags
- # in order to pass architecture information to the linker
- # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
- # but this is not reliable with gcc because gcc may use -mfoo to
- # select a different linker, different libraries, etc, while
- # -Wl,-mfoo simply passes -mfoo to the linker.
- -m*)
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
+
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -1506,7 +1663,7 @@ EOF
for flag in $args; do
IFS="$save_ifs"
case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
flag="\"$flag\""
;;
esac
@@ -1524,7 +1681,7 @@ EOF
for flag in $args; do
IFS="$save_ifs"
case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
flag="\"$flag\""
;;
esac
@@ -1557,7 +1714,7 @@ EOF
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -1691,7 +1848,7 @@ EOF
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -1858,7 +2015,7 @@ EOF
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- deplibs="$deplib $deplibs"
+ compiler_flags="$compiler_flags $deplib"
fi
continue
;;
@@ -1867,10 +2024,6 @@ EOF
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
continue
fi
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
for search_ext in .la $std_shrext .so .a; do
@@ -1981,7 +2134,22 @@ EOF
fi
case $linkmode in
lib)
- if test "$deplibs_check_method" != pass_all; then
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
$echo
$echo "*** Warning: Trying to link with static lib archive $deplib."
$echo "*** I have the capability to make that library automatically link in when"
@@ -2055,6 +2223,8 @@ EOF
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
+ avoidtemprpath=
+
# Read the .la file
case $lib in
@@ -2153,11 +2323,19 @@ EOF
dir="$libdir"
absdir="$libdir"
fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
fi # $installed = yes
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
@@ -2230,7 +2408,7 @@ EOF
if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
# We need to hardcode the library path
- if test -n "$shlibpath_var"; then
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath " in
*" $dir "*) ;;
@@ -2944,7 +3122,7 @@ EOF
# Check that each of the things are valid numbers.
case $current in
- [0-9]*) ;;
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2953,7 +3131,7 @@ EOF
esac
case $revision in
- [0-9]*) ;;
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2962,7 +3140,7 @@ EOF
esac
case $age in
- [0-9]*) ;;
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2990,7 +3168,7 @@ EOF
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
minor_current=`expr $current + 1`
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
;;
freebsd-aout)
@@ -3196,7 +3374,7 @@ EOF
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
@@ -3678,67 +3856,13 @@ EOF
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
fi
fi
-
+
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
linker_flags="$linker_flags $flag"
@@ -3787,6 +3911,7 @@ EOF
save_libobjs=$libobjs
fi
save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and
# initialize k to one.
@@ -3796,7 +3921,7 @@ EOF
delfiles=
last_robj=
k=1
- output=$output_objdir/$save_output-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
@@ -3816,9 +3941,9 @@ EOF
# the last one created.
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
fi
- last_robj=$output_objdir/$save_output-${k}.$objext
+ last_robj=$output_objdir/$output_la-${k}.$objext
k=`expr $k + 1`
- output=$output_objdir/$save_output-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
objlist=$obj
len=1
fi
@@ -3838,13 +3963,13 @@ EOF
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
fi
- # Set up a command to remove the reloadale object files
+ # Set up a command to remove the reloadable object files
# after they are used.
i=0
while test "$i" -lt "$k"
do
i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
done
$echo "creating a temporary reloadable object file: $output"
@@ -3976,64 +4101,10 @@ EOF
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${obj}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
@@ -4295,12 +4366,12 @@ extern \"C\" {
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$output.exp"
+ export_symbols="$output_objdir/$outputname.exp"
$run $rm $export_symbols
$run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
else
- $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
$run eval 'mv "$nlist"T "$nlist"'
fi
fi
@@ -4352,7 +4423,26 @@ extern \"C\" {
#endif
/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
const char *name;
lt_ptr address;
}
@@ -4581,7 +4671,7 @@ static const void *lt_preloaded_setup() {
esac
case $host in
*cygwin* | *mingw* )
- cwrappersource=`$echo ${objdir}/lt-${output}.c`
+ cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
cwrapper=`$echo ${output}.exe`
$rm $cwrappersource $cwrapper
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
@@ -4814,7 +4904,7 @@ sed_quote_subst='$sed_quote_subst'
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
relink_command=\"$relink_command\"
@@ -4991,65 +5081,10 @@ fi\
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
fi
# Do each command in the archive commands.
@@ -5294,7 +5329,7 @@ relink_command=\"$relink_command\""
# Aesthetically quote it.
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -5310,7 +5345,7 @@ relink_command=\"$relink_command\""
# Aesthetically quote it.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -5358,7 +5393,7 @@ relink_command=\"$relink_command\""
# Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
arg="\"$arg\""
;;
esac
@@ -6397,7 +6432,7 @@ esac
$echo
$echo "Try \`$modename --help' for more information about other modes."
-exit $EXIT_SUCCESS
+exit $?
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
diff --git a/missing b/missing
index fc54c64..64b5f90 100755
--- a/missing
+++ b/missing
@@ -1,6 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+
+scriptversion=2004-09-07.08
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -38,18 +42,24 @@ else
configure_ac=configure.in
fi
+msg="missing on your system"
+
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
-h|--h|--he|--hel|--help)
echo "\
@@ -74,11 +84,15 @@ Supported PROGRAM values:
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit 0
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing 0.4 - GNU automake"
+ echo "missing $scriptversion (GNU Automake)"
+ exit 0
;;
-*)
@@ -87,14 +101,44 @@ Supported PROGRAM values:
exit 1
;;
- aclocal*)
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
fi
+ ;;
+esac
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
@@ -102,13 +146,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
autoconf)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
@@ -116,13 +155,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
autoheader)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
@@ -140,13 +174,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
automake*)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
@@ -156,14 +185,9 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
autom4te)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
@@ -185,7 +209,7 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
bison|yacc)
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
@@ -215,7 +239,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
lex|flex)
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
@@ -237,13 +261,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
help2man)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
@@ -262,13 +281,8 @@ WARNING: \`$1' is missing on your system. You should only need it if
;;
makeinfo)
- if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
- # We have makeinfo, but it failed.
- exit 1
- fi
-
echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
+WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
@@ -284,10 +298,6 @@ WARNING: \`$1' is missing on your system. You should only need it if
tar)
shift
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
@@ -323,8 +333,8 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
*)
echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
@@ -334,3 +344,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
esac
exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/src/Makefile.am b/src/Makefile.am
index 3f76d27..8c624f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,56 +1,55 @@
if CAIRO_HAS_PS_SURFACE
libcairo_ps_headers = cairo-ps.h
-libcairo_ps_sources = cairo_ps_surface.c
+libcairo_ps_sources = cairo-ps-surface.c
endif
if CAIRO_HAS_PDF_SURFACE
libcairo_pdf_headers = cairo-pdf.h
-libcairo_pdf_sources = cairo_pdf_surface.c
+libcairo_pdf_sources = cairo-pdf-surface.c
endif
-if CAIRO_HAS_PNG_SURFACE
-libcairo_png_headers = cairo-png.h
-libcairo_png_sources = cairo_png_surface.c
+if CAIRO_HAS_PNG_FUNCTIONS
+libcairo_png_sources = cairo-png.c
endif
if CAIRO_HAS_XLIB_SURFACE
-libcairo_xlib_headers = cairo-xlib.h
-libcairo_xlib_sources = cairo_xlib_surface.c
+libcairo_xlib_headers = cairo-xlib.h cairo-xlib-xrender.h
+libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-test.h
endif
if CAIRO_HAS_QUARTZ_SURFACE
libcairo_quartz_headers = cairo-quartz.h
-libcairo_quartz_sources = cairo_quartz_surface.c
+libcairo_quartz_sources = cairo-quartz-surface.c
endif
if CAIRO_HAS_XCB_SURFACE
-libcairo_xcb_headers = cairo-xcb.h
-libcairo_xcb_sources = cairo_xcb_surface.c
+libcairo_xcb_headers = cairo-xcb.h cairo-xcb-xrender.h
+libcairo_xcb_sources = cairo-xcb-surface.c
endif
libcairo_win32_sources =
if CAIRO_HAS_WIN32_SURFACE
libcairo_win32_headers = cairo-win32.h
-libcairo_win32_sources += cairo_win32_surface.c cairo-win32-private.h
+libcairo_win32_sources += cairo-win32-surface.c cairo-win32-private.h
endif
if CAIRO_HAS_WIN32_FONT
-libcairo_win32_sources += cairo_win32_font.c
+libcairo_win32_sources += cairo-win32-font.c
endif
if CAIRO_HAS_GLITZ_SURFACE
libcairo_glitz_headers = cairo-glitz.h
-libcairo_glitz_sources = cairo_glitz_surface.c
+libcairo_glitz_sources = cairo-glitz-surface.c
endif
if CAIRO_HAS_ATSUI_FONT
libcairo_atsui_headers = cairo-atsui.h
-libcairo_atsui_sources = cairo_atsui_font.c
+libcairo_atsui_sources = cairo-atsui-font.c
endif
if CAIRO_HAS_FT_FONT
libcairo_ft_headers = cairo-ft.h
-libcairo_ft_sources = cairo_ft_font.c cairo-ft-private.h
+libcairo_ft_sources = cairo-ft-font.c cairo-ft-private.h
endif
# These names match automake style variable definition conventions so
@@ -68,7 +67,6 @@ cairoinclude_HEADERS = \
$(libcairo_ft_headers) \
$(libcairo_glitz_headers) \
$(libcairo_pdf_headers) \
- $(libcairo_png_headers) \
$(libcairo_ps_headers) \
$(libcairo_quartz_headers) \
$(libcairo_win32_headers) \
@@ -80,28 +78,36 @@ lib_LTLIBRARIES = libcairo.la
libcairo_la_SOURCES = \
cairo.c \
cairo.h \
- cairo_array.c \
- cairo_cache.c \
- cairo_color.c \
- cairo_fixed.c \
- cairo_font.c \
- cairo_gstate.c \
- cairo_hull.c \
- cairo_image_surface.c \
- cairo_matrix.c \
- cairo_path.c \
- cairo_path_bounds.c \
- cairo_path_fill.c \
- cairo_path_stroke.c \
- cairo_pen.c \
- cairo_polygon.c \
- cairo_slope.c \
- cairo_spline.c \
- cairo_surface.c \
- cairo_traps.c \
- cairo_pattern.c \
- cairo_unicode.c \
- cairo_wideint.c \
+ cairo-private.h \
+ cairo-arc.c \
+ cairo-arc-private.h \
+ cairo-array.c \
+ cairo-cache.c \
+ cairo-color.c \
+ cairo-fixed.c \
+ cairo-font.c \
+ cairo-gstate.c \
+ cairo-gstate-private.h \
+ cairo-hull.c \
+ cairo-image-surface.c \
+ cairo-matrix.c \
+ cairo-path.c \
+ cairo-path-bounds.c \
+ cairo-path-data.c \
+ cairo-path-data-private.h \
+ cairo-path-fill.c \
+ cairo-path-fixed-private.h \
+ cairo-path-stroke.c \
+ cairo-pen.c \
+ cairo-polygon.c \
+ cairo-slope.c \
+ cairo-spline.c \
+ cairo-surface.c \
+ cairo-traps.c \
+ cairo-pattern.c \
+ cairo-unicode.c \
+ cairo-output-stream.c \
+ cairo-wideint.c \
cairo-wideint.h \
$(libcairo_atsui_sources)\
$(libcairo_ft_sources)\
@@ -113,7 +119,6 @@ libcairo_la_SOURCES = \
$(libcairo_xcb_sources) \
$(libcairo_glitz_sources)\
$(libcairo_win32_sources)\
- $(libcairo_freetype_sources) \
cairoint.h
libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
@@ -123,7 +128,7 @@ INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS)
libcairo_la_LIBADD = $(CAIRO_LIBS)
install-data-local:
- @if test -f $(includedir)/cairo.h || test -f $(includedir)/cairo-features.h ; then \
+ @if test -f "$(DESTDIR)$(includedir)/cairo.h" || test -f "$(DESTDIR)$(includedir)/cairo-features.h" ; then \
echo "****************************************************************" ; \
echo "*** Error: Old headers found. You should remove the following" ; \
echo "*** files and then type 'make install' again." ; \
diff --git a/src/Makefile.in b/src/Makefile.in
index 9140313..354f04c 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -39,8 +39,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_1 = cairo_win32_surface.c cairo-win32-private.h
-@CAIRO_HAS_WIN32_FONT_TRUE@am__append_2 = cairo_win32_font.c
+@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_1 = cairo-win32-surface.c cairo-win32-private.h
+@CAIRO_HAS_WIN32_FONT_TRUE@am__append_2 = cairo-win32-font.c
subdir = src
DIST_COMMON = $(am__cairoinclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/cairo-features.h.in
@@ -63,39 +63,43 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libcairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
-am__libcairo_la_SOURCES_DIST = cairo.c cairo.h cairo_array.c \
- cairo_cache.c cairo_color.c cairo_fixed.c cairo_font.c \
- cairo_gstate.c cairo_hull.c cairo_image_surface.c \
- cairo_matrix.c cairo_path.c cairo_path_bounds.c \
- cairo_path_fill.c cairo_path_stroke.c cairo_pen.c \
- cairo_polygon.c cairo_slope.c cairo_spline.c cairo_surface.c \
- cairo_traps.c cairo_pattern.c cairo_unicode.c cairo_wideint.c \
- cairo-wideint.h cairo_atsui_font.c cairo_ft_font.c \
- cairo-ft-private.h cairo_ps_surface.c cairo_pdf_surface.c \
- cairo_png_surface.c cairo_xlib_surface.c \
- cairo_quartz_surface.c cairo_xcb_surface.c \
- cairo_glitz_surface.c cairo_win32_surface.c \
- cairo-win32-private.h cairo_win32_font.c cairoint.h
-@CAIRO_HAS_ATSUI_FONT_TRUE@am__objects_1 = cairo_atsui_font.lo
-@CAIRO_HAS_FT_FONT_TRUE@am__objects_2 = cairo_ft_font.lo
-@CAIRO_HAS_PS_SURFACE_TRUE@am__objects_3 = cairo_ps_surface.lo
-@CAIRO_HAS_PDF_SURFACE_TRUE@am__objects_4 = cairo_pdf_surface.lo
-@CAIRO_HAS_PNG_SURFACE_TRUE@am__objects_5 = cairo_png_surface.lo
-@CAIRO_HAS_XLIB_SURFACE_TRUE@am__objects_6 = cairo_xlib_surface.lo
+am__libcairo_la_SOURCES_DIST = cairo.c cairo.h cairo-private.h \
+ cairo-arc.c cairo-arc-private.h cairo-array.c cairo-cache.c \
+ cairo-color.c cairo-fixed.c cairo-font.c cairo-gstate.c \
+ cairo-gstate-private.h cairo-hull.c cairo-image-surface.c \
+ cairo-matrix.c cairo-path.c cairo-path-bounds.c \
+ cairo-path-data.c cairo-path-data-private.h cairo-path-fill.c \
+ cairo-path-fixed-private.h cairo-path-stroke.c cairo-pen.c \
+ cairo-polygon.c cairo-slope.c cairo-spline.c cairo-surface.c \
+ cairo-traps.c cairo-pattern.c cairo-unicode.c \
+ cairo-output-stream.c cairo-wideint.c cairo-wideint.h \
+ cairo-atsui-font.c cairo-ft-font.c cairo-ft-private.h \
+ cairo-ps-surface.c cairo-pdf-surface.c cairo-png.c \
+ cairo-xlib-surface.c cairo-xlib-test.h cairo-quartz-surface.c \
+ cairo-xcb-surface.c cairo-glitz-surface.c \
+ cairo-win32-surface.c cairo-win32-private.h cairo-win32-font.c \
+ cairoint.h
+@CAIRO_HAS_ATSUI_FONT_TRUE@am__objects_1 = cairo-atsui-font.lo
+@CAIRO_HAS_FT_FONT_TRUE@am__objects_2 = cairo-ft-font.lo
+@CAIRO_HAS_PS_SURFACE_TRUE@am__objects_3 = cairo-ps-surface.lo
+@CAIRO_HAS_PDF_SURFACE_TRUE@am__objects_4 = cairo-pdf-surface.lo
+@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__objects_5 = cairo-png.lo
+@CAIRO_HAS_XLIB_SURFACE_TRUE@am__objects_6 = cairo-xlib-surface.lo
@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__objects_7 = \
-@CAIRO_HAS_QUARTZ_SURFACE_TRUE@ cairo_quartz_surface.lo
-@CAIRO_HAS_XCB_SURFACE_TRUE@am__objects_8 = cairo_xcb_surface.lo
-@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__objects_9 = cairo_glitz_surface.lo
-@CAIRO_HAS_WIN32_SURFACE_TRUE@am__objects_10 = cairo_win32_surface.lo
-@CAIRO_HAS_WIN32_FONT_TRUE@am__objects_11 = cairo_win32_font.lo
+@CAIRO_HAS_QUARTZ_SURFACE_TRUE@ cairo-quartz-surface.lo
+@CAIRO_HAS_XCB_SURFACE_TRUE@am__objects_8 = cairo-xcb-surface.lo
+@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__objects_9 = cairo-glitz-surface.lo
+@CAIRO_HAS_WIN32_SURFACE_TRUE@am__objects_10 = cairo-win32-surface.lo
+@CAIRO_HAS_WIN32_FONT_TRUE@am__objects_11 = cairo-win32-font.lo
am__objects_12 = $(am__objects_10) $(am__objects_11)
-am_libcairo_la_OBJECTS = cairo.lo cairo_array.lo cairo_cache.lo \
- cairo_color.lo cairo_fixed.lo cairo_font.lo cairo_gstate.lo \
- cairo_hull.lo cairo_image_surface.lo cairo_matrix.lo \
- cairo_path.lo cairo_path_bounds.lo cairo_path_fill.lo \
- cairo_path_stroke.lo cairo_pen.lo cairo_polygon.lo \
- cairo_slope.lo cairo_spline.lo cairo_surface.lo cairo_traps.lo \
- cairo_pattern.lo cairo_unicode.lo cairo_wideint.lo \
+am_libcairo_la_OBJECTS = cairo.lo cairo-arc.lo cairo-array.lo \
+ cairo-cache.lo cairo-color.lo cairo-fixed.lo cairo-font.lo \
+ cairo-gstate.lo cairo-hull.lo cairo-image-surface.lo \
+ cairo-matrix.lo cairo-path.lo cairo-path-bounds.lo \
+ cairo-path-data.lo cairo-path-fill.lo cairo-path-stroke.lo \
+ cairo-pen.lo cairo-polygon.lo cairo-slope.lo cairo-spline.lo \
+ cairo-surface.lo cairo-traps.lo cairo-pattern.lo \
+ cairo-unicode.lo cairo-output-stream.lo cairo-wideint.lo \
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
@@ -115,8 +119,9 @@ LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
SOURCES = $(libcairo_la_SOURCES)
DIST_SOURCES = $(am__libcairo_la_SOURCES_DIST)
am__cairoinclude_HEADERS_DIST = cairo.h cairo-features.h cairo-atsui.h \
- cairo-ft.h cairo-glitz.h cairo-pdf.h cairo-png.h cairo-ps.h \
- cairo-quartz.h cairo-win32.h cairo-xcb.h cairo-xlib.h
+ cairo-ft.h cairo-glitz.h cairo-pdf.h cairo-ps.h cairo-quartz.h \
+ cairo-win32.h cairo-xcb.h cairo-xcb-xrender.h cairo-xlib.h \
+ cairo-xlib-xrender.h
cairoincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(cairoinclude_HEADERS)
ETAGS = etags
@@ -141,8 +146,8 @@ CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
-CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
-CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
+CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@
+CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
@@ -225,14 +230,13 @@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
+PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
-PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
-SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -295,25 +299,24 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
@CAIRO_HAS_PS_SURFACE_TRUE@libcairo_ps_headers = cairo-ps.h
-@CAIRO_HAS_PS_SURFACE_TRUE@libcairo_ps_sources = cairo_ps_surface.c
+@CAIRO_HAS_PS_SURFACE_TRUE@libcairo_ps_sources = cairo-ps-surface.c
@CAIRO_HAS_PDF_SURFACE_TRUE@libcairo_pdf_headers = cairo-pdf.h
-@CAIRO_HAS_PDF_SURFACE_TRUE@libcairo_pdf_sources = cairo_pdf_surface.c
-@CAIRO_HAS_PNG_SURFACE_TRUE@libcairo_png_headers = cairo-png.h
-@CAIRO_HAS_PNG_SURFACE_TRUE@libcairo_png_sources = cairo_png_surface.c
-@CAIRO_HAS_XLIB_SURFACE_TRUE@libcairo_xlib_headers = cairo-xlib.h
-@CAIRO_HAS_XLIB_SURFACE_TRUE@libcairo_xlib_sources = cairo_xlib_surface.c
+@CAIRO_HAS_PDF_SURFACE_TRUE@libcairo_pdf_sources = cairo-pdf-surface.c
+@CAIRO_HAS_PNG_FUNCTIONS_TRUE@libcairo_png_sources = cairo-png.c
+@CAIRO_HAS_XLIB_SURFACE_TRUE@libcairo_xlib_headers = cairo-xlib.h cairo-xlib-xrender.h
+@CAIRO_HAS_XLIB_SURFACE_TRUE@libcairo_xlib_sources = cairo-xlib-surface.c cairo-xlib-test.h
@CAIRO_HAS_QUARTZ_SURFACE_TRUE@libcairo_quartz_headers = cairo-quartz.h
-@CAIRO_HAS_QUARTZ_SURFACE_TRUE@libcairo_quartz_sources = cairo_quartz_surface.c
-@CAIRO_HAS_XCB_SURFACE_TRUE@libcairo_xcb_headers = cairo-xcb.h
-@CAIRO_HAS_XCB_SURFACE_TRUE@libcairo_xcb_sources = cairo_xcb_surface.c
+@CAIRO_HAS_QUARTZ_SURFACE_TRUE@libcairo_quartz_sources = cairo-quartz-surface.c
+@CAIRO_HAS_XCB_SURFACE_TRUE@libcairo_xcb_headers = cairo-xcb.h cairo-xcb-xrender.h
+@CAIRO_HAS_XCB_SURFACE_TRUE@libcairo_xcb_sources = cairo-xcb-surface.c
libcairo_win32_sources = $(am__append_1) $(am__append_2)
@CAIRO_HAS_WIN32_SURFACE_TRUE@libcairo_win32_headers = cairo-win32.h
@CAIRO_HAS_GLITZ_SURFACE_TRUE@libcairo_glitz_headers = cairo-glitz.h
-@CAIRO_HAS_GLITZ_SURFACE_TRUE@libcairo_glitz_sources = cairo_glitz_surface.c
+@CAIRO_HAS_GLITZ_SURFACE_TRUE@libcairo_glitz_sources = cairo-glitz-surface.c
@CAIRO_HAS_ATSUI_FONT_TRUE@libcairo_atsui_headers = cairo-atsui.h
-@CAIRO_HAS_ATSUI_FONT_TRUE@libcairo_atsui_sources = cairo_atsui_font.c
+@CAIRO_HAS_ATSUI_FONT_TRUE@libcairo_atsui_sources = cairo-atsui-font.c
@CAIRO_HAS_FT_FONT_TRUE@libcairo_ft_headers = cairo-ft.h
-@CAIRO_HAS_FT_FONT_TRUE@libcairo_ft_sources = cairo_ft_font.c cairo-ft-private.h
+@CAIRO_HAS_FT_FONT_TRUE@libcairo_ft_sources = cairo-ft-font.c cairo-ft-private.h
cairoincludedir = $(includedir)/cairo
cairoinclude_HEADERS = \
cairo.h \
@@ -322,7 +325,6 @@ cairoinclude_HEADERS = \
$(libcairo_ft_headers) \
$(libcairo_glitz_headers) \
$(libcairo_pdf_headers) \
- $(libcairo_png_headers) \
$(libcairo_ps_headers) \
$(libcairo_quartz_headers) \
$(libcairo_win32_headers) \
@@ -333,28 +335,36 @@ lib_LTLIBRARIES = libcairo.la
libcairo_la_SOURCES = \
cairo.c \
cairo.h \
- cairo_array.c \
- cairo_cache.c \
- cairo_color.c \
- cairo_fixed.c \
- cairo_font.c \
- cairo_gstate.c \
- cairo_hull.c \
- cairo_image_surface.c \
- cairo_matrix.c \
- cairo_path.c \
- cairo_path_bounds.c \
- cairo_path_fill.c \
- cairo_path_stroke.c \
- cairo_pen.c \
- cairo_polygon.c \
- cairo_slope.c \
- cairo_spline.c \
- cairo_surface.c \
- cairo_traps.c \
- cairo_pattern.c \
- cairo_unicode.c \
- cairo_wideint.c \
+ cairo-private.h \
+ cairo-arc.c \
+ cairo-arc-private.h \
+ cairo-array.c \
+ cairo-cache.c \
+ cairo-color.c \
+ cairo-fixed.c \
+ cairo-font.c \
+ cairo-gstate.c \
+ cairo-gstate-private.h \
+ cairo-hull.c \
+ cairo-image-surface.c \
+ cairo-matrix.c \
+ cairo-path.c \
+ cairo-path-bounds.c \
+ cairo-path-data.c \
+ cairo-path-data-private.h \
+ cairo-path-fill.c \
+ cairo-path-fixed-private.h \
+ cairo-path-stroke.c \
+ cairo-pen.c \
+ cairo-polygon.c \
+ cairo-slope.c \
+ cairo-spline.c \
+ cairo-surface.c \
+ cairo-traps.c \
+ cairo-pattern.c \
+ cairo-unicode.c \
+ cairo-output-stream.c \
+ cairo-wideint.c \
cairo-wideint.h \
$(libcairo_atsui_sources)\
$(libcairo_ft_sources)\
@@ -366,7 +376,6 @@ libcairo_la_SOURCES = \
$(libcairo_xcb_sources) \
$(libcairo_glitz_sources)\
$(libcairo_win32_sources)\
- $(libcairo_freetype_sources) \
cairoint.h
libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined
@@ -443,40 +452,43 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-arc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-array.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-atsui-font.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-cache.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-color.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-fixed.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-font.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-ft-font.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-glitz-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-gstate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-hull.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-image-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-matrix.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-output-stream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-path-bounds.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-path-data.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-path-fill.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-path-stroke.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-path.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-pattern.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-pdf-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-pen.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-png.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-polygon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-ps-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-quartz-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-slope.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-spline.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-traps.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-unicode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-wideint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-win32-font.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-win32-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-xcb-surface.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-xlib-surface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_array.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_atsui_font.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_cache.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_color.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_fixed.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_font.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_ft_font.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_glitz_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_gstate.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_hull.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_image_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_matrix.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path_bounds.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path_fill.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_path_stroke.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_pattern.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_pdf_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_pen.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_png_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_polygon.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_ps_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_quartz_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_slope.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_spline.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_traps.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_unicode.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_wideint.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_win32_font.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_win32_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_xcb_surface.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_xlib_surface.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -700,7 +712,7 @@ uninstall-am: uninstall-cairoincludeHEADERS uninstall-info-am \
install-data-local:
- @if test -f $(includedir)/cairo.h || test -f $(includedir)/cairo-features.h ; then \
+ @if test -f "$(DESTDIR)$(includedir)/cairo.h" || test -f "$(DESTDIR)$(includedir)/cairo-features.h" ; then \
echo "****************************************************************" ; \
echo "*** Error: Old headers found. You should remove the following" ; \
echo "*** files and then type 'make install' again." ; \
diff --git a/src/cairo-arc-private.h b/src/cairo-arc-private.h
new file mode 100644
index 0000000..1cd41cc
--- /dev/null
+++ b/src/cairo-arc-private.h
@@ -0,0 +1,57 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@redhat.com>
+ */
+
+#ifndef CAIRO_ARC_PRIVATE_H
+#define CAIRO_ARC_PRIVATE_H
+
+#include "cairoint.h"
+
+void
+_cairo_arc_path (cairo_t *cr,
+ double xc,
+ double yc,
+ double radius,
+ double angle1,
+ double angle2);
+
+void
+_cairo_arc_path_negative (cairo_t *cr,
+ double xc,
+ double yc,
+ double radius,
+ double angle1,
+ double angle2);
+
+#endif /* CAIRO_ARC_PRIVATE_H */
diff --git a/src/cairo-arc.c b/src/cairo-arc.c
new file mode 100644
index 0000000..d3302cd
--- /dev/null
+++ b/src/cairo-arc.c
@@ -0,0 +1,296 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <math.h>
+
+#include "cairo-arc-private.h"
+
+/* Spline deviation from the circle in radius would be given by:
+
+ error = sqrt (x**2 + y**2) - 1
+
+ A simpler error function to work with is:
+
+ e = x**2 + y**2 - 1
+
+ From "Good approximation of circles by curvature-continuous Bezier
+ curves", Tor Dokken and Morten Daehlen, Computer Aided Geometric
+ Design 8 (1990) 22-41, we learn:
+
+ abs (max(e)) = 4/27 * sin**6(angle/4) / cos**2(angle/4)
+
+ and
+ abs (error) =~ 1/2 * e
+
+ Of course, this error value applies only for the particular spline
+ approximation that is used in _cairo_gstate_arc_segment.
+*/
+static double
+_arc_error_normalized (double angle)
+{
+ return 2.0/27.0 * pow (sin (angle / 4), 6) / pow (cos (angle / 4), 2);
+}
+
+static double
+_arc_max_angle_for_tolerance_normalized (double tolerance)
+{
+ double angle, error;
+ int i;
+
+ /* Use table lookup to reduce search time in most cases. */
+ struct {
+ double angle;
+ double error;
+ } table[] = {
+ { M_PI / 1.0, 0.0185185185185185036127 },
+ { M_PI / 2.0, 0.000272567143730179811158 },
+ { M_PI / 3.0, 2.38647043651461047433e-05 },
+ { M_PI / 4.0, 4.2455377443222443279e-06 },
+ { M_PI / 5.0, 1.11281001494389081528e-06 },
+ { M_PI / 6.0, 3.72662000942734705475e-07 },
+ { M_PI / 7.0, 1.47783685574284411325e-07 },
+ { M_PI / 8.0, 6.63240432022601149057e-08 },
+ { M_PI / 9.0, 3.2715520137536980553e-08 },
+ { M_PI / 10.0, 1.73863223499021216974e-08 },
+ { M_PI / 11.0, 9.81410988043554039085e-09 },
+ };
+ int table_size = (sizeof (table) / sizeof (table[0]));
+
+ for (i = 0; i < table_size; i++)
+ if (table[i].error < tolerance)
+ return table[i].angle;
+
+ ++i;
+ do {
+ angle = M_PI / i++;
+ error = _arc_error_normalized (angle);
+ } while (error > tolerance);
+
+ return angle;
+}
+
+static int
+_arc_segments_needed (double angle,
+ double radius,
+ cairo_matrix_t *ctm,
+ double tolerance)
+{
+ double l1, l2, lmax;
+ double max_angle;
+
+ _cairo_matrix_compute_eigen_values (ctm, &l1, &l2);
+
+ l1 = fabs (l1);
+ l2 = fabs (l2);
+ if (l1 > l2)
+ lmax = l1;
+ else
+ lmax = l2;
+
+ max_angle = _arc_max_angle_for_tolerance_normalized (tolerance / (radius * lmax));
+
+ return (int) ceil (angle / max_angle);
+}
+
+/* We want to draw a single spline approximating a circular arc radius
+ R from angle A to angle B. Since we want a symmetric spline that
+ matches the endpoints of the arc in position and slope, we know
+ that the spline control points must be:
+
+ (R * cos(A), R * sin(A))
+ (R * cos(A) - h * sin(A), R * sin(A) + h * cos (A))
+ (R * cos(B) + h * sin(B), R * sin(B) - h * cos (B))
+ (R * cos(B), R * sin(B))
+
+ for some value of h.
+
+ "Approximation of circular arcs by cubic poynomials", Michael
+ Goldapp, Computer Aided Geometric Design 8 (1991) 227-238, provides
+ various values of h along with error analysis for each.
+
+ From that paper, a very practical value of h is:
+
+ h = 4/3 * tan(angle/4)
+
+ This value does not give the spline with minimal error, but it does
+ provide a very good approximation, (6th-order convergence), and the
+ error expression is quite simple, (see the comment for
+ _arc_error_normalized).
+*/
+static void
+_cairo_arc_segment (cairo_t *cr,
+ double xc,
+ double yc,
+ double radius,
+ double angle_A,
+ double angle_B)
+{
+ double r_sin_A, r_cos_A;
+ double r_sin_B, r_cos_B;
+ double h;
+
+ r_sin_A = radius * sin (angle_A);
+ r_cos_A = radius * cos (angle_A);
+ r_sin_B = radius * sin (angle_B);
+ r_cos_B = radius * cos (angle_B);
+
+ h = 4.0/3.0 * tan ((angle_B - angle_A) / 4.0);
+
+ cairo_curve_to (cr,
+ xc + r_cos_A - h * r_sin_A,
+ yc + r_sin_A + h * r_cos_A,
+ xc + r_cos_B + h * r_sin_B,
+ yc + r_sin_B - h * r_cos_B,
+ xc + r_cos_B,
+ yc + r_sin_B);
+}
+
+static void
+_cairo_arc_in_direction (cairo_t *cr,
+ double xc,
+ double yc,
+ double radius,
+ double angle_min,
+ double angle_max,
+ cairo_direction_t dir)
+{
+ while (angle_max - angle_min > 4 * M_PI)
+ angle_max -= 2 * M_PI;
+
+ /* Recurse if drawing arc larger than pi */
+ if (angle_max - angle_min > M_PI) {
+ double angle_mid = angle_min + (angle_max - angle_min) / 2.0;
+ /* XXX: Something tells me this block could be condensed. */
+ if (dir == CAIRO_DIRECTION_FORWARD) {
+ _cairo_arc_in_direction (cr, xc, yc, radius,
+ angle_min, angle_mid,
+ dir);
+
+ _cairo_arc_in_direction (cr, xc, yc, radius,
+ angle_mid, angle_max,
+ dir);
+ } else {
+ _cairo_arc_in_direction (cr, xc, yc, radius,
+ angle_mid, angle_max,
+ dir);
+
+ _cairo_arc_in_direction (cr, xc, yc, radius,
+ angle_min, angle_mid,
+ dir);
+ }
+ } else {
+ cairo_matrix_t ctm;
+ int i, segments;
+ double angle, angle_step;
+
+ cairo_get_matrix (cr, &ctm);
+ segments = _arc_segments_needed (angle_max - angle_min,
+ radius, &ctm,
+ cairo_get_tolerance (cr));
+ angle_step = (angle_max - angle_min) / (double) segments;
+
+ if (dir == CAIRO_DIRECTION_FORWARD) {
+ angle = angle_min;
+ } else {
+ angle = angle_max;
+ angle_step = - angle_step;
+ }
+
+ for (i = 0; i < segments; i++, angle += angle_step) {
+ _cairo_arc_segment (cr, xc, yc,
+ radius,
+ angle,
+ angle + angle_step);
+ }
+ }
+}
+
+/**
+ * _cairo_arc_path_negative:
+ * @cr: a cairo context
+ * @xc: X position of the center of the arc
+ * @yc: Y position of the center of the arc
+ * @radius: the radius of the arc
+ * @angle1: the start angle, in radians
+ * @angle2: the end angle, in radians
+ *
+ * Compute a path for the given arc and append it onto the current
+ * path within @cr. The arc will be accurate within the current
+ * tolerance and given the current transformation.
+ **/
+void
+_cairo_arc_path (cairo_t *cr,
+ double xc,
+ double yc,
+ double radius,
+ double angle1,
+ double angle2)
+{
+ _cairo_arc_in_direction (cr, xc, yc,
+ radius,
+ angle1, angle2,
+ CAIRO_DIRECTION_FORWARD);
+}
+
+/**
+ * _cairo_arc_path_negative:
+ * @xc: X position of the center of the arc
+ * @yc: Y position of the center of the arc
+ * @radius: the radius of the arc
+ * @angle1: the start angle, in radians
+ * @angle2: the end angle, in radians
+ * @ctm: the current transformation matrix
+ * @tolerance: the current tolerance value
+ * @path: the path onto which th earc will be appended
+ *
+ * Compute a path for the given arc (defined in the negative
+ * direction) and append it onto the current path within @cr. The arc
+ * will be accurate within the current tolerance and given the current
+ * transformation.
+ **/
+void
+_cairo_arc_path_negative (cairo_t *cr,
+ double xc,
+ double yc,
+ double radius,
+ double angle1,
+ double angle2)
+{
+ _cairo_arc_in_direction (cr, xc, yc,
+ radius,
+ angle2, angle1,
+ CAIRO_DIRECTION_REVERSE);
+}
diff --git a/src/cairo-array.c b/src/cairo-array.c
new file mode 100644
index 0000000..a9f148a
--- /dev/null
+++ b/src/cairo-array.c
@@ -0,0 +1,273 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2004 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Kristian Høgsberg <krh@redhat.com>
+ */
+
+#include "cairoint.h"
+
+void
+_cairo_array_init (cairo_array_t *array, int element_size)
+{
+ array->size = 0;
+ array->num_elements = 0;
+ array->element_size = element_size;
+ array->elements = NULL;
+}
+
+void
+_cairo_array_fini (cairo_array_t *array)
+{
+ free (array->elements);
+}
+
+cairo_status_t
+_cairo_array_grow_by (cairo_array_t *array, int additional)
+{
+ char *new_elements;
+ int old_size = array->size;
+ int required_size = array->num_elements + additional;
+ int new_size;
+
+ if (required_size <= old_size)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (old_size == 0)
+ new_size = 1;
+ else
+ new_size = old_size * 2;
+
+ while (new_size < required_size)
+ new_size = new_size * 2;
+
+ array->size = new_size;
+ new_elements = realloc (array->elements,
+ array->size * array->element_size);
+
+ if (new_elements == NULL) {
+ array->size = old_size;
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ array->elements = new_elements;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+void
+_cairo_array_truncate (cairo_array_t *array, int num_elements)
+{
+ if (num_elements < array->num_elements)
+ array->num_elements = num_elements;
+}
+
+void *
+_cairo_array_index (cairo_array_t *array, int index)
+{
+ assert (0 <= index && index < array->num_elements);
+
+ return (void *) &array->elements[index * array->element_size];
+}
+
+void
+_cairo_array_copy_element (cairo_array_t *array, int index, void *dst)
+{
+ memcpy (dst, _cairo_array_index (array, index), array->element_size);
+}
+
+void *
+_cairo_array_append (cairo_array_t *array,
+ const void *elements, int num_elements)
+{
+ cairo_status_t status;
+ void *dest;
+
+ status = _cairo_array_grow_by (array, num_elements);
+ if (status != CAIRO_STATUS_SUCCESS)
+ return NULL;
+
+ assert (array->num_elements + num_elements <= array->size);
+
+ dest = &array->elements[array->num_elements * array->element_size];
+ array->num_elements += num_elements;
+
+ if (elements != NULL)
+ memcpy (dest, elements, num_elements * array->element_size);
+
+ return dest;
+}
+
+int
+_cairo_array_num_elements (cairo_array_t *array)
+{
+ return array->num_elements;
+}
+
+/* cairo_user_data_array_t */
+
+typedef struct {
+ const cairo_user_data_key_t *key;
+ void *user_data;
+ cairo_destroy_func_t destroy;
+} cairo_user_data_slot_t;
+
+/**
+ * _cairo_user_data_array_init:
+ * @array: a #cairo_user_data_array_t
+ *
+ * Initializes a #cairo_user_data_array_t structure for future
+ * use. After initialization, the array has no keys. Call
+ * _cairo_user_data_array_fini() to free any allocated memory
+ * when done using the array.
+ **/
+void
+_cairo_user_data_array_init (cairo_user_data_array_t *array)
+{
+ _cairo_array_init (array, sizeof (cairo_user_data_slot_t));
+}
+
+/**
+ * _cairo_user_data_array_fini:
+ * @array: a #cairo_user_data_array_t
+ *
+ * Destroys all current keys in the user data array and deallocates
+ * any memory allocated for the array itself.
+ **/
+void
+_cairo_user_data_array_fini (cairo_user_data_array_t *array)
+{
+ int i, num_slots;
+ cairo_user_data_slot_t *slots;
+
+ num_slots = array->num_elements;
+ slots = (cairo_user_data_slot_t *) array->elements;
+ for (i = 0; i < num_slots; i++) {
+ if (slots[i].user_data != NULL && slots[i].destroy != NULL)
+ slots[i].destroy (slots[i].user_data);
+ }
+
+ _cairo_array_fini (array);
+}
+
+/**
+ * _cairo_user_data_array_get_data:
+ * @array: a #cairo_user_data_array_t
+ * @key: the address of the #cairo_user_data_key_t the user data was
+ * attached to
+ *
+ * Returns user data previously attached using the specified
+ * key. If no user data has been attached with the given key this
+ * function returns %NULL.
+ *
+ * Return value: the user data previously attached or %NULL.
+ **/
+void *
+_cairo_user_data_array_get_data (cairo_user_data_array_t *array,
+ const cairo_user_data_key_t *key)
+{
+ int i, num_slots;
+ cairo_user_data_slot_t *slots;
+
+ num_slots = array->num_elements;
+ slots = (cairo_user_data_slot_t *) array->elements;
+ for (i = 0; i < num_slots; i++) {
+ if (slots[i].key == key)
+ return slots[i].user_data;
+ }
+
+ return NULL;
+}
+
+/**
+ * _cairo_user_data_array_set_data:
+ * @array: a #cairo_user_data_array_t
+ * @key: the address of a #cairo_user_data_key_t to attach the user data to
+ * @user_data: the user data to attach
+ * @destroy: a #cairo_destroy_func_t which will be called when the
+ * user data array is destroyed or when new user data is attached using the
+ * same key.
+ *
+ * Attaches user data to a user data array. To remove user data,
+ * call this function with the key that was used to set it and %NULL
+ * for @data.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY if a
+ * slot could not be allocated for the user data.
+ **/
+cairo_status_t
+_cairo_user_data_array_set_data (cairo_user_data_array_t *array,
+ const cairo_user_data_key_t *key,
+ void *user_data,
+ cairo_destroy_func_t destroy)
+{
+ int i, num_slots;
+ cairo_user_data_slot_t *slots, *s;
+
+ s = NULL;
+ num_slots = array->num_elements;
+ slots = (cairo_user_data_slot_t *) array->elements;
+ for (i = 0; i < num_slots; i++) {
+ if (slots[i].key == key) {
+ if (slots[i].user_data != NULL && slots[i].destroy != NULL)
+ slots[i].destroy (slots[i].user_data);
+ s = &slots[i];
+ break;
+ }
+ if (user_data && slots[i].user_data == NULL) {
+ s = &slots[i]; /* Have to keep searching for an exact match */
+ }
+ }
+
+ if (user_data == NULL) {
+ if (s != NULL) {
+ s->key = NULL;
+ s->user_data = NULL;
+ s->destroy = NULL;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+
+ } else {
+ if (s == NULL)
+ s = _cairo_array_append (array, NULL, 1);
+ if (s == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ s->key = key;
+ s->user_data = user_data;
+ s->destroy = destroy;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
new file mode 100644
index 0000000..5c7ddf5
--- /dev/null
+++ b/src/cairo-atsui-font.c
@@ -0,0 +1,691 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2004 Calum Robinson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Calum Robinson
+ *
+ * Contributor(s):
+ * Calum Robinson <calumr@mac.com>
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include "cairo-atsui.h"
+#include "cairoint.h"
+#include "cairo.h"
+#include <iconv.h>
+
+typedef struct {
+ cairo_scaled_font_t base;
+
+ cairo_matrix_t scale;
+ ATSUStyle style;
+ ATSUStyle unscaled_style;
+ ATSUFontID fontID;
+} cairo_atsui_font_t;
+
+typedef struct cairo_ATSUI_glyph_path_callback_info_t {
+ cairo_path_fixed_t *path;
+ cairo_matrix_t scale;
+} cairo_ATSUI_glyph_path_callback_info_t;
+
+const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend;
+
+
+static CGAffineTransform
+CGAffineTransformMakeWithCairoFontScale(cairo_matrix_t *scale)
+{
+ return CGAffineTransformMake(scale->xx, scale->yx,
+ scale->xy, scale->yy,
+ 0, 0);
+}
+
+
+static ATSUStyle
+CreateSizedCopyOfStyle(ATSUStyle inStyle, cairo_matrix_t *scale)
+{
+ ATSUStyle style;
+ OSStatus err;
+
+
+ // Set the style's size
+ CGAffineTransform theTransform =
+ CGAffineTransformMakeWithCairoFontScale(scale);
+ Fixed theSize =
+ FloatToFixed(CGSizeApplyAffineTransform
+ (CGSizeMake(1.0, 1.0), theTransform).height);
+ const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag };
+ const ByteCount theFontStyleSizes[] = { sizeof(Fixed) };
+ ATSUAttributeValuePtr theFontStyleValues[] = { &theSize };
+
+ err = ATSUCreateAndCopyStyle(inStyle, &style);
+
+ err = ATSUSetAttributes(style,
+ sizeof(theFontStyleTags) /
+ sizeof(ATSUAttributeTag), theFontStyleTags,
+ theFontStyleSizes, theFontStyleValues);
+
+ return style;
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_create(const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **font_out)
+{
+ cairo_atsui_font_t *font = NULL;
+ ATSUStyle style;
+ ATSUFontID fontID;
+ OSStatus err;
+ Boolean isItalic, isBold;
+ cairo_matrix_t scale;
+
+ err = ATSUCreateStyle(&style);
+
+
+ switch (weight) {
+ case CAIRO_FONT_WEIGHT_BOLD:
+ isBold = true;
+ break;
+ case CAIRO_FONT_WEIGHT_NORMAL:
+ default:
+ isBold = false;
+ break;
+ }
+
+ switch (slant) {
+ case CAIRO_FONT_SLANT_ITALIC:
+ isItalic = true;
+ break;
+ case CAIRO_FONT_SLANT_OBLIQUE:
+ isItalic = false;
+ break;
+ case CAIRO_FONT_SLANT_NORMAL:
+ default:
+ isItalic = false;
+ break;
+ }
+
+ err = ATSUFindFontFromName(family, strlen(family),
+ kFontFamilyName,
+ kFontNoPlatformCode,
+ kFontRomanScript,
+ kFontNoLanguageCode, &fontID);
+
+ if (err != noErr) {
+ // couldn't get the font - remap css names and try again
+
+ if (!strcmp(family, "serif"))
+ family = "Times";
+ else if (!strcmp(family, "sans-serif"))
+ family = "Helvetica";
+ else if (!strcmp(family, "cursive"))
+ family = "Apple Chancery";
+ else if (!strcmp(family, "fantasy"))
+ family = "Gadget";
+ else if (!strcmp(family, "monospace"))
+ family = "Courier";
+ else // anything else - return error instead?
+ family = "Courier";
+
+ err = ATSUFindFontFromName(family, strlen(family),
+ kFontFamilyName,
+ kFontNoPlatformCode,
+ kFontRomanScript,
+ kFontNoLanguageCode, &fontID);
+ }
+
+
+ ATSUAttributeTag styleTags[] =
+ { kATSUQDItalicTag, kATSUQDBoldfaceTag, kATSUFontTag };
+ ATSUAttributeValuePtr styleValues[] = { &isItalic, &isBold, &fontID };
+ ByteCount styleSizes[] =
+ { sizeof(Boolean), sizeof(Boolean), sizeof(ATSUFontID) };
+
+
+ err = ATSUSetAttributes(style,
+ sizeof(styleTags) / sizeof(styleTags[0]),
+ styleTags, styleSizes, styleValues);
+
+ font = malloc(sizeof(cairo_atsui_font_t));
+
+ _cairo_scaled_font_init(&font->base, font_matrix, ctm,
+ &cairo_atsui_scaled_font_backend);
+
+ cairo_matrix_multiply(&scale, font_matrix, ctm);
+ font->style = CreateSizedCopyOfStyle(style, &scale);
+
+ Fixed theSize = FloatToFixed(1.0);
+ const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag };
+ const ByteCount theFontStyleSizes[] = { sizeof(Fixed) };
+ ATSUAttributeValuePtr theFontStyleValues[] = { &theSize };
+ err = ATSUSetAttributes(style,
+ sizeof(theFontStyleTags) /
+ sizeof(ATSUAttributeTag), theFontStyleTags,
+ theFontStyleSizes, theFontStyleValues);
+
+ font->unscaled_style = style;
+
+ font->fontID = fontID;
+ font->scale = scale;
+
+ *font_out = &font->base;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static void
+_cairo_atsui_font_destroy_font(void *abstract_font)
+{
+ cairo_atsui_font_t *font = abstract_font;
+
+ if (font == NULL)
+ return;
+
+ if (font->style)
+ ATSUDisposeStyle(font->style);
+ if (font->unscaled_style)
+ ATSUDisposeStyle(font->unscaled_style);
+}
+
+
+static void
+_cairo_atsui_font_get_glyph_cache_key(void *abstract_font,
+ cairo_glyph_cache_key_t *key)
+{
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_text_to_glyphs(void *abstract_font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs)
+{
+ cairo_atsui_font_t *font = abstract_font;
+ size_t i;
+ OSStatus err;
+ ATSUTextLayout textLayout;
+ ATSLayoutRecord *layoutRecords;
+ ItemCount glyphCount, charCount;
+ UniChar *theText;
+
+ err = ATSUCreateTextLayout(&textLayout);
+
+#if 1
+ charCount = strlen(utf8);
+
+ // Set the text in the text layout object, so we can measure it
+ theText = (UniChar *) malloc(charCount * sizeof(UniChar));
+
+ for (i = 0; i < charCount; i++) {
+ theText[i] = utf8[i];
+ }
+#endif
+
+#if 0
+ // Set the text in the text layout object, so we can measure it
+ charCount = strlen(utf8);
+ theText = (UniChar *) malloc(charCount * sizeof(UniChar));
+
+ size_t inBytes = charCount, outBytes = charCount;
+ iconv_t converter = iconv_open("UTF-8", "UTF-16");
+ charCount = iconv(converter, utf8, &inBytes, theText, &outBytes);
+#endif
+
+ err = ATSUSetTextPointerLocation(textLayout,
+ theText, 0, charCount, charCount);
+
+
+ // Set the style for all of the text
+ err = ATSUSetRunStyle(textLayout,
+ font->unscaled_style, kATSUFromTextBeginning, kATSUToTextEnd);
+
+ // Get the glyphs from the text layout object
+ err = ATSUDirectGetLayoutDataArrayPtrFromTextLayout(textLayout,
+ 0,
+ kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
+ (void *)
+ &layoutRecords,
+ &glyphCount);
+
+ *num_glyphs = glyphCount - 1;
+
+
+ *glyphs =
+ (cairo_glyph_t *) malloc(*num_glyphs * (sizeof(cairo_glyph_t)));
+ if (*glyphs == NULL) {
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ for (i = 0; i < *num_glyphs; i++) {
+ (*glyphs)[i].index = layoutRecords[i].glyphID;
+ (*glyphs)[i].x = FixedToFloat(layoutRecords[i].realPos);
+ (*glyphs)[i].y = 0;
+ }
+
+
+ free(theText);
+
+ ATSUDirectReleaseLayoutDataArrayPtr(NULL,
+ kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
+ (void *) &layoutRecords);
+
+ ATSUDisposeTextLayout(textLayout);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_font_extents(void *abstract_font,
+ cairo_font_extents_t * extents)
+{
+ cairo_atsui_font_t *font = abstract_font;
+ ATSFontRef atsFont;
+ ATSFontMetrics metrics;
+ OSStatus err;
+
+ // TODO - test this
+
+ atsFont = FMGetATSFontRefFromFont(font->fontID);
+
+ if (atsFont) {
+ err =
+ ATSFontGetHorizontalMetrics(atsFont, kATSOptionFlagsDefault,
+ &metrics);
+
+ if (err == noErr) {
+ extents->ascent = metrics.ascent;
+ extents->descent = metrics.descent;
+ extents->height = metrics.capHeight;
+ extents->max_x_advance = metrics.maxAdvanceWidth;
+
+ // The FT backend doesn't handle max_y_advance either, so we'll ignore it for now.
+ extents->max_y_advance = 0.0;
+
+ return CAIRO_STATUS_SUCCESS;
+ }
+ }
+
+
+ return CAIRO_STATUS_NULL_POINTER;
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_glyph_extents(void *abstract_font,
+ cairo_glyph_t * glyphs,
+ int num_glyphs,
+ cairo_text_extents_t * extents)
+{
+ cairo_atsui_font_t *font = abstract_font;
+ OSStatus err;
+
+ assert(num_glyphs == 1);
+
+ GlyphID theGlyph = glyphs[0].index;
+
+ ATSGlyphIdealMetrics metricsH, metricsV;
+ ATSUStyle style;
+
+ ATSUCreateAndCopyStyle(font->unscaled_style, &style);
+
+ err = ATSUGlyphGetIdealMetrics(style,
+ 1, &theGlyph, 0, &metricsH);
+
+ ATSUVerticalCharacterType verticalType = kATSUStronglyVertical;
+ const ATSUAttributeTag theTag[] = { kATSUVerticalCharacterTag };
+ const ByteCount theSizes[] = { sizeof(verticalType) };
+ ATSUAttributeValuePtr theValues[] = { &verticalType };
+
+ err = ATSUSetAttributes(style, 1, theTag, theSizes, theValues);
+
+ err = ATSUGlyphGetIdealMetrics(style,
+ 1, &theGlyph, 0, &metricsV);
+
+ extents->x_bearing = metricsH.sideBearing.x;
+ extents->y_bearing = metricsV.advance.y;
+ extents->width =
+ metricsH.advance.x - metricsH.sideBearing.x - metricsH.otherSideBearing.x;
+ extents->height =
+ -metricsV.advance.y - metricsV.sideBearing.y - metricsV.otherSideBearing.y;
+ extents->x_advance = metricsH.advance.x;
+ extents->y_advance = 0;
+
+ ATSUDisposeStyle(style);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_glyph_bbox(void *abstract_font,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs, cairo_box_t *bbox)
+{
+ cairo_atsui_font_t *font = abstract_font;
+ cairo_fixed_t x1, y1, x2, y2;
+ int i;
+
+ bbox->p1.x = bbox->p1.y = CAIRO_MAXSHORT << 16;
+ bbox->p2.x = bbox->p2.y = CAIRO_MINSHORT << 16;
+
+
+ for (i = 0; i < num_glyphs; i++) {
+ GlyphID theGlyph = glyphs[i].index;
+
+ ATSGlyphScreenMetrics metrics;
+ ATSUGlyphGetScreenMetrics(font->style,
+ 1, &theGlyph, 0, true, true, &metrics);
+
+ x1 = _cairo_fixed_from_double(glyphs[i].x + metrics.topLeft.x);
+ y1 = _cairo_fixed_from_double(glyphs[i].y - metrics.topLeft.y);
+ x2 = x1 + _cairo_fixed_from_double(metrics.height);
+ y2 = y1 + _cairo_fixed_from_double(metrics.width);
+
+ if (x1 < bbox->p1.x)
+ bbox->p1.x = x1;
+
+ if (y1 < bbox->p1.y)
+ bbox->p1.y = y1;
+
+ if (x2 > bbox->p2.x)
+ bbox->p2.x = x2;
+
+ if (y2 > bbox->p2.y)
+ bbox->p2.y = y2;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_show_glyphs(void *abstract_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *generic_surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs)
+{
+ cairo_atsui_font_t *font = abstract_font;
+ CGContextRef myBitmapContext;
+ CGColorSpaceRef colorSpace;
+ cairo_image_surface_t *destImageSurface;
+ int i;
+
+ cairo_rectangle_t rect = {dest_x, dest_y, width, height};
+ _cairo_surface_acquire_dest_image(generic_surface,
+ &rect,
+ &destImageSurface,
+ &rect,
+ NULL);
+
+ // Create a CGBitmapContext for the dest surface for drawing into
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+ myBitmapContext = CGBitmapContextCreate(destImageSurface->data,
+ destImageSurface->width,
+ destImageSurface->height,
+ destImageSurface->depth / 4,
+ destImageSurface->stride,
+ colorSpace,
+ kCGImageAlphaPremultipliedFirst);
+ CGContextTranslateCTM(myBitmapContext, 0, destImageSurface->height);
+ CGContextScaleCTM(myBitmapContext, 1.0f, -1.0f);
+
+ ATSFontRef atsFont = FMGetATSFontRefFromFont(font->fontID);
+ CGFontRef cgFont = CGFontCreateWithPlatformFont(&atsFont);
+
+ CGContextSetFont(myBitmapContext, cgFont);
+
+ CGAffineTransform textTransform =
+ CGAffineTransformMakeWithCairoFontScale(&font->scale);
+
+ textTransform = CGAffineTransformScale(textTransform, 1.0f, -1.0f);
+
+ CGContextSetFontSize(myBitmapContext, 1.0);
+ CGContextSetTextMatrix(myBitmapContext, textTransform);
+
+ if (pattern->type == CAIRO_PATTERN_SOLID &&
+ _cairo_pattern_is_opaque_solid(pattern))
+ {
+ cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *)pattern;
+ CGContextSetRGBFillColor(myBitmapContext,
+ solid->color.red,
+ solid->color.green,
+ solid->color.blue, 1.0f);
+ } else {
+ CGContextSetRGBFillColor(myBitmapContext, 0.0f, 0.0f, 0.0f, 0.0f);
+ }
+
+ // TODO - bold and italic text
+ //
+ // We could draw the text using ATSUI and get bold, italics
+ // etc. for free, but ATSUI does a lot of text layout work
+ // that we don't really need...
+
+
+ for (i = 0; i < num_glyphs; i++) {
+ CGGlyph theGlyph = glyphs[i].index;
+
+ CGContextShowGlyphsAtPoint(myBitmapContext,
+ glyphs[i].x,
+ glyphs[i].y,
+ &theGlyph, 1);
+ }
+
+
+ CGColorSpaceRelease(colorSpace);
+ CGContextRelease(myBitmapContext);
+
+ _cairo_surface_release_dest_image(generic_surface,
+ &rect,
+ destImageSurface,
+ &rect,
+ NULL);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static OSStatus MyATSCubicMoveToCallback(const Float32Point * pt,
+ void *callBackDataPtr)
+{
+ cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
+ double scaledPt[2];
+ cairo_fixed_t x, y;
+
+ scaledPt[0] = pt->x;
+ scaledPt[1] = pt->y;
+
+ cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
+
+ x = _cairo_fixed_from_double(scaledPt[0]);
+ y = _cairo_fixed_from_double(scaledPt[1]);
+
+ _cairo_path_fixed_close_path(info->path);
+ _cairo_path_fixed_move_to(info->path, x, y);
+
+ return noErr;
+}
+
+
+static OSStatus MyATSCubicLineToCallback(const Float32Point * pt,
+ void *callBackDataPtr)
+{
+ cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
+ double scaledPt[2];
+ cairo_fixed_t x, y;
+
+ scaledPt[0] = pt->x;
+ scaledPt[1] = pt->y;
+
+ cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
+
+ x = _cairo_fixed_from_double(scaledPt[0]);
+ y = _cairo_fixed_from_double(scaledPt[1]);
+
+ _cairo_path_fixed_line_to(info->path, x, y);
+
+
+ return noErr;
+}
+
+
+static OSStatus MyATSCubicCurveToCallback(const Float32Point * pt1,
+ const Float32Point * pt2,
+ const Float32Point * pt3,
+ void *callBackDataPtr)
+{
+ cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
+ double scaledPt[2];
+ cairo_fixed_t x0, y0;
+ cairo_fixed_t x1, y1;
+ cairo_fixed_t x2, y2;
+
+
+ scaledPt[0] = pt1->x;
+ scaledPt[1] = pt1->y;
+
+ cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
+
+ x0 = _cairo_fixed_from_double(scaledPt[0]);
+ y0 = _cairo_fixed_from_double(scaledPt[1]);
+
+
+ scaledPt[0] = pt2->x;
+ scaledPt[1] = pt2->y;
+
+ cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
+
+ x1 = _cairo_fixed_from_double(scaledPt[0]);
+ y1 = _cairo_fixed_from_double(scaledPt[1]);
+
+
+ scaledPt[0] = pt3->x;
+ scaledPt[1] = pt3->y;
+
+ cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
+
+ x2 = _cairo_fixed_from_double(scaledPt[0]);
+ y2 = _cairo_fixed_from_double(scaledPt[1]);
+
+
+ _cairo_path_fixed_curve_to(info->path, x0, y0, x1, y1, x2, y2);
+
+
+ return noErr;
+}
+
+
+static OSStatus MyCubicClosePathProc(void *callBackDataPtr)
+{
+ cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
+
+
+ _cairo_path_fixed_close_path(info->path);
+
+
+ return noErr;
+}
+
+
+static cairo_status_t
+_cairo_atsui_font_glyph_path(void *abstract_font,
+ cairo_glyph_t *glyphs, int num_glyphs,
+ cairo_path_fixed_t *path)
+{
+ int i;
+ cairo_atsui_font_t *font = abstract_font;
+ OSStatus err;
+ cairo_ATSUI_glyph_path_callback_info_t info;
+
+
+ static ATSCubicMoveToUPP moveProc = NULL;
+ static ATSCubicLineToUPP lineProc = NULL;
+ static ATSCubicCurveToUPP curveProc = NULL;
+ static ATSCubicClosePathUPP closePathProc = NULL;
+
+
+ if (moveProc == NULL) {
+ moveProc = NewATSCubicMoveToUPP(MyATSCubicMoveToCallback);
+ lineProc = NewATSCubicLineToUPP(MyATSCubicLineToCallback);
+ curveProc = NewATSCubicCurveToUPP(MyATSCubicCurveToCallback);
+ closePathProc = NewATSCubicClosePathUPP(MyCubicClosePathProc);
+ }
+
+
+ info.path = path;
+
+
+ for (i = 0; i < num_glyphs; i++) {
+ GlyphID theGlyph = glyphs[i].index;
+
+
+ cairo_matrix_init(&info.scale,
+ 1.0, 0.0,
+ 0.0, 1.0, glyphs[i].x, glyphs[i].y);
+
+
+ err = ATSUGlyphGetCubicPaths(font->style,
+ theGlyph,
+ moveProc,
+ lineProc,
+ curveProc,
+ closePathProc, (void *) &info, &err);
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = {
+ _cairo_atsui_font_create,
+ _cairo_atsui_font_destroy_font,
+ _cairo_atsui_font_font_extents,
+ _cairo_atsui_font_text_to_glyphs,
+ _cairo_atsui_font_glyph_extents,
+ _cairo_atsui_font_glyph_bbox,
+ _cairo_atsui_font_show_glyphs,
+ _cairo_atsui_font_glyph_path,
+ _cairo_atsui_font_get_glyph_cache_key,
+};
+
diff --git a/src/cairo-atsui.h b/src/cairo-atsui.h
index a5b7308..72e2d6d 100644
--- a/src/cairo-atsui.h
+++ b/src/cairo-atsui.h
@@ -38,7 +38,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_ATSUI_FONT
/* ATSUI platform-specific font interface */
@@ -46,10 +46,10 @@
CAIRO_BEGIN_DECLS
-cairo_font_t *
-cairo_atsui_font_create(ATSUStyle style);
-
CAIRO_END_DECLS
+#else /* CAIRO_HAS_ATSUI_FONT */
+# error Cairo was not compiled with support for the atsui font backend
#endif /* CAIRO_HAS_ATSUI_FONT */
+
#endif /* CAIRO_ATSUI_H */
diff --git a/src/cairo_cache.c b/src/cairo-cache.c
index d1ad5a4..e7547bc 100644
--- a/src/cairo_cache.c
+++ b/src/cairo-cache.c
@@ -113,7 +113,9 @@ static const cairo_cache_arrangement_t cache_arrangements [] = {
#define LIVE_ENTRY_P(cache, i) \
(!((NULL_ENTRY_P((cache),(i))) || (DEAD_ENTRY_P((cache),(i)))))
-#ifdef CAIRO_DO_SANITY_CHECKING
+#ifdef NDEBUG
+#define _cache_sane_state(c)
+#else
static void
_cache_sane_state (cairo_cache_t *cache)
{
@@ -125,8 +127,6 @@ _cache_sane_state (cairo_cache_t *cache)
/* assert (cache->used_memory <= cache->max_memory); */
assert (cache->live_entries <= cache->arrangement->size);
}
-#else
-#define _cache_sane_state(c)
#endif
static void
@@ -182,19 +182,25 @@ _cache_lookup (cairo_cache_t *cache,
{
/* We are looking up an exact entry. */
if (*probe == NULL)
+ {
/* Found an empty spot, there can't be a match */
break;
+ }
else if (*probe != DEAD_ENTRY
&& (*probe)->hashcode == hash
&& predicate (cache, key, *probe))
+ {
return probe;
+ }
}
else
{
/* We are just looking for a free slot. */
if (*probe == NULL
|| *probe == DEAD_ENTRY)
+ {
return probe;
+ }
}
if (step == 0) {
@@ -339,7 +345,6 @@ _cairo_cache_init (cairo_cache_t *cache,
if (cache != NULL){
cache->arrangement = &cache_arrangements[0];
- cache->refcount = 1;
cache->max_memory = max_memory;
cache->used_memory = 0;
cache->live_entries = 0;
@@ -351,8 +356,9 @@ _cairo_cache_init (cairo_cache_t *cache,
#endif
cache->backend = backend;
- cache->entries = calloc (sizeof(cairo_cache_entry_base_t *),
- cache->arrangement->size);
+ cache->entries = calloc (cache->arrangement->size,
+ sizeof(cairo_cache_entry_base_t *));
+
if (cache->entries == NULL)
return CAIRO_STATUS_NO_MEMORY;
}
@@ -361,31 +367,20 @@ _cairo_cache_init (cairo_cache_t *cache,
}
void
-_cairo_cache_reference (cairo_cache_t *cache)
-{
- _cache_sane_state (cache);
- cache->refcount++;
-}
-
-void
_cairo_cache_destroy (cairo_cache_t *cache)
{
unsigned long i;
- if (cache != NULL) {
+ if (cache == NULL)
+ return;
- _cache_sane_state (cache);
+ _cache_sane_state (cache);
- if (--cache->refcount > 0)
- return;
+ for (i = 0; i < cache->arrangement->size; ++i)
+ _entry_destroy (cache, i);
- for (i = 0; i < cache->arrangement->size; ++i) {
- _entry_destroy (cache, i);
- }
-
- free (cache->entries);
- cache->entries = NULL;
- cache->backend->destroy_cache (cache);
- }
+ free (cache->entries);
+ cache->entries = NULL;
+ cache->backend->destroy_cache (cache);
}
cairo_status_t
diff --git a/src/cairo-color.c b/src/cairo-color.c
new file mode 100644
index 0000000..beb4a34
--- /dev/null
+++ b/src/cairo-color.c
@@ -0,0 +1,163 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairoint.h"
+
+static cairo_color_t const cairo_color_white = {
+ 1.0, 1.0, 1.0, 1.0,
+ 0xffff, 0xffff, 0xffff, 0xffff
+};
+
+static cairo_color_t const cairo_color_black = {
+ 0.0, 0.0, 0.0, 1.0,
+ 0x0, 0x0, 0x0, 0xffff
+};
+
+static cairo_color_t const cairo_color_transparent = {
+ 0.0, 0.0, 0.0, 0.0,
+ 0x0, 0x0, 0x0, 0x0
+};
+
+static cairo_color_t const cairo_color_magenta = {
+ 1.0, 0.0, 1.0, 1.0,
+ 0xffff, 0x0, 0xffff, 0xffff
+};
+
+const cairo_color_t *
+_cairo_stock_color (cairo_stock_t stock)
+{
+ switch (stock) {
+ case CAIRO_STOCK_WHITE:
+ return &cairo_color_white;
+ case CAIRO_STOCK_BLACK:
+ return &cairo_color_black;
+ case CAIRO_STOCK_TRANSPARENT:
+ return &cairo_color_transparent;
+ }
+
+ ASSERT_NOT_REACHED;
+
+ /* If the user can get here somehow, give a color that indicates a
+ * problem. */
+ return &cairo_color_magenta;
+}
+
+void
+_cairo_color_init (cairo_color_t *color)
+{
+ *color = cairo_color_white;
+}
+
+void
+_cairo_color_init_rgb (cairo_color_t *color,
+ double red, double green, double blue)
+{
+ _cairo_color_init_rgba (color, red, green, blue, 1.0);
+}
+
+
+/* XXX: The calculation of:
+
+ channel * 0xffff
+
+ isn't really what we want since:
+
+ (1.0 - epsilon) * 0xffff = 0xfffe
+
+ In other words, given an input range of [0.0, 1.0], we have an
+ infinitely small range tha maps to the output value 0xffff,
+ (while having large, uniformly sized input ranges for all
+ other output values). This is undesirable, particularly when
+ we want to do optimizations for "opaque" colors specfied as
+ floating-point.
+*/
+static void
+_cairo_color_compute_shorts (cairo_color_t *color)
+{
+ color->red_short = color->red * color->alpha * 0xffff;
+ color->green_short = color->green * color->alpha * 0xffff;
+ color->blue_short = color->blue * color->alpha * 0xffff;
+ color->alpha_short = color->alpha * 0xffff;
+}
+
+void
+_cairo_color_init_rgba (cairo_color_t *color,
+ double red, double green, double blue,
+ double alpha)
+{
+ color->red = red;
+ color->green = green;
+ color->blue = blue;
+ color->alpha = alpha;
+
+ _cairo_color_compute_shorts (color);
+}
+
+void
+_cairo_color_multiply_alpha (cairo_color_t *color,
+ double alpha)
+{
+ color->alpha *= alpha;
+
+ _cairo_color_compute_shorts (color);
+}
+
+void
+_cairo_color_get_rgba (cairo_color_t *color,
+ double *red,
+ double *green,
+ double *blue,
+ double *alpha)
+{
+ *red = color->red;
+ *green = color->green;
+ *blue = color->blue;
+ *alpha = color->alpha;
+}
+
+void
+_cairo_color_get_rgba_premultiplied (cairo_color_t *color,
+ double *red,
+ double *green,
+ double *blue,
+ double *alpha)
+{
+ *red = color->red * color->alpha;
+ *green = color->green * color->alpha;
+ *blue = color->blue * color->alpha;
+ *alpha = color->alpha;
+}
diff --git a/src/cairo-features.h b/src/cairo-features.h
index 9c45af5..c2b6e71 100644
--- a/src/cairo-features.h
+++ b/src/cairo-features.h
@@ -37,28 +37,26 @@
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
-#define CAIRO_HAS_PS_SURFACE
+#define CAIRO_HAS_PS_SURFACE 1
-#define CAIRO_HAS_PDF_SURFACE
+#define CAIRO_HAS_PDF_SURFACE 1
-#define CAIRO_HAS_PNG_SURFACE
+#define CAIRO_HAS_XLIB_SURFACE 1
-#define CAIRO_HAS_XLIB_SURFACE
-#define CAIRO_HAS_NO_QUARTZ_SURFACE
-#define CAIRO_HAS_NO_XCB_SURFACE
+#define CAIRO_HAS_XCB_SURFACE 1
-#define CAIRO_HAS_NO_WIN32_SURFACE
-#define CAIRO_HAS_NO_GLITZ_SURFACE
-#define CAIRO_HAS_FT_FONT
+#define CAIRO_HAS_GLITZ_SURFACE 1
-#define CAIRO_HAS_NO_WIN32_FONT
+#define CAIRO_HAS_FT_FONT 1
-#define CAIRO_HAS_NO_ATSUI_FONT
-#define CAIRO_DO_SANITY_CHECKING
+
+
+
+#define CAIRO_HAS_PNG_FUNCTIONS 1
#endif
diff --git a/src/cairo-features.h.in b/src/cairo-features.h.in
index a13250d..8065be3 100644
--- a/src/cairo-features.h.in
+++ b/src/cairo-features.h.in
@@ -37,28 +37,26 @@
#ifndef CAIRO_FEATURES_H
#define CAIRO_FEATURES_H
-#define @PS_SURFACE_FEATURE@
+@PS_SURFACE_FEATURE@
-#define @PDF_SURFACE_FEATURE@
+@PDF_SURFACE_FEATURE@
-#define @PNG_SURFACE_FEATURE@
+@XLIB_SURFACE_FEATURE@
-#define @XLIB_SURFACE_FEATURE@
+@QUARTZ_SURFACE_FEATURE@
-#define @QUARTZ_SURFACE_FEATURE@
+@XCB_SURFACE_FEATURE@
-#define @XCB_SURFACE_FEATURE@
+@WIN32_SURFACE_FEATURE@
-#define @WIN32_SURFACE_FEATURE@
+@GLITZ_SURFACE_FEATURE@
-#define @GLITZ_SURFACE_FEATURE@
+@FT_FONT_FEATURE@
-#define @FT_FONT_FEATURE@
+@WIN32_FONT_FEATURE@
-#define @WIN32_FONT_FEATURE@
+@ATSUI_FONT_FEATURE@
-#define @ATSUI_FONT_FEATURE@
-
-#define @SANITY_CHECKING_FEATURE@
+@PNG_FUNCTIONS_FEATURE@
#endif
diff --git a/src/cairo_fixed.c b/src/cairo-fixed.c
index a4faa17..a4faa17 100644
--- a/src/cairo_fixed.c
+++ b/src/cairo-fixed.c
diff --git a/src/cairo-font.c b/src/cairo-font.c
new file mode 100644
index 0000000..0aeb00b
--- /dev/null
+++ b/src/cairo-font.c
@@ -0,0 +1,1217 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ * Graydon Hoare <graydon@redhat.com>
+ * Owen Taylor <otaylor@redhat.com>
+ */
+
+#include "cairoint.h"
+
+/* cairo_font_face_t */
+
+void
+_cairo_font_face_init (cairo_font_face_t *font_face,
+ const cairo_font_face_backend_t *backend)
+{
+ font_face->refcount = 1;
+ font_face->backend = backend;
+
+ _cairo_user_data_array_init (&font_face->user_data);
+}
+
+/**
+ * cairo_font_face_reference:
+ * @font_face: a #cairo_font_face_t, (may be NULL in which case this
+ * function does nothing).
+ *
+ * Increases the reference count on @font_face by one. This prevents
+ * @font_face from being destroyed until a matching call to
+ * cairo_font_face_destroy() is made.
+ **/
+void
+cairo_font_face_reference (cairo_font_face_t *font_face)
+{
+ if (font_face == NULL)
+ return;
+
+ font_face->refcount++;
+}
+
+/**
+ * cairo_font_face_destroy:
+ * @font_face: a #cairo_font_face_t
+ *
+ * Decreases the reference count on @font_face by one. If the result
+ * is zero, then @font_face and all associated resources are freed.
+ * See cairo_font_face_reference().
+ **/
+void
+cairo_font_face_destroy (cairo_font_face_t *font_face)
+{
+ if (font_face == NULL)
+ return;
+
+ if (--(font_face->refcount) > 0)
+ return;
+
+ font_face->backend->destroy (font_face);
+
+ /* We allow resurrection to deal with some memory management for the
+ * FreeType backend where cairo_ft_font_face_t and cairo_ft_unscaled_font_t
+ * need to effectively mutually reference each other
+ */
+ if (font_face->refcount > 0)
+ return;
+
+ _cairo_user_data_array_fini (&font_face->user_data);
+
+ free (font_face);
+}
+
+/**
+ * cairo_font_face_get_user_data:
+ * @font_face: a #cairo_font_face_t
+ * @key: the address of the #cairo_user_data_key_t the user data was
+ * attached to
+ *
+ * Return user data previously attached to @font_face using the specified
+ * key. If no user data has been attached with the given key this
+ * function returns %NULL.
+ *
+ * Return value: the user data previously attached or %NULL.
+ **/
+void *
+cairo_font_face_get_user_data (cairo_font_face_t *font_face,
+ const cairo_user_data_key_t *key)
+{
+ return _cairo_user_data_array_get_data (&font_face->user_data,
+ key);
+}
+
+/**
+ * cairo_font_face_set_user_data:
+ * @font_face: a #cairo_font_face_t
+ * @key: the address of a #cairo_user_data_key_t to attach the user data to
+ * @user_data: the user data to attach to the font face
+ * @destroy: a #cairo_destroy_func_t which will be called when the
+ * font face is destroyed or when new user data is attached using the
+ * same key.
+ *
+ * Attach user data to @font_face. To remove user data from a font face,
+ * call this function with the key that was used to set it and %NULL
+ * for @data.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY if a
+ * slot could not be allocated for the user data.
+ **/
+cairo_status_t
+cairo_font_face_set_user_data (cairo_font_face_t *font_face,
+ const cairo_user_data_key_t *key,
+ void *user_data,
+ cairo_destroy_func_t destroy)
+{
+ return _cairo_user_data_array_set_data (&font_face->user_data,
+ key, user_data, destroy);
+}
+
+/* cairo_simple_font_face_t - simple family/slant/weight font faces used for
+ * the built-in font API
+ */
+
+typedef struct _cairo_simple_font_face cairo_simple_font_face_t;
+
+struct _cairo_simple_font_face {
+ cairo_font_face_t base;
+ char *family;
+ cairo_font_slant_t slant;
+ cairo_font_weight_t weight;
+};
+
+static const cairo_font_face_backend_t _cairo_simple_font_face_backend;
+
+/* We maintain a global cache from family/weight/slant => cairo_font_face_t
+ * for cairo_simple_font_t. The primary purpose of this cache is to provide
+ * unique cairo_font_face_t values so that our cache from
+ * cairo_font_face_t => cairo_scaled_font_t works. For this reason, we don't need
+ * this cache to keep font faces alive; we just add them to the cache and
+ * remove them again when freed.
+ */
+
+typedef struct {
+ cairo_cache_entry_base_t base;
+ const char *family;
+ cairo_font_slant_t slant;
+ cairo_font_weight_t weight;
+} cairo_simple_cache_key_t;
+
+typedef struct {
+ cairo_simple_cache_key_t key;
+ cairo_simple_font_face_t *font_face;
+} cairo_simple_cache_entry_t;
+
+static const cairo_cache_backend_t _cairo_simple_font_cache_backend;
+
+static void
+_lock_global_simple_cache (void)
+{
+ /* FIXME: Perform locking here. */
+}
+
+static void
+_unlock_global_simple_cache (void)
+{
+ /* FIXME: Perform locking here. */
+}
+
+static cairo_cache_t *
+_get_global_simple_cache (void)
+{
+ static cairo_cache_t *global_simple_cache = NULL;
+
+ if (global_simple_cache == NULL)
+ {
+ global_simple_cache = malloc (sizeof (cairo_cache_t));
+ if (!global_simple_cache)
+ goto FAIL;
+
+ if (_cairo_cache_init (global_simple_cache,
+ &_cairo_simple_font_cache_backend,
+ 0)) /* No memory limit */
+ goto FAIL;
+ }
+ return global_simple_cache;
+
+ FAIL:
+ if (global_simple_cache)
+ free (global_simple_cache);
+ global_simple_cache = NULL;
+ return NULL;
+}
+
+static unsigned long
+_cairo_simple_font_cache_hash (void *cache, void *key)
+{
+ cairo_simple_cache_key_t *k = (cairo_simple_cache_key_t *) key;
+ unsigned long hash;
+
+ /* 1607 and 1451 are just a couple random primes. */
+ hash = _cairo_hash_string (k->family);
+ hash += ((unsigned long) k->slant) * 1607;
+ hash += ((unsigned long) k->weight) * 1451;
+
+ return hash;
+}
+
+static int
+_cairo_simple_font_cache_keys_equal (void *cache,
+ void *k1,
+ void *k2)
+{
+ cairo_simple_cache_key_t *a;
+ cairo_simple_cache_key_t *b;
+ a = (cairo_simple_cache_key_t *) k1;
+ b = (cairo_simple_cache_key_t *) k2;
+
+ return strcmp (a->family, b->family) == 0 &&
+ a->slant == b->slant &&
+ a->weight == b->weight;
+}
+
+static cairo_simple_font_face_t *
+_cairo_simple_font_face_create_from_cache_key (cairo_simple_cache_key_t *key)
+{
+ cairo_simple_font_face_t *simple_face;
+
+ simple_face = malloc (sizeof (cairo_simple_font_face_t));
+ if (!simple_face)
+ return NULL;
+
+ simple_face->family = strdup (key->family);
+ if (!simple_face->family) {
+ free (simple_face);
+ return NULL;
+ }
+
+ simple_face->slant = key->slant;
+ simple_face->weight = key->weight;
+
+ _cairo_font_face_init (&simple_face->base, &_cairo_simple_font_face_backend);
+
+ return simple_face;
+}
+
+static cairo_status_t
+_cairo_simple_font_cache_create_entry (void *cache,
+ void *key,
+ void **return_entry)
+{
+ cairo_simple_cache_key_t *k = (cairo_simple_cache_key_t *) key;
+ cairo_simple_cache_entry_t *entry;
+
+ entry = malloc (sizeof (cairo_simple_cache_entry_t));
+ if (entry == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ entry->font_face = _cairo_simple_font_face_create_from_cache_key (k);
+ if (!entry->font_face) {
+ free (entry);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ entry->key.base.memory = 0;
+ entry->key.family = entry->font_face->family;
+ entry->key.slant = entry->font_face->slant;
+ entry->key.weight = entry->font_face->weight;
+
+ *return_entry = entry;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/* Entries are never spontaneously destroyed; but only when
+ * we remove them from the cache specifically. We free entry->font_face
+ * in the code that removes the entry from the cache
+ */
+static void
+_cairo_simple_font_cache_destroy_entry (void *cache,
+ void *entry)
+{
+ cairo_simple_cache_entry_t *e = (cairo_simple_cache_entry_t *) entry;
+
+ free (e);
+}
+
+static void
+_cairo_simple_font_cache_destroy_cache (void *cache)
+{
+ free (cache);
+}
+
+static const cairo_cache_backend_t _cairo_simple_font_cache_backend = {
+ _cairo_simple_font_cache_hash,
+ _cairo_simple_font_cache_keys_equal,
+ _cairo_simple_font_cache_create_entry,
+ _cairo_simple_font_cache_destroy_entry,
+ _cairo_simple_font_cache_destroy_cache
+};
+
+static void
+_cairo_simple_font_face_destroy (void *abstract_face)
+{
+ cairo_simple_font_face_t *simple_face = abstract_face;
+ cairo_cache_t *cache;
+ cairo_simple_cache_key_t key;
+
+ if (simple_face == NULL)
+ return;
+
+ _lock_global_simple_cache ();
+ cache = _get_global_simple_cache ();
+ assert (cache);
+
+ key.family = simple_face->family;
+ key.slant = simple_face->slant;
+ key.weight = simple_face->weight;
+
+ _cairo_cache_remove (cache, &key);
+
+ _unlock_global_simple_cache ();
+
+ free (simple_face->family);
+}
+
+static cairo_status_t
+_cairo_simple_font_face_create_font (void *abstract_face,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **scaled_font)
+{
+ const cairo_scaled_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT;
+ cairo_simple_font_face_t *simple_face = abstract_face;
+
+ return backend->create (simple_face->family, simple_face->slant, simple_face->weight,
+ font_matrix, ctm, scaled_font);
+}
+
+static const cairo_font_face_backend_t _cairo_simple_font_face_backend = {
+ _cairo_simple_font_face_destroy,
+ _cairo_simple_font_face_create_font,
+};
+
+/**
+ * _cairo_simple_font_face_create:
+ * @family: a font family name, encoded in UTF-8
+ * @slant: the slant for the font
+ * @weight: the weight for the font
+ *
+ * Creates a font face from a triplet of family, slant, and weight.
+ * These font faces are used in implementation of the the #cairo_t "toy"
+ * font API.
+ *
+ * Return value: a newly created #cairo_font_face_t, destroy with
+ * cairo_font_face_destroy()
+ **/
+cairo_private cairo_font_face_t *
+_cairo_simple_font_face_create (const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight)
+{
+ cairo_simple_cache_entry_t *entry;
+ cairo_simple_cache_key_t key;
+ cairo_cache_t *cache;
+ cairo_status_t status;
+ cairo_bool_t created_entry;
+
+ key.family = family;
+ key.slant = slant;
+ key.weight = weight;
+
+ _lock_global_simple_cache ();
+ cache = _get_global_simple_cache ();
+ if (cache == NULL) {
+ _unlock_global_simple_cache ();
+ return NULL;
+ }
+ status = _cairo_cache_lookup (cache, &key, (void **) &entry, &created_entry);
+ if (status == CAIRO_STATUS_SUCCESS && !created_entry)
+ cairo_font_face_reference (&entry->font_face->base);
+
+ _unlock_global_simple_cache ();
+ if (status)
+ return NULL;
+
+ return &entry->font_face->base;
+}
+
+/* cairo_scaled_font_t */
+
+/* Here we keep a cache from cairo_font_face_t/matrix/ctm => cairo_scaled_font_t.
+ *
+ * The implementation is messy because we want
+ *
+ * - All otherwise referenced cairo_scaled_font_t's to be in the cache
+ * - Some number of not otherwise referenced cairo_scaled_font_t's
+ *
+ * For this reason, we actually use *two* caches ... a finite size
+ * cache that references the cairo_scaled_font_t as a first level (the outer
+ * cache), then an infinite size cache as the second level (the inner
+ * cache). A single cache could be used at the cost of complicating
+ * cairo-cache.c
+ */
+
+/* This defines the size of the outer cache ... that is, the number
+ * of scaled fonts we keep around even when not otherwise referenced
+ */
+#define MAX_CACHED_FONTS 24
+
+typedef struct {
+ cairo_cache_entry_base_t base;
+ cairo_font_face_t *font_face;
+ const cairo_matrix_t *font_matrix;
+ const cairo_matrix_t *ctm;
+} cairo_font_cache_key_t;
+
+typedef struct {
+ cairo_font_cache_key_t key;
+ cairo_scaled_font_t *scaled_font;
+} cairo_font_cache_entry_t;
+
+static const cairo_cache_backend_t _cairo_outer_font_cache_backend;
+static const cairo_cache_backend_t _cairo_inner_font_cache_backend;
+
+static void
+_lock_global_font_cache (void)
+{
+ /* FIXME: Perform locking here. */
+}
+
+static void
+_unlock_global_font_cache (void)
+{
+ /* FIXME: Perform locking here. */
+}
+
+static cairo_cache_t *
+_get_outer_font_cache (void)
+{
+ static cairo_cache_t *outer_font_cache = NULL;
+
+ if (outer_font_cache == NULL)
+ {
+ outer_font_cache = malloc (sizeof (cairo_cache_t));
+ if (!outer_font_cache)
+ goto FAIL;
+
+ if (_cairo_cache_init (outer_font_cache,
+ &_cairo_outer_font_cache_backend,
+ MAX_CACHED_FONTS))
+ goto FAIL;
+ }
+ return outer_font_cache;
+
+ FAIL:
+ if (outer_font_cache)
+ free (outer_font_cache);
+ outer_font_cache = NULL;
+ return NULL;
+}
+
+static cairo_cache_t *
+_get_inner_font_cache (void)
+{
+ static cairo_cache_t *inner_font_cache = NULL;
+
+ if (inner_font_cache == NULL)
+ {
+ inner_font_cache = malloc (sizeof (cairo_cache_t));
+ if (!inner_font_cache)
+ goto FAIL;
+
+ if (_cairo_cache_init (inner_font_cache,
+ &_cairo_inner_font_cache_backend,
+ MAX_CACHED_FONTS))
+ goto FAIL;
+ }
+ return inner_font_cache;
+
+ FAIL:
+ if (inner_font_cache)
+ free (inner_font_cache);
+ inner_font_cache = NULL;
+ return NULL;
+}
+
+
+/* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/)
+ *
+ * Not necessarily better than a lot of other hashes, but should be OK, and
+ * well tested with binary data.
+ */
+
+#define FNV_32_PRIME ((uint32_t)0x01000193)
+#define FNV1_32_INIT ((uint32_t)0x811c9dc5)
+
+static uint32_t
+_hash_bytes_fnv (unsigned char *buffer,
+ int len,
+ uint32_t hval)
+{
+ while (len--) {
+ hval *= FNV_32_PRIME;
+ hval ^= *buffer++;
+ }
+
+ return hval;
+}
+static unsigned long
+_cairo_font_cache_hash (void *cache, void *key)
+{
+ cairo_font_cache_key_t *k = (cairo_font_cache_key_t *) key;
+ uint32_t hash = FNV1_32_INIT;
+
+ /* We do a bytewise hash on the font matrices */
+ hash = _hash_bytes_fnv ((unsigned char *)(&k->font_matrix->xx),
+ sizeof(double) * 4,
+ hash);
+ hash = _hash_bytes_fnv ((unsigned char *)(&k->ctm->xx),
+ sizeof(double) * 4,
+ hash);
+
+ return hash ^ (unsigned long)k->font_face;
+}
+
+static int
+_cairo_font_cache_keys_equal (void *cache,
+ void *k1,
+ void *k2)
+{
+ cairo_font_cache_key_t *a;
+ cairo_font_cache_key_t *b;
+ a = (cairo_font_cache_key_t *) k1;
+ b = (cairo_font_cache_key_t *) k2;
+
+ return (a->font_face == b->font_face &&
+ memcmp ((unsigned char *)(&a->font_matrix->xx),
+ (unsigned char *)(&b->font_matrix->xx),
+ sizeof(double) * 4) == 0 &&
+ memcmp ((unsigned char *)(&a->ctm->xx),
+ (unsigned char *)(&b->ctm->xx),
+ sizeof(double) * 4) == 0);
+}
+
+/* The cache lookup failed in the outer cache, so we pull
+ * the font from the inner cache (if that in turns fails,
+ * it will create the font
+ */
+static cairo_status_t
+_cairo_outer_font_cache_create_entry (void *cache,
+ void *key,
+ void **return_entry)
+{
+ cairo_font_cache_entry_t *entry;
+ cairo_font_cache_entry_t *inner_entry;
+ cairo_bool_t created_entry;
+ cairo_status_t status;
+
+ entry = malloc (sizeof (cairo_font_cache_entry_t));
+ if (entry == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ cache = _get_inner_font_cache ();
+ if (cache == NULL) {
+ _unlock_global_font_cache ();
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ status = _cairo_cache_lookup (cache, key, (void **) &inner_entry, &created_entry);
+ if (status) {
+ free (entry);
+ return status;
+ }
+
+ entry->scaled_font = inner_entry->scaled_font;
+ if (!created_entry)
+ cairo_scaled_font_reference (entry->scaled_font);
+
+ entry->key.base.memory = 1;
+ entry->key.font_face = entry->scaled_font->font_face;
+ entry->key.font_matrix = &entry->scaled_font->font_matrix;
+ entry->key.ctm = &entry->scaled_font->ctm;
+
+ *return_entry = entry;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_outer_font_cache_destroy_entry (void *cache,
+ void *entry)
+{
+ cairo_font_cache_entry_t *e = (cairo_font_cache_entry_t *) entry;
+
+ cairo_scaled_font_destroy (e->scaled_font);
+
+ free (e);
+}
+
+/* Called when the lookup fails in the inner cache as well; there
+ * is no existing font, so we have to create one.
+ */
+static cairo_status_t
+_cairo_inner_font_cache_create_entry (void *cache,
+ void *key,
+ void **return_entry)
+{
+ cairo_font_cache_key_t *k = (cairo_font_cache_key_t *) key;
+ cairo_font_cache_entry_t *entry;
+ cairo_status_t status;
+
+ entry = malloc (sizeof (cairo_font_cache_entry_t));
+ if (entry == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ status = k->font_face->backend->create_font (k->font_face,
+ k->font_matrix,
+ k->ctm,
+ &entry->scaled_font);
+ if (status) {
+ free (entry);
+ return status;
+ }
+
+ entry->scaled_font->font_face = k->font_face;
+ cairo_font_face_reference (k->font_face);
+
+ entry->key.base.memory = 0;
+ entry->key.font_face = k->font_face;
+ entry->key.font_matrix = &entry->scaled_font->font_matrix;
+ entry->key.ctm = &entry->scaled_font->ctm;
+
+ *return_entry = entry;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/* Entries in the inner font cache are never spontaneously destroyed;
+ * but only when we remove them from the cache specifically. We free
+ * entry->scaled_font in the code that removes the entry from the cache
+ */
+static void
+_cairo_inner_font_cache_destroy_entry (void *cache,
+ void *entry)
+{
+ free (entry);
+}
+
+static void
+_cairo_font_cache_destroy_cache (void *cache)
+{
+ free (cache);
+}
+
+static const cairo_cache_backend_t _cairo_outer_font_cache_backend = {
+ _cairo_font_cache_hash,
+ _cairo_font_cache_keys_equal,
+ _cairo_outer_font_cache_create_entry,
+ _cairo_outer_font_cache_destroy_entry,
+ _cairo_font_cache_destroy_cache
+};
+
+static const cairo_cache_backend_t _cairo_inner_font_cache_backend = {
+ _cairo_font_cache_hash,
+ _cairo_font_cache_keys_equal,
+ _cairo_inner_font_cache_create_entry,
+ _cairo_inner_font_cache_destroy_entry,
+ _cairo_font_cache_destroy_cache
+};
+
+/**
+ * cairo_scaled_font_create:
+ * @font_face: a #cairo_font_face_t
+ * @font_matrix: font space to user space transformation matrix for the
+ * font. In the simplest case of a N point font, this matrix is
+ * just a scale by N, but it can also be used to shear the font
+ * or stretch it unequally along the two axes. See
+ * cairo_set_font_matrix().
+ * @ctm: user to device transformation matrix with which the font will
+ * be used.
+ *
+ * Creates a #cairo_scaled_font_t object from a font face and matrices that
+ * describe the size of the font and the environment in which it will
+ * be used.
+ *
+ * Return value: a newly created #cairo_scaled_font_t. Destroy with
+ * cairo_scaled_font_destroy()
+ **/
+cairo_scaled_font_t *
+cairo_scaled_font_create (cairo_font_face_t *font_face,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm)
+{
+ cairo_font_cache_entry_t *entry;
+ cairo_font_cache_key_t key;
+ cairo_cache_t *cache;
+ cairo_status_t status;
+
+ key.font_face = font_face;
+ key.font_matrix = font_matrix;
+ key.ctm = ctm;
+
+ _lock_global_font_cache ();
+ cache = _get_outer_font_cache ();
+ if (cache == NULL) {
+ _unlock_global_font_cache ();
+ return NULL;
+ }
+
+ status = _cairo_cache_lookup (cache, &key, (void **) &entry, NULL);
+ if (status == CAIRO_STATUS_SUCCESS)
+ cairo_scaled_font_reference (entry->scaled_font);
+
+ _unlock_global_font_cache ();
+ if (status)
+ return NULL;
+
+ return entry->scaled_font;
+}
+
+void
+_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ const cairo_scaled_font_backend_t *backend)
+{
+ scaled_font->font_matrix = *font_matrix;
+ scaled_font->ctm = *ctm;
+ cairo_matrix_multiply (&scaled_font->scale, &scaled_font->font_matrix, &scaled_font->ctm);
+
+ scaled_font->refcount = 1;
+ scaled_font->backend = backend;
+}
+
+cairo_status_t
+_cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs)
+{
+ return scaled_font->backend->text_to_glyphs (scaled_font, utf8, glyphs, num_glyphs);
+}
+
+cairo_status_t
+_cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents)
+{
+ return scaled_font->backend->glyph_extents (scaled_font, glyphs, num_glyphs, extents);
+}
+
+
+cairo_status_t
+_cairo_scaled_font_glyph_bbox (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_box_t *bbox)
+{
+ return scaled_font->backend->glyph_bbox (scaled_font, glyphs, num_glyphs, bbox);
+}
+
+cairo_status_t
+_cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ cairo_glyph_t *glyphs,
+ int num_glyphs)
+{
+ cairo_status_t status;
+
+ status = _cairo_surface_show_glyphs (scaled_font, operator, pattern,
+ surface,
+ source_x, source_y,
+ dest_x, dest_y,
+ width, height,
+ glyphs, num_glyphs);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+
+ /* Surface display routine either does not exist or failed. */
+ return scaled_font->backend->show_glyphs (scaled_font, operator, pattern,
+ surface,
+ source_x, source_y,
+ dest_x, dest_y,
+ width, height,
+ glyphs, num_glyphs);
+}
+
+cairo_status_t
+_cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path)
+{
+ return scaled_font->backend->glyph_path (scaled_font, glyphs, num_glyphs, path);
+}
+
+void
+_cairo_scaled_font_get_glyph_cache_key (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_cache_key_t *key)
+{
+ scaled_font->backend->get_glyph_cache_key (scaled_font, key);
+}
+
+cairo_status_t
+_cairo_scaled_font_font_extents (cairo_scaled_font_t *scaled_font,
+ cairo_font_extents_t *extents)
+{
+ return scaled_font->backend->font_extents (scaled_font, extents);
+}
+
+void
+_cairo_unscaled_font_init (cairo_unscaled_font_t *unscaled_font,
+ const cairo_unscaled_font_backend_t *backend)
+{
+ unscaled_font->refcount = 1;
+ unscaled_font->backend = backend;
+}
+
+void
+_cairo_unscaled_font_reference (cairo_unscaled_font_t *unscaled_font)
+{
+ if (unscaled_font == NULL)
+ return;
+
+ unscaled_font->refcount++;
+}
+
+void
+_cairo_unscaled_font_destroy (cairo_unscaled_font_t *unscaled_font)
+{
+ if (unscaled_font == NULL)
+ return;
+
+ if (--(unscaled_font->refcount) > 0)
+ return;
+
+ unscaled_font->backend->destroy (unscaled_font);
+
+ free (unscaled_font);
+}
+
+
+
+/* Public font API follows. */
+
+/**
+ * cairo_scaled_font_reference:
+ * @scaled_font: a #cairo_scaled_font_t, (may be NULL in which case
+ * this function does nothing)
+ *
+ * Increases the reference count on @scaled_font by one. This prevents
+ * @scaled_font from being destroyed until a matching call to
+ * cairo_scaled_font_destroy() is made.
+ **/
+void
+cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font)
+{
+ if (scaled_font == NULL)
+ return;
+
+ scaled_font->refcount++;
+}
+
+/**
+ * cairo_scaled_font_destroy:
+ * @scaled_font: a #cairo_scaled_font_t
+ *
+ * Decreases the reference count on @font by one. If the result
+ * is zero, then @font and all associated resources are freed.
+ * See cairo_scaled_font_reference().
+ **/
+void
+cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
+{
+ cairo_font_cache_key_t key;
+ cairo_cache_t *cache;
+
+ if (scaled_font == NULL)
+ return;
+
+ if (--(scaled_font->refcount) > 0)
+ return;
+
+ if (scaled_font->font_face) {
+ _lock_global_font_cache ();
+ cache = _get_inner_font_cache ();
+ assert (cache);
+
+ key.font_face = scaled_font->font_face;
+ key.font_matrix = &scaled_font->font_matrix;
+ key.ctm = &scaled_font->ctm;
+
+ _cairo_cache_remove (cache, &key);
+ _unlock_global_font_cache ();
+
+ cairo_font_face_destroy (scaled_font->font_face);
+ }
+
+ scaled_font->backend->destroy (scaled_font);
+
+ free (scaled_font);
+}
+
+/**
+ * cairo_scaled_font_extents:
+ * @scaled_font: a #cairo_scaled_font_t
+ * @extents: a #cairo_font_extents_t which to store the retrieved extents.
+ *
+ * Gets the metrics for a #cairo_scaled_font_t.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS on success. Otherwise, an
+ * error such as %CAIRO_STATUS_NO_MEMORY.
+ **/
+cairo_status_t
+cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font,
+ cairo_font_extents_t *extents)
+{
+ cairo_int_status_t status;
+ double font_scale_x, font_scale_y;
+
+ status = _cairo_scaled_font_font_extents (scaled_font, extents);
+
+ if (status)
+ return status;
+
+ _cairo_matrix_compute_scale_factors (&scaled_font->font_matrix,
+ &font_scale_x, &font_scale_y,
+ /* XXX */ 1);
+
+ /*
+ * The font responded in unscaled units, scale by the font
+ * matrix scale factors to get to user space
+ */
+
+ extents->ascent *= font_scale_y;
+ extents->descent *= font_scale_y;
+ extents->height *= font_scale_y;
+ extents->max_x_advance *= font_scale_x;
+ extents->max_y_advance *= font_scale_y;
+
+ return status;
+}
+
+/**
+ * cairo_font_glyph_extents:
+ * @scaled_font: a #cairo_scaled_font_t
+ * @glyphs: an array of glyph IDs with X and Y offsets.
+ * @num_glyphs: the number of glyphs in the @glyphs array
+ * @extents: a #cairo_text_extents_t which to store the retrieved extents.
+ *
+ * cairo_font_glyph_extents() gets the overall metrics for a string of
+ * glyphs. The X and Y offsets in @glyphs are taken from an origin of 0,0.
+ **/
+void
+cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents)
+{
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+ cairo_glyph_t origin_glyph;
+ cairo_text_extents_t origin_extents;
+ int i;
+ double min_x = 0.0, min_y = 0.0, max_x = 0.0, max_y = 0.0;
+ double x_pos = 0.0, y_pos = 0.0;
+ int set = 0;
+
+ if (!num_glyphs)
+ {
+ extents->x_bearing = 0.0;
+ extents->y_bearing = 0.0;
+ extents->width = 0.0;
+ extents->height = 0.0;
+ extents->x_advance = 0.0;
+ extents->y_advance = 0.0;
+
+ return;
+ }
+
+ for (i = 0; i < num_glyphs; i++)
+ {
+ double x, y;
+ double wm, hm;
+
+ origin_glyph = glyphs[i];
+ origin_glyph.x = 0.0;
+ origin_glyph.y = 0.0;
+ status = _cairo_scaled_font_glyph_extents (scaled_font,
+ &origin_glyph, 1,
+ &origin_extents);
+
+ /*
+ * Transform font space metrics into user space metrics
+ * by running the corners through the font matrix and
+ * expanding the bounding box as necessary
+ */
+ x = origin_extents.x_bearing;
+ y = origin_extents.y_bearing;
+ cairo_matrix_transform_point (&scaled_font->font_matrix,
+ &x, &y);
+
+ for (hm = 0.0; hm <= 1.0; hm += 1.0)
+ for (wm = 0.0; wm <= 1.0; wm += 1.0)
+ {
+ x = origin_extents.x_bearing + origin_extents.width * wm;
+ y = origin_extents.y_bearing + origin_extents.height * hm;
+ cairo_matrix_transform_point (&scaled_font->font_matrix,
+ &x, &y);
+ x += glyphs[i].x;
+ y += glyphs[i].y;
+ if (!set)
+ {
+ min_x = max_x = x;
+ min_y = max_y = y;
+ set = 1;
+ }
+ else
+ {
+ if (x < min_x) min_x = x;
+ if (x > max_x) max_x = x;
+ if (y < min_y) min_y = y;
+ if (y > max_y) max_y = y;
+ }
+ }
+
+ x = origin_extents.x_advance;
+ y = origin_extents.y_advance;
+ cairo_matrix_transform_point (&scaled_font->font_matrix,
+ &x, &y);
+ x_pos = glyphs[i].x + x;
+ y_pos = glyphs[i].y + y;
+ }
+
+ extents->x_bearing = min_x - glyphs[0].x;
+ extents->y_bearing = min_y - glyphs[0].y;
+ extents->width = max_x - min_x;
+ extents->height = max_y - min_y;
+ extents->x_advance = x_pos - glyphs[0].x;
+ extents->y_advance = y_pos - glyphs[0].y;
+}
+
+/* Now we implement functions to access a default global image & metrics
+ * cache.
+ */
+
+unsigned long
+_cairo_glyph_cache_hash (void *cache, void *key)
+{
+ cairo_glyph_cache_key_t *in;
+ in = (cairo_glyph_cache_key_t *) key;
+ return
+ ((unsigned long) in->unscaled)
+ ^ ((unsigned long) in->scale.xx)
+ ^ ((unsigned long) in->scale.yx)
+ ^ ((unsigned long) in->scale.xy)
+ ^ ((unsigned long) in->scale.yy)
+ ^ (in->flags * 1451) /* 1451 is just an abitrary prime */
+ ^ in->index;
+}
+
+int
+_cairo_glyph_cache_keys_equal (void *cache,
+ void *k1,
+ void *k2)
+{
+ cairo_glyph_cache_key_t *a, *b;
+ a = (cairo_glyph_cache_key_t *) k1;
+ b = (cairo_glyph_cache_key_t *) k2;
+ return (a->index == b->index)
+ && (a->unscaled == b->unscaled)
+ && (a->flags == b->flags)
+ && (a->scale.xx == b->scale.xx)
+ && (a->scale.yx == b->scale.yx)
+ && (a->scale.xy == b->scale.xy)
+ && (a->scale.yy == b->scale.yy);
+}
+
+
+static cairo_status_t
+_image_glyph_cache_create_entry (void *cache,
+ void *key,
+ void **return_value)
+{
+ cairo_glyph_cache_key_t *k = (cairo_glyph_cache_key_t *) key;
+ cairo_image_glyph_cache_entry_t *im;
+ cairo_status_t status;
+
+ im = calloc (1, sizeof (cairo_image_glyph_cache_entry_t));
+ if (im == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ im->key = *k;
+ status = im->key.unscaled->backend->create_glyph (im->key.unscaled,
+ im);
+
+ if (status != CAIRO_STATUS_SUCCESS) {
+ free (im);
+ return status;
+ }
+
+ _cairo_unscaled_font_reference (im->key.unscaled);
+
+ im->key.base.memory =
+ sizeof (cairo_image_glyph_cache_entry_t)
+ + (im->image ?
+ sizeof (cairo_image_surface_t)
+ + 28 * sizeof (int) /* rough guess at size of pixman image structure */
+ + (im->image->height * im->image->stride) : 0);
+
+ *return_value = im;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static void
+_image_glyph_cache_destroy_entry (void *cache,
+ void *value)
+{
+ cairo_image_glyph_cache_entry_t *im;
+
+ im = (cairo_image_glyph_cache_entry_t *) value;
+ _cairo_unscaled_font_destroy (im->key.unscaled);
+ cairo_surface_destroy (&(im->image->base));
+ free (im);
+}
+
+static void
+_image_glyph_cache_destroy_cache (void *cache)
+{
+ free (cache);
+}
+
+static const cairo_cache_backend_t cairo_image_cache_backend = {
+ _cairo_glyph_cache_hash,
+ _cairo_glyph_cache_keys_equal,
+ _image_glyph_cache_create_entry,
+ _image_glyph_cache_destroy_entry,
+ _image_glyph_cache_destroy_cache
+};
+
+void
+_cairo_lock_global_image_glyph_cache()
+{
+ /* FIXME: implement locking. */
+}
+
+void
+_cairo_unlock_global_image_glyph_cache()
+{
+ /* FIXME: implement locking. */
+}
+
+static cairo_cache_t *
+_global_image_glyph_cache = NULL;
+
+cairo_cache_t *
+_cairo_get_global_image_glyph_cache ()
+{
+ if (_global_image_glyph_cache == NULL) {
+ _global_image_glyph_cache = malloc (sizeof (cairo_cache_t));
+
+ if (_global_image_glyph_cache == NULL)
+ goto FAIL;
+
+ if (_cairo_cache_init (_global_image_glyph_cache,
+ &cairo_image_cache_backend,
+ CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT))
+ goto FAIL;
+ }
+
+ return _global_image_glyph_cache;
+
+ FAIL:
+ if (_global_image_glyph_cache)
+ free (_global_image_glyph_cache);
+ _global_image_glyph_cache = NULL;
+ return NULL;
+}
diff --git a/src/cairo_ft_font.c b/src/cairo-ft-font.c
index 44e1b0e..63f51a5 100644
--- a/src/cairo_ft_font.c
+++ b/src/cairo-ft-font.c
@@ -66,31 +66,42 @@ typedef struct {
/*
* We create an object that corresponds to a single font on the disk;
* (identified by a filename/id pair) these are shared between all
- * fonts using that file. For cairo_ft_font_create_for_ft_face(), we
+ * fonts using that file. For cairo_ft_scaled_font_create_for_ft_face(), we
* just create a one-off version with a permanent face value.
*/
+
+typedef struct _ft_font_face ft_font_face_t;
+
typedef struct {
cairo_unscaled_font_t base;
- int from_face; /* from cairo_ft_font_create_for_ft_face()? */
- FT_Face face; /* provided or cached face */
+ cairo_bool_t from_face; /* from cairo_ft_scaled_font_create_for_ft_face()? */
+ FT_Face face; /* provided or cached face */
/* only set if from_face is false */
- FT_Library library;
char *filename;
int id;
/* We temporarily scale the unscaled font as neede */
int have_scale;
- cairo_font_scale_t current_scale;
+ cairo_matrix_t current_scale;
double x_scale; /* Extracted X scale factor */
double y_scale; /* Extracted Y scale factor */
int lock; /* count of how many times this font has been locked */
+
+ ft_font_face_t *faces; /* Linked list of faces for this font */
} ft_unscaled_font_t;
-const cairo_font_backend_t cairo_ft_font_backend;
+struct _ft_font_face {
+ cairo_font_face_t base;
+ ft_unscaled_font_t *unscaled;
+ int load_flags;
+ ft_font_face_t *next_face;
+};
+
+const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend;
static ft_unscaled_font_t *
_ft_unscaled_font_create_from_face (FT_Face face)
@@ -102,21 +113,21 @@ _ft_unscaled_font_create_from_face (FT_Face face)
unscaled->from_face = 1;
unscaled->face = face;
- unscaled->library = NULL;
unscaled->filename = NULL;
unscaled->id = 0;
unscaled->have_scale = 0;
unscaled->lock = 0;
- _cairo_unscaled_font_init ((cairo_unscaled_font_t *)unscaled,
- &cairo_ft_font_backend);
+ unscaled->faces = NULL;
+
+ _cairo_unscaled_font_init (&unscaled->base,
+ &cairo_ft_unscaled_font_backend);
return unscaled;
}
static ft_unscaled_font_t *
-_ft_unscaled_font_create_from_filename (FT_Library library,
- const char *filename,
+_ft_unscaled_font_create_from_filename (const char *filename,
int id)
{
ft_unscaled_font_t *unscaled;
@@ -135,15 +146,16 @@ _ft_unscaled_font_create_from_filename (FT_Library library,
unscaled->from_face = 0;
unscaled->face = NULL;
- unscaled->library = library;
unscaled->filename = new_filename;
unscaled->id = id;
unscaled->have_scale = 0;
unscaled->lock = 0;
- _cairo_unscaled_font_init ((cairo_unscaled_font_t *)unscaled,
- &cairo_ft_font_backend);
+ unscaled->faces = NULL;
+
+ _cairo_unscaled_font_init (&unscaled->base,
+ &cairo_ft_unscaled_font_backend);
return unscaled;
}
@@ -204,7 +216,6 @@ _ft_font_cache_create_entry (void *cache,
void *key,
void **return_entry)
{
- ft_cache_t *ftcache = (ft_cache_t *) cache;
cairo_ft_cache_key_t *k = (cairo_ft_cache_key_t *) key;
cairo_ft_cache_entry_t *entry;
@@ -212,8 +223,7 @@ _ft_font_cache_create_entry (void *cache,
if (entry == NULL)
return CAIRO_STATUS_NO_MEMORY;
- entry->unscaled = _ft_unscaled_font_create_from_filename (ftcache->lib,
- k->filename,
+ entry->unscaled = _ft_unscaled_font_create_from_filename (k->filename,
k->id);
if (!entry->unscaled) {
free (entry);
@@ -246,6 +256,7 @@ static void
_ft_font_cache_destroy_cache (void *cache)
{
ft_cache_t *fc = (ft_cache_t *) cache;
+
FT_Done_FreeType (fc->lib);
free (fc);
}
@@ -327,13 +338,13 @@ _ft_unscaled_font_get_for_pattern (FcPattern *pattern)
}
status = _cairo_cache_lookup (cache, &key, (void **) &entry, &created_entry);
+ if (status == CAIRO_STATUS_SUCCESS && !created_entry)
+ _cairo_unscaled_font_reference (&entry->unscaled->base);
+
_unlock_global_ft_cache ();
if (status)
return NULL;
- if (!created_entry)
- _cairo_unscaled_font_reference ((cairo_unscaled_font_t *)entry->unscaled);
-
return entry->unscaled;
}
@@ -406,9 +417,9 @@ _ft_unscaled_font_unlock_face (ft_unscaled_font_t *unscaled)
static void
_compute_transform (ft_font_transform_t *sf,
- cairo_font_scale_t *sc)
+ cairo_matrix_t *scale)
{
- cairo_matrix_t normalized;
+ cairo_matrix_t normalized = *scale;
double tx, ty;
/* The font matrix has x and y "scale" components which we extract and
@@ -418,21 +429,14 @@ _compute_transform (ft_font_transform_t *sf,
* freetype's transformation.
*/
- cairo_matrix_set_affine (&normalized,
- sc->matrix[0][0],
- sc->matrix[0][1],
- sc->matrix[1][0],
- sc->matrix[1][1],
- 0, 0);
-
_cairo_matrix_compute_scale_factors (&normalized,
&sf->x_scale, &sf->y_scale,
/* XXX */ 1);
cairo_matrix_scale (&normalized, 1.0 / sf->x_scale, 1.0 / sf->y_scale);
- cairo_matrix_get_affine (&normalized,
- &sf->shape[0][0], &sf->shape[0][1],
- &sf->shape[1][0], &sf->shape[1][1],
- &tx, &ty);
+ _cairo_matrix_get_affine (&normalized,
+ &sf->shape[0][0], &sf->shape[0][1],
+ &sf->shape[1][0], &sf->shape[1][1],
+ &tx, &ty);
}
/* Temporarily scales an unscaled font to the give scale. We catch
@@ -440,7 +444,7 @@ _compute_transform (ft_font_transform_t *sf,
*/
static void
_ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled,
- cairo_font_scale_t *scale)
+ cairo_matrix_t *scale)
{
ft_font_transform_t sf;
FT_Matrix mat;
@@ -448,10 +452,10 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled,
assert (unscaled->face != NULL);
if (unscaled->have_scale &&
- scale->matrix[0][0] == unscaled->current_scale.matrix[0][0] &&
- scale->matrix[0][1] == unscaled->current_scale.matrix[0][1] &&
- scale->matrix[1][0] == unscaled->current_scale.matrix[1][0] &&
- scale->matrix[1][1] == unscaled->current_scale.matrix[1][1])
+ scale->xx == unscaled->current_scale.xx &&
+ scale->yx == unscaled->current_scale.yx &&
+ scale->xy == unscaled->current_scale.xy &&
+ scale->yy == unscaled->current_scale.yy)
return;
unscaled->have_scale = 1;
@@ -474,14 +478,174 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled,
(FT_UInt) sf.y_scale);
}
-/* implement the font backend interface */
+static void
+_cairo_ft_unscaled_font_destroy (void *abstract_font)
+{
+ ft_unscaled_font_t *unscaled = abstract_font;
+
+ if (unscaled == NULL)
+ return;
+
+ if (unscaled->from_face) {
+ /* See comments in _ft_font_face_destroy about the "zombie" state
+ * for a _ft_font_face.
+ */
+ if (unscaled->faces && !unscaled->faces->unscaled)
+ cairo_font_face_destroy (&unscaled->faces->base);
+ } else {
+ cairo_cache_t *cache;
+ cairo_ft_cache_key_t key;
+
+ _lock_global_ft_cache ();
+ cache = _get_global_ft_cache ();
+ assert (cache);
+
+ key.filename = unscaled->filename;
+ key.id = unscaled->id;
+
+ _cairo_cache_remove (cache, &key);
+
+ _unlock_global_ft_cache ();
+
+ if (unscaled->filename)
+ free (unscaled->filename);
+
+ if (unscaled->face)
+ FT_Done_Face (unscaled->face);
+ }
+}
+
+static cairo_status_t
+_cairo_ft_unscaled_font_create_glyph (void *abstract_font,
+ cairo_image_glyph_cache_entry_t *val)
+{
+ ft_unscaled_font_t *unscaled = abstract_font;
+ FT_GlyphSlot glyphslot;
+ unsigned int width, height, stride;
+ FT_Face face;
+ FT_Outline *outline;
+ FT_BBox cbox;
+ FT_Bitmap bitmap;
+ FT_Glyph_Metrics *metrics;
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+
+ face = _ft_unscaled_font_lock_face (unscaled);
+ if (!face)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ glyphslot = face->glyph;
+ metrics = &glyphslot->metrics;
+
+ _ft_unscaled_font_set_scale (unscaled, &val->key.scale);
+
+ if (FT_Load_Glyph (face, val->key.index, val->key.flags) != 0) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto FAIL;
+ }
+
+ /*
+ * Note: the font's coordinate system is upside down from ours, so the
+ * Y coordinates of the bearing and advance need to be negated.
+ *
+ * Scale metrics back to glyph space from the scaled glyph space returned
+ * by FreeType
+ */
+
+ val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / unscaled->x_scale;
+ val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / unscaled->y_scale;
+
+ val->extents.width = DOUBLE_FROM_26_6 (metrics->width) / unscaled->x_scale;
+ val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / unscaled->y_scale;
+
+ /*
+ * use untransformed advance values
+ * XXX uses horizontal advance only at present;
+ should provide FT_LOAD_VERTICAL_LAYOUT
+ */
+
+ val->extents.x_advance = DOUBLE_FROM_26_6 (face->glyph->metrics.horiAdvance) / unscaled->x_scale;
+ val->extents.y_advance = 0 / unscaled->y_scale;
+
+ outline = &glyphslot->outline;
+
+ FT_Outline_Get_CBox (outline, &cbox);
+
+ cbox.xMin &= -64;
+ cbox.yMin &= -64;
+ cbox.xMax = (cbox.xMax + 63) & -64;
+ cbox.yMax = (cbox.yMax + 63) & -64;
+
+ width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
+ height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
+ stride = (width + 3) & -4;
+
+ if (width * height == 0) {
+ val->image = NULL;
+ } else {
+
+ bitmap.pixel_mode = ft_pixel_mode_grays;
+ bitmap.num_grays = 256;
+ bitmap.width = width;
+ bitmap.rows = height;
+ bitmap.pitch = stride;
+ bitmap.buffer = calloc (1, stride * height);
+
+ if (bitmap.buffer == NULL) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto FAIL;
+ }
+
+ FT_Outline_Translate (outline, -cbox.xMin, -cbox.yMin);
+
+ if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
+ free (bitmap.buffer);
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto FAIL;
+ }
+
+ val->image = (cairo_image_surface_t *)
+ cairo_image_surface_create_for_data (bitmap.buffer,
+ CAIRO_FORMAT_A8,
+ width, height, stride);
+ if (val->image == NULL) {
+ free (bitmap.buffer);
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto FAIL;
+ }
+
+ _cairo_image_surface_assume_ownership_of_data (val->image);
+ }
+
+ /*
+ * Note: the font's coordinate system is upside down from ours, so the
+ * Y coordinate of the control box needs to be negated.
+ */
+
+ val->size.width = (unsigned short) width;
+ val->size.height = (unsigned short) height;
+ val->size.x = (short) (cbox.xMin >> 6);
+ val->size.y = - (short) (cbox.yMax >> 6);
+
+ FAIL:
+ _ft_unscaled_font_unlock_face (unscaled);
+
+ return status;
+}
+
+const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend = {
+ _cairo_ft_unscaled_font_destroy,
+ _cairo_ft_unscaled_font_create_glyph
+};
+
+/* cairo_ft_scaled_font_t */
typedef struct {
- cairo_font_t base;
- FcPattern *pattern;
+ cairo_scaled_font_t base;
int load_flags;
ft_unscaled_font_t *unscaled;
-} cairo_ft_font_t;
+} cairo_ft_scaled_font_t;
+
+const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend;
/* for compatibility with older freetype versions */
#ifndef FT_LOAD_TARGET_MONO
@@ -547,51 +711,43 @@ _get_load_flags (FcPattern *pattern)
return load_flags;
}
-/* Like the public cairo_ft_font_create, but takes a cairo_font_scale_t,
- * rather than a cairo_font_t
- */
-static cairo_font_t *
-_ft_font_create (FcPattern *pattern,
- cairo_font_scale_t *scale)
+static cairo_scaled_font_t *
+_ft_scaled_font_create (ft_unscaled_font_t *unscaled,
+ int load_flags,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm)
{
- cairo_ft_font_t *f = NULL;
- ft_unscaled_font_t *unscaled = NULL;
+ cairo_ft_scaled_font_t *f = NULL;
- unscaled = _ft_unscaled_font_get_for_pattern (pattern);
- if (unscaled == NULL)
- return NULL;
-
- f = malloc (sizeof(cairo_ft_font_t));
+ f = malloc (sizeof(cairo_ft_scaled_font_t));
if (f == NULL)
- goto FREE_UNSCALED;
+ return NULL;
f->unscaled = unscaled;
- f->pattern = pattern;
- FcPatternReference (pattern);
- f->load_flags = _get_load_flags (pattern);
-
- _cairo_font_init ((cairo_font_t *)f, scale, &cairo_ft_font_backend);
-
- return (cairo_font_t *)f;
+ _cairo_unscaled_font_reference (&unscaled->base);
+
+ f->load_flags = load_flags;
- FREE_UNSCALED:
- _cairo_unscaled_font_destroy ((cairo_unscaled_font_t *)unscaled);
+ _cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_ft_scaled_font_backend);
- return NULL;
+ return (cairo_scaled_font_t *)f;
}
static cairo_status_t
-_cairo_ft_font_create (const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight,
- cairo_font_scale_t *scale,
- cairo_font_t **font)
+_cairo_ft_scaled_font_create (const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **font)
{
FcPattern *pattern, *resolved;
- cairo_font_t *new_font;
+ ft_unscaled_font_t *unscaled;
+ cairo_scaled_font_t *new_font;
FcResult result;
int fcslant;
int fcweight;
+ cairo_matrix_t scale;
ft_font_transform_t sf;
pattern = FcPatternCreate ();
@@ -623,14 +779,15 @@ _cairo_ft_font_create (const char *family,
break;
}
- if (!FcPatternAddString (pattern, FC_FAMILY, family))
+ if (!FcPatternAddString (pattern, FC_FAMILY, (unsigned char *) family))
goto FREE_PATTERN;
if (!FcPatternAddInteger (pattern, FC_SLANT, fcslant))
goto FREE_PATTERN;
if (!FcPatternAddInteger (pattern, FC_WEIGHT, fcweight))
goto FREE_PATTERN;
- _compute_transform (&sf, scale);
+ cairo_matrix_multiply (&scale, font_matrix, ctm);
+ _compute_transform (&sf, &scale);
FcPatternAddInteger (pattern, FC_PIXEL_SIZE, sf.y_scale);
@@ -641,7 +798,13 @@ _cairo_ft_font_create (const char *family,
if (!resolved)
goto FREE_PATTERN;
- new_font = _ft_font_create (resolved, scale);
+ unscaled = _ft_unscaled_font_get_for_pattern (resolved);
+ if (!unscaled)
+ goto FREE_RESOLVED;
+
+ new_font = _ft_scaled_font_create (unscaled, _get_load_flags (pattern),
+ font_matrix, ctm);
+ _cairo_unscaled_font_destroy (&unscaled->base);
FcPatternDestroy (resolved);
FcPatternDestroy (pattern);
@@ -653,6 +816,9 @@ _cairo_ft_font_create (const char *family,
return CAIRO_STATUS_NO_MEMORY; /* A guess */
}
+ FREE_RESOLVED:
+ FcPatternDestroy (resolved);
+
FREE_PATTERN:
FcPatternDestroy (pattern);
@@ -660,88 +826,50 @@ _cairo_ft_font_create (const char *family,
}
static void
-_cairo_ft_font_destroy_font (void *abstract_font)
+_cairo_ft_scaled_font_destroy (void *abstract_font)
{
- cairo_ft_font_t * font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
- if (font == NULL)
- return;
-
- if (font->pattern != NULL)
- FcPatternDestroy (font->pattern);
-
- _cairo_unscaled_font_destroy ((cairo_unscaled_font_t *)font->unscaled);
-
- free (font);
-}
-
-static void
-_cairo_ft_font_destroy_unscaled_font (void *abstract_font)
-{
- ft_unscaled_font_t *unscaled = abstract_font;
-
- if (!unscaled->from_face) {
- cairo_cache_t *cache;
- cairo_ft_cache_key_t key;
-
- _lock_global_ft_cache ();
- cache = _get_global_ft_cache ();
- assert (cache);
-
- key.filename = unscaled->filename;
- key.id = unscaled->id;
-
- _cairo_cache_remove (cache, &key);
-
- _unlock_global_ft_cache ();
- }
-
- if (unscaled == NULL)
+ if (scaled_font == NULL)
return;
-
- if (!unscaled->from_face && unscaled->face)
- FT_Done_Face (unscaled->face);
-
- if (unscaled->filename)
- free (unscaled->filename);
- free (unscaled);
+ _cairo_unscaled_font_destroy (&scaled_font->unscaled->base);
}
static void
-_cairo_ft_font_get_glyph_cache_key (void *abstract_font,
- cairo_glyph_cache_key_t *key)
+_cairo_ft_scaled_font_get_glyph_cache_key (void *abstract_font,
+ cairo_glyph_cache_key_t *key)
{
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
- key->unscaled = (cairo_unscaled_font_t *)font->unscaled;
- key->scale = font->base.scale;
- key->flags = font->load_flags;
+ key->unscaled = &scaled_font->unscaled->base;
+ key->scale = scaled_font->base.scale;
+ key->flags = scaled_font->load_flags;
}
static cairo_status_t
-_cairo_ft_font_text_to_glyphs (void *abstract_font,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *nglyphs)
+_cairo_ft_scaled_font_text_to_glyphs (void *abstract_font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs)
{
double x = 0., y = 0.;
size_t i;
uint32_t *ucs4 = NULL;
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
FT_Face face;
cairo_glyph_cache_key_t key;
cairo_image_glyph_cache_entry_t *val;
cairo_cache_t *cache = NULL;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
- _cairo_ft_font_get_glyph_cache_key (font, &key);
+ _cairo_ft_scaled_font_get_glyph_cache_key (scaled_font, &key);
- status = _cairo_utf8_to_ucs4 (utf8, -1, &ucs4, nglyphs);
- if (!CAIRO_OK (status))
+ status = _cairo_utf8_to_ucs4 ((unsigned char*)utf8, -1, &ucs4, num_glyphs);
+ if (status)
return status;
- face = cairo_ft_font_lock_face ((cairo_font_t *)font);
+ face = cairo_ft_scaled_font_lock_face (&scaled_font->base);
if (!face) {
status = CAIRO_STATUS_NO_MEMORY;
goto FAIL1;
@@ -754,13 +882,13 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font,
goto FAIL2;
}
- *glyphs = (cairo_glyph_t *) malloc ((*nglyphs) * (sizeof (cairo_glyph_t)));
+ *glyphs = (cairo_glyph_t *) malloc ((*num_glyphs) * (sizeof (cairo_glyph_t)));
if (*glyphs == NULL) {
status = CAIRO_STATUS_NO_MEMORY;
goto FAIL2;
}
- for (i = 0; i < *nglyphs; i++)
+ for (i = 0; i < *num_glyphs; i++)
{
(*glyphs)[i].index = FT_Get_Char_Index (face, ucs4[i]);
(*glyphs)[i].x = x;
@@ -781,7 +909,7 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font,
if (cache)
_cairo_unlock_global_image_glyph_cache ();
- cairo_ft_font_unlock_face ((cairo_font_t *)font);
+ cairo_ft_scaled_font_unlock_face (&scaled_font->base);
FAIL1:
free (ucs4);
@@ -791,49 +919,50 @@ _cairo_ft_font_text_to_glyphs (void *abstract_font,
static cairo_status_t
-_cairo_ft_font_font_extents (void *abstract_font,
- cairo_font_extents_t *extents)
+_cairo_ft_scaled_font_font_extents (void *abstract_font,
+ cairo_font_extents_t *extents)
{
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
FT_Face face;
FT_Size_Metrics *metrics;
- face = _ft_unscaled_font_lock_face (font->unscaled);
+ face = _ft_unscaled_font_lock_face (scaled_font->unscaled);
if (!face)
return CAIRO_STATUS_NO_MEMORY;
metrics = &face->size->metrics;
- _ft_unscaled_font_set_scale (font->unscaled, &font->base.scale);
+ _ft_unscaled_font_set_scale (scaled_font->unscaled, &scaled_font->base.scale);
/*
* Get to unscaled metrics so that the upper level can get back to
* user space
*/
- extents->ascent = DOUBLE_FROM_26_6(metrics->ascender) / font->unscaled->y_scale;
- extents->descent = DOUBLE_FROM_26_6(metrics->descender) / font->unscaled->y_scale;
- extents->height = DOUBLE_FROM_26_6(metrics->height) / font->unscaled->y_scale;
- extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) / font->unscaled->x_scale;
+ extents->ascent = DOUBLE_FROM_26_6(metrics->ascender) / scaled_font->unscaled->y_scale;
+ extents->descent = DOUBLE_FROM_26_6(- metrics->descender) / scaled_font->unscaled->y_scale;
+ extents->height = DOUBLE_FROM_26_6(metrics->height) / scaled_font->unscaled->y_scale;
+ extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) / scaled_font->unscaled->x_scale;
/* FIXME: this doesn't do vertical layout atm. */
extents->max_y_advance = 0.0;
- _ft_unscaled_font_unlock_face (font->unscaled);
+ _ft_unscaled_font_unlock_face (scaled_font->unscaled);
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
-_cairo_ft_font_glyph_extents (void *abstract_font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents)
+_cairo_ft_scaled_font_glyph_extents (void *abstract_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents)
{
int i;
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
cairo_point_double_t origin;
cairo_point_double_t glyph_min, glyph_max;
- cairo_point_double_t total_min, total_max;
+ /* Initialize just to squelch anti-helpful compiler warning. */
+ cairo_point_double_t total_min = { 0, 0}, total_max = {0,0};
cairo_image_glyph_cache_entry_t *img = NULL;
cairo_cache_t *cache;
@@ -861,7 +990,7 @@ _cairo_ft_font_glyph_extents (void *abstract_font,
return CAIRO_STATUS_NO_MEMORY;
}
- _cairo_ft_font_get_glyph_cache_key (font, &key);
+ _cairo_ft_scaled_font_get_glyph_cache_key (scaled_font, &key);
for (i = 0; i < num_glyphs; i++)
{
@@ -874,7 +1003,7 @@ _cairo_ft_font_glyph_extents (void *abstract_font,
/* XXX: Need to add code here to check the font's FcPattern
for FC_VERTICAL_LAYOUT and if set get vertBearingX/Y
instead. This will require that
- cairo_ft_font_create_for_ft_face accept an
+ cairo_ft_scaled_font_create_for_ft_face accept an
FcPattern. */
glyph_min.x = glyphs[i].x + img->extents.x_bearing;
glyph_min.y = glyphs[i].y + img->extents.y_bearing;
@@ -910,15 +1039,15 @@ _cairo_ft_font_glyph_extents (void *abstract_font,
static cairo_status_t
-_cairo_ft_font_glyph_bbox (void *abstract_font,
- const cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_box_t *bbox)
+_cairo_ft_scaled_font_glyph_bbox (void *abstract_font,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_box_t *bbox)
{
cairo_image_glyph_cache_entry_t *img;
cairo_cache_t *cache;
cairo_glyph_cache_key_t key;
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
cairo_fixed_t x1, y1, x2, y2;
int i;
@@ -930,13 +1059,13 @@ _cairo_ft_font_glyph_bbox (void *abstract_font,
cache = _cairo_get_global_image_glyph_cache();
if (cache == NULL
- || font == NULL
+ || scaled_font == NULL
|| glyphs == NULL) {
_cairo_unlock_global_image_glyph_cache ();
return CAIRO_STATUS_NO_MEMORY;
}
- _cairo_ft_font_get_glyph_cache_key (font, &key);
+ _cairo_ft_scaled_font_get_glyph_cache_key (scaled_font, &key);
for (i = 0; i < num_glyphs; i++)
{
@@ -972,23 +1101,23 @@ _cairo_ft_font_glyph_bbox (void *abstract_font,
static cairo_status_t
-_cairo_ft_font_show_glyphs (void *abstract_font,
- cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height,
- const cairo_glyph_t *glyphs,
- int num_glyphs)
+_cairo_ft_scaled_font_show_glyphs (void *abstract_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs)
{
cairo_image_glyph_cache_entry_t *img;
cairo_cache_t *cache;
cairo_glyph_cache_key_t key;
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
cairo_surface_pattern_t glyph_pattern;
cairo_status_t status;
int x, y;
@@ -998,7 +1127,7 @@ _cairo_ft_font_show_glyphs (void *abstract_font,
cache = _cairo_get_global_image_glyph_cache();
if (cache == NULL
- || font == NULL
+ || scaled_font == NULL
|| pattern == NULL
|| surface == NULL
|| glyphs == NULL) {
@@ -1006,9 +1135,9 @@ _cairo_ft_font_show_glyphs (void *abstract_font,
return CAIRO_STATUS_NO_MEMORY;
}
- key.unscaled = (cairo_unscaled_font_t *)font->unscaled;
- key.scale = font->base.scale;
- key.flags = font->load_flags;
+ key.unscaled = &scaled_font->unscaled->base;
+ key.scale = scaled_font->base.scale;
+ key.flags = scaled_font->load_flags;
for (i = 0; i < num_glyphs; i++)
{
@@ -1054,14 +1183,14 @@ _cairo_ft_font_show_glyphs (void *abstract_font,
static int
_move_to (FT_Vector *to, void *closure)
{
- cairo_path_t *path = closure;
- cairo_point_t point;
+ cairo_path_fixed_t *path = closure;
+ cairo_fixed_t x, y;
- point.x = _cairo_fixed_from_26_6 (to->x);
- point.y = _cairo_fixed_from_26_6 (to->y);
+ x = _cairo_fixed_from_26_6 (to->x);
+ y = _cairo_fixed_from_26_6 (to->y);
- _cairo_path_close_path (path);
- _cairo_path_move_to (path, &point);
+ _cairo_path_fixed_close_path (path);
+ _cairo_path_fixed_move_to (path, x, y);
return 0;
}
@@ -1069,13 +1198,13 @@ _move_to (FT_Vector *to, void *closure)
static int
_line_to (FT_Vector *to, void *closure)
{
- cairo_path_t *path = closure;
- cairo_point_t point;
+ cairo_path_fixed_t *path = closure;
+ cairo_fixed_t x, y;
- point.x = _cairo_fixed_from_26_6 (to->x);
- point.y = _cairo_fixed_from_26_6 (to->y);
+ x = _cairo_fixed_from_26_6 (to->x);
+ y = _cairo_fixed_from_26_6 (to->y);
- _cairo_path_line_to (path, &point);
+ _cairo_path_fixed_line_to (path, x, y);
return 0;
}
@@ -1083,27 +1212,32 @@ _line_to (FT_Vector *to, void *closure)
static int
_conic_to (FT_Vector *control, FT_Vector *to, void *closure)
{
- cairo_path_t *path = closure;
+ cairo_path_fixed_t *path = closure;
- cairo_point_t p0, p1, p2, p3;
+ cairo_fixed_t x0, y0;
+ cairo_fixed_t x1, y1;
+ cairo_fixed_t x2, y2;
+ cairo_fixed_t x3, y3;
cairo_point_t conic;
- _cairo_path_current_point (path, &p0);
+ _cairo_path_fixed_get_current_point (path, &x0, &y0);
conic.x = _cairo_fixed_from_26_6 (control->x);
conic.y = _cairo_fixed_from_26_6 (control->y);
- p3.x = _cairo_fixed_from_26_6 (to->x);
- p3.y = _cairo_fixed_from_26_6 (to->y);
+ x3 = _cairo_fixed_from_26_6 (to->x);
+ y3 = _cairo_fixed_from_26_6 (to->y);
- p1.x = p0.x + 2.0/3.0 * (conic.x - p0.x);
- p1.y = p0.y + 2.0/3.0 * (conic.y - p0.y);
+ x1 = x0 + 2.0/3.0 * (conic.x - x0);
+ y1 = y0 + 2.0/3.0 * (conic.y - y0);
- p2.x = p3.x + 2.0/3.0 * (conic.x - p3.x);
- p2.y = p3.y + 2.0/3.0 * (conic.y - p3.y);
+ x2 = x3 + 2.0/3.0 * (conic.x - x3);
+ y2 = y3 + 2.0/3.0 * (conic.y - y3);
- _cairo_path_curve_to (path,
- &p1, &p2, &p3);
+ _cairo_path_fixed_curve_to (path,
+ x1, y1,
+ x2, y2,
+ x3, y3);
return 0;
}
@@ -1111,31 +1245,36 @@ _conic_to (FT_Vector *control, FT_Vector *to, void *closure)
static int
_cubic_to (FT_Vector *control1, FT_Vector *control2, FT_Vector *to, void *closure)
{
- cairo_path_t *path = closure;
- cairo_point_t p0, p1, p2;
+ cairo_path_fixed_t *path = closure;
+ cairo_fixed_t x0, y0;
+ cairo_fixed_t x1, y1;
+ cairo_fixed_t x2, y2;
- p0.x = _cairo_fixed_from_26_6 (control1->x);
- p0.y = _cairo_fixed_from_26_6 (control1->y);
+ x0 = _cairo_fixed_from_26_6 (control1->x);
+ y0 = _cairo_fixed_from_26_6 (control1->y);
- p1.x = _cairo_fixed_from_26_6 (control2->x);
- p1.y = _cairo_fixed_from_26_6 (control2->y);
+ x1 = _cairo_fixed_from_26_6 (control2->x);
+ y1 = _cairo_fixed_from_26_6 (control2->y);
- p2.x = _cairo_fixed_from_26_6 (to->x);
- p2.y = _cairo_fixed_from_26_6 (to->y);
+ x2 = _cairo_fixed_from_26_6 (to->x);
+ y2 = _cairo_fixed_from_26_6 (to->y);
- _cairo_path_curve_to (path, &p0, &p1, &p2);
+ _cairo_path_fixed_curve_to (path,
+ x0, y0,
+ x1, y1,
+ x2, y2);
return 0;
}
static cairo_status_t
-_cairo_ft_font_glyph_path (void *abstract_font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_t *path)
+_cairo_ft_scaled_font_glyph_path (void *abstract_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path)
{
int i;
- cairo_ft_font_t *font = abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
FT_GlyphSlot glyph;
FT_Face face;
FT_Error error;
@@ -1148,7 +1287,7 @@ _cairo_ft_font_glyph_path (void *abstract_font,
0, /* delta */
};
- face = cairo_ft_font_lock_face (abstract_font);
+ face = cairo_ft_scaled_font_lock_face (abstract_font);
if (!face)
return CAIRO_STATUS_NO_MEMORY;
@@ -1161,7 +1300,7 @@ _cairo_ft_font_glyph_path (void *abstract_font,
0, DOUBLE_TO_16_16 (-1.0),
};
- error = FT_Load_Glyph (font->unscaled->face, glyphs[i].index, font->load_flags | FT_LOAD_NO_BITMAP);
+ error = FT_Load_Glyph (scaled_font->unscaled->face, glyphs[i].index, scaled_font->load_flags | FT_LOAD_NO_BITMAP);
/* XXX: What to do in this error case? */
if (error)
continue;
@@ -1176,148 +1315,139 @@ _cairo_ft_font_glyph_path (void *abstract_font,
DOUBLE_TO_26_6(glyphs[i].y));
FT_Outline_Decompose (&glyph->outline, &outline_funcs, path);
}
- _cairo_path_close_path (path);
+ _cairo_path_fixed_close_path (path);
- cairo_ft_font_unlock_face (abstract_font);
+ cairo_ft_scaled_font_unlock_face (abstract_font);
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
-_cairo_ft_font_create_glyph (cairo_image_glyph_cache_entry_t *val)
-{
- ft_unscaled_font_t *unscaled = (ft_unscaled_font_t *)val->key.unscaled;
- FT_GlyphSlot glyphslot;
- unsigned int width, height, stride;
- FT_Face face;
- FT_Outline *outline;
- FT_BBox cbox;
- FT_Bitmap bitmap;
- FT_Glyph_Metrics *metrics;
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
-
- glyphslot = unscaled->face->glyph;
- metrics = &glyphslot->metrics;
+const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend = {
+ _cairo_ft_scaled_font_create,
+ _cairo_ft_scaled_font_destroy,
+ _cairo_ft_scaled_font_font_extents,
+ _cairo_ft_scaled_font_text_to_glyphs,
+ _cairo_ft_scaled_font_glyph_extents,
+ _cairo_ft_scaled_font_glyph_bbox,
+ _cairo_ft_scaled_font_show_glyphs,
+ _cairo_ft_scaled_font_glyph_path,
+ _cairo_ft_scaled_font_get_glyph_cache_key,
+};
- face = _ft_unscaled_font_lock_face (unscaled);
- if (!face)
- return CAIRO_STATUS_NO_MEMORY;
+/* ft_font_face_t */
- _ft_unscaled_font_set_scale (unscaled, &val->key.scale);
+static void
+_ft_font_face_destroy (void *abstract_face)
+{
+ ft_font_face_t *font_face = abstract_face;
+
+ ft_font_face_t *tmp_face = NULL;
+ ft_font_face_t *last_face = NULL;
- if (FT_Load_Glyph (face, val->key.index, val->key.flags) != 0) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto FAIL;
- }
+ if (font_face == NULL)
+ return;
- /*
- * Note: the font's coordinate system is upside down from ours, so the
- * Y coordinates of the bearing and advance need to be negated.
+ /* When destroying the face created by cairo_ft_font_face_create_for_ft_face,
+ * we have a special "zombie" state for the face when the unscaled font
+ * is still alive but there are no public references to the font face.
*
- * Scale metrics back to glyph space from the scaled glyph space returned
- * by FreeType
+ * We go from:
+ *
+ * font_face ------> unscaled
+ * <-....weak....../
+ *
+ * To:
+ *
+ * font_face <------- unscaled
*/
- val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / unscaled->x_scale;
- val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / unscaled->y_scale;
+ if (font_face->unscaled &&
+ font_face->unscaled->from_face &&
+ font_face->unscaled->base.refcount > 1) {
+ cairo_font_face_reference (&font_face->base);
+
+ _cairo_unscaled_font_destroy (&font_face->unscaled->base);
+ font_face->unscaled = NULL;
+
+ return;
+ }
+
+ if (font_face->unscaled) {
+ /* Remove face from linked list */
+ for (tmp_face = font_face->unscaled->faces; tmp_face; tmp_face = tmp_face->next_face) {
+ if (tmp_face == font_face) {
+ if (last_face)
+ last_face->next_face = tmp_face->next_face;
+ else
+ font_face->unscaled->faces = tmp_face->next_face;
+ }
+
+ last_face = tmp_face;
+ }
- val->extents.width = DOUBLE_FROM_26_6 (metrics->width) / unscaled->x_scale;
- val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / unscaled->y_scale;
+ _cairo_unscaled_font_destroy (&font_face->unscaled->base);
+ font_face->unscaled = NULL;
+ }
+}
- /*
- * use untransformed advance values
- * XXX uses horizontal advance only at present;
- should provide FT_LOAD_VERTICAL_LAYOUT
- */
+static cairo_status_t
+_ft_font_face_create_font (void *abstract_face,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **scaled_font)
+{
+ ft_font_face_t *font_face = abstract_face;
- val->extents.x_advance = DOUBLE_FROM_26_6 (face->glyph->metrics.horiAdvance) / unscaled->x_scale;
- val->extents.y_advance = 0 / unscaled->y_scale;
-
- outline = &glyphslot->outline;
+ *scaled_font = _ft_scaled_font_create (font_face->unscaled,
+ font_face->load_flags,
+ font_matrix, ctm);
+ if (*scaled_font)
+ return CAIRO_STATUS_SUCCESS;
+ else
+ return CAIRO_STATUS_NO_MEMORY;
+}
- FT_Outline_Get_CBox (outline, &cbox);
+static const cairo_font_face_backend_t _ft_font_face_backend = {
+ _ft_font_face_destroy,
+ _ft_font_face_create_font,
+};
- cbox.xMin &= -64;
- cbox.yMin &= -64;
- cbox.xMax = (cbox.xMax + 63) & -64;
- cbox.yMax = (cbox.yMax + 63) & -64;
-
- width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
- height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
- stride = (width + 3) & -4;
-
- if (width * height == 0)
- val->image = NULL;
- else
- {
+static cairo_font_face_t *
+_ft_font_face_create (ft_unscaled_font_t *unscaled,
+ int load_flags)
+{
+ ft_font_face_t *font_face;
- bitmap.pixel_mode = ft_pixel_mode_grays;
- bitmap.num_grays = 256;
- bitmap.width = width;
- bitmap.rows = height;
- bitmap.pitch = stride;
- bitmap.buffer = calloc (1, stride * height);
-
- if (bitmap.buffer == NULL) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto FAIL;
+ /* Looked for an existing matching font face */
+ for (font_face = unscaled->faces; font_face; font_face = font_face->next_face) {
+ if (font_face->load_flags == load_flags) {
+ cairo_font_face_reference (&font_face->base);
+ return &font_face->base;
}
-
- FT_Outline_Translate (outline, -cbox.xMin, -cbox.yMin);
-
- if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
- free (bitmap.buffer);
- status = CAIRO_STATUS_NO_MEMORY;
- goto FAIL;
- }
-
- val->image = (cairo_image_surface_t *)
- cairo_image_surface_create_for_data ((char *) bitmap.buffer,
- CAIRO_FORMAT_A8,
- width, height, stride);
- if (val->image == NULL) {
- free (bitmap.buffer);
- status = CAIRO_STATUS_NO_MEMORY;
- goto FAIL;
- }
-
- _cairo_image_surface_assume_ownership_of_data (val->image);
}
- /*
- * Note: the font's coordinate system is upside down from ours, so the
- * Y coordinate of the control box needs to be negated.
- */
-
- val->size.width = (unsigned short) width;
- val->size.height = (unsigned short) height;
- val->size.x = (short) (cbox.xMin >> 6);
- val->size.y = - (short) (cbox.yMax >> 6);
+ /* No match found, create a new one */
+ font_face = malloc (sizeof (ft_font_face_t));
+ if (!font_face)
+ return NULL;
- FAIL:
- _ft_unscaled_font_unlock_face (unscaled);
+ font_face->unscaled = unscaled;
+ _cairo_unscaled_font_reference (&unscaled->base);
- return status;
-}
+ font_face->load_flags = load_flags;
-const cairo_font_backend_t cairo_ft_font_backend = {
- _cairo_ft_font_create,
- _cairo_ft_font_destroy_font,
- _cairo_ft_font_destroy_unscaled_font,
- _cairo_ft_font_font_extents,
- _cairo_ft_font_text_to_glyphs,
- _cairo_ft_font_glyph_extents,
- _cairo_ft_font_glyph_bbox,
- _cairo_ft_font_show_glyphs,
- _cairo_ft_font_glyph_path,
- _cairo_ft_font_get_glyph_cache_key,
- _cairo_ft_font_create_glyph
-};
+ font_face->next_face = unscaled->faces;
+ unscaled->faces = font_face;
+
+ _cairo_font_face_init (&font_face->base, &_ft_font_face_backend);
+
+ return &font_face->base;
+}
/* implement the platform-specific interface */
/**
- * cairo_ft_font_create:
+ * cairo_ft_font_face_create_for_pattern:
* @pattern: A fully resolved fontconfig
* pattern. A pattern can be resolved, by, among other things, calling
* FcConfigSubstitute(), FcDefaultSubstitute(), then
@@ -1325,112 +1455,83 @@ const cairo_font_backend_t cairo_ft_font_backend = {
* pattern, so you should not further modify the pattern, but you can
* release your reference to the pattern with FcPatternDestroy() if
* you no longer need to access it.
- * @scale: The scale at which this font will be used. The
- * scale is given by multiplying the font matrix (see
- * cairo_transform_font()) by the current transformation matrix.
- * The translation elements of the resulting matrix are ignored.
*
- * Creates a new font for the FreeType font backend based on a
+ * Creates a new font face for the FreeType font backend based on a
* fontconfig pattern. This font can then be used with
- * cairo_set_font(), cairo_font_glyph_extents(), or FreeType backend
- * specific functions like cairo_ft_font_lock_face().
+ * cairo_set_font_face() or cairo_font_create(). The #cairo_scaled_font_t
+ * returned from cairo_font_create() is also for the FreeType backend
+ * and can be used with functions such as cairo_ft_font_lock_face().
*
- * Return value: a newly created #cairo_font_t. Free with
- * cairo_font_destroy() when you are done using it.
+ * Return value: a newly created #cairo_font_face_t. Free with
+ * cairo_font_face_destroy() when you are done using it.
**/
-cairo_font_t *
-cairo_ft_font_create (FcPattern *pattern,
- cairo_matrix_t *scale)
-{
- cairo_font_scale_t sc;
- double tx, ty;
+cairo_font_face_t *
+cairo_ft_font_face_create_for_pattern (FcPattern *pattern)
+{
+ ft_unscaled_font_t *unscaled;
+ cairo_font_face_t *font_face;
- cairo_matrix_get_affine (scale,
- &sc.matrix[0][0], &sc.matrix[0][1],
- &sc.matrix[1][0], &sc.matrix[1][1],
- &tx, &ty);
+ unscaled = _ft_unscaled_font_get_for_pattern (pattern);
+ if (unscaled == NULL)
+ return NULL;
- return _ft_font_create (pattern, &sc);
+ font_face = _ft_font_face_create (unscaled, _get_load_flags (pattern));
+ _cairo_unscaled_font_destroy (&unscaled->base);
+
+ return font_face;
}
/**
- * cairo_ft_font_create_for_ft_face:
+ * cairo_ft_font_face_create_for_ft_face:
* @face: A FreeType face object, already opened. This must
- * be kept around until the font object's refcount drops to
- * zero and it is freed. The font object can be kept alive by
- * internal caching, so it's safest to keep the face object
- * around forever.
+ * be kept around until the face's refcount drops to
+ * zero and it is freed. Since the face may be referenced
+ * internally to Cairo, the best way to determine when it
+ * is safe to free the face is to pass a
+ * #cairo_destroy_func_t to cairo_font_face_set_user_data()
* @load_flags: The flags to pass to FT_Load_Glyph when loading
* glyphs from the font. These flags control aspects of
* rendering such as hinting and antialiasing. See the FreeType
* docs for full information.
- * @scale: The scale at which this font will be used. The
- * scale is given by multiplying the font matrix (see
- * cairo_transform_font()) by the current transformation matrix.
- * The translation elements of the resulting matrix are ignored.
*
- * Creates a new font forthe FreeType font backend from a pre-opened
- * FreeType face. This font can then be used with cairo_set_font(),
- * cairo_font_glyph_extents(), or FreeType backend specific
- * functions like cairo_ft_font_lock_face() Cairo will determine the
- * pixel size and transformation from the @scale parameter and call
- * FT_Set_Transform() and FT_Set_Pixel_Sizes().
+ * Creates a new font face for the FreeType font backend from a pre-opened
+ * FreeType face. This font can then be used with
+ * cairo_set_font_face() or cairo_font_create(). The #cairo_scaled_font_t
+ * returned from cairo_font_create() is also for the FreeType backend
+ * and can be used with functions such as cairo_ft_font_lock_face().
*
- * Return value: a newly created #cairo_font_t. Free with
- * cairo_font_destroy() when you are done using it.
+ * Return value: a newly created #cairo_font_face_t. Free with
+ * cairo_font_face_destroy() when you are done using it.
**/
-cairo_font_t *
-cairo_ft_font_create_for_ft_face (FT_Face face,
- int load_flags,
- cairo_matrix_t *scale)
+cairo_font_face_t *
+cairo_ft_font_face_create_for_ft_face (FT_Face face,
+ int load_flags)
{
- cairo_ft_font_t *f = NULL;
- ft_unscaled_font_t *unscaled = NULL;
- cairo_font_scale_t sc;
- double tx, ty;
+ ft_unscaled_font_t *unscaled;
+ cairo_font_face_t *font_face;
unscaled = _ft_unscaled_font_create_from_face (face);
if (unscaled == NULL)
return NULL;
- f = malloc (sizeof(cairo_ft_font_t));
- if (f == NULL)
- goto FREE_UNSCALED;
-
- f->unscaled = unscaled;
- f->pattern = NULL;
- f->load_flags = load_flags;
-
- cairo_matrix_get_affine (scale,
- &sc.matrix[0][0], &sc.matrix[0][1],
- &sc.matrix[1][0], &sc.matrix[1][1],
- &tx, &ty);
-
- _cairo_font_init ((cairo_font_t *)f, &sc, &cairo_ft_font_backend);
-
- return (cairo_font_t *)f;
-
- FREE_UNSCALED:
- _cairo_unscaled_font_destroy ((cairo_unscaled_font_t *)unscaled);
+ font_face = _ft_font_face_create (unscaled, load_flags);
+ _cairo_unscaled_font_destroy (&unscaled->base);
- return NULL;
+ return font_face;
}
-
/**
- * cairo_ft_font_lock_face:
- * @ft_font: A #cairo_font_t from the FreeType font backend. Such an
- * object can be created with cairo_ft_font_create() or
- * cairo_ft_font_create_for_ft_face(). On some platforms the font from
- * cairo_current_font() will also be a FreeType font, but using this
- * functionality with fonts you don't create yourself is not
- * recommended.
+ * cairo_ft_scaled_font_lock_face:
+ * @scaled_font: A #cairo_scaled_font_t from the FreeType font backend. Such an
+ * object can be created by calling cairo_scaled_font_create() on a
+ * FreeType backend font face (see cairo_ft_font_face_create_for_pattern(),
+ * cairo_ft_font_face_create_for_face()).
*
* cairo_ft_font_lock_face() gets the #FT_Face object from a FreeType
* backend font and scales it appropriately for the font. You must
* release the face with cairo_ft_font_unlock_face()
* when you are done using it. Since the #FT_Face object can be
- * shared between multiple #cairo_font_t objects, you must not
+ * shared between multiple #cairo_scaled_font_t objects, you must not
* lock any other font objects until you unlock this one. A count is
* kept of the number of times cairo_ft_font_lock_face() is
* called. cairo_ft_font_unlock_face() must be called the same number
@@ -1447,67 +1548,36 @@ cairo_ft_font_create_for_ft_face (FT_Face face,
* Return value: The #FT_Face object for @font, scaled appropriately.
**/
FT_Face
-cairo_ft_font_lock_face (cairo_font_t *abstract_font)
+cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *abstract_font)
{
- cairo_ft_font_t *font = (cairo_ft_font_t *) abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = (cairo_ft_scaled_font_t *) abstract_font;
FT_Face face;
- face = _ft_unscaled_font_lock_face (font->unscaled);
+ face = _ft_unscaled_font_lock_face (scaled_font->unscaled);
if (!face)
return NULL;
- _ft_unscaled_font_set_scale (font->unscaled, &font->base.scale);
+ _ft_unscaled_font_set_scale (scaled_font->unscaled, &scaled_font->base.scale);
return face;
}
/**
- * cairo_ft_font_unlock_face:
- * @ft_font: A #cairo_font_t from the FreeType font backend. Such an
- * object can be created with cairo_ft_font_create() or
- * cairo_ft_font_create_for_ft_face(). On some platforms the font from
- * cairo_current_font() will also be a FreeType font, but using this
- * functionality with fonts you don't create yourself is not
- * recommended.
+ * cairo_ft_scaled_font_unlock_face:
+ * @scaled_font: A #cairo_scaled_font_t from the FreeType font backend. Such an
+ * object can be created by calling cairo_scaled_font_create() on a
+ * FreeType backend font face (see cairo_ft_font_face_create_for_pattern(),
+ * cairo_ft_font_face_create_for_face()).
*
* Releases a face obtained with cairo_ft_font_lock_face(). See the
* documentation for that function for full details.
**/
void
-cairo_ft_font_unlock_face (cairo_font_t *abstract_font)
-{
- cairo_ft_font_t *font = (cairo_ft_font_t *) abstract_font;
-
- _ft_unscaled_font_unlock_face (font->unscaled);
-}
-
-/**
- * cairo_ft_font_get_pattern:
- * @ft_font: A #cairo_font_t from the FreeType font backend. Such an
- * object can be created with cairo_ft_font_create() or
- * cairo_ft_font_create_for_ft_face(). On some platforms the font from
- * cairo_current_font() will also be a FreeType font, but using this
- * functionality with fonts you don't create yourself is not
- * recommended.
- *
- * cairo_ft_font_get_pattern() gets the #FcPattern for a FreeType
- * backend font.
-
- * Return value: The #FcPattenr for @font. The return value is owned
- * by the font, so you must not modify it, and must call
- * FcPatternReference() to keep a persistant reference to the
- * pattern. If the font was created with cairo_ft_font_create_for_ft_face()
- * returns %NULL.
- **/
-FcPattern *
-cairo_ft_font_get_pattern (cairo_font_t *abstract_font)
+cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *abstract_font)
{
- cairo_ft_font_t *font = (cairo_ft_font_t *) abstract_font;
-
- if (font == NULL)
- return NULL;
+ cairo_ft_scaled_font_t *scaled_font = (cairo_ft_scaled_font_t *) abstract_font;
- return font->pattern;
+ _ft_unscaled_font_unlock_face (scaled_font->unscaled);
}
/* We expose our unscaled font implementation internally for the the
@@ -1515,11 +1585,11 @@ cairo_ft_font_get_pattern (cairo_font_t *abstract_font)
* fonts-on-disk used by a document, so it can embed them.
*/
cairo_unscaled_font_t *
-_cairo_ft_font_get_unscaled_font (cairo_font_t *abstract_font)
+_cairo_ft_scaled_font_get_unscaled_font (cairo_scaled_font_t *abstract_font)
{
- cairo_ft_font_t *font = (cairo_ft_font_t *) abstract_font;
+ cairo_ft_scaled_font_t *scaled_font = (cairo_ft_scaled_font_t *) abstract_font;
- return (cairo_unscaled_font_t *)font->unscaled;
+ return &scaled_font->unscaled->base;
}
/* This differs from _cairo_ft_scaled_font_lock_face in that it doesn't
diff --git a/src/cairo-ft-private.h b/src/cairo-ft-private.h
index 37a6fee..494d836 100644
--- a/src/cairo-ft-private.h
+++ b/src/cairo-ft-private.h
@@ -40,7 +40,7 @@
#include <cairo-ft.h>
#include <cairoint.h>
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
CAIRO_BEGIN_DECLS
@@ -48,7 +48,7 @@ CAIRO_BEGIN_DECLS
* the different fonts-on-disk used by a document, so it can embed them
*/
cairo_private cairo_unscaled_font_t *
-_cairo_ft_font_get_unscaled_font (cairo_font_t *font);
+_cairo_ft_scaled_font_get_unscaled_font (cairo_scaled_font_t *scaled_font);
cairo_private FT_Face
_cairo_ft_unscaled_font_lock_face (cairo_unscaled_font_t *unscaled_font);
diff --git a/src/cairo-ft.h b/src/cairo-ft.h
index f10c67d..4e8b8bc 100644
--- a/src/cairo-ft.h
+++ b/src/cairo-ft.h
@@ -39,7 +39,7 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
/* Fontconfig/Freetype platform-specific font interface */
@@ -49,25 +49,23 @@
CAIRO_BEGIN_DECLS
-cairo_font_t *
-cairo_ft_font_create (FcPattern *pattern,
- cairo_matrix_t *scale);
+cairo_font_face_t *
+cairo_ft_font_face_create_for_pattern (FcPattern *pattern);
-cairo_font_t *
-cairo_ft_font_create_for_ft_face (FT_Face face,
- int load_flags,
- cairo_matrix_t *scale);
+cairo_font_face_t *
+cairo_ft_font_face_create_for_ft_face (FT_Face face,
+ int load_flags);
FT_Face
-cairo_ft_font_lock_face (cairo_font_t *ft_font);
+cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *scaled_font);
void
-cairo_ft_font_unlock_face (cairo_font_t *ft_font);
-
-FcPattern *
-cairo_ft_font_get_pattern (cairo_font_t *ft_font);
+cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *scaled_font);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_FT_FONT */
+# error Cairo was not compiled with support for the freetype font backend
#endif /* CAIRO_HAS_FT_FONT */
+
#endif /* CAIRO_FT_H */
diff --git a/src/cairo_glitz_surface.c b/src/cairo-glitz-surface.c
index ee664e1..ce9da25 100644
--- a/src/cairo_glitz_surface.c
+++ b/src/cairo-glitz-surface.c
@@ -27,25 +27,6 @@
#include "cairoint.h"
#include "cairo-glitz.h"
-void
-cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface)
-{
- cairo_surface_t *crsurface;
-
- if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
- return;
-
- crsurface = cairo_glitz_surface_create (surface);
- if (crsurface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface (cr, crsurface);
-
- cairo_surface_destroy (crsurface);
-}
-
typedef struct _cairo_glitz_surface {
cairo_surface_t base;
@@ -54,8 +35,8 @@ typedef struct _cairo_glitz_surface {
pixman_region16_t *clip;
} cairo_glitz_surface_t;
-static void
-_cairo_glitz_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_glitz_surface_finish (void *abstract_surface)
{
cairo_glitz_surface_t *surface = abstract_surface;
@@ -66,7 +47,8 @@ _cairo_glitz_surface_destroy (void *abstract_surface)
}
glitz_surface_destroy (surface->surface);
- free (surface);
+
+ return CAIRO_STATUS_SUCCESS;
}
static glitz_format_name_t
@@ -88,7 +70,6 @@ _glitz_format (cairo_format_t format)
static cairo_surface_t *
_cairo_glitz_surface_create_similar (void *abstract_src,
cairo_format_t format,
- int draw,
int width,
int height)
{
@@ -115,12 +96,6 @@ _cairo_glitz_surface_create_similar (void *abstract_src,
return crsurface;
}
-static double
-_cairo_glitz_surface_pixels_per_inch (void *abstract_surface)
-{
- return 96.0;
-}
-
static cairo_status_t
_cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface,
cairo_rectangle_t *interest,
@@ -130,7 +105,7 @@ _cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface,
cairo_image_surface_t *image;
int x1, y1, x2, y2;
int width, height;
- char *pixels;
+ unsigned char *pixels;
cairo_format_masks_t format;
glitz_buffer_t *buffer;
glitz_pixel_format_t pf;
@@ -239,9 +214,6 @@ _cairo_glitz_surface_get_image (cairo_glitz_surface_t *surface,
_cairo_image_surface_assume_ownership_of_data (image);
- _cairo_image_surface_set_repeat (image, surface->base.repeat);
- _cairo_image_surface_set_matrix (image, &(surface->base.matrix));
-
*image_out = image;
return CAIRO_STATUS_SUCCESS;
@@ -380,7 +352,7 @@ _cairo_glitz_surface_clone_similar (void *abstract_surface,
cairo_image_surface_t *image_src = (cairo_image_surface_t *) src;
clone = (cairo_glitz_surface_t *)
- _cairo_glitz_surface_create_similar (surface, image_src->format, 0,
+ _cairo_glitz_surface_create_similar (surface, image_src->format,
image_src->width,
image_src->height);
if (!clone)
@@ -402,17 +374,17 @@ _cairo_glitz_surface_set_matrix (cairo_glitz_surface_t *surface,
{
glitz_transform_t transform;
- transform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]);
- transform.matrix[0][1] = _cairo_fixed_from_double (matrix->m[1][0]);
- transform.matrix[0][2] = _cairo_fixed_from_double (matrix->m[2][0]);
+ transform.matrix[0][0] = _cairo_fixed_from_double (matrix->xx);
+ transform.matrix[0][1] = _cairo_fixed_from_double (matrix->xy);
+ transform.matrix[0][2] = _cairo_fixed_from_double (matrix->x0);
- transform.matrix[1][0] = _cairo_fixed_from_double (matrix->m[0][1]);
- transform.matrix[1][1] = _cairo_fixed_from_double (matrix->m[1][1]);
- transform.matrix[1][2] = _cairo_fixed_from_double (matrix->m[2][1]);
+ transform.matrix[1][0] = _cairo_fixed_from_double (matrix->yx);
+ transform.matrix[1][1] = _cairo_fixed_from_double (matrix->yy);
+ transform.matrix[1][2] = _cairo_fixed_from_double (matrix->y0);
transform.matrix[2][0] = 0;
transform.matrix[2][1] = 0;
- transform.matrix[2][2] = 1 << 16;
+ transform.matrix[2][2] = _cairo_fixed_from_double (1);
glitz_surface_set_transform (surface->surface, &transform);
}
@@ -423,32 +395,49 @@ _glitz_operator (cairo_operator_t op)
switch (op) {
case CAIRO_OPERATOR_CLEAR:
return GLITZ_OPERATOR_CLEAR;
- case CAIRO_OPERATOR_SRC:
+
+ case CAIRO_OPERATOR_SOURCE:
return GLITZ_OPERATOR_SRC;
- case CAIRO_OPERATOR_DST:
- return GLITZ_OPERATOR_DST;
- case CAIRO_OPERATOR_OVER_REVERSE:
- return GLITZ_OPERATOR_OVER_REVERSE;
+ case CAIRO_OPERATOR_OVER:
+ return GLITZ_OPERATOR_OVER;
case CAIRO_OPERATOR_IN:
return GLITZ_OPERATOR_IN;
- case CAIRO_OPERATOR_IN_REVERSE:
- return GLITZ_OPERATOR_IN_REVERSE;
case CAIRO_OPERATOR_OUT:
return GLITZ_OPERATOR_OUT;
- case CAIRO_OPERATOR_OUT_REVERSE:
- return GLITZ_OPERATOR_OUT_REVERSE;
case CAIRO_OPERATOR_ATOP:
return GLITZ_OPERATOR_ATOP;
- case CAIRO_OPERATOR_ATOP_REVERSE:
+
+ case CAIRO_OPERATOR_DEST:
+ return GLITZ_OPERATOR_DST;
+ case CAIRO_OPERATOR_DEST_OVER:
+ return GLITZ_OPERATOR_OVER_REVERSE;
+ case CAIRO_OPERATOR_DEST_IN:
+ return GLITZ_OPERATOR_IN_REVERSE;
+ case CAIRO_OPERATOR_DEST_OUT:
+ return GLITZ_OPERATOR_OUT_REVERSE;
+ case CAIRO_OPERATOR_DEST_ATOP:
return GLITZ_OPERATOR_ATOP_REVERSE;
+
case CAIRO_OPERATOR_XOR:
return GLITZ_OPERATOR_XOR;
case CAIRO_OPERATOR_ADD:
return GLITZ_OPERATOR_ADD;
- case CAIRO_OPERATOR_OVER:
- default:
+ case CAIRO_OPERATOR_SATURATE:
+ /* XXX: OVER is definitely not the right thing here, (but it
+ * is what the original glitz backend code has always
+ * done). Cairo's SATURATE operator is the native GL
+ * compositing mode, (from my understanding). So why isn't
+ * there a GLITZ_OPERATOR_SATURATE for us to use here? */
return GLITZ_OPERATOR_OVER;
}
+
+ ASSERT_NOT_REACHED;
+
+ /* Something's very broken if this line of code can be reached, so
+ we want to return something that would give a noticeably
+ incorrect result. The XOR operator seems so rearely desired
+ that it should fit the bill here. */
+ return CAIRO_OPERATOR_XOR;
}
static glitz_status_t
@@ -586,12 +575,12 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t *pattern,
pattern->filter != CAIRO_FILTER_BEST)
break;
- alpha = (gradient->stops[0].color.alpha * pattern->alpha) * 0xffff;
+ alpha = (gradient->stops[0].color.alpha) * 0xffff;
for (i = 1; i < gradient->n_stops; i++)
{
unsigned short a;
- a = (gradient->stops[i].color.alpha * pattern->alpha) * 0xffff;
+ a = (gradient->stops[i].color.alpha) * 0xffff;
if (a != alpha)
break;
}
@@ -609,7 +598,7 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t *pattern,
src = (cairo_glitz_surface_t *)
_cairo_surface_create_similar_scratch (&dst->base,
- CAIRO_FORMAT_ARGB32, 0,
+ CAIRO_FORMAT_ARGB32,
gradient->n_stops, 1);
if (!src)
{
@@ -733,7 +722,7 @@ _cairo_glitz_pattern_release_surface (cairo_glitz_surface_t *dst,
_cairo_pattern_release_surface (&dst->base, &surface->base,
&attr->base);
else
- _cairo_glitz_surface_destroy (surface);
+ cairo_surface_destroy (&surface->base);
}
static cairo_int_status_t
@@ -753,50 +742,30 @@ _cairo_glitz_pattern_acquire_surfaces (cairo_pattern_t *src,
{
cairo_int_status_t status;
cairo_pattern_union_t tmp;
- cairo_bool_t src_opaque, mask_opaque;
- double src_alpha, mask_alpha;
- src_opaque = _cairo_pattern_is_opaque (src);
- mask_opaque = !mask || _cairo_pattern_is_opaque (mask);
-
- /* For surface patterns, we move any translucency from src->alpha
- * to mask->alpha so we can use the source unchanged. Otherwise we
- * move the translucency from mask->alpha to src->alpha so that
- * we can drop the mask if possible.
- */
- if (src->type == CAIRO_PATTERN_SURFACE)
- {
- if (mask) {
- mask_opaque = mask_opaque && src_opaque;
- mask_alpha = mask->alpha * src->alpha;
- } else {
- mask_opaque = src_opaque;
- mask_alpha = src->alpha;
- }
-
- src_alpha = 1.0;
- src_opaque = TRUE;
- }
- else
+ /* If src and mask are both solid, then the mask alpha can be
+ * combined into src and mask can be ignored. */
+
+ /* XXX: This optimization assumes that there is no color
+ * information in mask, so this will need to change when we
+ * support RENDER-style 4-channel masks. */
+
+ if (src->type == CAIRO_PATTERN_SOLID &&
+ mask->type == CAIRO_PATTERN_SOLID)
{
- if (mask)
- {
- src_opaque = mask_opaque && src_opaque;
- src_alpha = mask->alpha * src->alpha;
- /* FIXME: This needs changing when we support RENDER
- * style 4-channel masks.
- */
- if (mask->type == CAIRO_PATTERN_SOLID)
- mask = NULL;
- } else
- src_alpha = src->alpha;
-
- mask_alpha = 1.0;
- mask_opaque = TRUE;
- }
+ cairo_color_t combined;
+ cairo_solid_pattern_t *src_solid = (cairo_solid_pattern_t *) src;
+ cairo_solid_pattern_t *mask_solid = (cairo_solid_pattern_t *) mask;
+
+ combined = src_solid->color;
+ _cairo_color_multiply_alpha (&combined, mask_solid->color.alpha);
- _cairo_pattern_init_copy (&tmp.base, src);
- _cairo_pattern_set_alpha (&tmp.base, src_alpha);
+ _cairo_pattern_init_solid (&tmp.solid, &combined);
+
+ mask = NULL;
+ } else {
+ _cairo_pattern_init_copy (&tmp.base, src);
+ }
status = _cairo_glitz_pattern_acquire_surface (&tmp.base, dst,
src_x, src_y,
@@ -808,14 +777,9 @@ _cairo_glitz_pattern_acquire_surfaces (cairo_pattern_t *src,
if (status)
return status;
- if (mask || !mask_opaque)
+ if (mask)
{
- if (mask)
- _cairo_pattern_init_copy (&tmp.base, mask);
- else
- _cairo_pattern_init_solid (&tmp.solid, 0.0, 0.0, 0.0);
-
- _cairo_pattern_set_alpha (&tmp.base, mask_alpha);
+ _cairo_pattern_init_copy (&tmp.base, mask);
status = _cairo_glitz_pattern_acquire_surface (&tmp.base, dst,
mask_x, mask_y,
@@ -937,7 +901,7 @@ _cairo_glitz_surface_fill_rectangles (void *abstract_dst,
{
cairo_glitz_surface_t *dst = abstract_dst;
- if (op == CAIRO_OPERATOR_SRC)
+ if (op == CAIRO_OPERATOR_SOURCE)
{
glitz_color_t glitz_color;
@@ -969,6 +933,8 @@ _cairo_glitz_surface_fill_rectangles (void *abstract_dst,
(cairo_color_t *) color);
if (!src)
return CAIRO_STATUS_NO_MEMORY;
+
+ glitz_surface_set_fill (src->surface, GLITZ_FILL_REPEAT);
while (n_rects--)
{
@@ -1025,7 +991,6 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
cairo_pattern_union_t tmp;
_cairo_pattern_init_copy (&tmp.base, pattern);
- _cairo_pattern_set_alpha (&tmp.base, 1.0);
status = _cairo_glitz_pattern_acquire_surface (&tmp.base, dst,
src_x, src_y,
@@ -1033,8 +998,6 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
&src, &attributes);
_cairo_pattern_fini (&tmp.base);
-
- alpha = pattern->alpha * 0xffff;
}
else
{
@@ -1042,8 +1005,8 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
src_x, src_y,
width, height,
&src, &attributes);
- alpha = 0xffff;
}
+ alpha = 0xffff;
if (status)
return status;
@@ -1068,7 +1031,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
mask = (cairo_glitz_surface_t *)
_cairo_glitz_surface_create_similar (&dst->base,
- CAIRO_FORMAT_A8, 0,
+ CAIRO_FORMAT_A8,
2, 1);
if (!mask)
{
@@ -1076,7 +1039,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
- color.red = color.green = color.blue = color.alpha = alpha;
+ color.red = color.green = color.blue = color.alpha = 0xffff;
glitz_set_rectangle (mask->surface, &clear_black, 0, 0, 1, 1);
glitz_set_rectangle (mask->surface, &color, 1, 0, 1, 1);
@@ -1135,7 +1098,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
else
{
cairo_image_surface_t *image;
- char *ptr;
+ unsigned char *ptr;
int stride;
stride = (width + 3) & -4;
@@ -1149,7 +1112,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
memset (data, 0, stride * height);
/* using negative stride */
- ptr = (char *) data + stride * (height - 1);
+ ptr = (unsigned char *) data + stride * (height - 1);
image = (cairo_image_surface_t *)
cairo_image_surface_create_for_data (ptr,
@@ -1166,21 +1129,9 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
pixman_add_trapezoids (image->pixman_image, -dst_x, -dst_y,
(pixman_trapezoid_t *) traps, n_traps);
- if (alpha != 0xffff)
- {
- pixman_color_t color;
-
- color.red = color.green = color.blue = color.alpha = alpha;
-
- pixman_fill_rectangle (PIXMAN_OPERATOR_IN,
- image->pixman_image,
- &color,
- 0, 0, width, height);
- }
-
mask = (cairo_glitz_surface_t *)
_cairo_surface_create_similar_scratch (&dst->base,
- CAIRO_FORMAT_A8, 0,
+ CAIRO_FORMAT_A8,
width, height);
if (!mask)
{
@@ -1228,18 +1179,6 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op,
}
static cairo_int_status_t
-_cairo_glitz_surface_copy_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_glitz_surface_show_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
_cairo_glitz_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
@@ -1275,10 +1214,910 @@ _cairo_glitz_surface_set_clip_region (void *abstract_surface,
return CAIRO_STATUS_SUCCESS;
}
+static cairo_int_status_t
+_cairo_glitz_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_glitz_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+ rectangle->width = glitz_surface_get_width (surface->surface);
+ rectangle->height = glitz_surface_get_height (surface->surface);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+#define CAIRO_GLITZ_GLYPH_CACHE_MEMORY_DEFAULT 0x100000
+
+#define CAIRO_GLITZ_AREA_AVAILABLE 0
+#define CAIRO_GLITZ_AREA_DIVIDED 1
+#define CAIRO_GLITZ_AREA_OCCUPIED 2
+
+typedef struct _cairo_glitz_root_area cairo_glitz_root_area_t;
+
+typedef struct _cairo_glitz_area {
+ int state;
+ int level;
+ int x, y;
+ int width, height;
+ struct _cairo_glitz_area *area[4];
+ cairo_glitz_root_area_t *root;
+ void *closure;
+} cairo_glitz_area_t;
+
+static cairo_glitz_area_t _empty_area = {
+ 0, 0, 0, 0, 0, 0,
+ { NULL, NULL, NULL, NULL },
+ NULL,
+ NULL
+};
+
+typedef struct _cairo_glitz_area_funcs {
+ cairo_status_t (*move_in) (cairo_glitz_area_t *area,
+ void *closure);
+
+ void (*move_out) (cairo_glitz_area_t *area,
+ void *closure);
+
+ int (*compare_score) (cairo_glitz_area_t *area,
+ void *closure1,
+ void *closure2);
+} cairo_glitz_area_funcs_t;
+
+struct _cairo_glitz_root_area {
+ int max_level;
+ int width, height;
+ cairo_glitz_area_t *area;
+ const cairo_glitz_area_funcs_t *funcs;
+};
+
+static cairo_status_t
+_cairo_glitz_area_move_in (cairo_glitz_area_t *area,
+ void *closure)
+{
+ area->closure = closure;
+ area->state = CAIRO_GLITZ_AREA_OCCUPIED;
+
+ return (*area->root->funcs->move_in) (area, area->closure);
+}
+
+static void
+_cairo_glitz_area_move_out (cairo_glitz_area_t *area)
+{
+ (*area->root->funcs->move_out) (area, area->closure);
+
+ area->closure = NULL;
+ area->state = CAIRO_GLITZ_AREA_AVAILABLE;
+}
+
+static cairo_glitz_area_t *
+_cairo_glitz_area_create (cairo_glitz_root_area_t *root,
+ int level,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ cairo_glitz_area_t *area;
+ int n = 4;
+
+ area = malloc (sizeof (cairo_glitz_area_t));
+ if (!area)
+ return NULL;
+
+ area->level = level;
+ area->x = x;
+ area->y = y;
+ area->width = width;
+ area->height = height;
+ area->root = root;
+ area->closure = NULL;
+ area->state = CAIRO_GLITZ_AREA_AVAILABLE;
+
+ while (n--)
+ area->area[n] = NULL;
+
+ return area;
+}
+
+static void
+_cairo_glitz_area_destroy (cairo_glitz_area_t *area)
+{
+ if (area == NULL)
+ return;
+
+ if (area->state == CAIRO_GLITZ_AREA_OCCUPIED)
+ {
+ _cairo_glitz_area_move_out (area);
+ }
+ else
+ {
+ int n = 4;
+
+ while (n--)
+ _cairo_glitz_area_destroy (area->area[n]);
+ }
+
+ free (area);
+}
+
+static cairo_glitz_area_t *
+_cairo_glitz_area_get_top_scored_sub_area (cairo_glitz_area_t *area)
+{
+ if (!area)
+ return NULL;
+
+ switch (area->state) {
+ case CAIRO_GLITZ_AREA_OCCUPIED:
+ return area;
+ case CAIRO_GLITZ_AREA_AVAILABLE:
+ break;
+ case CAIRO_GLITZ_AREA_DIVIDED: {
+ cairo_glitz_area_t *tmp, *top = NULL;
+ int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ tmp = _cairo_glitz_area_get_top_scored_sub_area (area->area[i]);
+ if (tmp && top)
+ {
+ if ((*area->root->funcs->compare_score) (tmp,
+ tmp->closure,
+ top->closure) > 0)
+ top = tmp;
+ }
+ else if (tmp)
+ {
+ top = tmp;
+ }
+ }
+ return top;
+ }
+ }
+
+ return NULL;
+}
+
+static cairo_int_status_t
+_cairo_glitz_area_find (cairo_glitz_area_t *area,
+ int width,
+ int height,
+ cairo_bool_t kick_out,
+ void *closure)
+{
+ cairo_status_t status;
+
+ if (area->width < width || area->height < height)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ switch (area->state) {
+ case CAIRO_GLITZ_AREA_OCCUPIED:
+ if (kick_out)
+ {
+ if ((*area->root->funcs->compare_score) (area,
+ area->closure,
+ closure) >= 0)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ _cairo_glitz_area_move_out (area);
+ } else {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+
+ /* fall-through */
+ case CAIRO_GLITZ_AREA_AVAILABLE: {
+ if (area->level == area->root->max_level ||
+ (area->width == width && area->height == height))
+ {
+ return _cairo_glitz_area_move_in (area, closure);
+ }
+ else
+ {
+ int dx[4], dy[4], w[4], h[4], i;
+
+ dx[0] = dx[2] = dy[0] = dy[1] = 0;
+
+ w[0] = w[2] = dx[1] = dx[3] = width;
+ h[0] = h[1] = dy[2] = dy[3] = height;
+
+ w[1] = w[3] = area->width - width;
+ h[2] = h[3] = area->height - height;
+
+ for (i = 0; i < 2; i++)
+ {
+ if (w[i])
+ area->area[i] =
+ _cairo_glitz_area_create (area->root,
+ area->level + 1,
+ area->x + dx[i],
+ area->y + dy[i],
+ w[i], h[i]);
+ }
+
+ for (; i < 4; i++)
+ {
+ if (w[i] && h[i])
+ area->area[i] =
+ _cairo_glitz_area_create (area->root,
+ area->level + 1,
+ area->x + dx[i],
+ area->y + dy[i],
+ w[i], h[i]);
+ }
+
+ area->state = CAIRO_GLITZ_AREA_DIVIDED;
+
+ status = _cairo_glitz_area_find (area->area[0],
+ width, height,
+ kick_out, closure);
+ if (status == CAIRO_STATUS_SUCCESS)
+ return CAIRO_STATUS_SUCCESS;
+ }
+ } break;
+ case CAIRO_GLITZ_AREA_DIVIDED: {
+ cairo_glitz_area_t *to_area;
+ int i, rejected = FALSE;
+
+ for (i = 0; i < 4; i++)
+ {
+ if (area->area[i])
+ {
+ if (area->area[i]->width >= width &&
+ area->area[i]->height >= height)
+ {
+ status = _cairo_glitz_area_find (area->area[i],
+ width, height,
+ kick_out, closure);
+ if (status == CAIRO_STATUS_SUCCESS)
+ return CAIRO_STATUS_SUCCESS;
+
+ rejected = TRUE;
+ }
+ }
+ }
+
+ if (rejected)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ to_area = _cairo_glitz_area_get_top_scored_sub_area (area);
+ if (to_area)
+ {
+ if (kick_out)
+ {
+ if ((*area->root->funcs->compare_score) (to_area,
+ to_area->closure,
+ closure) >= 0)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ } else {
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ _cairo_glitz_area_destroy (area->area[i]);
+ area->area[i] = NULL;
+ }
+
+ area->closure = NULL;
+ area->state = CAIRO_GLITZ_AREA_AVAILABLE;
+
+ status = _cairo_glitz_area_find (area, width, height,
+ TRUE, closure);
+ if (status == CAIRO_STATUS_SUCCESS)
+ return CAIRO_STATUS_SUCCESS;
+
+ } break;
+ }
+
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+}
+
+static cairo_status_t
+_cairo_glitz_root_area_init (cairo_glitz_root_area_t *root,
+ int max_level,
+ int width,
+ int height,
+ const cairo_glitz_area_funcs_t *funcs)
+{
+ root->max_level = max_level;
+ root->funcs = funcs;
+
+ root->area = _cairo_glitz_area_create (root, 0, 0, 0, width, height);
+ if (!root->area)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_glitz_root_area_fini (cairo_glitz_root_area_t *root)
+{
+ _cairo_glitz_area_destroy (root->area);
+}
+
+#define GLYPH_CACHE_TEXTURE_SIZE 512
+#define GLYPH_CACHE_MAX_LEVEL 64
+#define GLYPH_CACHE_MAX_HEIGHT 72
+#define GLYPH_CACHE_MAX_WIDTH 72
+
+#define WRITE_VEC2(ptr, _x, _y) \
+ *(ptr)++ = (_x); \
+ *(ptr)++ = (_y)
+
+#define WRITE_BOX(ptr, _vx1, _vy1, _vx2, _vy2, p1, p2) \
+ WRITE_VEC2 (ptr, _vx1, _vy1); \
+ WRITE_VEC2 (ptr, (p1)->x, (p2)->y); \
+ WRITE_VEC2 (ptr, _vx2, _vy1); \
+ WRITE_VEC2 (ptr, (p2)->x, (p2)->y); \
+ WRITE_VEC2 (ptr, _vx2, _vy2); \
+ WRITE_VEC2 (ptr, (p2)->x, (p1)->y); \
+ WRITE_VEC2 (ptr, _vx1, _vy2); \
+ WRITE_VEC2 (ptr, (p1)->x, (p1)->y)
+
+typedef struct _cairo_glitz_glyph_cache {
+ cairo_cache_t base;
+ cairo_glitz_root_area_t root;
+ glitz_surface_t *surface;
+} cairo_glitz_glyph_cache_t;
+
+typedef struct {
+ cairo_glyph_cache_key_t key;
+ int refcount;
+ cairo_glyph_size_t size;
+ cairo_glitz_area_t *area;
+ cairo_bool_t locked;
+ cairo_point_double_t p1, p2;
+} cairo_glitz_glyph_cache_entry_t;
+
+static cairo_status_t
+_cairo_glitz_glyph_move_in (cairo_glitz_area_t *area,
+ void *closure)
+{
+ cairo_glitz_glyph_cache_entry_t *entry = closure;
+
+ entry->area = area;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_glitz_glyph_move_out (cairo_glitz_area_t *area,
+ void *closure)
+{
+ cairo_glitz_glyph_cache_entry_t *entry = closure;
+
+ entry->area = NULL;
+}
+
+static int
+_cairo_glitz_glyph_compare (cairo_glitz_area_t *area,
+ void *closure1,
+ void *closure2)
+{
+ cairo_glitz_glyph_cache_entry_t *entry = closure1;
+
+ if (entry->locked)
+ return 1;
+
+ return -1;
+}
+
+static const cairo_glitz_area_funcs_t _cairo_glitz_area_funcs = {
+ _cairo_glitz_glyph_move_in,
+ _cairo_glitz_glyph_move_out,
+ _cairo_glitz_glyph_compare
+};
+
+static cairo_status_t
+_cairo_glitz_glyph_cache_create_entry (void *abstract_cache,
+ void *abstract_key,
+ void **return_entry)
+{
+ cairo_glitz_glyph_cache_entry_t *entry;
+ cairo_glyph_cache_key_t *key = abstract_key;
+
+ entry = malloc (sizeof (cairo_glitz_glyph_cache_entry_t));
+ if (!entry)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ entry->refcount = 1;
+ entry->key = *key;
+ entry->area = NULL;
+ entry->locked = FALSE;
+
+ _cairo_unscaled_font_reference (entry->key.unscaled);
+
+ *return_entry = entry;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_glitz_glyph_cache_destroy_entry (void *abstract_cache,
+ void *abstract_entry)
+{
+ cairo_glitz_glyph_cache_entry_t *entry = abstract_entry;
+
+ entry->refcount--;
+ if (entry->refcount)
+ return;
+
+ if (entry->area)
+ _cairo_glitz_area_move_out (entry->area);
+
+ _cairo_unscaled_font_destroy (entry->key.unscaled);
+
+ free (entry);
+}
+
+static void
+_cairo_glitz_glyph_cache_entry_reference (void *abstract_entry)
+{
+ cairo_glitz_glyph_cache_entry_t *entry = abstract_entry;
+
+ entry->refcount++;
+}
+
+static void
+_cairo_glitz_glyph_cache_destroy_cache (void *abstract_cache)
+{
+ cairo_glitz_glyph_cache_t *cache = abstract_cache;
+
+ _cairo_glitz_root_area_fini (&cache->root);
+
+ glitz_surface_destroy (cache->surface);
+}
+
+static const cairo_cache_backend_t _cairo_glitz_glyph_cache_backend = {
+ _cairo_glyph_cache_hash,
+ _cairo_glyph_cache_keys_equal,
+ _cairo_glitz_glyph_cache_create_entry,
+ _cairo_glitz_glyph_cache_destroy_entry,
+ _cairo_glitz_glyph_cache_destroy_cache
+};
+
+static cairo_glitz_glyph_cache_t *_cairo_glitz_glyph_caches = NULL;
+
+static cairo_glitz_glyph_cache_t *
+_cairo_glitz_get_glyph_cache (cairo_glitz_surface_t *surface)
+{
+ cairo_glitz_glyph_cache_t *cache;
+ glitz_drawable_t *drawable;
+ glitz_format_t *format;
+
+ /*
+ * FIXME: caches should be thread specific, display specific and screen
+ * specific.
+ */
+
+ if (_cairo_glitz_glyph_caches)
+ return _cairo_glitz_glyph_caches;
+
+ drawable = glitz_surface_get_drawable (surface->surface);
+
+ format = glitz_find_standard_format (drawable, GLITZ_STANDARD_A8);
+ if (!format)
+ return NULL;
+
+ cache = malloc (sizeof (cairo_glitz_glyph_cache_t));
+ if (!cache)
+ return NULL;
+
+ cache->surface =
+ glitz_surface_create (drawable, format,
+ GLYPH_CACHE_TEXTURE_SIZE,
+ GLYPH_CACHE_TEXTURE_SIZE,
+ 0, NULL);
+ if (!cache->surface)
+ {
+ free (cache);
+ return NULL;
+ }
+
+ if (_cairo_glitz_root_area_init (&cache->root,
+ GLYPH_CACHE_MAX_LEVEL,
+ GLYPH_CACHE_TEXTURE_SIZE,
+ GLYPH_CACHE_TEXTURE_SIZE,
+ &_cairo_glitz_area_funcs))
+ {
+ glitz_surface_destroy (cache->surface);
+ free (cache);
+ return NULL;
+ }
+
+ if (_cairo_cache_init (&cache->base,
+ &_cairo_glitz_glyph_cache_backend,
+ CAIRO_GLITZ_GLYPH_CACHE_MEMORY_DEFAULT))
+ {
+ _cairo_glitz_root_area_fini (&cache->root);
+ glitz_surface_destroy (cache->surface);
+ free (cache);
+ return NULL;
+ }
+
+ _cairo_glitz_glyph_caches = cache;
+
+ return cache;
+}
+
+#define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
+
+static cairo_status_t
+_cairo_glitz_cache_glyph (cairo_glitz_glyph_cache_t *cache,
+ cairo_glitz_glyph_cache_entry_t *entry,
+ cairo_image_glyph_cache_entry_t *image_entry)
+{
+ glitz_point_fixed_t p1, p2;
+ glitz_pixel_format_t pf;
+ glitz_buffer_t *buffer;
+ pixman_format_t *format;
+ int am, rm, gm, bm;
+
+ entry->size = image_entry->size;
+
+ if (entry->size.width > GLYPH_CACHE_MAX_WIDTH ||
+ entry->size.height > GLYPH_CACHE_MAX_HEIGHT)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (!image_entry->image)
+ {
+ entry->area = &_empty_area;
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ format = pixman_image_get_format (image_entry->image->pixman_image);
+ if (!format)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ if (_cairo_glitz_area_find (cache->root.area,
+ entry->size.width,
+ entry->size.height,
+ FALSE, entry))
+ {
+ if (_cairo_glitz_area_find (cache->root.area,
+ entry->size.width,
+ entry->size.height,
+ TRUE, entry))
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ buffer = glitz_buffer_create_for_data (image_entry->image->data);
+ if (!buffer)
+ {
+ _cairo_glitz_area_move_out (entry->area);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ pixman_format_get_masks (format, &pf.masks.bpp, &am, &rm, &gm, &bm);
+
+ pf.masks.alpha_mask = am;
+ pf.masks.red_mask = rm;
+ pf.masks.green_mask = gm;
+ pf.masks.blue_mask = bm;
+
+ pf.bytes_per_line = image_entry->image->stride;
+ pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
+ pf.xoffset = 0;
+ pf.skip_lines = 0;
+
+ glitz_set_pixels (cache->surface,
+ entry->area->x,
+ entry->area->y,
+ entry->size.width,
+ entry->size.height,
+ &pf, buffer);
+
+ glitz_buffer_destroy (buffer);
+
+ p1.x = entry->area->x << 16;
+ p1.y = entry->area->y << 16;
+ p2.x = (entry->area->x + entry->size.width) << 16;
+ p2.y = (entry->area->y + entry->size.height) << 16;
+
+ glitz_surface_translate_point (cache->surface, &p1, &p1);
+ glitz_surface_translate_point (cache->surface, &p2, &p2);
+
+ entry->p1.x = FIXED_TO_FLOAT (p1.x);
+ entry->p1.y = FIXED_TO_FLOAT (p1.y);
+ entry->p2.x = FIXED_TO_FLOAT (p2.x);
+ entry->p2.y = FIXED_TO_FLOAT (p2.y);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+#define N_STACK_BUF 256
+
+static cairo_int_status_t
+_cairo_glitz_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
+ cairo_operator_t op,
+ cairo_pattern_t *pattern,
+ void *abstract_surface,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ unsigned int width,
+ unsigned int height,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs)
+{
+ cairo_glitz_surface_attributes_t attributes;
+ cairo_glitz_surface_t *dst = abstract_surface;
+ cairo_glitz_surface_t *src;
+ cairo_glitz_glyph_cache_t *cache;
+ cairo_glitz_glyph_cache_entry_t *stack_entries[N_STACK_BUF];
+ cairo_glitz_glyph_cache_entry_t **entries;
+ cairo_glyph_cache_key_t key;
+ glitz_float_t stack_vertices[N_STACK_BUF * 16];
+ glitz_float_t *vertices;
+ glitz_buffer_t *buffer;
+ cairo_int_status_t status;
+ int i, cached_glyphs = 0;
+ int remaining_glyps = num_glyphs;
+ glitz_float_t x1, y1, x2, y2;
+ static glitz_vertex_format_t format = {
+ GLITZ_PRIMITIVE_QUADS,
+ GLITZ_DATA_TYPE_FLOAT,
+ sizeof (glitz_float_t) * 4,
+ GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK,
+ { 0 },
+ {
+ GLITZ_DATA_TYPE_FLOAT,
+ GLITZ_COORDINATE_SIZE_XY,
+ sizeof (glitz_float_t) * 2,
+ }
+ };
+
+ if (op == CAIRO_OPERATOR_SATURATE)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ if (_glitz_ensure_target (dst->surface))
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ status = _cairo_glitz_pattern_acquire_surface (pattern, dst,
+ src_x, src_y,
+ width, height,
+ &src, &attributes);
+ if (status)
+ return status;
+
+ _cairo_glitz_surface_set_attributes (src, &attributes);
+
+ if (num_glyphs > N_STACK_BUF)
+ {
+ char *data;
+
+ data = malloc (num_glyphs * sizeof (void *) +
+ num_glyphs * sizeof (glitz_float_t) * 16);
+ if (!data)
+ goto FAIL1;
+
+ entries = (cairo_glitz_glyph_cache_entry_t **) data;
+ vertices = (glitz_float_t *) (data + num_glyphs * sizeof (void *));
+ }
+ else
+ {
+ entries = stack_entries;
+ vertices = stack_vertices;
+ }
+
+ buffer = glitz_buffer_create_for_data (vertices);
+ if (!buffer)
+ goto FAIL2;
+
+ cache = _cairo_glitz_get_glyph_cache (dst);
+ if (!cache)
+ {
+ num_glyphs = 0;
+ goto UNLOCK;
+ }
+
+ _cairo_scaled_font_get_glyph_cache_key (scaled_font, &key);
+
+ for (i = 0; i < num_glyphs; i++)
+ {
+ key.index = glyphs[i].index;
+
+ status = _cairo_cache_lookup (&cache->base,
+ &key,
+ (void **) &entries[i],
+ NULL);
+ if (status)
+ {
+ num_glyphs = i;
+ goto UNLOCK;
+ }
+
+ _cairo_glitz_glyph_cache_entry_reference (entries[i]);
+
+ if (entries[i]->area)
+ {
+ remaining_glyps--;
+
+ if (entries[i]->area->width)
+ {
+ x1 = floor (glyphs[i].x + 0.5) + entries[i]->size.x;
+ y1 = floor (glyphs[i].y + 0.5) + entries[i]->size.y;
+ x2 = x1 + entries[i]->size.width;
+ y2 = y1 + entries[i]->size.height;
+
+ WRITE_BOX (vertices, x1, y1, x2, y2,
+ &entries[i]->p1, &entries[i]->p2);
+
+ entries[i]->locked = TRUE;
+ cached_glyphs++;
+ }
+ }
+ }
+
+ if (remaining_glyps)
+ {
+ cairo_cache_t *image_cache;
+ cairo_image_glyph_cache_entry_t *image_entry;
+ cairo_surface_t *image;
+ cairo_glitz_surface_t *clone;
+
+ _cairo_lock_global_image_glyph_cache ();
+
+ image_cache = _cairo_get_global_image_glyph_cache ();
+ if (!image_cache)
+ {
+ _cairo_unlock_global_image_glyph_cache ();
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto UNLOCK;
+ }
+
+ for (i = 0; i < num_glyphs; i++)
+ {
+ if (!entries[i]->area)
+ {
+ key.index = glyphs[i].index;
+
+ status = _cairo_cache_lookup (image_cache,
+ &key,
+ (void **) &image_entry,
+ NULL);
+ if (status)
+ {
+ _cairo_unlock_global_image_glyph_cache ();
+ goto UNLOCK;
+ }
+
+ status = _cairo_glitz_cache_glyph (cache,
+ entries[i],
+ image_entry);
+ if (status)
+ {
+ _cairo_unlock_global_image_glyph_cache ();
+ goto UNLOCK;
+ }
+ }
+
+ x1 = floor (glyphs[i].x + 0.5);
+ y1 = floor (glyphs[i].y + 0.5);
+
+ if (entries[i]->area)
+ {
+ if (entries[i]->area->width)
+ {
+ x1 += entries[i]->size.x;
+ y1 += entries[i]->size.y;
+ x2 = x1 + entries[i]->size.width;
+ y2 = y1 + entries[i]->size.height;
+
+ WRITE_BOX (vertices, x1, y1, x2, y2,
+ &entries[i]->p1, &entries[i]->p2);
+
+ entries[i]->locked = TRUE;
+ cached_glyphs++;
+ }
+ }
+ else
+ {
+ x1 += image_entry->size.x;
+ y1 += image_entry->size.y;
+
+ if (!image_entry->image)
+ continue;
+
+ image = &image_entry->image->base;
+ status =
+ _cairo_glitz_surface_clone_similar (abstract_surface,
+ image,
+ (cairo_surface_t **)
+ &clone);
+ if (status)
+ {
+ _cairo_unlock_global_image_glyph_cache ();
+ goto UNLOCK;
+ }
+
+ glitz_composite (_glitz_operator (op),
+ src->surface,
+ clone->surface,
+ dst->surface,
+ src_x + attributes.base.x_offset + x1,
+ src_y + attributes.base.y_offset + y1,
+ 0, 0,
+ x1, y1,
+ image_entry->size.width,
+ image_entry->size.height);
+
+ cairo_surface_destroy (&clone->base);
+
+ if (glitz_surface_get_status (dst->surface) ==
+ GLITZ_STATUS_NOT_SUPPORTED)
+ {
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ _cairo_unlock_global_image_glyph_cache ();
+ goto UNLOCK;
+ }
+ }
+ }
+
+ _cairo_unlock_global_image_glyph_cache ();
+ }
+
+ if (cached_glyphs)
+ {
+ glitz_set_geometry (dst->surface,
+ GLITZ_GEOMETRY_TYPE_VERTEX,
+ (glitz_geometry_format_t *) &format,
+ buffer);
+
+ glitz_set_array (dst->surface, 0, 4, cached_glyphs * 4, 0, 0);
+
+ glitz_composite (_glitz_operator (op),
+ src->surface,
+ cache->surface,
+ dst->surface,
+ src_x + attributes.base.x_offset,
+ src_y + attributes.base.y_offset,
+ 0, 0,
+ dst_x, dst_y,
+ width, height);
+
+ glitz_set_geometry (dst->surface,
+ GLITZ_GEOMETRY_TYPE_NONE,
+ NULL, NULL);
+ }
+
+UNLOCK:
+ if (cached_glyphs)
+ {
+ for (i = 0; i < num_glyphs; i++)
+ entries[i]->locked = FALSE;
+ }
+
+ for (i = 0; i < num_glyphs; i++)
+ _cairo_glitz_glyph_cache_destroy_entry (cache, entries[i]);
+
+ glitz_buffer_destroy (buffer);
+
+ FAIL2:
+ if (num_glyphs > N_STACK_BUF)
+ free (entries);
+
+ FAIL1:
+ if (attributes.n_params)
+ free (attributes.params);
+
+ _cairo_glitz_pattern_release_surface (dst, src, &attributes);
+
+ if (status)
+ return status;
+
+ if (glitz_surface_get_status (dst->surface) == GLITZ_STATUS_NOT_SUPPORTED)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static const cairo_surface_backend_t cairo_glitz_surface_backend = {
_cairo_glitz_surface_create_similar,
- _cairo_glitz_surface_destroy,
- _cairo_glitz_surface_pixels_per_inch,
+ _cairo_glitz_surface_finish,
_cairo_glitz_surface_acquire_source_image,
_cairo_glitz_surface_release_source_image,
_cairo_glitz_surface_acquire_dest_image,
@@ -1287,10 +2126,12 @@ static const cairo_surface_backend_t cairo_glitz_surface_backend = {
_cairo_glitz_surface_composite,
_cairo_glitz_surface_fill_rectangles,
_cairo_glitz_surface_composite_trapezoids,
- _cairo_glitz_surface_copy_page,
- _cairo_glitz_surface_show_page,
+ NULL, /* copy_page */
+ NULL, /* show_page */
_cairo_glitz_surface_set_clip_region,
- NULL /* show_glyphs */
+ NULL, /* intersect_clip_path */
+ _cairo_glitz_surface_get_extents,
+ _cairo_glitz_surface_show_glyphs
};
cairo_surface_t *
diff --git a/src/cairo-glitz.h b/src/cairo-glitz.h
index f1917eb..f5b4f28 100644
--- a/src/cairo-glitz.h
+++ b/src/cairo-glitz.h
@@ -39,20 +39,19 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_GLITZ_SURFACE
+#if CAIRO_HAS_GLITZ_SURFACE
#include <glitz.h>
CAIRO_BEGIN_DECLS
-void
-cairo_set_target_glitz (cairo_t *cr,
- glitz_surface_t *surface);
-
cairo_surface_t *
cairo_glitz_surface_create (glitz_surface_t *surface);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_GLITZ_SURFACE */
+# error Cairo was not compiled with support for the glitz backend
#endif /* CAIRO_HAS_GLITZ_SURFACE */
+
#endif /* CAIRO_GLITZ_H */
diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h
new file mode 100644
index 0000000..7e2c859
--- /dev/null
+++ b/src/cairo-gstate-private.h
@@ -0,0 +1,115 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@redhat.com>
+ */
+
+#ifndef CAIRO_GSTATE_PRIVATE_H
+#define CAIRO_GSTATE_PRIVATE_H
+
+#include "cairo-path-fixed-private.h"
+
+struct _cairo_clip_path {
+ unsigned int ref_count;
+ cairo_path_fixed_t path;
+ cairo_fill_rule_t fill_rule;
+ double tolerance;
+ cairo_clip_path_t *prev;
+};
+
+typedef struct _cairo_clip {
+ cairo_clip_mode_t mode;
+
+ /*
+ * Mask-based clipping for cases where the backend
+ * clipping isn't sufficiently able.
+ *
+ * The rectangle here represents the
+ * portion of the destination surface that this
+ * clip surface maps to, it does not
+ * represent the extents of the clip region or
+ * clip paths
+ */
+ cairo_surface_t *surface;
+ cairo_rectangle_t surface_rect;
+ /*
+ * Surface clip serial number to store
+ * in the surface when this clip is set
+ */
+ unsigned int serial;
+ /*
+ * A clip region that can be placed in the surface
+ */
+ pixman_region16_t *region;
+ /*
+ * If the surface supports path clipping, we store the list of
+ * clipping paths that has been set here as a linked list.
+ */
+ cairo_clip_path_t *path;
+} cairo_clip_t;
+
+struct _cairo_gstate {
+ cairo_operator_t operator;
+
+ double tolerance;
+
+ /* stroke style */
+ double line_width;
+ cairo_line_cap_t line_cap;
+ cairo_line_join_t line_join;
+ double miter_limit;
+
+ cairo_fill_rule_t fill_rule;
+
+ double *dash;
+ int num_dashes;
+ double dash_offset;
+
+ cairo_font_face_t *font_face;
+ cairo_scaled_font_t *scaled_font; /* Specific to the current CTM */
+ cairo_matrix_t font_matrix;
+
+ cairo_clip_t clip;
+
+ cairo_matrix_t ctm;
+ cairo_matrix_t ctm_inverse;
+
+ cairo_pen_t pen_regular;
+
+ cairo_surface_t *target;
+
+ cairo_pattern_t *source;
+
+ struct _cairo_gstate *next;
+};
+
+#endif /* CAIRO_GSTATE_PRIVATE_H */
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
new file mode 100644
index 0000000..94770f3
--- /dev/null
+++ b/src/cairo-gstate.c
@@ -0,0 +1,2266 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdlib.h>
+
+#include "cairoint.h"
+
+#include "cairo-gstate-private.h"
+
+static cairo_status_t
+_cairo_gstate_init (cairo_gstate_t *gstate,
+ cairo_surface_t *target);
+
+static cairo_status_t
+_cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other);
+
+static void
+_cairo_gstate_fini (cairo_gstate_t *gstate);
+
+static cairo_status_t
+_cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate,
+ cairo_pattern_t *src,
+ cairo_operator_t operator,
+ cairo_surface_t *dst,
+ cairo_traps_t *traps);
+
+static cairo_status_t
+_cairo_gstate_ensure_font (cairo_gstate_t *gstate);
+
+static cairo_status_t
+_cairo_gstate_ensure_font_face (cairo_gstate_t *gstate);
+
+static void
+_cairo_gstate_unset_font (cairo_gstate_t *gstate);
+
+static void
+_cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src);
+
+static void
+_cairo_clip_path_reference (cairo_clip_path_t *clip_path);
+
+static void
+_cairo_clip_path_destroy (cairo_clip_path_t *clip_path);
+
+cairo_gstate_t *
+_cairo_gstate_create (cairo_surface_t *target)
+{
+ cairo_status_t status;
+ cairo_gstate_t *gstate;
+
+ gstate = malloc (sizeof (cairo_gstate_t));
+
+ if (gstate)
+ {
+ status = _cairo_gstate_init (gstate, target);
+ if (status) {
+ free (gstate);
+ return NULL;
+ }
+ }
+
+ return gstate;
+}
+
+static cairo_status_t
+_cairo_gstate_init (cairo_gstate_t *gstate,
+ cairo_surface_t *target)
+{
+ gstate->operator = CAIRO_GSTATE_OPERATOR_DEFAULT;
+
+ gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
+
+ gstate->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
+ gstate->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
+ gstate->line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
+ gstate->miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
+
+ gstate->fill_rule = CAIRO_GSTATE_FILL_RULE_DEFAULT;
+
+ gstate->dash = NULL;
+ gstate->num_dashes = 0;
+ gstate->dash_offset = 0.0;
+
+ gstate->font_face = NULL;
+ gstate->scaled_font = NULL;
+
+ cairo_matrix_init_scale (&gstate->font_matrix,
+ CAIRO_GSTATE_DEFAULT_FONT_SIZE,
+ CAIRO_GSTATE_DEFAULT_FONT_SIZE);
+
+ gstate->clip.mode = _cairo_surface_get_clip_mode (target);
+ gstate->clip.region = NULL;
+ gstate->clip.surface = NULL;
+ gstate->clip.serial = 0;
+ gstate->clip.path = NULL;
+
+ _cairo_gstate_identity_matrix (gstate);
+
+ _cairo_pen_init_empty (&gstate->pen_regular);
+
+ gstate->target = target;
+ cairo_surface_reference (gstate->target);
+
+ gstate->source = _cairo_pattern_create_solid (CAIRO_COLOR_BLACK);
+ if (gstate->source->status)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ gstate->next = NULL;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
+{
+ cairo_status_t status;
+ cairo_gstate_t *next;
+
+ /* Copy all members, but don't smash the next pointer */
+ next = gstate->next;
+ *gstate = *other;
+ gstate->next = next;
+
+ /* Now fix up pointer data that needs to be cloned/referenced */
+ if (other->dash) {
+ gstate->dash = malloc (other->num_dashes * sizeof (double));
+ if (gstate->dash == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+ memcpy (gstate->dash, other->dash, other->num_dashes * sizeof (double));
+ }
+
+ if (other->clip.region) {
+ gstate->clip.region = pixman_region_create ();
+ pixman_region_copy (gstate->clip.region, other->clip.region);
+ }
+
+ if (gstate->font_face)
+ cairo_font_face_reference (gstate->font_face);
+
+ if (gstate->scaled_font)
+ cairo_scaled_font_reference (gstate->scaled_font);
+
+ cairo_surface_reference (gstate->target);
+ cairo_surface_reference (gstate->clip.surface);
+ _cairo_clip_path_reference (gstate->clip.path);
+
+ cairo_pattern_reference (gstate->source);
+
+ status = _cairo_pen_init_copy (&gstate->pen_regular, &other->pen_regular);
+ if (status)
+ goto CLEANUP_FONT;
+
+ return status;
+
+ CLEANUP_FONT:
+ cairo_scaled_font_destroy (gstate->scaled_font);
+ gstate->scaled_font = NULL;
+
+ free (gstate->dash);
+ gstate->dash = NULL;
+
+ return CAIRO_STATUS_NO_MEMORY;
+}
+
+void
+_cairo_gstate_fini (cairo_gstate_t *gstate)
+{
+ if (gstate->font_face)
+ cairo_font_face_destroy (gstate->font_face);
+
+ if (gstate->scaled_font)
+ cairo_scaled_font_destroy (gstate->scaled_font);
+
+ if (gstate->target) {
+ cairo_surface_destroy (gstate->target);
+ gstate->target = NULL;
+ }
+
+ if (gstate->clip.surface)
+ cairo_surface_destroy (gstate->clip.surface);
+ gstate->clip.surface = NULL;
+
+ if (gstate->clip.path)
+ _cairo_clip_path_destroy (gstate->clip.path);
+ gstate->clip.path = NULL;
+
+ if (gstate->clip.region)
+ pixman_region_destroy (gstate->clip.region);
+ gstate->clip.region = NULL;
+ gstate->clip.serial = 0;
+
+ cairo_pattern_destroy (gstate->source);
+
+ _cairo_pen_fini (&gstate->pen_regular);
+
+ if (gstate->dash) {
+ free (gstate->dash);
+ gstate->dash = NULL;
+ }
+}
+
+void
+_cairo_gstate_destroy (cairo_gstate_t *gstate)
+{
+ _cairo_gstate_fini (gstate);
+ free (gstate);
+}
+
+cairo_gstate_t*
+_cairo_gstate_clone (cairo_gstate_t *gstate)
+{
+ cairo_status_t status;
+ cairo_gstate_t *clone;
+
+ clone = malloc (sizeof (cairo_gstate_t));
+ if (clone) {
+ status = _cairo_gstate_init_copy (clone, gstate);
+ if (status) {
+ free (clone);
+ return NULL;
+ }
+ }
+ clone->next = NULL;
+
+ return clone;
+}
+
+/* Push rendering off to an off-screen group. */
+/* XXX: Rethinking this API
+cairo_status_t
+_cairo_gstate_begin_group (cairo_gstate_t *gstate)
+{
+ Pixmap pix;
+ unsigned int width, height;
+
+ gstate->parent_surface = gstate->target;
+
+ width = _cairo_surface_get_width (gstate->target);
+ height = _cairo_surface_get_height (gstate->target);
+
+ pix = XCreatePixmap (gstate->dpy,
+ _cairo_surface_get_drawable (gstate->target),
+ width, height,
+ _cairo_surface_get_depth (gstate->target));
+ if (pix == 0)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ gstate->target = cairo_surface_create (gstate->dpy);
+ if (gstate->target == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ _cairo_surface_set_drawableWH (gstate->target, pix, width, height);
+
+ status = _cairo_surface_fill_rectangle (gstate->target,
+ CAIRO_OPERATOR_SOURCE,
+ &CAIRO_COLOR_TRANSPARENT,
+ 0, 0,
+ _cairo_surface_get_width (gstate->target),
+ _cairo_surface_get_height (gstate->target));
+ if (status)
+ return status;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+*/
+
+/* Complete the current offscreen group, composing its contents onto the parent surface. */
+/* XXX: Rethinking this API
+cairo_status_t
+_cairo_gstate_end_group (cairo_gstate_t *gstate)
+{
+ Pixmap pix;
+ cairo_color_t mask_color;
+ cairo_surface_t mask;
+
+ if (gstate->parent_surface == NULL)
+ return CAIRO_STATUS_INVALID_POP_GROUP;
+
+ _cairo_surface_init (&mask, gstate->dpy);
+ _cairo_color_init (&mask_color);
+
+ _cairo_surface_set_solid_color (&mask, &mask_color);
+
+ * XXX: This could be made much more efficient by using
+ _cairo_surface_get_damaged_width/Height if cairo_surface_t actually kept
+ track of such informaton. *
+ _cairo_surface_composite (gstate->operator,
+ gstate->target,
+ mask,
+ gstate->parent_surface,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ _cairo_surface_get_width (gstate->target),
+ _cairo_surface_get_height (gstate->target));
+
+ _cairo_surface_fini (&mask);
+
+ pix = _cairo_surface_get_drawable (gstate->target);
+ XFreePixmap (gstate->dpy, pix);
+
+ cairo_surface_destroy (gstate->target);
+ gstate->target = gstate->parent_surface;
+ gstate->parent_surface = NULL;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+*/
+
+static cairo_status_t
+_cairo_gstate_set_clip (cairo_gstate_t *gstate)
+{
+ cairo_surface_t *surface = gstate->target;
+
+ if (!surface)
+ return CAIRO_STATUS_NULL_POINTER;
+ if (gstate->clip.serial == _cairo_surface_get_current_clip_serial (surface))
+ return CAIRO_STATUS_SUCCESS;
+
+ if (gstate->clip.path)
+ return _cairo_surface_set_clip_path (surface,
+ gstate->clip.path,
+ gstate->clip.serial);
+
+ if (gstate->clip.region)
+ return _cairo_surface_set_clip_region (surface,
+ gstate->clip.region,
+ gstate->clip.serial);
+
+ return _cairo_surface_reset_clip (surface);
+}
+
+static cairo_status_t
+_cairo_gstate_get_clip_extents (cairo_gstate_t *gstate,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_status_t status;
+
+ status = _cairo_surface_get_extents (gstate->target, rectangle);
+ if (status)
+ return status;
+ /* check path extents here */
+
+ if (gstate->clip.region) {
+ pixman_box16_t *clip_box;
+ cairo_rectangle_t clip_rect;
+
+ /* get region extents as a box */
+ clip_box = pixman_region_extents (gstate->clip.region);
+ /* convert to a rectangle */
+ clip_rect.x = clip_box->x1;
+ clip_rect.width = clip_box->x2 - clip_box->x1;
+ clip_rect.y = clip_box->y1;
+ clip_rect.height = clip_box->y2 - clip_box->y1;
+ /* intersect with surface extents */
+ _cairo_rectangle_intersect (rectangle, &clip_rect);
+ }
+
+ if (gstate->clip.surface)
+ _cairo_rectangle_intersect (rectangle, &gstate->clip.surface_rect);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_surface_t *
+_cairo_gstate_get_target (cairo_gstate_t *gstate)
+{
+ if (gstate == NULL)
+ return NULL;
+
+ return gstate->target;
+}
+
+cairo_status_t
+_cairo_gstate_set_source (cairo_gstate_t *gstate,
+ cairo_pattern_t *source)
+{
+ if (source->status)
+ return source->status;
+
+ cairo_pattern_reference (source);
+ cairo_pattern_destroy (gstate->source);
+ gstate->source = source;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_pattern_t *
+_cairo_gstate_get_source (cairo_gstate_t *gstate)
+{
+ if (gstate == NULL)
+ return NULL;
+
+ return gstate->source;
+}
+
+cairo_status_t
+_cairo_gstate_set_operator (cairo_gstate_t *gstate, cairo_operator_t operator)
+{
+ gstate->operator = operator;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_operator_t
+_cairo_gstate_get_operator (cairo_gstate_t *gstate)
+{
+ return gstate->operator;
+}
+
+cairo_status_t
+_cairo_gstate_set_tolerance (cairo_gstate_t *gstate, double tolerance)
+{
+ gstate->tolerance = tolerance;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+double
+_cairo_gstate_get_tolerance (cairo_gstate_t *gstate)
+{
+ return gstate->tolerance;
+}
+
+cairo_status_t
+_cairo_gstate_set_fill_rule (cairo_gstate_t *gstate, cairo_fill_rule_t fill_rule)
+{
+ gstate->fill_rule = fill_rule;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_fill_rule_t
+_cairo_gstate_get_fill_rule (cairo_gstate_t *gstate)
+{
+ return gstate->fill_rule;
+}
+
+cairo_status_t
+_cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width)
+{
+ gstate->line_width = width;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+double
+_cairo_gstate_get_line_width (cairo_gstate_t *gstate)
+{
+ return gstate->line_width;
+}
+
+cairo_status_t
+_cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap)
+{
+ gstate->line_cap = line_cap;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_line_cap_t
+_cairo_gstate_get_line_cap (cairo_gstate_t *gstate)
+{
+ return gstate->line_cap;
+}
+
+cairo_status_t
+_cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join)
+{
+ gstate->line_join = line_join;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_line_join_t
+_cairo_gstate_get_line_join (cairo_gstate_t *gstate)
+{
+ return gstate->line_join;
+}
+
+cairo_status_t
+_cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, double offset)
+{
+ if (gstate->dash) {
+ free (gstate->dash);
+ gstate->dash = NULL;
+ }
+
+ gstate->num_dashes = num_dashes;
+ if (gstate->num_dashes) {
+ gstate->dash = malloc (gstate->num_dashes * sizeof (double));
+ if (gstate->dash == NULL) {
+ gstate->num_dashes = 0;
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+ }
+
+ memcpy (gstate->dash, dash, gstate->num_dashes * sizeof (double));
+ gstate->dash_offset = offset;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit)
+{
+ gstate->miter_limit = limit;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+double
+_cairo_gstate_get_miter_limit (cairo_gstate_t *gstate)
+{
+ return gstate->miter_limit;
+}
+
+void
+_cairo_gstate_get_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
+{
+ *matrix = gstate->ctm;
+}
+
+cairo_status_t
+_cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty)
+{
+ cairo_matrix_t tmp;
+
+ _cairo_gstate_unset_font (gstate);
+
+ cairo_matrix_init_translate (&tmp, tx, ty);
+ cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
+
+ cairo_matrix_init_translate (&tmp, -tx, -ty);
+ cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy)
+{
+ cairo_matrix_t tmp;
+
+ if (sx == 0 || sy == 0)
+ return CAIRO_STATUS_INVALID_MATRIX;
+
+ _cairo_gstate_unset_font (gstate);
+
+ cairo_matrix_init_scale (&tmp, sx, sy);
+ cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
+
+ cairo_matrix_init_scale (&tmp, 1/sx, 1/sy);
+ cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_rotate (cairo_gstate_t *gstate, double angle)
+{
+ cairo_matrix_t tmp;
+
+ _cairo_gstate_unset_font (gstate);
+
+ cairo_matrix_init_rotate (&tmp, angle);
+ cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
+
+ cairo_matrix_init_rotate (&tmp, -angle);
+ cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_transform (cairo_gstate_t *gstate,
+ const cairo_matrix_t *matrix)
+{
+ cairo_matrix_t tmp;
+
+ _cairo_gstate_unset_font (gstate);
+
+ tmp = *matrix;
+ cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
+
+ cairo_matrix_invert (&tmp);
+ cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_set_matrix (cairo_gstate_t *gstate,
+ const cairo_matrix_t *matrix)
+{
+ cairo_status_t status;
+
+ _cairo_gstate_unset_font (gstate);
+
+ gstate->ctm = *matrix;
+
+ gstate->ctm_inverse = *matrix;
+ status = cairo_matrix_invert (&gstate->ctm_inverse);
+ if (status)
+ return status;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_identity_matrix (cairo_gstate_t *gstate)
+{
+ _cairo_gstate_unset_font (gstate);
+
+ cairo_matrix_init_identity (&gstate->ctm);
+ cairo_matrix_init_identity (&gstate->ctm_inverse);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_user_to_device (cairo_gstate_t *gstate, double *x, double *y)
+{
+ cairo_matrix_transform_point (&gstate->ctm, x, y);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_user_to_device_distance (cairo_gstate_t *gstate,
+ double *dx, double *dy)
+{
+ cairo_matrix_transform_distance (&gstate->ctm, dx, dy);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_device_to_user (cairo_gstate_t *gstate, double *x, double *y)
+{
+ cairo_matrix_transform_point (&gstate->ctm_inverse, x, y);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_device_to_user_distance (cairo_gstate_t *gstate,
+ double *dx, double *dy)
+{
+ cairo_matrix_transform_distance (&gstate->ctm_inverse, dx, dy);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+void
+_cairo_gstate_user_to_backend (cairo_gstate_t *gstate, double *x, double *y)
+{
+ cairo_matrix_transform_point (&gstate->ctm, x, y);
+ if (gstate->target) {
+ *x += gstate->target->device_x_offset;
+ *y += gstate->target->device_y_offset;
+ }
+}
+
+void
+_cairo_gstate_backend_to_user (cairo_gstate_t *gstate, double *x, double *y)
+{
+ if (gstate->target) {
+ *x -= gstate->target->device_x_offset;
+ *y -= gstate->target->device_y_offset;
+ }
+ cairo_matrix_transform_point (&gstate->ctm_inverse, x, y);
+}
+
+/* XXX: NYI
+cairo_status_t
+_cairo_gstate_stroke_to_path (cairo_gstate_t *gstate)
+{
+ cairo_status_t status;
+
+ _cairo_pen_init (&gstate);
+ return CAIRO_STATUS_SUCCESS;
+}
+*/
+
+static void
+_cairo_gstate_pattern_transform (cairo_gstate_t *gstate,
+ cairo_pattern_t *pattern)
+{
+ cairo_matrix_t tmp_matrix = gstate->ctm_inverse;
+
+ if (gstate->target)
+ cairo_matrix_translate (&tmp_matrix,
+ - gstate->target->device_x_offset,
+ - gstate->target->device_y_offset);
+
+ _cairo_pattern_transform (pattern, &tmp_matrix);
+}
+
+cairo_status_t
+_cairo_gstate_paint (cairo_gstate_t *gstate)
+{
+ cairo_rectangle_t rectangle;
+ cairo_status_t status;
+ cairo_box_t box;
+ cairo_traps_t traps;
+
+ if (gstate->source->status)
+ return gstate->source->status;
+
+ status = _cairo_gstate_set_clip (gstate);
+ if (status)
+ return status;
+
+ status = _cairo_gstate_get_clip_extents (gstate, &rectangle);
+ if (status)
+ return status;
+
+ box.p1.x = _cairo_fixed_from_int (rectangle.x);
+ box.p1.y = _cairo_fixed_from_int (rectangle.y);
+ box.p2.x = _cairo_fixed_from_int (rectangle.x + rectangle.width);
+ box.p2.y = _cairo_fixed_from_int (rectangle.y + rectangle.height);
+ status = _cairo_traps_init_box (&traps, &box);
+ if (status)
+ return status;
+
+ _cairo_gstate_clip_and_composite_trapezoids (gstate,
+ gstate->source,
+ gstate->operator,
+ gstate->target,
+ &traps);
+
+ _cairo_traps_fini (&traps);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/* Combines @gstate->clip_surface using the IN operator with
+ * the given intermediate surface, which corresponds to the
+ * rectangle of the destination space given by @extents.
+ */
+static cairo_status_t
+_cairo_gstate_combine_clip_surface (cairo_gstate_t *gstate,
+ cairo_surface_t *intermediate,
+ cairo_rectangle_t *extents)
+{
+ cairo_pattern_union_t pattern;
+ cairo_status_t status;
+
+ _cairo_pattern_init_for_surface (&pattern.surface,
+ gstate->clip.surface);
+
+ status = _cairo_surface_composite (CAIRO_OPERATOR_IN,
+ &pattern.base,
+ NULL,
+ intermediate,
+ extents->x - gstate->clip.surface_rect.x,
+ extents->y - gstate->clip.surface_rect.y,
+ 0, 0,
+ 0, 0,
+ extents->width, extents->height);
+
+ _cairo_pattern_fini (&pattern.base);
+
+ return status;
+}
+
+/* Creates a region from a cairo_rectangle_t */
+static cairo_status_t
+_region_new_from_rect (cairo_rectangle_t *rect,
+ pixman_region16_t **region)
+{
+ *region = pixman_region_create ();
+ if (pixman_region_union_rect (*region, *region,
+ rect->x, rect->y,
+ rect->width, rect->height) != PIXMAN_REGION_STATUS_SUCCESS) {
+ pixman_region_destroy (*region);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/* Gets the bounding box of a region as a cairo_rectangle_t */
+static void
+_region_rect_extents (pixman_region16_t *region,
+ cairo_rectangle_t *rect)
+{
+ pixman_box16_t *region_extents = pixman_region_extents (region);
+
+ rect->x = region_extents->x1;
+ rect->y = region_extents->y1;
+ rect->width = region_extents->x2 - region_extents->x1;
+ rect->height = region_extents->y2 - region_extents->y1;
+}
+
+/* Intersects @region with the clipping bounds (both region
+ * and surface) of @gstate
+ */
+static cairo_status_t
+_cairo_gstate_intersect_clip (cairo_gstate_t *gstate,
+ pixman_region16_t *region)
+{
+ if (gstate->clip.region)
+ pixman_region_intersect (region, gstate->clip.region, region);
+
+ if (gstate->clip.surface) {
+ pixman_region16_t *clip_rect;
+ cairo_status_t status;
+
+ status = _region_new_from_rect (&gstate->clip.surface_rect, &clip_rect);
+ if (status)
+ return status;
+
+ if (pixman_region_intersect (region,
+ clip_rect,
+ region) != PIXMAN_REGION_STATUS_SUCCESS)
+ status = CAIRO_STATUS_NO_MEMORY;
+
+ pixman_region_destroy (clip_rect);
+
+ if (status)
+ return status;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_get_mask_extents (cairo_gstate_t *gstate,
+ cairo_pattern_t *mask,
+ cairo_rectangle_t *extents)
+{
+ /*
+ * XXX should take mask extents into account, but
+ * that involves checking the transform... For now,
+ * be lazy and just use the destination extents
+ */
+ return _cairo_gstate_get_clip_extents (gstate, extents);
+}
+
+cairo_status_t
+_cairo_gstate_mask (cairo_gstate_t *gstate,
+ cairo_pattern_t *mask)
+{
+ cairo_rectangle_t extents;
+ cairo_pattern_union_t pattern;
+ cairo_surface_pattern_t intermediate_pattern;
+ cairo_pattern_t *effective_mask;
+ cairo_status_t status;
+ int mask_x, mask_y;
+
+ if (mask->status)
+ return mask->status;
+
+ if (gstate->source->status)
+ return gstate->source->status;
+
+ status = _cairo_gstate_set_clip (gstate);
+ if (status)
+ return status;
+
+ _get_mask_extents (gstate, mask, &extents);
+
+ if (gstate->clip.surface) {
+ /* When there is clip surface, we'll need to create a
+ * temporary surface that combines the clip and mask
+ */
+ cairo_surface_t *intermediate;
+
+ intermediate = cairo_surface_create_similar (gstate->clip.surface,
+ CAIRO_FORMAT_A8,
+ extents.width,
+ extents.height);
+ if (intermediate == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE,
+ mask, NULL, intermediate,
+ extents.x, extents.y,
+ 0, 0,
+ 0, 0,
+ extents.width, extents.height);
+ if (status) {
+ cairo_surface_destroy (intermediate);
+ return status;
+ }
+
+ status = _cairo_gstate_combine_clip_surface (gstate, intermediate, &extents);
+ if (status) {
+ cairo_surface_destroy (intermediate);
+ return status;
+ }
+
+ _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
+ cairo_surface_destroy (intermediate);
+
+ effective_mask = &intermediate_pattern.base;
+ mask_x = extents.x;
+ mask_y = extents.y;
+
+ } else {
+ effective_mask = mask;
+ mask_x = mask_y = 0;
+ }
+
+ _cairo_pattern_init_copy (&pattern.base, gstate->source);
+ _cairo_gstate_pattern_transform (gstate, &pattern.base);
+
+ status = _cairo_surface_composite (gstate->operator,
+ &pattern.base,
+ effective_mask,
+ gstate->target,
+ extents.x, extents.y,
+ extents.x - mask_x, extents.y - mask_y,
+ extents.x, extents.y,
+ extents.width, extents.height);
+
+ if (gstate->clip.surface)
+ _cairo_pattern_fini (&intermediate_pattern.base);
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
+{
+ cairo_status_t status;
+ cairo_traps_t traps;
+
+ if (gstate->source->status)
+ return gstate->source->status;
+
+ if (gstate->line_width <= 0.0)
+ return CAIRO_STATUS_SUCCESS;
+
+ status = _cairo_gstate_set_clip (gstate);
+ if (status)
+ return status;
+
+ _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);
+
+ _cairo_traps_init (&traps);
+
+ status = _cairo_path_fixed_stroke_to_traps (path, gstate, &traps);
+ if (status) {
+ _cairo_traps_fini (&traps);
+ return status;
+ }
+
+ _cairo_gstate_clip_and_composite_trapezoids (gstate,
+ gstate->source,
+ gstate->operator,
+ gstate->target,
+ &traps);
+
+ _cairo_traps_fini (&traps);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_in_stroke (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
+ double x,
+ double y,
+ cairo_bool_t *inside_ret)
+{
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+ cairo_traps_t traps;
+
+ _cairo_gstate_user_to_backend (gstate, &x, &y);
+
+ _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);
+
+ _cairo_traps_init (&traps);
+
+ status = _cairo_path_fixed_stroke_to_traps (path, gstate, &traps);
+ if (status)
+ goto BAIL;
+
+ *inside_ret = _cairo_traps_contain (&traps, x, y);
+
+BAIL:
+ _cairo_traps_fini (&traps);
+
+ return status;
+}
+
+/* XXX We currently have a confusing mix of boxes and rectangles as
+ * exemplified by this function. A cairo_box_t is a rectangular area
+ * represented by the coordinates of the upper left and lower right
+ * corners, expressed in fixed point numbers. A cairo_rectangle_t is
+ * also a rectangular area, but represented by the upper left corner
+ * and the width and the height, as integer numbers.
+ *
+ * This function converts a cairo_box_t to a cairo_rectangle_t by
+ * increasing the area to the nearest integer coordinates. We should
+ * standardize on cairo_rectangle_t and cairo_rectangle_fixed_t, and
+ * this function could be renamed to the more reasonable
+ * _cairo_rectangle_fixed_round.
+ */
+
+static void
+_cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_t *rectangle)
+{
+ rectangle->x = _cairo_fixed_integer_floor (box->p1.x);
+ rectangle->y = _cairo_fixed_integer_floor (box->p1.y);
+ rectangle->width = _cairo_fixed_integer_ceil (box->p2.x) - rectangle->x;
+ rectangle->height = _cairo_fixed_integer_ceil (box->p2.y) - rectangle->y;
+}
+
+static void
+_cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src)
+{
+ int x1, y1, x2, y2;
+
+ x1 = MAX (dest->x, src->x);
+ y1 = MAX (dest->y, src->y);
+ x2 = MIN (dest->x + dest->width, src->x + src->width);
+ y2 = MIN (dest->y + dest->height, src->y + src->height);
+
+ if (x1 >= x2 || y1 >= y2) {
+ dest->x = 0;
+ dest->y = 0;
+ dest->width = 0;
+ dest->height = 0;
+ } else {
+ dest->x = x1;
+ dest->y = y1;
+ dest->width = x2 - x1;
+ dest->height = y2 - y1;
+ }
+}
+
+static int
+_cairo_rectangle_empty (cairo_rectangle_t *rect)
+{
+ return rect->width == 0 || rect->height == 0;
+}
+
+/* Given a region representing a set of trapezoids that will be
+ * drawn, clip the region according to the gstate and compute
+ * the overall extents.
+ */
+static cairo_status_t
+_clip_and_compute_extents_region (cairo_gstate_t *gstate,
+ pixman_region16_t *trap_region,
+ cairo_rectangle_t *extents)
+{
+ cairo_status_t status;
+
+ status = _cairo_gstate_intersect_clip (gstate, trap_region);
+ if (status)
+ return status;
+
+ _region_rect_extents (trap_region, extents);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/* Given a a set of trapezoids to draw, find a bounding box (non-exact)
+ * of the trapezoids clipped by the gstate
+ */
+static cairo_status_t
+_clip_and_compute_extents_arbitrary (cairo_gstate_t *gstate,
+ cairo_traps_t *traps,
+ cairo_rectangle_t *extents)
+{
+ cairo_box_t trap_extents;
+
+ _cairo_traps_extents (traps, &trap_extents);
+ _cairo_box_round_to_rectangle (&trap_extents, extents);
+
+ if (gstate->clip.region) {
+ pixman_region16_t *intersection;
+ cairo_status_t status;
+
+ status = _region_new_from_rect (extents, &intersection);
+ if (status)
+ return status;
+
+ if (pixman_region_intersect (intersection,
+ gstate->clip.region,
+ intersection) == PIXMAN_REGION_STATUS_SUCCESS)
+ {
+ _region_rect_extents (intersection, extents);
+ }
+ else
+ {
+ status = CAIRO_STATUS_NO_MEMORY;
+ }
+
+ pixman_region_destroy (intersection);
+
+ if (status)
+ return status;
+ }
+
+ if (gstate->clip.surface)
+ _cairo_rectangle_intersect (extents, &gstate->clip.surface_rect);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/* Composites a region representing a set of trapezoids.
+ */
+static cairo_status_t
+_composite_trap_region (cairo_gstate_t *gstate,
+ cairo_pattern_t *src,
+ cairo_operator_t operator,
+ cairo_surface_t *dst,
+ pixman_region16_t *trap_region,
+ cairo_rectangle_t *extents)
+{
+ cairo_status_t status;
+ cairo_pattern_union_t pattern;
+ cairo_pattern_union_t mask;
+ int num_rects = pixman_region_num_rects (trap_region);
+ unsigned int clip_serial;
+
+ if (num_rects == 0)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (num_rects > 1) {
+
+ if (gstate->clip.mode != CAIRO_CLIP_MODE_REGION)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ clip_serial = _cairo_surface_allocate_clip_serial (gstate->target);
+ status = _cairo_surface_set_clip_region (gstate->target,
+ trap_region,
+ clip_serial);
+ if (status)
+ return status;
+ }
+
+ _cairo_pattern_init_copy (&pattern.base, src);
+ _cairo_gstate_pattern_transform (gstate, &pattern.base);
+
+ if (gstate->clip.surface)
+ _cairo_pattern_init_for_surface (&mask.surface, gstate->clip.surface);
+
+ status = _cairo_surface_composite (gstate->operator,
+ &pattern.base,
+ gstate->clip.surface ? &mask.base : NULL,
+ dst,
+ extents->x, extents->y,
+ extents->x - (gstate->clip.surface ? gstate->clip.surface_rect.x : 0),
+ extents->y - (gstate->clip.surface ? gstate->clip.surface_rect.y : 0),
+ extents->x, extents->y,
+ extents->width, extents->height);
+
+ _cairo_pattern_fini (&pattern.base);
+ if (gstate->clip.surface)
+ _cairo_pattern_fini (&mask.base);
+
+ return status;
+}
+
+static void
+translate_traps (cairo_traps_t *traps, int x, int y)
+{
+ cairo_fixed_t xoff, yoff;
+ cairo_trapezoid_t *t;
+ int i;
+
+ /* Ugh. The cairo_composite/(Render) interface doesn't allow
+ an offset for the trapezoids. Need to manually shift all
+ the coordinates to align with the offset origin of the
+ intermediate surface. */
+
+ xoff = _cairo_fixed_from_int (x);
+ yoff = _cairo_fixed_from_int (y);
+
+ for (i = 0, t = traps->traps; i < traps->num_traps; i++, t++) {
+ t->top += yoff;
+ t->bottom += yoff;
+ t->left.p1.x += xoff;
+ t->left.p1.y += yoff;
+ t->left.p2.x += xoff;
+ t->left.p2.y += yoff;
+ t->right.p1.x += xoff;
+ t->right.p1.y += yoff;
+ t->right.p2.x += xoff;
+ t->right.p2.y += yoff;
+ }
+}
+
+/* Composites a set of trapezoids in the case where we need to create
+ * an intermediate surface to handle gstate->clip.surface
+ *
+ * Warning: This call modifies the coordinates of traps
+ */
+static cairo_status_t
+_composite_traps_intermediate_surface (cairo_gstate_t *gstate,
+ cairo_pattern_t *src,
+ cairo_operator_t operator,
+ cairo_surface_t *dst,
+ cairo_traps_t *traps,
+ cairo_rectangle_t *extents)
+{
+ cairo_pattern_union_t pattern;
+ cairo_surface_t *intermediate;
+ cairo_surface_pattern_t intermediate_pattern;
+ cairo_status_t status;
+
+ translate_traps (traps, -extents->x, -extents->y);
+
+ intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface,
+ CAIRO_FORMAT_A8,
+ extents->width,
+ extents->height,
+ CAIRO_COLOR_TRANSPARENT);
+ if (intermediate == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
+
+ status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_ADD,
+ &pattern.base,
+ intermediate,
+ extents->x, extents->y,
+ 0, 0,
+ extents->width,
+ extents->height,
+ traps->traps,
+ traps->num_traps);
+ _cairo_pattern_fini (&pattern.base);
+
+ if (status)
+ goto out;
+
+ status = _cairo_gstate_combine_clip_surface (gstate, intermediate, extents);
+ if (status)
+ goto out;
+
+ _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
+ _cairo_pattern_init_copy (&pattern.base, src);
+ _cairo_gstate_pattern_transform (gstate, &pattern.base);
+
+ status = _cairo_surface_composite (operator,
+ &pattern.base,
+ &intermediate_pattern.base,
+ dst,
+ extents->x, extents->y,
+ 0, 0,
+ extents->x, extents->y,
+ extents->width, extents->height);
+
+ _cairo_pattern_fini (&pattern.base);
+ _cairo_pattern_fini (&intermediate_pattern.base);
+
+ out:
+ cairo_surface_destroy (intermediate);
+
+ return status;
+}
+
+/* Composites a region representing a set of trapezoids in the
+ * case of a solid source (so we can use
+ * _cairo_surface_fill_rectangles).
+ */
+static cairo_status_t
+_composite_trap_region_solid (cairo_gstate_t *gstate,
+ cairo_solid_pattern_t *src,
+ cairo_operator_t operator,
+ cairo_surface_t *dst,
+ pixman_region16_t *region)
+{
+ int num_rects = pixman_region_num_rects (region);
+ pixman_box16_t *boxes = pixman_region_rects (region);
+ cairo_rectangle_t *rects;
+ cairo_status_t status;
+ int i;
+
+ if (!num_rects)
+ return CAIRO_STATUS_SUCCESS;
+
+ rects = malloc (sizeof (pixman_rectangle_t) * num_rects);
+ if (!rects)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ for (i = 0; i < num_rects; i++) {
+ rects[i].x = boxes[i].x1;
+ rects[i].y = boxes[i].y1;
+ rects[i].width = boxes[i].x2 - boxes[i].x1;
+ rects[i].height = boxes[i].y2 - boxes[i].y1;
+ }
+
+ status = _cairo_surface_fill_rectangles (dst, operator,
+ &src->color, rects, num_rects);
+
+ free (rects);
+
+ return status;
+}
+
+/* Composites a set of trapezoids in the general case where
+ gstate->clip.surface == NULL
+ */
+static cairo_status_t
+_composite_traps (cairo_gstate_t *gstate,
+ cairo_pattern_t *src,
+ cairo_operator_t operator,
+ cairo_surface_t *dst,
+ cairo_traps_t *traps,
+ cairo_rectangle_t *extents)
+{
+ cairo_pattern_union_t pattern;
+ cairo_status_t status;
+
+ _cairo_pattern_init_copy (&pattern.base, src);
+ _cairo_gstate_pattern_transform (gstate, &pattern.base);
+
+ status = _cairo_surface_composite_trapezoids (gstate->operator,
+ &pattern.base, dst,
+ extents->x, extents->y,
+ extents->x, extents->y,
+ extents->width,
+ extents->height,
+ traps->traps,
+ traps->num_traps);
+
+ _cairo_pattern_fini (&pattern.base);
+
+ return status;
+}
+
+/* Warning: This call modifies the coordinates of traps */
+static cairo_status_t
+_cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate,
+ cairo_pattern_t *src,
+ cairo_operator_t operator,
+ cairo_surface_t *dst,
+ cairo_traps_t *traps)
+{
+ cairo_status_t status;
+ pixman_region16_t *trap_region;
+ cairo_rectangle_t extents;
+
+ if (traps->num_traps == 0)
+ return CAIRO_STATUS_SUCCESS;
+
+ if (gstate->target == NULL)
+ return CAIRO_STATUS_NO_TARGET_SURFACE;
+
+ status = _cairo_traps_extract_region (traps, &trap_region);
+ if (status)
+ return status;
+
+ if (trap_region)
+ status = _clip_and_compute_extents_region (gstate, trap_region, &extents);
+ else
+ status = _clip_and_compute_extents_arbitrary (gstate, traps, &extents);
+
+ if (status)
+ goto out;
+
+ if (_cairo_rectangle_empty (&extents))
+ /* Nothing to do */
+ goto out;
+
+ if (gstate->clip.surface) {
+ if (trap_region) {
+ /* If we are compositing a set of rectangles, we can set them as the
+ * clip region for the destination surface and use the clip surface
+ * as the mask. A clip region might not be supported, in which case
+ * we fall through to the next method
+ */
+ status = _composite_trap_region (gstate, src, operator, dst,
+ trap_region, &extents);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ goto out;
+ }
+
+ /* Handle a clip surface by creating an intermediate surface. */
+ status = _composite_traps_intermediate_surface (gstate, src, operator,
+ dst, traps, &extents);
+ } else {
+ /* No clip surface */
+ if (trap_region && src->type == CAIRO_PATTERN_SOLID) {
+ /* Solid rectangles are handled specially */
+ status = _composite_trap_region_solid (gstate, (cairo_solid_pattern_t *)src,
+ operator, dst, trap_region);
+ } else {
+ if (trap_region) {
+ /* For a simple rectangle, we can just use composite(), for more
+ * rectangles, we have to set a clip region. The cost of rasterizing
+ * trapezoids is pretty high for most backends currently, so it's
+ * worthwhile even if a region is needed.
+ */
+ status = _composite_trap_region (gstate, src, operator, dst,
+ trap_region, &extents);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ goto out;
+
+ /* If a clip regions aren't supported, fall through */
+ }
+
+ status = _composite_traps (gstate, src, operator,
+ dst, traps, &extents);
+ }
+ }
+
+ out:
+ if (trap_region)
+ pixman_region_destroy (trap_region);
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
+{
+ cairo_status_t status;
+ cairo_traps_t traps;
+
+ if (gstate->source->status)
+ return gstate->source->status;
+
+ status = _cairo_gstate_set_clip (gstate);
+ if (status)
+ return status;
+
+ status = _cairo_surface_fill_path (gstate->operator,
+ gstate->source,
+ gstate->target,
+ path,
+ gstate->fill_rule,
+ gstate->tolerance);
+
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+
+ _cairo_traps_init (&traps);
+
+ status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps);
+ if (status) {
+ _cairo_traps_fini (&traps);
+ return status;
+ }
+
+ _cairo_gstate_clip_and_composite_trapezoids (gstate,
+ gstate->source,
+ gstate->operator,
+ gstate->target,
+ &traps);
+
+ _cairo_traps_fini (&traps);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_in_fill (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
+ double x,
+ double y,
+ cairo_bool_t *inside_ret)
+{
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+ cairo_traps_t traps;
+
+ _cairo_gstate_user_to_backend (gstate, &x, &y);
+
+ _cairo_traps_init (&traps);
+
+ status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps);
+ if (status)
+ goto BAIL;
+
+ *inside_ret = _cairo_traps_contain (&traps, x, y);
+
+BAIL:
+ _cairo_traps_fini (&traps);
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_copy_page (cairo_gstate_t *gstate)
+{
+ if (gstate->target == NULL)
+ return CAIRO_STATUS_NO_TARGET_SURFACE;
+
+ return _cairo_surface_copy_page (gstate->target);
+}
+
+cairo_status_t
+_cairo_gstate_show_page (cairo_gstate_t *gstate)
+{
+ if (gstate->target == NULL)
+ return CAIRO_STATUS_NO_TARGET_SURFACE;
+
+ return _cairo_surface_show_page (gstate->target);
+}
+
+cairo_status_t
+_cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
+ double *x1, double *y1,
+ double *x2, double *y2)
+{
+ cairo_status_t status;
+ cairo_traps_t traps;
+ cairo_box_t extents;
+
+ _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);
+
+ _cairo_traps_init (&traps);
+
+ status = _cairo_path_fixed_stroke_to_traps (path, gstate, &traps);
+ if (status)
+ goto BAIL;
+
+ _cairo_traps_extents (&traps, &extents);
+
+ *x1 = _cairo_fixed_to_double (extents.p1.x);
+ *y1 = _cairo_fixed_to_double (extents.p1.y);
+ *x2 = _cairo_fixed_to_double (extents.p2.x);
+ *y2 = _cairo_fixed_to_double (extents.p2.y);
+
+ _cairo_gstate_backend_to_user (gstate, x1, y1);
+ _cairo_gstate_backend_to_user (gstate, x2, y2);
+
+BAIL:
+ _cairo_traps_fini (&traps);
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_fill_extents (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
+ double *x1, double *y1,
+ double *x2, double *y2)
+{
+ cairo_status_t status;
+ cairo_traps_t traps;
+ cairo_box_t extents;
+
+ _cairo_traps_init (&traps);
+
+ status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps);
+ if (status)
+ goto BAIL;
+
+ _cairo_traps_extents (&traps, &extents);
+
+ *x1 = _cairo_fixed_to_double (extents.p1.x);
+ *y1 = _cairo_fixed_to_double (extents.p1.y);
+ *x2 = _cairo_fixed_to_double (extents.p2.x);
+ *y2 = _cairo_fixed_to_double (extents.p2.y);
+
+ _cairo_gstate_backend_to_user (gstate, x1, y1);
+ _cairo_gstate_backend_to_user (gstate, x2, y2);
+
+BAIL:
+ _cairo_traps_fini (&traps);
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_reset_clip (cairo_gstate_t *gstate)
+{
+ /* destroy any existing clip-region artifacts */
+ if (gstate->clip.surface)
+ cairo_surface_destroy (gstate->clip.surface);
+ gstate->clip.surface = NULL;
+
+ if (gstate->clip.region)
+ pixman_region_destroy (gstate->clip.region);
+ gstate->clip.region = NULL;
+
+ if (gstate->clip.path)
+ _cairo_clip_path_destroy (gstate->clip.path);
+ gstate->clip.path = NULL;
+
+ gstate->clip.serial = 0;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_gstate_intersect_clip_path (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path)
+{
+ cairo_clip_path_t *clip_path;
+ cairo_status_t status;
+
+ if (gstate->clip.mode != CAIRO_CLIP_MODE_PATH)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ clip_path = malloc (sizeof (cairo_clip_path_t));
+ if (clip_path == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ status = _cairo_path_fixed_init_copy (&clip_path->path, path);
+ if (status)
+ return status;
+
+ clip_path->ref_count = 1;
+ clip_path->fill_rule = gstate->fill_rule;
+ clip_path->tolerance = gstate->tolerance;
+ clip_path->prev = gstate->clip.path;
+ gstate->clip.path = clip_path;
+ gstate->clip.serial = _cairo_surface_allocate_clip_serial (gstate->target);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_clip_path_reference (cairo_clip_path_t *clip_path)
+{
+ if (clip_path == NULL)
+ return;
+
+ clip_path->ref_count++;
+}
+
+static void
+_cairo_clip_path_destroy (cairo_clip_path_t *clip_path)
+{
+ if (clip_path == NULL)
+ return;
+
+ clip_path->ref_count--;
+ if (clip_path->ref_count)
+ return;
+
+ _cairo_path_fixed_fini (&clip_path->path);
+ _cairo_clip_path_destroy (clip_path->prev);
+ free (clip_path);
+}
+
+static cairo_status_t
+_cairo_gstate_intersect_clip_region (cairo_gstate_t *gstate,
+ cairo_traps_t *traps)
+{
+ pixman_region16_t *region;
+ cairo_status_t status;
+
+ if (gstate->clip.mode != CAIRO_CLIP_MODE_REGION)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ status = _cairo_traps_extract_region (traps, &region);
+ if (status)
+ return status;
+
+ if (region == NULL)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ status = CAIRO_STATUS_SUCCESS;
+ if (gstate->clip.region == NULL) {
+ gstate->clip.region = region;
+ } else {
+ pixman_region16_t *intersection = pixman_region_create();
+
+ if (pixman_region_intersect (intersection,
+ gstate->clip.region, region)
+ == PIXMAN_REGION_STATUS_SUCCESS) {
+ pixman_region_destroy (gstate->clip.region);
+ gstate->clip.region = intersection;
+ } else {
+ status = CAIRO_STATUS_NO_MEMORY;
+ }
+ pixman_region_destroy (region);
+ }
+ gstate->clip.serial = _cairo_surface_allocate_clip_serial (gstate->target);
+ return status;
+}
+
+static cairo_status_t
+_cairo_gstate_intersect_clip_mask (cairo_gstate_t *gstate,
+ cairo_traps_t *traps)
+{
+ cairo_pattern_union_t pattern;
+ cairo_box_t extents;
+ cairo_rectangle_t surface_rect;
+ cairo_surface_t *surface;
+ cairo_status_t status;
+
+ /* Represent the clip as a mask surface. We create a new surface
+ * the size of the intersection of the old mask surface and the
+ * extents of the new clip path. */
+
+ _cairo_traps_extents (traps, &extents);
+ _cairo_box_round_to_rectangle (&extents, &surface_rect);
+
+ if (gstate->clip.surface != NULL)
+ _cairo_rectangle_intersect (&surface_rect, &gstate->clip.surface_rect);
+
+ surface = _cairo_surface_create_similar_solid (gstate->target,
+ CAIRO_FORMAT_A8,
+ surface_rect.width,
+ surface_rect.height,
+ CAIRO_COLOR_WHITE);
+ if (surface == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ /* Render the new clipping path into the new mask surface. */
+
+ translate_traps (traps, -surface_rect.x, -surface_rect.y);
+ _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
+
+ status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN,
+ &pattern.base,
+ surface,
+ 0, 0,
+ 0, 0,
+ surface_rect.width,
+ surface_rect.height,
+ traps->traps,
+ traps->num_traps);
+
+ _cairo_pattern_fini (&pattern.base);
+
+ if (status) {
+ cairo_surface_destroy (surface);
+ return status;
+ }
+
+ /* If there was a clip surface already, combine it with the new
+ * mask surface using the IN operator, so we get the intersection
+ * of the old and new clipping paths. */
+
+ if (gstate->clip.surface != NULL) {
+ _cairo_pattern_init_for_surface (&pattern.surface, gstate->clip.surface);
+
+ status = _cairo_surface_composite (CAIRO_OPERATOR_IN,
+ &pattern.base,
+ NULL,
+ surface,
+ surface_rect.x - gstate->clip.surface_rect.x,
+ surface_rect.y - gstate->clip.surface_rect.y,
+ 0, 0,
+ 0, 0,
+ surface_rect.width,
+ surface_rect.height);
+
+ _cairo_pattern_fini (&pattern.base);
+
+ if (status) {
+ cairo_surface_destroy (surface);
+ return status;
+ }
+
+ cairo_surface_destroy (gstate->clip.surface);
+ }
+
+ gstate->clip.surface = surface;
+ gstate->clip.surface_rect = surface_rect;
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_clip (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
+{
+ cairo_status_t status;
+ cairo_traps_t traps;
+
+ status = _cairo_gstate_intersect_clip_path (gstate, path);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+
+ _cairo_traps_init (&traps);
+ status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps);
+ if (status)
+ goto bail;
+
+ status = _cairo_gstate_intersect_clip_region (gstate, &traps);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ goto bail;
+
+ status = _cairo_gstate_intersect_clip_mask (gstate, &traps);
+
+ bail:
+ _cairo_traps_fini (&traps);
+
+ return status;
+}
+
+static void
+_cairo_gstate_unset_font (cairo_gstate_t *gstate)
+{
+ if (gstate->scaled_font) {
+ cairo_scaled_font_destroy (gstate->scaled_font);
+ gstate->scaled_font = NULL;
+ }
+}
+
+cairo_status_t
+_cairo_gstate_select_font_face (cairo_gstate_t *gstate,
+ const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight)
+{
+ cairo_font_face_t *font_face;
+
+ font_face = _cairo_simple_font_face_create (family, slant, weight);
+ if (!font_face)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ _cairo_gstate_set_font_face (gstate, font_face);
+ cairo_font_face_destroy (font_face);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_set_font_size (cairo_gstate_t *gstate,
+ double size)
+{
+ _cairo_gstate_unset_font (gstate);
+
+ cairo_matrix_init_scale (&gstate->font_matrix, size, size);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
+ const cairo_matrix_t *matrix)
+{
+ _cairo_gstate_unset_font (gstate);
+
+ gstate->font_matrix = *matrix;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+void
+_cairo_gstate_get_font_matrix (cairo_gstate_t *gstate,
+ cairo_matrix_t *matrix)
+{
+ *matrix = gstate->font_matrix;
+}
+
+cairo_status_t
+_cairo_gstate_get_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t **font_face)
+{
+ cairo_status_t status;
+
+ status = _cairo_gstate_ensure_font_face (gstate);
+ if (status)
+ return status;
+
+ *font_face = gstate->font_face;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/*
+ * Like everything else in this file, fonts involve Too Many Coordinate Spaces;
+ * it is easy to get confused about what's going on.
+ *
+ * The user's view
+ * ---------------
+ *
+ * Users ask for things in user space. When cairo starts, a user space unit
+ * is about 1/96 inch, which is similar to (but importantly different from)
+ * the normal "point" units most users think in terms of. When a user
+ * selects a font, its scale is set to "one user unit". The user can then
+ * independently scale the user coordinate system *or* the font matrix, in
+ * order to adjust the rendered size of the font.
+ *
+ * Metrics are returned in user space, whether they are obtained from
+ * the currently selected font in a #cairo_t or from a #cairo_scaled_font_t
+ * which is aa font specialized to a particular scale matrix, CTM, and target
+ * surface.
+ *
+ * The font's view
+ * ---------------
+ *
+ * Fonts are designed and stored (in say .ttf files) in "font space", which
+ * describes an "EM Square" (a design tile) and has some abstract number
+ * such as 1000, 1024, or 2048 units per "EM". This is basically an
+ * uninteresting space for us, but we need to remember that it exists.
+ *
+ * Font resources (from libraries or operating systems) render themselves
+ * to a particular device. Since they do not want to make most programmers
+ * worry about the font design space, the scaling API is simplified to
+ * involve just telling the font the required pixel size of the EM square
+ * (that is, in device space).
+ *
+ *
+ * Cairo's gstate view
+ * -------------------
+ *
+ * In addition to the CTM and CTM inverse, we keep a matrix in the gstate
+ * called the "font matrix" which describes the user's most recent
+ * font-scaling or font-transforming request. This is kept in terms of an
+ * abstract scale factor, composed with the CTM and used to set the font's
+ * pixel size. So if the user asks to "scale the font by 12", the matrix
+ * is:
+ *
+ * [ 12.0, 0.0, 0.0, 12.0, 0.0, 0.0 ]
+ *
+ * It is an affine matrix, like all cairo matrices, but its tx and ty
+ * components are always set to zero; we don't permit "nudging" fonts
+ * around.
+ *
+ * In order to perform any action on a font, we must build an object
+ * called a cairo_font_scale_t; this contains the central 2x2 matrix
+ * resulting from "font matrix * CTM".
+ *
+ * We pass this to the font when making requests of it, which causes it to
+ * reply for a particular [user request, device] combination, under the CTM
+ * (to accomodate the "zoom in" == "bigger fonts" issue above).
+ *
+ * The other terms in our communication with the font are therefore in
+ * device space. When we ask it to perform text->glyph conversion, it will
+ * produce a glyph string in device space. Glyph vectors we pass to it for
+ * measuring or rendering should be in device space. The metrics which we
+ * get back from the font will be in device space. The contents of the
+ * global glyph image cache will be in device space.
+ *
+ *
+ * Cairo's public view
+ * -------------------
+ *
+ * Since the values entering and leaving via public API calls are in user
+ * space, the gstate functions typically need to multiply argumens by the
+ * CTM (for user-input glyph vectors), and return values by the CTM inverse
+ * (for font responses such as metrics or glyph vectors).
+ *
+ */
+
+static cairo_status_t
+_cairo_gstate_ensure_font_face (cairo_gstate_t *gstate)
+{
+ if (!gstate->font_face) {
+ gstate->font_face = _cairo_simple_font_face_create (CAIRO_FONT_FAMILY_DEFAULT,
+ CAIRO_FONT_SLANT_DEFAULT,
+ CAIRO_FONT_WEIGHT_DEFAULT);
+ if (!gstate->font_face)
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_gstate_ensure_font (cairo_gstate_t *gstate)
+{
+ cairo_status_t status;
+
+ if (gstate->scaled_font)
+ return CAIRO_STATUS_SUCCESS;
+
+ status = _cairo_gstate_ensure_font_face (gstate);
+ if (status)
+ return status;
+
+ gstate->scaled_font = cairo_scaled_font_create (gstate->font_face,
+ &gstate->font_matrix,
+ &gstate->ctm);
+
+ if (!gstate->scaled_font)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_get_font_extents (cairo_gstate_t *gstate,
+ cairo_font_extents_t *extents)
+{
+ cairo_status_t status = _cairo_gstate_ensure_font (gstate);
+ if (status)
+ return status;
+
+ return cairo_scaled_font_extents (gstate->scaled_font, extents);
+}
+
+cairo_status_t
+_cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
+ const char *utf8,
+ double x,
+ double y,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs)
+{
+ cairo_status_t status;
+ int i;
+
+ status = _cairo_gstate_ensure_font (gstate);
+ if (status)
+ return status;
+
+ status = _cairo_scaled_font_text_to_glyphs (gstate->scaled_font,
+ utf8, glyphs, num_glyphs);
+
+ if (status || !glyphs || !num_glyphs || !(*glyphs) || !(num_glyphs))
+ return status;
+
+ /* The font responded in glyph space, starting from (0,0). Convert to
+ user space by applying the font transform, then add any current point
+ offset. */
+
+ for (i = 0; i < *num_glyphs; ++i) {
+ cairo_matrix_transform_point (&gstate->font_matrix,
+ &((*glyphs)[i].x),
+ &((*glyphs)[i].y));
+ (*glyphs)[i].x += x;
+ (*glyphs)[i].y += y;
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_set_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t *font_face)
+{
+ if (font_face != gstate->font_face) {
+ if (gstate->font_face)
+ cairo_font_face_destroy (gstate->font_face);
+ gstate->font_face = font_face;
+ if (gstate->font_face)
+ cairo_font_face_reference (gstate->font_face);
+ }
+
+ _cairo_gstate_unset_font (gstate);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents)
+{
+ cairo_status_t status;
+
+ status = _cairo_gstate_ensure_font (gstate);
+ if (status)
+ return status;
+
+ cairo_scaled_font_glyph_extents (gstate->scaled_font,
+ glyphs, num_glyphs,
+ extents);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
+ cairo_glyph_t *glyphs,
+ int num_glyphs)
+{
+ cairo_status_t status;
+ int i;
+ cairo_glyph_t *transformed_glyphs = NULL;
+ cairo_pattern_union_t pattern;
+ cairo_box_t bbox;
+ cairo_rectangle_t extents;
+
+ if (gstate->source->status)
+ return gstate->source->status;
+
+ status = _cairo_gstate_set_clip (gstate);
+ if (status)
+ return status;
+
+ status = _cairo_gstate_ensure_font (gstate);
+ if (status)
+ return status;
+
+ transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
+ if (transformed_glyphs == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ for (i = 0; i < num_glyphs; ++i)
+ {
+ transformed_glyphs[i] = glyphs[i];
+ _cairo_gstate_user_to_backend (gstate,
+ &transformed_glyphs[i].x,
+ &transformed_glyphs[i].y);
+ }
+
+ status = _cairo_scaled_font_glyph_bbox (gstate->scaled_font,
+ transformed_glyphs, num_glyphs,
+ &bbox);
+ _cairo_box_round_to_rectangle (&bbox, &extents);
+
+ if (status)
+ goto CLEANUP_GLYPHS;
+
+ if (gstate->clip.surface)
+ {
+ cairo_surface_t *intermediate;
+ cairo_surface_pattern_t intermediate_pattern;
+
+ _cairo_rectangle_intersect (&extents, &gstate->clip.surface_rect);
+
+ /* Shortcut if empty */
+ if (_cairo_rectangle_empty (&extents)) {
+ status = CAIRO_STATUS_SUCCESS;
+ goto BAIL1;
+ }
+
+ intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface,
+ CAIRO_FORMAT_A8,
+ extents.width,
+ extents.height,
+ CAIRO_COLOR_TRANSPARENT);
+ if (intermediate == NULL) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto BAIL1;
+ }
+
+ /* move the glyphs again, from dev space to intermediate space */
+ for (i = 0; i < num_glyphs; ++i)
+ {
+ transformed_glyphs[i].x -= extents.x;
+ transformed_glyphs[i].y -= extents.y;
+ }
+
+ _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
+
+ status = _cairo_scaled_font_show_glyphs (gstate->scaled_font,
+ CAIRO_OPERATOR_ADD,
+ &pattern.base, intermediate,
+ extents.x, extents.y,
+ 0, 0,
+ extents.width, extents.height,
+ transformed_glyphs, num_glyphs);
+
+ _cairo_pattern_fini (&pattern.base);
+
+ if (status)
+ goto BAIL2;
+
+ _cairo_pattern_init_for_surface (&pattern.surface,
+ gstate->clip.surface);
+
+ status = _cairo_surface_composite (CAIRO_OPERATOR_IN,
+ &pattern.base,
+ NULL,
+ intermediate,
+ extents.x - gstate->clip.surface_rect.x,
+ extents.y - gstate->clip.surface_rect.y,
+ 0, 0,
+ 0, 0,
+ extents.width, extents.height);
+
+ _cairo_pattern_fini (&pattern.base);
+
+ if (status)
+ goto BAIL2;
+
+ _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
+ _cairo_pattern_init_copy (&pattern.base, gstate->source);
+ _cairo_gstate_pattern_transform (gstate, &pattern.base);
+
+ status = _cairo_surface_composite (gstate->operator,
+ &pattern.base,
+ &intermediate_pattern.base,
+ gstate->target,
+ extents.x, extents.y,
+ 0, 0,
+ extents.x, extents.y,
+ extents.width, extents.height);
+ _cairo_pattern_fini (&pattern.base);
+ _cairo_pattern_fini (&intermediate_pattern.base);
+
+ BAIL2:
+ cairo_surface_destroy (intermediate);
+ BAIL1:
+ ;
+ }
+ else
+ {
+ _cairo_pattern_init_copy (&pattern.base, gstate->source);
+ _cairo_gstate_pattern_transform (gstate, &pattern.base);
+
+ status = _cairo_scaled_font_show_glyphs (gstate->scaled_font,
+ gstate->operator, &pattern.base,
+ gstate->target,
+ extents.x, extents.y,
+ extents.x, extents.y,
+ extents.width, extents.height,
+ transformed_glyphs, num_glyphs);
+
+ _cairo_pattern_fini (&pattern.base);
+ }
+
+ CLEANUP_GLYPHS:
+ free (transformed_glyphs);
+
+ return status;
+}
+
+cairo_status_t
+_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path)
+{
+ cairo_status_t status;
+ int i;
+ cairo_glyph_t *transformed_glyphs = NULL;
+
+ status = _cairo_gstate_ensure_font (gstate);
+ if (status)
+ return status;
+
+ transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
+ if (transformed_glyphs == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ for (i = 0; i < num_glyphs; ++i)
+ {
+ transformed_glyphs[i] = glyphs[i];
+ _cairo_gstate_user_to_backend (gstate,
+ &(transformed_glyphs[i].x),
+ &(transformed_glyphs[i].y));
+ }
+
+ status = _cairo_scaled_font_glyph_path (gstate->scaled_font,
+ transformed_glyphs, num_glyphs,
+ path);
+
+ free (transformed_glyphs);
+ return status;
+}
diff --git a/src/cairo_hull.c b/src/cairo-hull.c
index c93d706..c93d706 100644
--- a/src/cairo_hull.c
+++ b/src/cairo-hull.c
diff --git a/src/cairo_image_surface.c b/src/cairo-image-surface.c
index 9745b31..255cd0c 100644
--- a/src/cairo_image_surface.c
+++ b/src/cairo-image-surface.c
@@ -68,7 +68,7 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
surface->pixman_image = pixman_image;
surface->format = format;
- surface->data = (char *) pixman_image_get_data (pixman_image);
+ surface->data = (unsigned char *) pixman_image_get_data (pixman_image);
surface->owns_data = 0;
surface->width = pixman_image_get_width (pixman_image);
@@ -80,8 +80,8 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
}
cairo_image_surface_t *
-_cairo_image_surface_create_with_masks (char *data,
- cairo_format_masks_t *format,
+_cairo_image_surface_create_with_masks (unsigned char *data,
+ cairo_format_masks_t *format,
int width,
int height,
int stride)
@@ -195,7 +195,7 @@ cairo_image_surface_create (cairo_format_t format,
* be created because of lack of memory
**/
cairo_surface_t *
-cairo_image_surface_create_for_data (char *data,
+cairo_image_surface_create_for_data (unsigned char *data,
cairo_format_t format,
int width,
int height,
@@ -224,30 +224,63 @@ cairo_image_surface_create_for_data (char *data,
return &surface->base;
}
+/**
+ * cairo_image_surface_get_width:
+ * @surface: a #cairo_image_surface_t
+ *
+ * Get the width of the image surface in pixels.
+ *
+ * Return value: the width of the surface in pixels.
+ **/
+int
+cairo_image_surface_get_width (cairo_surface_t *surface)
+{
+ cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
+
+ return image_surface->width;
+}
+
+/**
+ * cairo_image_surface_get_height:
+ * @surface: a #cairo_image_surface_t
+ *
+ * Get the height of the image surface in pixels.
+ *
+ * Return value: the height of the surface in pixels.
+ **/
+int
+cairo_image_surface_get_height (cairo_surface_t *surface)
+{
+ cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
+
+ return image_surface->height;
+}
+
static cairo_surface_t *
_cairo_image_surface_create_similar (void *abstract_src,
cairo_format_t format,
- int drawable,
int width,
int height)
{
return cairo_image_surface_create (format, width, height);
}
-static void
-_cairo_image_abstract_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_image_abstract_surface_finish (void *abstract_surface)
{
cairo_image_surface_t *surface = abstract_surface;
- if (surface->pixman_image)
+ if (surface->pixman_image) {
pixman_image_destroy (surface->pixman_image);
+ surface->pixman_image = NULL;
+ }
if (surface->owns_data) {
free (surface->data);
surface->data = NULL;
}
- free (surface);
+ return CAIRO_STATUS_SUCCESS;
}
void
@@ -256,13 +289,6 @@ _cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface)
surface->owns_data = 1;
}
-static double
-_cairo_image_surface_pixels_per_inch (void *abstract_surface)
-{
- /* XXX: We'll want a way to let the user set this. */
- return 96.0;
-}
-
static cairo_status_t
_cairo_image_surface_acquire_source_image (void *abstract_surface,
cairo_image_surface_t **image_out,
@@ -325,19 +351,19 @@ _cairo_image_surface_clone_similar (void *abstract_surface,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
-cairo_status_t
+static cairo_status_t
_cairo_image_surface_set_matrix (cairo_image_surface_t *surface,
- cairo_matrix_t *matrix)
+ const cairo_matrix_t *matrix)
{
pixman_transform_t pixman_transform;
- pixman_transform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]);
- pixman_transform.matrix[0][1] = _cairo_fixed_from_double (matrix->m[1][0]);
- pixman_transform.matrix[0][2] = _cairo_fixed_from_double (matrix->m[2][0]);
+ pixman_transform.matrix[0][0] = _cairo_fixed_from_double (matrix->xx);
+ pixman_transform.matrix[0][1] = _cairo_fixed_from_double (matrix->xy);
+ pixman_transform.matrix[0][2] = _cairo_fixed_from_double (matrix->x0);
- pixman_transform.matrix[1][0] = _cairo_fixed_from_double (matrix->m[0][1]);
- pixman_transform.matrix[1][1] = _cairo_fixed_from_double (matrix->m[1][1]);
- pixman_transform.matrix[1][2] = _cairo_fixed_from_double (matrix->m[2][1]);
+ pixman_transform.matrix[1][0] = _cairo_fixed_from_double (matrix->yx);
+ pixman_transform.matrix[1][1] = _cairo_fixed_from_double (matrix->yy);
+ pixman_transform.matrix[1][2] = _cairo_fixed_from_double (matrix->y0);
pixman_transform.matrix[2][0] = 0;
pixman_transform.matrix[2][1] = 0;
@@ -348,7 +374,7 @@ _cairo_image_surface_set_matrix (cairo_image_surface_t *surface,
return CAIRO_STATUS_SUCCESS;
}
-cairo_status_t
+static cairo_status_t
_cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t filter)
{
pixman_filter_t pixman_filter;
@@ -378,7 +404,7 @@ _cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t
return CAIRO_STATUS_SUCCESS;
}
-cairo_status_t
+static cairo_status_t
_cairo_image_surface_set_repeat (cairo_image_surface_t *surface, int repeat)
{
pixman_image_set_repeat (surface->pixman_image, repeat);
@@ -414,32 +440,40 @@ _cairo_image_surface_set_attributes (cairo_image_surface_t *surface,
return status;
}
+/* XXX: I think we should fix pixman to match the names/order of the
+ * cairo operators, but that will likely be better done at the same
+ * time the X server is ported to pixman, (which will change a lot of
+ * things in pixman I think).
+ */
static pixman_operator_t
_pixman_operator (cairo_operator_t operator)
{
switch (operator) {
case CAIRO_OPERATOR_CLEAR:
return PIXMAN_OPERATOR_CLEAR;
- case CAIRO_OPERATOR_SRC:
+
+ case CAIRO_OPERATOR_SOURCE:
return PIXMAN_OPERATOR_SRC;
- case CAIRO_OPERATOR_DST:
- return PIXMAN_OPERATOR_DST;
case CAIRO_OPERATOR_OVER:
return PIXMAN_OPERATOR_OVER;
- case CAIRO_OPERATOR_OVER_REVERSE:
- return PIXMAN_OPERATOR_OVER_REVERSE;
case CAIRO_OPERATOR_IN:
return PIXMAN_OPERATOR_IN;
- case CAIRO_OPERATOR_IN_REVERSE:
- return PIXMAN_OPERATOR_IN_REVERSE;
case CAIRO_OPERATOR_OUT:
return PIXMAN_OPERATOR_OUT;
- case CAIRO_OPERATOR_OUT_REVERSE:
- return PIXMAN_OPERATOR_OUT_REVERSE;
case CAIRO_OPERATOR_ATOP:
return PIXMAN_OPERATOR_ATOP;
- case CAIRO_OPERATOR_ATOP_REVERSE:
+
+ case CAIRO_OPERATOR_DEST:
+ return PIXMAN_OPERATOR_DST;
+ case CAIRO_OPERATOR_DEST_OVER:
+ return PIXMAN_OPERATOR_OVER_REVERSE;
+ case CAIRO_OPERATOR_DEST_IN:
+ return PIXMAN_OPERATOR_IN_REVERSE;
+ case CAIRO_OPERATOR_DEST_OUT:
+ return PIXMAN_OPERATOR_OUT_REVERSE;
+ case CAIRO_OPERATOR_DEST_ATOP:
return PIXMAN_OPERATOR_ATOP_REVERSE;
+
case CAIRO_OPERATOR_XOR:
return PIXMAN_OPERATOR_XOR;
case CAIRO_OPERATOR_ADD:
@@ -483,12 +517,12 @@ _cairo_image_surface_composite (cairo_operator_t operator,
return status;
status = _cairo_image_surface_set_attributes (src, &src_attr);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
{
if (mask)
{
status = _cairo_image_surface_set_attributes (mask, &mask_attr);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
pixman_composite (_pixman_operator (operator),
src->pixman_image,
mask->pixman_image,
@@ -586,8 +620,8 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t operator,
/* XXX: The pixman_trapezoid_t cast is evil and needs to go away
* somehow. */
status = _cairo_image_surface_set_attributes (src, &attributes);
- if (CAIRO_OK (status))
- pixman_composite_trapezoids (operator,
+ if (status == CAIRO_STATUS_SUCCESS)
+ pixman_composite_trapezoids (_pixman_operator (operator),
src->pixman_image,
dst->pixman_image,
render_src_x + attributes.x_offset,
@@ -600,18 +634,6 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t operator,
}
static cairo_int_status_t
-_cairo_image_surface_copy_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_image_surface_show_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
_cairo_image_abstract_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
@@ -642,6 +664,27 @@ _cairo_image_surface_set_clip_region (cairo_image_surface_t *surface,
return CAIRO_STATUS_SUCCESS;
}
+static cairo_int_status_t
+_cairo_image_surface_get_extents (cairo_image_surface_t *surface,
+ cairo_rectangle_t *rectangle)
+{
+ rectangle->x = 0;
+ rectangle->y = 0;
+ rectangle->width = surface->width;
+ rectangle->height = surface->height;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_cairo_image_abstract_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_image_surface_t *surface = abstract_surface;
+
+ return _cairo_image_surface_get_extents (surface, rectangle);
+}
+
/**
* _cairo_surface_is_image:
* @surface: a #cairo_surface_t
@@ -658,8 +701,7 @@ _cairo_surface_is_image (cairo_surface_t *surface)
static const cairo_surface_backend_t cairo_image_surface_backend = {
_cairo_image_surface_create_similar,
- _cairo_image_abstract_surface_destroy,
- _cairo_image_surface_pixels_per_inch,
+ _cairo_image_abstract_surface_finish,
_cairo_image_surface_acquire_source_image,
_cairo_image_surface_release_source_image,
_cairo_image_surface_acquire_dest_image,
@@ -668,8 +710,10 @@ static const cairo_surface_backend_t cairo_image_surface_backend = {
_cairo_image_surface_composite,
_cairo_image_surface_fill_rectangles,
_cairo_image_surface_composite_trapezoids,
- _cairo_image_surface_copy_page,
- _cairo_image_surface_show_page,
+ NULL, /* copy_page */
+ NULL, /* show_page */
_cairo_image_abstract_surface_set_clip_region,
+ NULL, /* intersect_clip_path */
+ _cairo_image_abstract_surface_get_extents,
NULL /* show_glyphs */
};
diff --git a/src/cairo_matrix.c b/src/cairo-matrix.c
index 88e536e..98feb57 100644
--- a/src/cairo_matrix.c
+++ b/src/cairo-matrix.c
@@ -40,14 +40,6 @@
#include "cairoint.h"
-static cairo_matrix_t const CAIRO_MATRIX_IDENTITY = {
- {
- {1, 0},
- {0, 1},
- {0, 0}
- }
-};
-
static void
_cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar);
@@ -55,228 +47,185 @@ static void
_cairo_matrix_compute_adjoint (cairo_matrix_t *matrix);
/**
- * cairo_matrix_create:
- *
- * Creates a new identity matrix.
- *
- * Return value: a newly created matrix; free with cairo_matrix_destroy(),
- * or %NULL if memory couldn't be allocated.
- **/
-cairo_matrix_t *
-cairo_matrix_create (void)
-{
- cairo_matrix_t *matrix;
-
- matrix = malloc (sizeof (cairo_matrix_t));
- if (matrix == NULL)
- return NULL;
-
- _cairo_matrix_init (matrix);
-
- return matrix;
-}
-
-void
-_cairo_matrix_init (cairo_matrix_t *matrix)
-{
- cairo_matrix_set_identity (matrix);
-}
-
-void
-_cairo_matrix_fini (cairo_matrix_t *matrix)
-{
- /* nothing to do here */
-}
-
-/**
- * cairo_matrix_destroy:
- * @matrix: a #cairo_matrix_t
- *
- * Frees a matrix created with cairo_matrix_create.
- **/
-void
-cairo_matrix_destroy (cairo_matrix_t *matrix)
-{
- _cairo_matrix_fini (matrix);
- free (matrix);
-}
-
-/**
- * cairo_matrix_copy:
- * @matrix: a #cairo_matrix_t
- * @other: another #cairo_
- *
- * Modifies @matrix to be identical to @other.
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
- **/
-cairo_status_t
-cairo_matrix_copy (cairo_matrix_t *matrix, const cairo_matrix_t *other)
-{
- *matrix = *other;
-
- return CAIRO_STATUS_SUCCESS;
-}
-slim_hidden_def(cairo_matrix_copy);
-
-/**
- * cairo_matrix_set_identity:
+ * cairo_matrix_init_identity:
* @matrix: a #cairo_matrix_t
*
* Modifies @matrix to be an identity transformation.
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
**/
-cairo_status_t
-cairo_matrix_set_identity (cairo_matrix_t *matrix)
+void
+cairo_matrix_init_identity (cairo_matrix_t *matrix)
{
- *matrix = CAIRO_MATRIX_IDENTITY;
-
- return CAIRO_STATUS_SUCCESS;
+ cairo_matrix_init (matrix,
+ 1, 0,
+ 0, 1,
+ 0, 0);
}
-slim_hidden_def(cairo_matrix_set_identity);
+slim_hidden_def(cairo_matrix_init_identity);
/**
- * cairo_matrix_set_affine:
+ * cairo_matrix_init:
* @matrix: a cairo_matrix_t
- * @a: a component of the affine transformation
- * @b: b component of the affine transformation
- * @c: c component of the affine transformation
- * @d: d component of the affine transformation
- * @tx: X translation component of the affine transformation
- * @ty: Y translation component of the affine transformation
+ * @xx: xx component of the affine transformation
+ * @yx: yx component of the affine transformation
+ * @xy: xy component of the affine transformation
+ * @yy: yy component of the affine transformation
+ * @x0: X translation component of the affine transformation
+ * @y0: Y translation component of the affine transformation
*
* Sets @matrix to be the affine transformation given by
- * @a, b, @c, @d, @tx, @ty. The transformation is given
+ * @xx, @yx, @xy, @yy, @x0, @y0. The transformation is given
* by:
* <programlisting>
- * x_new = x * a + y * c + tx;
- * y_new = x * b + y * d + ty;
+ * x_new = xx * x + xy * y + x0;
+ * y_new = yx * x + yy * y + y0;
* </programlisting>
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
**/
-cairo_status_t
-cairo_matrix_set_affine (cairo_matrix_t *matrix,
- double a, double b,
- double c, double d,
- double tx, double ty)
+void
+cairo_matrix_init (cairo_matrix_t *matrix,
+ double xx, double yx,
+ double xy, double yy,
+ double x0, double y0)
{
- matrix->m[0][0] = a; matrix->m[0][1] = b;
- matrix->m[1][0] = c; matrix->m[1][1] = d;
- matrix->m[2][0] = tx; matrix->m[2][1] = ty;
-
- return CAIRO_STATUS_SUCCESS;
+ matrix->xx = xx; matrix->yx = yx;
+ matrix->xy = xy; matrix->yy = yy;
+ matrix->x0 = x0; matrix->y0 = y0;
}
-slim_hidden_def(cairo_matrix_set_affine);
+slim_hidden_def(cairo_matrix_init);
/**
- * cairo_matrix_get_affine:
+ * _cairo_matrix_get_affine:
* @matrix: a @cairo_matrix_t
- * @a: location to store a component of affine transformation, or %NULL
- * @b: location to store b component of affine transformation, or %NULL
- * @c: location to store c component of affine transformation, or %NULL
- * @d: location to store d component of affine transformation, or %NULL
- * @tx: location to store X-translation component of affine transformation, or %NULL
- * @ty: location to store Y-translation component of affine transformation, or %NULL
+ * @xx: location to store xx component of matrix
+ * @yx: location to store yx component of matrix
+ * @xy: location to store xy component of matrix
+ * @yy: location to store yy component of matrix
+ * @x0: location to store x0 (X-translation component) of matrix, or %NULL
+ * @y0: location to store y0 (Y-translation component) of matrix, or %NULL
*
* Gets the matrix values for the affine tranformation that @matrix represents.
- * See cairo_matrix_set_affine().
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
+ * See cairo_matrix_init().
+ *
+ *
+ * This function is a leftover from the old public API, but is still
+ * mildly useful as an internal means for getting at the matrix
+ * members in a positional way. For example, when reassigning to some
+ * external matrix type, or when renaming members to more meaningful
+ * names (such as a,b,c,d,e,f) for particular manipulations.
**/
-cairo_status_t
-cairo_matrix_get_affine (cairo_matrix_t *matrix,
- double *a, double *b,
- double *c, double *d,
- double *tx, double *ty)
+void
+_cairo_matrix_get_affine (const cairo_matrix_t *matrix,
+ double *xx, double *yx,
+ double *xy, double *yy,
+ double *x0, double *y0)
{
- if (a)
- *a = matrix->m[0][0];
- if (b)
- *b = matrix->m[0][1];
-
- if (c)
- *c = matrix->m[1][0];
- if (d)
- *d = matrix->m[1][1];
+ *xx = matrix->xx;
+ *yx = matrix->yx;
- if (tx)
- *tx = matrix->m[2][0];
- if (ty)
- *ty = matrix->m[2][1];
+ *xy = matrix->xy;
+ *yy = matrix->yy;
- return CAIRO_STATUS_SUCCESS;
+ if (x0)
+ *x0 = matrix->x0;
+ if (y0)
+ *y0 = matrix->y0;
}
-cairo_status_t
-_cairo_matrix_set_translate (cairo_matrix_t *matrix,
+/**
+ * cairo_matrix_init_translate:
+ * @matrix: a cairo_matrix_t
+ * @tx: amount to translate in the X direction
+ * @ty: amount to translate in the Y direction
+ *
+ * Initializes @matrix to a transformation that translates by @tx and
+ * @ty in the X and Y dimensions, respectively.
+ **/
+void
+cairo_matrix_init_translate (cairo_matrix_t *matrix,
double tx, double ty)
{
- return cairo_matrix_set_affine (matrix,
- 1, 0,
- 0, 1,
- tx, ty);
+ cairo_matrix_init (matrix,
+ 1, 0,
+ 0, 1,
+ tx, ty);
}
+slim_hidden_def(cairo_matrix_init_translate);
/**
* cairo_matrix_translate:
* @matrix: a cairo_matrix_t
- * @tx: amount to rotate in the X direction
- * @ty: amount to rotate in the Y direction
+ * @tx: amount to translate in the X direction
+ * @ty: amount to translate in the Y direction
*
* Applies a translation by @tx, @ty to the transformation in
- * @matrix. The new transformation is given by first translating by
- * @tx, @ty then applying the original transformation
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
+ * @matrix. The effect of the new transformation is to first translate
+ * the coordinates by @tx and @ty, then apply the original transformation
+ * to the coordinates.
**/
-cairo_status_t
+void
cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty)
{
cairo_matrix_t tmp;
- _cairo_matrix_set_translate (&tmp, tx, ty);
+ cairo_matrix_init_translate (&tmp, tx, ty);
- return cairo_matrix_multiply (matrix, &tmp, matrix);
+ cairo_matrix_multiply (matrix, &tmp, matrix);
}
-cairo_status_t
-_cairo_matrix_set_scale (cairo_matrix_t *matrix,
+/**
+ * cairo_matrix_init_scale:
+ * @matrix: a cairo_matrix_t
+ * @sx: scale factor in the X direction
+ * @sy: scale factor in the Y direction
+ *
+ * Initializes @matrix to a transformation that scales by @sx and @sy
+ * in the X and Y dimensions, respectively.
+ **/
+void
+cairo_matrix_init_scale (cairo_matrix_t *matrix,
double sx, double sy)
{
- return cairo_matrix_set_affine (matrix,
- sx, 0,
- 0, sy,
- 0, 0);
+ cairo_matrix_init (matrix,
+ sx, 0,
+ 0, sy,
+ 0, 0);
}
+slim_hidden_def(cairo_matrix_init_scale);
/**
* cairo_matrix_scale:
* @matrix: a #cairo_matrix_t
- * @sx: Scale factor in the X direction
- * @sy: Scale factor in the Y direction
+ * @sx: scale factor in the X direction
+ * @sy: scale factor in the Y direction
*
- * Applies scaling by @tx, @ty to the transformation in
- * @matrix. The new transformation is given by first scaling by @sx
- * and @sy then applying the original transformation
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
+ * Applies scaling by @tx, @ty to the transformation in @matrix. The
+ * effect of the new transformation is to first scale the coordinates
+ * by @sx and @sy, then apply the original transformation to the coordinates.
**/
-cairo_status_t
+void
cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy)
{
cairo_matrix_t tmp;
- _cairo_matrix_set_scale (&tmp, sx, sy);
+ cairo_matrix_init_scale (&tmp, sx, sy);
- return cairo_matrix_multiply (matrix, &tmp, matrix);
+ cairo_matrix_multiply (matrix, &tmp, matrix);
}
slim_hidden_def(cairo_matrix_scale);
-cairo_status_t
-_cairo_matrix_set_rotate (cairo_matrix_t *matrix,
- double radians)
+/**
+ * cairo_matrix_init_rotate:
+ * @matrix: a cairo_matrix_t
+ * @radians: angle of rotation, in radians. The direction of rotation
+ * is defined such that positive angles rotate in the direction from
+ * the positive X axis toward the positive Y axis. With the default
+ * axis orientation of cairo, positive angles rotate in a clockwise
+ * direction.
+ *
+ * Initialized @matrix to a transformation that rotates by @radians.
+ **/
+void
+cairo_matrix_init_rotate (cairo_matrix_t *matrix,
+ double radians)
{
double s;
double c;
@@ -286,35 +235,35 @@ _cairo_matrix_set_rotate (cairo_matrix_t *matrix,
s = sin (radians);
c = cos (radians);
#endif
- return cairo_matrix_set_affine (matrix,
- c, s,
- -s, c,
- 0, 0);
+ cairo_matrix_init (matrix,
+ c, s,
+ -s, c,
+ 0, 0);
}
+slim_hidden_def(cairo_matrix_init_rotate);
/**
* cairo_matrix_rotate:
* @matrix: a @cairo_matrix_t
- * @radians: angle of rotation, in radians. Angles are defined
- * so that an angle of 90 degrees (%M_PI radians) rotates the
- * positive X axis into the positive Y axis. With the default
- * Cairo choice of axis orientation, positive rotations are
- * clockwise.
+ * @radians: angle of rotation, in radians. The direction of rotation
+ * is defined such that positive angles rotate in the direction from
+ * the positive X axis toward the positive Y axis. With the default
+ * axis orientation of cairo, positive angles rotate in a clockwise
+ * direction.
*
* Applies rotation by @radians to the transformation in
- * @matrix. The new transformation is given by first rotating by
- * @radians then applying the original transformation
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
+ * @matrix. The effect of the new transformation is to first rotate the
+ * coordinates by @radians, then apply the original transformation
+ * to the coordinates.
**/
-cairo_status_t
+void
cairo_matrix_rotate (cairo_matrix_t *matrix, double radians)
{
cairo_matrix_t tmp;
- _cairo_matrix_set_rotate (&tmp, radians);
+ cairo_matrix_init_rotate (&tmp, radians);
- return cairo_matrix_multiply (matrix, &tmp, matrix);
+ cairo_matrix_multiply (matrix, &tmp, matrix);
}
/**
@@ -324,46 +273,47 @@ cairo_matrix_rotate (cairo_matrix_t *matrix, double radians)
* @b: a @cairo_matrix_t
*
* Multiplies the affine transformations in @a and @b together
- * and stores the result in @result. The resulting transformation
- * is given by first applying the transformation in @b then
- * applying the transformation in @a.
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
+ * and stores the result in @result. The effect of the resulting
+ * transformation is to first apply the transformation in @a to the
+ * coordinates and then apply the transformation in @b to the
+ * coordinates.
+ *
+ * It is allowable for @result to be identical to either @a or @b.
**/
-cairo_status_t
+/*
+ * XXX: The ordering of the arguments to this function corresponds
+ * to [row_vector]*A*B. If we want to use column vectors instead,
+ * then we need to switch the two arguments and fix up all
+ * uses.
+ */
+void
cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b)
{
cairo_matrix_t r;
- int row, col, n;
- double t;
-
- for (row = 0; row < 3; row++) {
- for (col = 0; col < 2; col++) {
- if (row == 2)
- t = b->m[2][col];
- else
- t = 0;
- for (n = 0; n < 2; n++) {
- t += a->m[row][n] * b->m[n][col];
- }
- r.m[row][col] = t;
- }
- }
- *result = r;
+ r.xx = a->xx * b->xx + a->yx * b->xy;
+ r.yx = a->xx * b->yx + a->yx * b->yy;
- return CAIRO_STATUS_SUCCESS;
+ r.xy = a->xy * b->xx + a->yy * b->xy;
+ r.yy = a->xy * b->yx + a->yy * b->yy;
+
+ r.x0 = a->x0 * b->xx + a->y0 * b->xy + b->x0;
+ r.y0 = a->x0 * b->yx + a->y0 * b->yy + b->y0;
+
+ *result = r;
}
slim_hidden_def(cairo_matrix_multiply);
/**
* cairo_matrix_transform_distance:
* @matrix: a @cairo_matrix_t
- * @dx: a distance in the X direction. An in/out parameter
- * @dy: a distance in the Y direction. An in/out parameter
+ * @dx: X component of a distance vector. An in/out parameter
+ * @dy: Y component of a distance vector. An in/out parameter
*
- * Transforms the vector (@dx,@dy) by @matrix. Translation is
- * ignored. In terms of the components of the affine transformation:
+ * Transforms the distance vector (@dx,@dy) by @matrix. This is
+ * similar to cairo_matrix_transform() except that the translation
+ * components of the transformation are ignored. The calculation of
+ * the returned vector is as follows:
*
* <programlisting>
* dx2 = dx1 * a + dy1 * c;
@@ -374,23 +324,17 @@ slim_hidden_def(cairo_matrix_multiply);
* always transforms to the same vector. If (@x1,@y1) transforms
* to (@x2,@y2) then (@x1+@dx1,@y1+@dy1) will transform to
* (@x1+@dx2,@y1+@dy2) for all values of @x1 and @x2.
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
**/
-cairo_status_t
-cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy)
+void
+cairo_matrix_transform_distance (const cairo_matrix_t *matrix, double *dx, double *dy)
{
double new_x, new_y;
- new_x = (matrix->m[0][0] * *dx
- + matrix->m[1][0] * *dy);
- new_y = (matrix->m[0][1] * *dx
- + matrix->m[1][1] * *dy);
+ new_x = (matrix->xx * *dx + matrix->xy * *dy);
+ new_y = (matrix->yx * *dx + matrix->yy * *dy);
*dx = new_x;
*dy = new_y;
-
- return CAIRO_STATUS_SUCCESS;
}
slim_hidden_def(cairo_matrix_transform_distance);
@@ -401,23 +345,19 @@ slim_hidden_def(cairo_matrix_transform_distance);
* @y: Y position. An in/out parameter
*
* Transforms the point (@x, @y) by @matrix.
- *
- * Return value: %CAIRO_STATUS_SUCCESS, always.
**/
-cairo_status_t
-cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y)
+void
+cairo_matrix_transform_point (const cairo_matrix_t *matrix, double *x, double *y)
{
cairo_matrix_transform_distance (matrix, x, y);
- *x += matrix->m[2][0];
- *y += matrix->m[2][1];
-
- return CAIRO_STATUS_SUCCESS;
+ *x += matrix->x0;
+ *y += matrix->y0;
}
slim_hidden_def(cairo_matrix_transform_point);
-cairo_status_t
-_cairo_matrix_transform_bounding_box (cairo_matrix_t *matrix,
+void
+_cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
double *x, double *y,
double *width, double *height)
{
@@ -466,18 +406,19 @@ _cairo_matrix_transform_bounding_box (cairo_matrix_t *matrix,
*y = min_y;
*width = max_x - min_x;
*height = max_y - min_y;
-
- return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar)
{
- int row, col;
+ matrix->xx *= scalar;
+ matrix->yx *= scalar;
- for (row = 0; row < 3; row++)
- for (col = 0; col < 2; col++)
- matrix->m[row][col] *= scalar;
+ matrix->xy *= scalar;
+ matrix->yy *= scalar;
+
+ matrix->x0 *= scalar;
+ matrix->y0 *= scalar;
}
/* This function isn't a correct adjoint in that the implicit 1 in the
@@ -490,14 +431,15 @@ _cairo_matrix_compute_adjoint (cairo_matrix_t *matrix)
/* adj (A) = transpose (C:cofactor (A,i,j)) */
double a, b, c, d, tx, ty;
- a = matrix->m[0][0]; b = matrix->m[0][1];
- c = matrix->m[1][0]; d = matrix->m[1][1];
- tx = matrix->m[2][0]; ty = matrix->m[2][1];
+ _cairo_matrix_get_affine (matrix,
+ &a, &b,
+ &c, &d,
+ &tx, &ty);
- cairo_matrix_set_affine (matrix,
- d, -b,
- -c, a,
- c*ty - d*tx, b*tx - a*ty);
+ cairo_matrix_init (matrix,
+ d, -b,
+ -c, a,
+ c*ty - d*tx, b*tx - a*ty);
}
/**
@@ -531,21 +473,21 @@ cairo_matrix_invert (cairo_matrix_t *matrix)
}
slim_hidden_def(cairo_matrix_invert);
-cairo_status_t
-_cairo_matrix_compute_determinant (cairo_matrix_t *matrix, double *det)
+void
+_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix,
+ double *det)
{
double a, b, c, d;
- a = matrix->m[0][0]; b = matrix->m[0][1];
- c = matrix->m[1][0]; d = matrix->m[1][1];
+ a = matrix->xx; b = matrix->yx;
+ c = matrix->xy; d = matrix->yy;
*det = a*d - b*c;
-
- return CAIRO_STATUS_SUCCESS;
}
-cairo_status_t
-_cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, double *lambda2)
+void
+_cairo_matrix_compute_eigen_values (const cairo_matrix_t *matrix,
+ double *lambda1, double *lambda2)
{
/* The eigenvalues of an NxN matrix M are found by solving the polynomial:
@@ -566,28 +508,27 @@ _cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, dou
double a, b, c, d, rad;
- a = matrix->m[0][0];
- b = matrix->m[0][1];
- c = matrix->m[1][0];
- d = matrix->m[1][1];
+ a = matrix->xx; b = matrix->yx;
+ c = matrix->xy; d = matrix->yy;
rad = sqrt (a*a + 2*a*d + d*d - 4*(a*d - b*c));
*lambda1 = (a + d + rad) / 2.0;
*lambda2 = (a + d - rad) / 2.0;
-
- return CAIRO_STATUS_SUCCESS;
}
/* Compute the amount that each basis vector is scaled by. */
cairo_status_t
-_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy, int x_major)
+_cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
+ double *sx, double *sy, int x_major)
{
double det;
_cairo_matrix_compute_determinant (matrix, &det);
if (det == 0)
+ {
*sx = *sy = 0;
+ }
else
{
double x = x_major != 0;
@@ -621,25 +562,29 @@ _cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double
}
cairo_bool_t
-_cairo_matrix_is_integer_translation(cairo_matrix_t *mat,
+_cairo_matrix_is_integer_translation(const cairo_matrix_t *m,
int *itx, int *ity)
{
- double a, b, c, d, tx, ty;
- int ttx, tty;
- int ok = 0;
- cairo_matrix_get_affine (mat, &a, &b, &c, &d, &tx, &ty);
- ttx = _cairo_fixed_from_double (tx);
- tty = _cairo_fixed_from_double (ty);
- ok = ((a == 1.0)
- && (b == 0.0)
- && (c == 0.0)
- && (d == 1.0)
- && (_cairo_fixed_is_integer(ttx))
- && (_cairo_fixed_is_integer(tty)));
- if (ok) {
- *itx = _cairo_fixed_integer_part(ttx);
- *ity = _cairo_fixed_integer_part(tty);
- return TRUE;
- }
- return FALSE;
+ cairo_bool_t is_integer_translation;
+ cairo_fixed_t x0_fixed, y0_fixed;
+
+ x0_fixed = _cairo_fixed_from_double (m->x0);
+ y0_fixed = _cairo_fixed_from_double (m->y0);
+
+ is_integer_translation = ((m->xx == 1.0) &&
+ (m->yx == 0.0) &&
+ (m->xy == 0.0) &&
+ (m->yy == 1.0) &&
+ (_cairo_fixed_is_integer(x0_fixed)) &&
+ (_cairo_fixed_is_integer(y0_fixed)));
+
+ if (! is_integer_translation)
+ return FALSE;
+
+ if (itx)
+ *itx = _cairo_fixed_integer_part(x0_fixed);
+ if (ity)
+ *ity = _cairo_fixed_integer_part(y0_fixed);
+
+ return TRUE;
}
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
new file mode 100644
index 0000000..14b4486
--- /dev/null
+++ b/src/cairo-output-stream.c
@@ -0,0 +1,285 @@
+/* cairo_output_stream.c: Output stream abstraction
+ *
+ * Copyright © 2005 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is cairo_output_stream.c as distributed with the
+ * cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Author(s):
+ * Kristian Høgsberg <krh@redhat.com>
+ */
+
+#include <stdio.h>
+#include <locale.h>
+#include <ctype.h>
+#include "cairoint.h"
+
+struct _cairo_output_stream {
+ cairo_write_func_t write_data;
+ void *closure;
+ cairo_bool_t owns_closure_is_file;
+ unsigned long position;
+ cairo_status_t status;
+};
+
+cairo_output_stream_t *
+_cairo_output_stream_create (cairo_write_func_t write_data,
+ void *closure)
+{
+ cairo_output_stream_t *stream;
+
+ stream = malloc (sizeof (cairo_output_stream_t));
+ if (stream == NULL)
+ return NULL;
+
+ stream->write_data = write_data;
+ stream->closure = closure;
+ stream->owns_closure_is_file = FALSE;
+ stream->position = 0;
+ stream->status = CAIRO_STATUS_SUCCESS;
+
+ return stream;
+}
+
+void
+_cairo_output_stream_destroy (cairo_output_stream_t *stream)
+{
+ if (stream->owns_closure_is_file) {
+ FILE *file = stream->closure;
+ fflush (file);
+ fclose (file);
+ }
+ free (stream);
+}
+
+cairo_status_t
+_cairo_output_stream_write (cairo_output_stream_t *stream,
+ const void *data, size_t length)
+{
+ if (length == 0)
+ return CAIRO_STATUS_SUCCESS;
+
+ stream->status = stream->write_data (stream->closure, data, length);
+ stream->position += length;
+
+ return stream->status;
+}
+
+/* Format a double in a locale independent way and trim trailing
+ * zeros. Based on code from Alex Larson <alexl@redhat.com>.
+ * http://mail.gnome.org/archives/gtk-devel-list/2001-October/msg00087.html
+ */
+
+static int
+dtostr (char *buffer, size_t size, double d)
+{
+ struct lconv *locale_data;
+ const char *decimal_point;
+ int decimal_point_len;
+ char *p;
+ int decimal_len;
+
+ snprintf (buffer, size, "%f", d);
+
+ locale_data = localeconv ();
+ decimal_point = locale_data->decimal_point;
+ decimal_point_len = strlen (decimal_point);
+
+ assert (decimal_point_len != 0);
+ p = buffer;
+
+ if (*p == '+' || *p == '-')
+ p++;
+
+ while (isdigit (*p))
+ p++;
+
+ if (strncmp (p, decimal_point, decimal_point_len) == 0) {
+ *p = '.';
+ decimal_len = strlen (p + decimal_point_len);
+ memmove (p + 1, p + decimal_point_len, decimal_len);
+ p[1 + decimal_len] = 0;
+
+ /* Remove trailing zeros and decimal point if possible. */
+ for (p = p + decimal_len; *p == '0'; p--)
+ *p = 0;
+
+ if (*p == '.') {
+ *p = 0;
+ p--;
+ }
+ }
+
+ return p + 1 - buffer;
+}
+
+
+enum {
+ LENGTH_MODIFIER_LONG = 0x100
+};
+
+/* Here's a limited reimplementation of printf. The reason for doing
+ * this is primarily to special case handling of doubles. We want
+ * locale independent formatting of doubles and we want to trim
+ * trailing zeros. This is handled by dtostr() above, and the code
+ * below handles everything else by calling snprintf() to do the
+ * formatting. This functionality is only for internal use and we
+ * only implement the formats we actually use.
+ */
+
+cairo_status_t
+_cairo_output_stream_vprintf (cairo_output_stream_t *stream,
+ const char *fmt, va_list ap)
+{
+ char buffer[512];
+ char *p;
+ const char *f;
+ int length_modifier;
+
+ f = fmt;
+ p = buffer;
+ while (*f != '\0') {
+ if (p == buffer + sizeof (buffer)) {
+ _cairo_output_stream_write (stream, buffer, sizeof (buffer));
+ p = buffer;
+ }
+
+ if (*f != '%') {
+ *p++ = *f++;
+ continue;
+ }
+
+ f++;
+
+ _cairo_output_stream_write (stream, buffer, p - buffer);
+ p = buffer;
+
+ length_modifier = 0;
+ if (*f == 'l') {
+ length_modifier = LENGTH_MODIFIER_LONG;
+ f++;
+ }
+
+ switch (*f | length_modifier) {
+ case '%':
+ p[0] = *f;
+ p[1] = 0;
+ break;
+ case 'd':
+ snprintf (buffer, sizeof buffer, "%d", va_arg (ap, int));
+ break;
+ case 'd' | LENGTH_MODIFIER_LONG:
+ snprintf (buffer, sizeof buffer, "%ld", va_arg (ap, long int));
+ break;
+ case 'u':
+ snprintf (buffer, sizeof buffer, "%u", va_arg (ap, unsigned int));
+ break;
+ case 'u' | LENGTH_MODIFIER_LONG:
+ snprintf (buffer, sizeof buffer, "%lu", va_arg (ap, long unsigned int));
+ break;
+ case 'o':
+ snprintf (buffer, sizeof buffer, "%o", va_arg (ap, int));
+ break;
+ case 's':
+ snprintf (buffer, sizeof buffer, "%s", va_arg (ap, const char *));
+ break;
+ case 'f':
+ dtostr (buffer, sizeof buffer, va_arg (ap, double));
+ break;
+ default:
+ ASSERT_NOT_REACHED;
+ }
+ p = buffer + strlen (buffer);
+ f++;
+ }
+
+ _cairo_output_stream_write (stream, buffer, p - buffer);
+
+ return stream->status;
+}
+
+cairo_status_t
+_cairo_output_stream_printf (cairo_output_stream_t *stream,
+ const char *fmt, ...)
+{
+ va_list ap;
+ cairo_status_t status;
+
+ va_start (ap, fmt);
+
+ status = _cairo_output_stream_vprintf (stream, fmt, ap);
+
+ va_end (ap);
+
+ return status;
+}
+
+long
+_cairo_output_stream_get_position (cairo_output_stream_t *stream)
+{
+ return stream->position;
+}
+
+cairo_status_t
+_cairo_output_stream_get_status (cairo_output_stream_t *stream)
+{
+ return stream->status;
+}
+
+
+/* Maybe this should be a configure time option, so embedded targets
+ * don't have to pull in stdio. */
+
+static cairo_status_t
+stdio_write (void *closure, const unsigned char *data, unsigned int length)
+{
+ FILE *fp = closure;
+
+ if (fwrite (data, 1, length, fp) == length)
+ return CAIRO_STATUS_SUCCESS;
+
+ return CAIRO_STATUS_WRITE_ERROR;
+}
+
+cairo_output_stream_t *
+_cairo_output_stream_create_for_file (const char *filename)
+{
+ FILE *fp;
+ cairo_output_stream_t *stream;
+
+ fp = fopen (filename, "wb");
+ if (fp == NULL)
+ return NULL;
+
+ stream = _cairo_output_stream_create (stdio_write, fp);
+ if (stream == NULL)
+ fclose (fp);
+ stream->owns_closure_is_file = TRUE;
+
+ return stream;
+}
diff --git a/src/cairo_path_bounds.c b/src/cairo-path-bounds.c
index 7c5772a..670036c 100644
--- a/src/cairo_path_bounds.c
+++ b/src/cairo-path-bounds.c
@@ -151,7 +151,9 @@ _cairo_path_bounder_close_path (void *closure)
/* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */
cairo_status_t
-_cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, double *y2)
+_cairo_path_fixed_bounds (cairo_path_fixed_t *path,
+ double *x1, double *y1,
+ double *x2, double *y2)
{
cairo_status_t status;
@@ -159,12 +161,12 @@ _cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, doub
_cairo_path_bounder_init (&bounder);
- status = _cairo_path_interpret (path, CAIRO_DIRECTION_FORWARD,
- _cairo_path_bounder_move_to,
- _cairo_path_bounder_line_to,
- _cairo_path_bounder_curve_to,
- _cairo_path_bounder_close_path,
- &bounder);
+ status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD,
+ _cairo_path_bounder_move_to,
+ _cairo_path_bounder_line_to,
+ _cairo_path_bounder_curve_to,
+ _cairo_path_bounder_close_path,
+ &bounder);
if (status) {
*x1 = *y1 = *x2 = *y2 = 0.0;
_cairo_path_bounder_fini (&bounder);
diff --git a/src/cairo-path-data-private.h b/src/cairo-path-data-private.h
new file mode 100644
index 0000000..f7f4294
--- /dev/null
+++ b/src/cairo-path-data-private.h
@@ -0,0 +1,56 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@redhat.com>
+ */
+
+#ifndef CAIRO_PATH_DATA_PRIVATE_H
+#define CAIRO_PATH_DATA_PRIVATE_H
+
+#include "cairoint.h"
+
+cairo_private cairo_path_t *
+_cairo_path_data_create (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate);
+
+cairo_private cairo_path_t *
+_cairo_path_data_create_flat (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate);
+
+cairo_private cairo_path_t *
+_cairo_path_data_create_in_error (cairo_status_t status);
+
+cairo_private cairo_status_t
+_cairo_path_data_append_to_context (cairo_path_t *path,
+ cairo_t *cr);
+
+#endif /* CAIRO_PATH_DATA_PRIVATE_H */
diff --git a/src/cairo-path-data.c b/src/cairo-path-data.c
new file mode 100644
index 0000000..519c763
--- /dev/null
+++ b/src/cairo-path-data.c
@@ -0,0 +1,517 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@redhat.com>
+ */
+
+#include "cairo-path-data-private.h"
+#include "cairo-path-fixed-private.h"
+#include "cairo-gstate-private.h"
+
+static cairo_path_t
+cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 };
+
+/* Closure for path interpretation. */
+typedef struct cairo_path_data_count {
+ int count;
+ double tolerance;
+ cairo_point_t current_point;
+} cpdc_t;
+
+static cairo_status_t
+_cpdc_move_to (void *closure, cairo_point_t *point)
+{
+ cpdc_t *cpdc = closure;
+
+ cpdc->count += 2;
+
+ cpdc->current_point = *point;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cpdc_line_to (void *closure, cairo_point_t *point)
+{
+ cpdc_t *cpdc = closure;
+
+ cpdc->count += 2;
+
+ cpdc->current_point = *point;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cpdc_curve_to (void *closure,
+ cairo_point_t *p1,
+ cairo_point_t *p2,
+ cairo_point_t *p3)
+{
+ cpdc_t *cpdc = closure;
+
+ cpdc->count += 4;
+
+ cpdc->current_point = *p3;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cpdc_curve_to_flatten (void *closure,
+ cairo_point_t *p1,
+ cairo_point_t *p2,
+ cairo_point_t *p3)
+{
+ cpdc_t *cpdc = closure;
+ cairo_status_t status;
+ cairo_spline_t spline;
+ int i;
+
+ cairo_point_t *p0 = &cpdc->current_point;
+
+ status = _cairo_spline_init (&spline, p0, p1, p2, p3);
+ if (status == CAIRO_INT_STATUS_DEGENERATE)
+ return CAIRO_STATUS_SUCCESS;
+
+ status = _cairo_spline_decompose (&spline, cpdc->tolerance);
+ if (status)
+ goto out;
+
+ for (i=1; i < spline.num_points; i++)
+ _cpdc_line_to (cpdc, &spline.points[i]);
+
+ cpdc->current_point = *p3;
+
+ status = CAIRO_STATUS_SUCCESS;
+
+ out:
+ _cairo_spline_fini (&spline);
+ return status;
+}
+
+static cairo_status_t
+_cpdc_close_path (void *closure)
+{
+ cpdc_t *cpdc = closure;
+
+ cpdc->count += 1;
+
+ cpdc->current_point.x = 0;
+ cpdc->current_point.y = 0;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static int
+_cairo_path_data_count (cairo_path_t *path,
+ cairo_path_fixed_t *path_fixed,
+ double tolerance,
+ cairo_bool_t flatten)
+{
+ cpdc_t cpdc;
+
+ cpdc.count = 0;
+ cpdc.tolerance = tolerance;
+ cpdc.current_point.x = 0;
+ cpdc.current_point.y = 0;
+
+ _cairo_path_fixed_interpret (path_fixed,
+ CAIRO_DIRECTION_FORWARD,
+ _cpdc_move_to,
+ _cpdc_line_to,
+ flatten ?
+ _cpdc_curve_to_flatten :
+ _cpdc_curve_to,
+ _cpdc_close_path,
+ &cpdc);
+
+ return cpdc.count;
+}
+
+/* Closure for path interpretation. */
+typedef struct cairo_path_data_populate {
+ cairo_path_data_t *data;
+ cairo_gstate_t *gstate;
+ cairo_point_t current_point;
+} cpdp_t;
+
+static cairo_status_t
+_cpdp_move_to (void *closure, cairo_point_t *point)
+{
+ cpdp_t *cpdp = closure;
+ cairo_path_data_t *data = cpdp->data;
+ double x, y;
+
+ x = _cairo_fixed_to_double (point->x);
+ y = _cairo_fixed_to_double (point->y);
+
+ _cairo_gstate_backend_to_user (cpdp->gstate, &x, &y);
+
+ data->header.type = CAIRO_PATH_MOVE_TO;
+ data->header.length = 2;
+
+ /* We index from 1 to leave room for data->header */
+ data[1].point.x = x;
+ data[1].point.y = y;
+
+ cpdp->data += data->header.length;
+
+ cpdp->current_point = *point;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cpdp_line_to (void *closure, cairo_point_t *point)
+{
+ cpdp_t *cpdp = closure;
+ cairo_path_data_t *data = cpdp->data;
+ double x, y;
+
+ x = _cairo_fixed_to_double (point->x);
+ y = _cairo_fixed_to_double (point->y);
+
+ _cairo_gstate_backend_to_user (cpdp->gstate, &x, &y);
+
+ data->header.type = CAIRO_PATH_LINE_TO;
+ data->header.length = 2;
+
+ /* We index from 1 to leave room for data->header */
+ data[1].point.x = x;
+ data[1].point.y = y;
+
+ cpdp->data += data->header.length;
+
+ cpdp->current_point = *point;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cpdp_curve_to (void *closure,
+ cairo_point_t *p1,
+ cairo_point_t *p2,
+ cairo_point_t *p3)
+{
+ cpdp_t *cpdp = closure;
+ cairo_path_data_t *data = cpdp->data;
+ double x1, y1;
+ double x2, y2;
+ double x3, y3;
+
+ x1 = _cairo_fixed_to_double (p1->x);
+ y1 = _cairo_fixed_to_double (p1->y);
+ _cairo_gstate_backend_to_user (cpdp->gstate, &x1, &y1);
+
+ x2 = _cairo_fixed_to_double (p2->x);
+ y2 = _cairo_fixed_to_double (p2->y);
+ _cairo_gstate_backend_to_user (cpdp->gstate, &x2, &y2);
+
+ x3 = _cairo_fixed_to_double (p3->x);
+ y3 = _cairo_fixed_to_double (p3->y);
+ _cairo_gstate_backend_to_user (cpdp->gstate, &x3, &y3);
+
+ data->header.type = CAIRO_PATH_CURVE_TO;
+ data->header.length = 4;
+
+ /* We index from 1 to leave room for data->header */
+ data[1].point.x = x1;
+ data[1].point.y = y1;
+
+ data[2].point.x = x2;
+ data[2].point.y = y2;
+
+ data[3].point.x = x3;
+ data[3].point.y = y3;
+
+ cpdp->data += data->header.length;
+
+ cpdp->current_point = *p3;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cpdp_curve_to_flatten (void *closure,
+ cairo_point_t *p1,
+ cairo_point_t *p2,
+ cairo_point_t *p3)
+{
+ cpdp_t *cpdp = closure;
+ cairo_status_t status;
+ cairo_spline_t spline;
+ int i;
+
+ cairo_point_t *p0 = &cpdp->current_point;
+
+ status = _cairo_spline_init (&spline, p0, p1, p2, p3);
+ if (status == CAIRO_INT_STATUS_DEGENERATE)
+ return CAIRO_STATUS_SUCCESS;
+
+ status = _cairo_spline_decompose (&spline, cpdp->gstate->tolerance);
+ if (status)
+ goto out;
+
+ for (i=1; i < spline.num_points; i++)
+ _cpdp_line_to (cpdp, &spline.points[i]);
+
+ cpdp->current_point = *p3;
+
+ status = CAIRO_STATUS_SUCCESS;
+
+ out:
+ _cairo_spline_fini (&spline);
+ return status;
+}
+
+static cairo_status_t
+_cpdp_close_path (void *closure)
+{
+ cpdp_t *cpdp = closure;
+ cairo_path_data_t *data = cpdp->data;
+
+ data->header.type = CAIRO_PATH_CLOSE_PATH;
+ data->header.length = 1;
+
+ cpdp->data += data->header.length;
+
+ cpdp->current_point.x = 0;
+ cpdp->current_point.y = 0;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_path_data_populate (cairo_path_t *path,
+ cairo_path_fixed_t *path_fixed,
+ cairo_gstate_t *gstate,
+ cairo_bool_t flatten)
+{
+ cpdp_t cpdp;
+
+ cpdp.data = path->data;
+ cpdp.gstate = gstate;
+ cpdp.current_point.x = 0;
+ cpdp.current_point.y = 0;
+
+ _cairo_path_fixed_interpret (path_fixed,
+ CAIRO_DIRECTION_FORWARD,
+ _cpdp_move_to,
+ _cpdp_line_to,
+ flatten ?
+ _cpdp_curve_to_flatten :
+ _cpdp_curve_to,
+ _cpdp_close_path,
+ &cpdp);
+
+ /* Sanity check the count */
+ assert (cpdp.data - path->data == path->num_data);
+}
+
+static cairo_path_t *
+_cairo_path_data_create_real (cairo_path_fixed_t *path_fixed,
+ cairo_gstate_t *gstate,
+ cairo_bool_t flatten)
+{
+ cairo_path_t *path;
+
+ path = malloc (sizeof (cairo_path_t));
+ if (path == NULL)
+ return &cairo_path_nil;
+
+ path->num_data = _cairo_path_data_count (path, path_fixed,
+ gstate->tolerance, flatten);
+
+ path->data = malloc (path->num_data * sizeof (cairo_path_data_t));
+ if (path->data == NULL) {
+ free (path);
+ return &cairo_path_nil;
+ }
+
+ path->status = CAIRO_STATUS_SUCCESS;
+
+ _cairo_path_data_populate (path, path_fixed,
+ gstate, flatten);
+
+ return path;
+}
+
+/**
+ * cairo_path_destroy:
+ * @path: a path to destroy which was previously returned by either
+ * cairo_copy_path or cairo_copy_path_flat.
+ *
+ * Immediately releases all memory associated with @path. After a call
+ * to cairo_path_destroy() the @path pointer is no longer valid and
+ * should not be used further.
+ *
+ * NOTE: cairo_path_destroy function should only be called with a
+ * pointer to a #cairo_path_t returned by a cairo function. Any path
+ * that is created manually (ie. outside of cairo) should be destroyed
+ * manually as well.
+ **/
+void
+cairo_path_destroy (cairo_path_t *path)
+{
+ if (path == NULL || path == &cairo_path_nil)
+ return;
+
+ free (path->data);
+ path->num_data = 0;
+ free (path);
+}
+
+/**
+ * _cairo_path_data_create:
+ * @path: a fixed-point, device-space path to be converted and copied
+ * @gstate: the current graphics state
+ *
+ * Creates a user-space #cairo_path_t copy of the given device-space
+ * @path. The @gstate parameter provides the inverse CTM for the
+ * conversion.
+ *
+ * Return value: the new copy of the path. If there is insufficient
+ * memory a pointer to a special static cairo_path_nil will be
+ * returned instead with status==CAIRO_STATUS_NO_MEMORY and
+ * data==NULL.
+ **/
+cairo_path_t *
+_cairo_path_data_create (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate)
+{
+ return _cairo_path_data_create_real (path, gstate, FALSE);
+}
+
+/**
+ * _cairo_path_data_create_flat:
+ * @path: a fixed-point, device-space path to be flattened, converted and copied
+ * @gstate: the current graphics state
+ *
+ * Creates a flattened, user-space #cairo_path_t copy of the given
+ * device-space @path. The @gstate parameter provide the inverse CTM
+ * for the conversion, as well as the tolerance value to control the
+ * accuracy of the flattening.
+ *
+ * Return value: the flattened copy of the path. If there is insufficient
+ * memory a pointer to a special static cairo_path_nil will be
+ * returned instead with status==CAIRO_STATUS_NO_MEMORY and
+ * data==NULL.
+ **/
+cairo_path_t *
+_cairo_path_data_create_flat (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate)
+{
+ return _cairo_path_data_create_real (path, gstate, TRUE);
+}
+
+/**
+ * _cairo_path_data_create_in_error:
+ * @status: an error status
+ *
+ * Create an empty #cairo_path_t object to hold an error status. This
+ * is useful for propagating status values from an existing object to
+ * a new #cairo_path_t.
+ *
+ * Return value: a #cairo_path_t object with status of @status, NULL
+ * data, and 0 num_data. If there is insufficient memory a pointer to
+ * a special static cairo_path_nil will be returned instead with
+ * status==CAIRO_STATUS_NO_MEMORY rather than @status.
+ **/
+cairo_path_t *
+_cairo_path_data_create_in_error (cairo_status_t status)
+{
+ cairo_path_t *path;
+
+ path = malloc (sizeof (cairo_path_t));
+ if (path == NULL)
+ return &cairo_path_nil;
+
+ path->status = status;
+ path->data = NULL;
+ path->num_data = 0;
+
+ return path;
+}
+
+/**
+ * _cairo_path_data_append_to_context:
+ * @path: the path data to be appended
+ * @cr: a cairo context
+ *
+ * Append @path to the current path within @cr.
+ *
+ * Return value: CAIRO_STATUS_INVALID_PATH_DATA if the data in @path
+ * is invalid, and CAIRO_STATUS_SUCCESS otherwise.
+ **/
+cairo_status_t
+_cairo_path_data_append_to_context (cairo_path_t *path,
+ cairo_t *cr)
+{
+ int i;
+ cairo_path_data_t *p;
+
+ for (i=0; i < path->num_data; i += path->data[i].header.length) {
+ p = &path->data[i];
+ switch (p->header.type) {
+ case CAIRO_PATH_MOVE_TO:
+ cairo_move_to (cr,
+ p[1].point.x, p[1].point.y);
+ if (p->header.length != 2)
+ return CAIRO_STATUS_INVALID_PATH_DATA;
+ break;
+ case CAIRO_PATH_LINE_TO:
+ cairo_line_to (cr,
+ p[1].point.x, p[1].point.y);
+ if (p->header.length != 2)
+ return CAIRO_STATUS_INVALID_PATH_DATA;
+ break;
+ case CAIRO_PATH_CURVE_TO:
+ cairo_curve_to (cr,
+ p[1].point.x, p[1].point.y,
+ p[2].point.x, p[2].point.y,
+ p[3].point.x, p[3].point.y);
+ if (p->header.length != 4)
+ return CAIRO_STATUS_INVALID_PATH_DATA;
+ break;
+ case CAIRO_PATH_CLOSE_PATH:
+ cairo_close_path (cr);
+ if (p->header.length != 1)
+ return CAIRO_STATUS_INVALID_PATH_DATA;
+ break;
+ default:
+ return CAIRO_STATUS_INVALID_PATH_DATA;
+ }
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
diff --git a/src/cairo_path_fill.c b/src/cairo-path-fill.c
index dc79b6b..c0015fc 100644
--- a/src/cairo_path_fill.c
+++ b/src/cairo-path-fill.c
@@ -36,6 +36,8 @@
#include "cairoint.h"
+#include "cairo-gstate-private.h"
+
typedef struct cairo_filler {
cairo_gstate_t *gstate;
cairo_traps_t *traps;
@@ -171,20 +173,22 @@ _cairo_filler_close_path (void *closure)
}
cairo_status_t
-_cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
+_cairo_path_fixed_fill_to_traps (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate,
+ cairo_traps_t *traps)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_filler_t filler;
_cairo_filler_init (&filler, gstate, traps);
- status = _cairo_path_interpret (path,
- CAIRO_DIRECTION_FORWARD,
- _cairo_filler_move_to,
- _cairo_filler_line_to,
- _cairo_filler_curve_to,
- _cairo_filler_close_path,
- &filler);
+ status = _cairo_path_fixed_interpret (path,
+ CAIRO_DIRECTION_FORWARD,
+ _cairo_filler_move_to,
+ _cairo_filler_line_to,
+ _cairo_filler_curve_to,
+ _cairo_filler_close_path,
+ &filler);
if (status)
goto BAIL;
diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h
new file mode 100644
index 0000000..e8e0df1
--- /dev/null
+++ b/src/cairo-path-fixed-private.h
@@ -0,0 +1,74 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@redhat.com>
+ */
+
+#ifndef CAIRO_PATH_FIXED_PRIVATE_H
+#define CAIRO_PATH_FIXED_PRIVATE_H
+
+typedef enum cairo_path_op {
+ CAIRO_PATH_OP_MOVE_TO = 0,
+ CAIRO_PATH_OP_LINE_TO = 1,
+ CAIRO_PATH_OP_CURVE_TO = 2,
+ CAIRO_PATH_OP_CLOSE_PATH = 3
+} __attribute__ ((packed)) cairo_path_op_t; /* Don't want 32 bits if we can avoid it. */
+
+#define CAIRO_PATH_BUF_SIZE 64
+
+typedef struct _cairo_path_op_buf {
+ int num_ops;
+ cairo_path_op_t op[CAIRO_PATH_BUF_SIZE];
+
+ struct _cairo_path_op_buf *next, *prev;
+} cairo_path_op_buf_t;
+
+typedef struct _cairo_path_arg_buf {
+ int num_points;
+ cairo_point_t points[CAIRO_PATH_BUF_SIZE];
+
+ struct _cairo_path_arg_buf *next, *prev;
+} cairo_path_arg_buf_t;
+
+struct _cairo_path_fixed {
+ cairo_path_op_buf_t *op_buf_head;
+ cairo_path_op_buf_t *op_buf_tail;
+
+ cairo_path_arg_buf_t *arg_buf_head;
+ cairo_path_arg_buf_t *arg_buf_tail;
+
+ cairo_point_t last_move_point;
+ cairo_point_t current_point;
+ int has_current_point;
+};
+
+#endif /* CAIRO_PATH_FIXED_PRIVATE_H */
diff --git a/src/cairo_path_stroke.c b/src/cairo-path-stroke.c
index 08b3809..b81d862 100644
--- a/src/cairo_path_stroke.c
+++ b/src/cairo-path-stroke.c
@@ -36,6 +36,8 @@
#include "cairoint.h"
+#include "cairo-gstate-private.h"
+
typedef struct cairo_stroker {
cairo_gstate_t *gstate;
cairo_traps_t *traps;
@@ -794,7 +796,9 @@ _cairo_stroker_close_path (void *closure)
}
cairo_status_t
-_cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
+_cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate,
+ cairo_traps_t *traps)
{
cairo_status_t status = CAIRO_STATUS_SUCCESS;
cairo_stroker_t stroker;
@@ -802,21 +806,21 @@ _cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_t
_cairo_stroker_init (&stroker, gstate, traps);
if (gstate->dash)
- status = _cairo_path_interpret (path,
- CAIRO_DIRECTION_FORWARD,
- _cairo_stroker_move_to,
- _cairo_stroker_line_to_dashed,
- _cairo_stroker_curve_to,
- _cairo_stroker_close_path,
- &stroker);
+ status = _cairo_path_fixed_interpret (path,
+ CAIRO_DIRECTION_FORWARD,
+ _cairo_stroker_move_to,
+ _cairo_stroker_line_to_dashed,
+ _cairo_stroker_curve_to,
+ _cairo_stroker_close_path,
+ &stroker);
else
- status = _cairo_path_interpret (path,
- CAIRO_DIRECTION_FORWARD,
- _cairo_stroker_move_to,
- _cairo_stroker_line_to,
- _cairo_stroker_curve_to,
- _cairo_stroker_close_path,
- &stroker);
+ status = _cairo_path_fixed_interpret (path,
+ CAIRO_DIRECTION_FORWARD,
+ _cairo_stroker_move_to,
+ _cairo_stroker_line_to,
+ _cairo_stroker_curve_to,
+ _cairo_stroker_close_path,
+ &stroker);
if (status)
goto BAIL;
diff --git a/src/cairo-path.c b/src/cairo-path.c
new file mode 100644
index 0000000..0940c4d
--- /dev/null
+++ b/src/cairo-path.c
@@ -0,0 +1,532 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdlib.h>
+#include "cairoint.h"
+
+#include "cairo-path-fixed-private.h"
+
+/* private functions */
+static cairo_status_t
+_cairo_path_fixed_add (cairo_path_fixed_t *path,
+ cairo_path_op_t op,
+ cairo_point_t *points,
+ int num_points);
+
+static void
+_cairo_path_fixed_add_op_buf (cairo_path_fixed_t *path,
+ cairo_path_op_buf_t *op_buf);
+
+static void
+_cairo_path_fixed_add_arg_buf (cairo_path_fixed_t *path,
+ cairo_path_arg_buf_t *arg_buf);
+
+static cairo_path_op_buf_t *
+_cairo_path_op_buf_create (void);
+
+static void
+_cairo_path_op_buf_destroy (cairo_path_op_buf_t *op_buf);
+
+static void
+_cairo_path_op_buf_add_op (cairo_path_op_buf_t *op_buf,
+ cairo_path_op_t op);
+
+static cairo_path_arg_buf_t *
+_cairo_path_arg_buf_create (void);
+
+static void
+_cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *arg_buf);
+
+static void
+_cairo_path_arg_buf_add_points (cairo_path_arg_buf_t *arg_buf,
+ cairo_point_t *points,
+ int num_points);
+
+void
+_cairo_path_fixed_init (cairo_path_fixed_t *path)
+{
+ path->op_buf_head = NULL;
+ path->op_buf_tail = NULL;
+
+ path->arg_buf_head = NULL;
+ path->arg_buf_tail = NULL;
+
+ path->current_point.x = 0;
+ path->current_point.y = 0;
+ path->has_current_point = 0;
+ path->last_move_point = path->current_point;
+}
+
+cairo_status_t
+_cairo_path_fixed_init_copy (cairo_path_fixed_t *path,
+ cairo_path_fixed_t *other)
+{
+ cairo_path_op_buf_t *op_buf, *other_op_buf;
+ cairo_path_arg_buf_t *arg_buf, *other_arg_buf;
+
+ _cairo_path_fixed_init (path);
+ path->current_point = other->current_point;
+ path->has_current_point = other->has_current_point;
+ path->last_move_point = other->last_move_point;
+
+ for (other_op_buf = other->op_buf_head;
+ other_op_buf;
+ other_op_buf = other_op_buf->next)
+ {
+ op_buf = _cairo_path_op_buf_create ();
+ if (op_buf == NULL) {
+ _cairo_path_fixed_fini (path);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+ memcpy (op_buf, other_op_buf, sizeof (cairo_path_op_buf_t));
+ _cairo_path_fixed_add_op_buf (path, op_buf);
+ }
+
+ for (other_arg_buf = other->arg_buf_head;
+ other_arg_buf;
+ other_arg_buf = other_arg_buf->next)
+ {
+ arg_buf = _cairo_path_arg_buf_create ();
+ if (arg_buf == NULL) {
+ _cairo_path_fixed_fini (path);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+ memcpy (arg_buf, other_arg_buf, sizeof (cairo_path_arg_buf_t));
+ _cairo_path_fixed_add_arg_buf (path, arg_buf);
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+void
+_cairo_path_fixed_fini (cairo_path_fixed_t *path)
+{
+ cairo_path_op_buf_t *op_buf;
+ cairo_path_arg_buf_t *arg_buf;
+
+ while (path->op_buf_head) {
+ op_buf = path->op_buf_head;
+ path->op_buf_head = op_buf->next;
+ _cairo_path_op_buf_destroy (op_buf);
+ }
+ path->op_buf_tail = NULL;
+
+ while (path->arg_buf_head) {
+ arg_buf = path->arg_buf_head;
+ path->arg_buf_head = arg_buf->next;
+ _cairo_path_arg_buf_destroy (arg_buf);
+ }
+ path->arg_buf_tail = NULL;
+
+ path->has_current_point = 0;
+}
+
+cairo_status_t
+_cairo_path_fixed_move_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x,
+ cairo_fixed_t y)
+{
+ cairo_status_t status;
+ cairo_point_t point;
+
+ point.x = x;
+ point.y = y;
+
+ status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_MOVE_TO, &point, 1);
+ if (status)
+ return status;
+
+ path->current_point = point;
+ path->has_current_point = 1;
+ path->last_move_point = path->current_point;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_path_fixed_rel_move_to (cairo_path_fixed_t *path,
+ cairo_fixed_t dx,
+ cairo_fixed_t dy)
+{
+ cairo_fixed_t x, y;
+
+ if (!path->has_current_point)
+ return CAIRO_STATUS_NO_CURRENT_POINT;
+
+ x = path->current_point.x + dx;
+ y = path->current_point.y + dy;
+
+ return _cairo_path_fixed_move_to (path, x, y);
+}
+
+cairo_status_t
+_cairo_path_fixed_line_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x,
+ cairo_fixed_t y)
+{
+ cairo_status_t status;
+ cairo_point_t point;
+
+ point.x = x;
+ point.y = y;
+
+ status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_LINE_TO, &point, 1);
+ if (status)
+ return status;
+
+ path->current_point = point;
+ path->has_current_point = 1;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_path_fixed_rel_line_to (cairo_path_fixed_t *path,
+ cairo_fixed_t dx,
+ cairo_fixed_t dy)
+{
+ cairo_fixed_t x, y;
+
+ if (!path->has_current_point)
+ return CAIRO_STATUS_NO_CURRENT_POINT;
+
+ x = path->current_point.x + dx;
+ y = path->current_point.y + dy;
+
+ return _cairo_path_fixed_line_to (path, x, y);
+}
+
+cairo_status_t
+_cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x0, cairo_fixed_t y0,
+ cairo_fixed_t x1, cairo_fixed_t y1,
+ cairo_fixed_t x2, cairo_fixed_t y2)
+{
+ cairo_status_t status;
+ cairo_point_t point[3];
+
+ point[0].x = x0; point[0].y = y0;
+ point[1].x = x1; point[1].y = y1;
+ point[2].x = x2; point[2].y = y2;
+
+ status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
+ if (status)
+ return status;
+
+ path->current_point = point[2];
+ path->has_current_point = 1;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
+ cairo_fixed_t dx0, cairo_fixed_t dy0,
+ cairo_fixed_t dx1, cairo_fixed_t dy1,
+ cairo_fixed_t dx2, cairo_fixed_t dy2)
+{
+ cairo_fixed_t x0, y0;
+ cairo_fixed_t x1, y1;
+ cairo_fixed_t x2, y2;
+
+ if (!path->has_current_point)
+ return CAIRO_STATUS_NO_CURRENT_POINT;
+
+ x0 = path->current_point.x + dx0;
+ y0 = path->current_point.y + dy0;
+
+ x1 = path->current_point.x + dx1;
+ y1 = path->current_point.y + dy1;
+
+ x2 = path->current_point.x + dx2;
+ y2 = path->current_point.y + dy2;
+
+ return _cairo_path_fixed_curve_to (path,
+ x0, y0,
+ x1, y1,
+ x2, y2);
+}
+
+cairo_status_t
+_cairo_path_fixed_close_path (cairo_path_fixed_t *path)
+{
+ cairo_status_t status;
+
+ status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_CLOSE_PATH, NULL, 0);
+ if (status)
+ return status;
+
+ path->current_point.x = path->last_move_point.x;
+ path->current_point.y = path->last_move_point.y;
+ path->has_current_point = 1;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+cairo_status_t
+_cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
+ cairo_fixed_t *x,
+ cairo_fixed_t *y)
+{
+ if (! path->has_current_point)
+ return CAIRO_STATUS_NO_CURRENT_POINT;
+
+ *x = path->current_point.x;
+ *y = path->current_point.y;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_path_fixed_add (cairo_path_fixed_t *path,
+ cairo_path_op_t op,
+ cairo_point_t *points,
+ int num_points)
+{
+ if (path->op_buf_tail == NULL ||
+ path->op_buf_tail->num_ops + 1 > CAIRO_PATH_BUF_SIZE)
+ {
+ cairo_path_op_buf_t *op_buf;
+
+ op_buf = _cairo_path_op_buf_create ();
+ if (op_buf == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ _cairo_path_fixed_add_op_buf (path, op_buf);
+ }
+
+ _cairo_path_op_buf_add_op (path->op_buf_tail, op);
+
+ if (path->arg_buf_tail == NULL ||
+ path->arg_buf_tail->num_points + num_points > CAIRO_PATH_BUF_SIZE)
+ {
+ cairo_path_arg_buf_t *arg_buf;
+
+ arg_buf = _cairo_path_arg_buf_create ();
+
+ if (arg_buf == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ _cairo_path_fixed_add_arg_buf (path, arg_buf);
+ }
+
+ _cairo_path_arg_buf_add_points (path->arg_buf_tail, points, num_points);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_path_fixed_add_op_buf (cairo_path_fixed_t *path,
+ cairo_path_op_buf_t *op_buf)
+{
+ op_buf->next = NULL;
+ op_buf->prev = path->op_buf_tail;
+
+ if (path->op_buf_tail) {
+ path->op_buf_tail->next = op_buf;
+ } else {
+ path->op_buf_head = op_buf;
+ }
+
+ path->op_buf_tail = op_buf;
+}
+
+static void
+_cairo_path_fixed_add_arg_buf (cairo_path_fixed_t *path,
+ cairo_path_arg_buf_t *arg_buf)
+{
+ arg_buf->next = NULL;
+ arg_buf->prev = path->arg_buf_tail;
+
+ if (path->arg_buf_tail) {
+ path->arg_buf_tail->next = arg_buf;
+ } else {
+ path->arg_buf_head = arg_buf;
+ }
+
+ path->arg_buf_tail = arg_buf;
+}
+
+static cairo_path_op_buf_t *
+_cairo_path_op_buf_create (void)
+{
+ cairo_path_op_buf_t *op_buf;
+
+ op_buf = malloc (sizeof (cairo_path_op_buf_t));
+
+ if (op_buf) {
+ op_buf->num_ops = 0;
+ op_buf->next = NULL;
+ }
+
+ return op_buf;
+}
+
+static void
+_cairo_path_op_buf_destroy (cairo_path_op_buf_t *op_buf)
+{
+ free (op_buf);
+}
+
+static void
+_cairo_path_op_buf_add_op (cairo_path_op_buf_t *op_buf,
+ cairo_path_op_t op)
+{
+ op_buf->op[op_buf->num_ops++] = op;
+}
+
+static cairo_path_arg_buf_t *
+_cairo_path_arg_buf_create (void)
+{
+ cairo_path_arg_buf_t *arg_buf;
+
+ arg_buf = malloc (sizeof (cairo_path_arg_buf_t));
+
+ if (arg_buf) {
+ arg_buf->num_points = 0;
+ arg_buf->next = NULL;
+ }
+
+ return arg_buf;
+}
+
+static void
+_cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *arg_buf)
+{
+ free (arg_buf);
+}
+
+static void
+_cairo_path_arg_buf_add_points (cairo_path_arg_buf_t *arg_buf,
+ cairo_point_t *points,
+ int num_points)
+{
+ int i;
+
+ for (i=0; i < num_points; i++) {
+ arg_buf->points[arg_buf->num_points++] = points[i];
+ }
+}
+
+#define CAIRO_PATH_OP_MAX_ARGS 3
+
+static int const num_args[] =
+{
+ 1, /* cairo_path_move_to */
+ 1, /* cairo_path_op_line_to */
+ 3, /* cairo_path_op_curve_to */
+ 0, /* cairo_path_op_close_path */
+};
+
+cairo_status_t
+_cairo_path_fixed_interpret (cairo_path_fixed_t *path,
+ cairo_direction_t dir,
+ cairo_path_fixed_move_to_func_t *move_to,
+ cairo_path_fixed_line_to_func_t *line_to,
+ cairo_path_fixed_curve_to_func_t *curve_to,
+ cairo_path_fixed_close_path_func_t *close_path,
+ void *closure)
+{
+ cairo_status_t status;
+ int i, arg;
+ cairo_path_op_buf_t *op_buf;
+ cairo_path_op_t op;
+ cairo_path_arg_buf_t *arg_buf = path->arg_buf_head;
+ int buf_i = 0;
+ cairo_point_t point[CAIRO_PATH_OP_MAX_ARGS];
+ cairo_bool_t forward = (dir == CAIRO_DIRECTION_FORWARD);
+ int step = forward ? 1 : -1;
+
+ for (op_buf = forward ? path->op_buf_head : path->op_buf_tail;
+ op_buf;
+ op_buf = forward ? op_buf->next : op_buf->prev)
+ {
+ int start, stop;
+ if (forward) {
+ start = 0;
+ stop = op_buf->num_ops;
+ } else {
+ start = op_buf->num_ops - 1;
+ stop = -1;
+ }
+
+ for (i=start; i != stop; i += step) {
+ op = op_buf->op[i];
+
+ if (! forward) {
+ if (buf_i == 0) {
+ arg_buf = arg_buf->prev;
+ buf_i = arg_buf->num_points;
+ }
+ buf_i -= num_args[op];
+ }
+
+ for (arg = 0; arg < num_args[op]; arg++) {
+ point[arg] = arg_buf->points[buf_i];
+ buf_i++;
+ if (buf_i >= arg_buf->num_points) {
+ arg_buf = arg_buf->next;
+ buf_i = 0;
+ }
+ }
+
+ if (! forward) {
+ buf_i -= num_args[op];
+ }
+
+ switch (op) {
+ case CAIRO_PATH_OP_MOVE_TO:
+ status = (*move_to) (closure, &point[0]);
+ break;
+ case CAIRO_PATH_OP_LINE_TO:
+ status = (*line_to) (closure, &point[0]);
+ break;
+ case CAIRO_PATH_OP_CURVE_TO:
+ status = (*curve_to) (closure, &point[0], &point[1], &point[2]);
+ break;
+ case CAIRO_PATH_OP_CLOSE_PATH:
+ default:
+ status = (*close_path) (closure);
+ break;
+ }
+ if (status)
+ return status;
+ }
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
diff --git a/src/cairo_pattern.c b/src/cairo-pattern.c
index 283c36d..cd099fd 100644
--- a/src/cairo_pattern.c
+++ b/src/cairo-pattern.c
@@ -1,6 +1,7 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2004 David Reveman
+ * Copyright © 2005 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
@@ -49,21 +50,67 @@ typedef struct _cairo_shader_op {
((unsigned char) \
((((unsigned char) (c1)) * (int) ((unsigned char) (c2))) / 0xff))
+static const cairo_solid_pattern_t cairo_solid_pattern_nil = {
+ { CAIRO_PATTERN_SOLID, /* type */
+ (unsigned int)-1, /* ref_count */
+ CAIRO_STATUS_NO_MEMORY, /* status */
+ { 1., 0., 0., 1., 0., 0., }, /* matrix */
+ CAIRO_FILTER_DEFAULT, /* filter */
+ CAIRO_EXTEND_DEFAULT }, /* extend */
+ { 0.0, 0.0, 0.0, 1.0, /* solid black */
+ 0x0, 0x0, 0x0, 0xffff }
+};
+
+static const cairo_surface_pattern_t cairo_surface_pattern_nil = {
+ { CAIRO_PATTERN_SURFACE, /* type */
+ (unsigned int)-1, /* ref_count */
+ CAIRO_STATUS_NO_MEMORY, /* status */
+ { 1., 0., 0., 1., 0., 0., }, /* matrix */
+ CAIRO_FILTER_DEFAULT, /* filter */
+ CAIRO_EXTEND_DEFAULT }, /* extend */
+ NULL /* surface */
+};
+
+static const cairo_linear_pattern_t cairo_linear_pattern_nil = {
+ { { CAIRO_PATTERN_LINEAR, /* type */
+ (unsigned int)-1, /* ref_count */
+ CAIRO_STATUS_NO_MEMORY, /* status */
+ { 1., 0., 0., 1., 0., 0., }, /* matrix */
+ CAIRO_FILTER_DEFAULT, /* filter */
+ CAIRO_EXTEND_DEFAULT }, /* extend */
+ NULL, /* stops */
+ 0 }, /* n_stops */
+ { 0., 0. }, { 1.0, 1.0 } /* point0, point1 */
+};
+
+static const cairo_radial_pattern_t cairo_radial_pattern_nil = {
+ { { CAIRO_PATTERN_RADIAL, /* type */
+ (unsigned int)-1, /* ref_count */
+ CAIRO_STATUS_NO_MEMORY, /* status */
+ { 1., 0., 0., 1., 0., 0., }, /* matrix */
+ CAIRO_FILTER_DEFAULT, /* filter */
+ CAIRO_EXTEND_DEFAULT }, /* extend */
+ NULL, /* stops */
+ 0 }, /* n_stops */
+ { 0., 0. }, { 0.0, 0.0 }, /* center0, center1 */
+ 1.0, 1.0, /* radius0, radius1 */
+};
+
static void
_cairo_pattern_init (cairo_pattern_t *pattern, cairo_pattern_type_t type)
{
pattern->type = type;
pattern->ref_count = 1;
+ pattern->status = CAIRO_STATUS_SUCCESS;
pattern->extend = CAIRO_EXTEND_DEFAULT;
pattern->filter = CAIRO_FILTER_DEFAULT;
- pattern->alpha = 1.0;
- _cairo_matrix_init (&pattern->matrix);
+ cairo_matrix_init_identity (&pattern->matrix);
}
-static cairo_status_t
-_cairo_gradient_pattern_init_copy (cairo_gradient_pattern_t *pattern,
- cairo_gradient_pattern_t *other)
+static void
+_cairo_gradient_pattern_init_copy (cairo_gradient_pattern_t *pattern,
+ const cairo_gradient_pattern_t *other)
{
if (other->base.type == CAIRO_PATTERN_LINEAR)
{
@@ -83,18 +130,22 @@ _cairo_gradient_pattern_init_copy (cairo_gradient_pattern_t *pattern,
if (other->n_stops)
{
pattern->stops = malloc (other->n_stops * sizeof (cairo_color_stop_t));
- if (!pattern->stops)
- return CAIRO_STATUS_NO_MEMORY;
+ if (!pattern->stops) {
+ if (other->base.type == CAIRO_PATTERN_LINEAR)
+ _cairo_gradient_pattern_init_copy (pattern, &cairo_linear_pattern_nil.base);
+ else
+ _cairo_gradient_pattern_init_copy (pattern, &cairo_radial_pattern_nil.base);
+ return;
+ }
memcpy (pattern->stops, other->stops,
other->n_stops * sizeof (cairo_color_stop_t));
}
-
- return CAIRO_STATUS_SUCCESS;
}
-cairo_status_t
-_cairo_pattern_init_copy (cairo_pattern_t *pattern, cairo_pattern_t *other)
+void
+_cairo_pattern_init_copy (cairo_pattern_t *pattern,
+ const cairo_pattern_t *other)
{
switch (other->type) {
case CAIRO_PATTERN_SOLID: {
@@ -114,17 +165,12 @@ _cairo_pattern_init_copy (cairo_pattern_t *pattern, cairo_pattern_t *other)
case CAIRO_PATTERN_RADIAL: {
cairo_gradient_pattern_t *dst = (cairo_gradient_pattern_t *) pattern;
cairo_gradient_pattern_t *src = (cairo_gradient_pattern_t *) other;
- cairo_status_t status;
- status = _cairo_gradient_pattern_init_copy (dst, src);
- if (status)
- return status;
+ _cairo_gradient_pattern_init_copy (dst, src);
} break;
}
pattern->ref_count = 1;
-
- return CAIRO_STATUS_SUCCESS;
}
void
@@ -150,15 +196,10 @@ _cairo_pattern_fini (cairo_pattern_t *pattern)
void
_cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
- double red,
- double green,
- double blue)
+ const cairo_color_t *color)
{
_cairo_pattern_init (&pattern->base, CAIRO_PATTERN_SOLID);
-
- pattern->red = red;
- pattern->green = green;
- pattern->blue = blue;
+ pattern->color = *color;
}
void
@@ -209,15 +250,46 @@ _cairo_pattern_init_radial (cairo_radial_pattern_t *pattern,
}
cairo_pattern_t *
-_cairo_pattern_create_solid (double red, double green, double blue)
+_cairo_pattern_create_solid (const cairo_color_t *color)
+{
+ cairo_solid_pattern_t *pattern;
+
+ pattern = malloc (sizeof (cairo_solid_pattern_t));
+ if (pattern == NULL)
+ return (cairo_pattern_t *) &cairo_solid_pattern_nil.base;
+
+ _cairo_pattern_init_solid (pattern, color);
+
+ return &pattern->base;
+}
+
+/**
+ * _cairo_pattern_create_in_error:
+ * @status: an error status
+ *
+ * Create an empty #cairo_pattern_t object to hold an error
+ * status. This is useful for propagating status values from an
+ * existing object to a new #cairo_pattern_t.
+ *
+ * Return value: a (solid, black) #cairo_pattern_t object with status
+ * of @status. If there is insufficient memory a pointer to a special,
+ * static cairo_solid_pattern_nil will be returned instead with a
+ * status of CAIRO_STATUS_NO_MEMORY rather than @status.
+ *
+ * Return value:
+ **/
+cairo_pattern_t *
+_cairo_pattern_create_in_error (cairo_status_t status)
{
cairo_solid_pattern_t *pattern;
pattern = malloc (sizeof (cairo_solid_pattern_t));
if (pattern == NULL)
- return NULL;
+ return (cairo_pattern_t *) &cairo_solid_pattern_nil.base;
+
+ _cairo_pattern_init_solid (pattern, CAIRO_COLOR_BLACK);
- _cairo_pattern_init_solid (pattern, red, green, blue);
+ pattern->base.status = status;
return &pattern->base;
}
@@ -229,16 +301,10 @@ cairo_pattern_create_for_surface (cairo_surface_t *surface)
pattern = malloc (sizeof (cairo_surface_pattern_t));
if (pattern == NULL)
- return NULL;
+ return (cairo_pattern_t *)&cairo_surface_pattern_nil.base;
_cairo_pattern_init_for_surface (pattern, surface);
- /* this will go away when we completely remove the surface attributes */
- if (surface->repeat)
- pattern->base.extend = CAIRO_EXTEND_REPEAT;
- else
- pattern->base.extend = CAIRO_EXTEND_DEFAULT;
-
return &pattern->base;
}
@@ -249,7 +315,7 @@ cairo_pattern_create_linear (double x0, double y0, double x1, double y1)
pattern = malloc (sizeof (cairo_linear_pattern_t));
if (pattern == NULL)
- return NULL;
+ return (cairo_pattern_t *) &cairo_linear_pattern_nil.base;
_cairo_pattern_init_linear (pattern, x0, y0, x1, y1);
@@ -264,7 +330,7 @@ cairo_pattern_create_radial (double cx0, double cy0, double radius0,
pattern = malloc (sizeof (cairo_radial_pattern_t));
if (pattern == NULL)
- return NULL;
+ return (cairo_pattern_t *) &cairo_radial_pattern_nil.base;
_cairo_pattern_init_radial (pattern, cx0, cy0, radius0, cx1, cy1, radius1);
@@ -277,15 +343,36 @@ cairo_pattern_reference (cairo_pattern_t *pattern)
if (pattern == NULL)
return;
+ if (pattern->ref_count == (unsigned int)-1)
+ return;
+
pattern->ref_count++;
}
+/**
+ * cairo_pattern_status:
+ * @pattern: a #cairo_pattern_t
+ *
+ * Checks whether an error has previously occurred for this
+ * pattern.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY
+ **/
+cairo_status_t
+cairo_pattern_status (cairo_pattern_t *pattern)
+{
+ return pattern->status;
+}
+
void
cairo_pattern_destroy (cairo_pattern_t *pattern)
{
if (pattern == NULL)
return;
+ if (pattern->ref_count == (unsigned int)-1)
+ return;
+
pattern->ref_count--;
if (pattern->ref_count)
return;
@@ -294,49 +381,78 @@ cairo_pattern_destroy (cairo_pattern_t *pattern)
free (pattern);
}
-static cairo_status_t
+static void
_cairo_pattern_add_color_stop (cairo_gradient_pattern_t *pattern,
- double offset,
- double red,
- double green,
- double blue,
- double alpha)
+ double offset,
+ cairo_color_t *color)
{
cairo_color_stop_t *stop;
+ cairo_color_stop_t *new_stops;
pattern->n_stops++;
- pattern->stops = realloc (pattern->stops,
- pattern->n_stops * sizeof (cairo_color_stop_t));
- if (pattern->stops == NULL) {
- pattern->n_stops = 0;
-
- return CAIRO_STATUS_NO_MEMORY;
+ new_stops = realloc (pattern->stops,
+ pattern->n_stops * sizeof (cairo_color_stop_t));
+ if (new_stops == NULL) {
+ pattern->base.status = CAIRO_STATUS_NO_MEMORY;
+ return;
}
+
+ pattern->stops = new_stops;
stop = &pattern->stops[pattern->n_stops - 1];
stop->offset = _cairo_fixed_from_double (offset);
+ stop->color = *color;
+}
- _cairo_color_init (&stop->color);
- _cairo_color_set_rgb (&stop->color, red, green, blue);
- _cairo_color_set_alpha (&stop->color, alpha);
+void
+cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
+ double offset,
+ double red,
+ double green,
+ double blue)
+{
+ cairo_color_t color;
- return CAIRO_STATUS_SUCCESS;
+ if (pattern->status)
+ return;
+
+ if (pattern->type != CAIRO_PATTERN_LINEAR &&
+ pattern->type != CAIRO_PATTERN_RADIAL)
+ {
+ pattern->status = CAIRO_STATUS_PATTERN_TYPE_MISMATCH;
+ return;
+ }
+
+ _cairo_restrict_value (&offset, 0.0, 1.0);
+ _cairo_restrict_value (&red, 0.0, 1.0);
+ _cairo_restrict_value (&green, 0.0, 1.0);
+ _cairo_restrict_value (&blue, 0.0, 1.0);
+
+ _cairo_color_init_rgb (&color, red, green, blue);
+ _cairo_pattern_add_color_stop ((cairo_gradient_pattern_t *) pattern,
+ offset,
+ &color);
}
-cairo_status_t
-cairo_pattern_add_color_stop (cairo_pattern_t *pattern,
- double offset,
- double red,
- double green,
- double blue,
- double alpha)
+void
+cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
+ double offset,
+ double red,
+ double green,
+ double blue,
+ double alpha)
{
+ cairo_color_t color;
+
+ if (pattern->status)
+ return;
+
if (pattern->type != CAIRO_PATTERN_LINEAR &&
pattern->type != CAIRO_PATTERN_RADIAL)
{
- /* XXX: CAIRO_STATUS_INVALID_PATTERN? */
- return CAIRO_STATUS_SUCCESS;
+ pattern->status = CAIRO_STATUS_PATTERN_TYPE_MISMATCH;
+ return;
}
_cairo_restrict_value (&offset, 0.0, 1.0);
@@ -345,30 +461,35 @@ cairo_pattern_add_color_stop (cairo_pattern_t *pattern,
_cairo_restrict_value (&blue, 0.0, 1.0);
_cairo_restrict_value (&alpha, 0.0, 1.0);
- return _cairo_pattern_add_color_stop ((cairo_gradient_pattern_t *) pattern,
- offset,
- red, green, blue,
- alpha);
+ _cairo_color_init_rgba (&color, red, green, blue, alpha);
+ _cairo_pattern_add_color_stop ((cairo_gradient_pattern_t *) pattern,
+ offset,
+ &color);
}
-cairo_status_t
-cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix)
+void
+cairo_pattern_set_matrix (cairo_pattern_t *pattern,
+ const cairo_matrix_t *matrix)
{
- return cairo_matrix_copy (&pattern->matrix, matrix);
+ if (pattern->status)
+ return;
+
+ pattern->matrix = *matrix;
}
-cairo_status_t
+void
cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix)
{
- return cairo_matrix_copy (matrix, &pattern->matrix);
+ *matrix = pattern->matrix;
}
-cairo_status_t
+void
cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter)
{
- pattern->filter = filter;
+ if (pattern->status)
+ return;
- return CAIRO_STATUS_SUCCESS;
+ pattern->filter = filter;
}
cairo_filter_t
@@ -377,12 +498,13 @@ cairo_pattern_get_filter (cairo_pattern_t *pattern)
return pattern->filter;
}
-cairo_status_t
+void
cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend)
{
- pattern->extend = extend;
+ if (pattern->status)
+ return;
- return CAIRO_STATUS_SUCCESS;
+ pattern->extend = extend;
}
cairo_extend_t
@@ -391,36 +513,12 @@ cairo_pattern_get_extend (cairo_pattern_t *pattern)
return pattern->extend;
}
-cairo_status_t
-_cairo_pattern_get_rgb (cairo_pattern_t *pattern,
- double *red,
- double *green,
- double *blue)
-{
-
- if (pattern->type == CAIRO_PATTERN_SOLID)
- {
- cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) pattern;
-
- *red = solid->red;
- *green = solid->green;
- *blue = solid->blue;
- } else
- *red = *green = *blue = 1.0;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
void
-_cairo_pattern_set_alpha (cairo_pattern_t *pattern, double alpha)
+_cairo_pattern_transform (cairo_pattern_t *pattern,
+ const cairo_matrix_t *ctm_inverse)
{
- pattern->alpha = alpha;
-}
+ assert (pattern->status == CAIRO_STATUS_SUCCESS);
-void
-_cairo_pattern_transform (cairo_pattern_t *pattern,
- cairo_matrix_t *ctm_inverse)
-{
cairo_matrix_multiply (&pattern->matrix, ctm_inverse, &pattern->matrix);
}
@@ -506,8 +604,7 @@ _cairo_pattern_shader_init (cairo_gradient_pattern_t *pattern,
op->stops[i].color_char[0] = pattern->stops[i].color.red * 0xff;
op->stops[i].color_char[1] = pattern->stops[i].color.green * 0xff;
op->stops[i].color_char[2] = pattern->stops[i].color.blue * 0xff;
- op->stops[i].color_char[3] = pattern->stops[i].color.alpha *
- pattern->base.alpha * 0xff;
+ op->stops[i].color_char[3] = pattern->stops[i].color.alpha * 0xff;
op->stops[i].offset = pattern->stops[i].offset;
op->stops[i].id = i;
}
@@ -516,6 +613,13 @@ _cairo_pattern_shader_init (cairo_gradient_pattern_t *pattern,
qsort (op->stops, pattern->n_stops, sizeof (cairo_shader_color_stop_t),
_cairo_shader_color_stop_compare);
+ /* this scale value is used only when computing gradient values
+ * before the defined range, in which case stop 0 is used for both
+ * ends of the interpolation, making the value of 'scale' not
+ * actually matter, except that valgrind notices we're using
+ * an undefined value.
+ */
+ op->stops[0].scale = 0;
for (i = 0; i < pattern->n_stops - 1; i++)
{
op->stops[i + 1].scale = op->stops[i + 1].offset - op->stops[i].offset;
@@ -666,8 +770,8 @@ _cairo_image_data_set_linear (cairo_linear_pattern_t *pattern,
point1.x = pattern->point1.x;
point1.y = pattern->point1.y;
- cairo_matrix_get_affine (&pattern->base.base.matrix,
- &a, &b, &c, &d, &tx, &ty);
+ _cairo_matrix_get_affine (&pattern->base.base.matrix,
+ &a, &b, &c, &d, &tx, &ty);
dx = point1.x - point0.x;
dy = point1.y - point0.y;
@@ -721,8 +825,8 @@ _cairo_linear_pattern_classify (cairo_linear_pattern_t *pattern,
point1.x = pattern->point1.x;
point1.y = pattern->point1.y;
- cairo_matrix_get_affine (&pattern->base.base.matrix,
- &a, &b, &c, &d, &tx, &ty);
+ _cairo_matrix_get_affine (&pattern->base.base.matrix,
+ &a, &b, &c, &d, &tx, &ty);
dx = point1.x - point0.x;
dy = point1.y - point0.y;
@@ -795,8 +899,8 @@ _cairo_image_data_set_radial (cairo_radial_pattern_t *pattern,
r1_2 = c0_c1 = 0.0; /* shut up compiler */
}
- cairo_matrix_get_affine (&pattern->base.base.matrix,
- &a, &b, &c, &d, &tx, &ty);
+ _cairo_matrix_get_affine (&pattern->base.base.matrix,
+ &a, &b, &c, &d, &tx, &ty);
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
@@ -865,8 +969,9 @@ _cairo_image_data_set_radial (cairo_radial_pattern_t *pattern,
c0_x = y_x + c0_y;
factor = (c0_e - r0) / (c0_x - r0);
- } else
+ } else {
factor = -r0;
+ }
}
_cairo_pattern_calc_color_at_pixel (&op, factor * 65536, pixels++);
@@ -889,9 +994,9 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern,
cairo_surface_attributes_t *attr)
{
cairo_image_surface_t *image;
- cairo_status_t status;
- uint32_t *data;
- cairo_bool_t repeat = FALSE;
+ cairo_status_t status;
+ uint32_t *data;
+ cairo_bool_t repeat = FALSE;
if (pattern->base.type == CAIRO_PATTERN_LINEAR) {
cairo_bool_t is_horizontal;
@@ -935,7 +1040,7 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern,
}
image = (cairo_image_surface_t *)
- cairo_image_surface_create_for_data ((char *) data,
+ cairo_image_surface_create_for_data ((unsigned char *) data,
CAIRO_FORMAT_ARGB32,
width, height,
width * 4);
@@ -953,7 +1058,7 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern,
attr->x_offset = -x;
attr->y_offset = -y;
- cairo_matrix_set_identity (&attr->matrix);
+ cairo_matrix_init_identity (&attr->matrix);
attr->extend = repeat ? CAIRO_EXTEND_REPEAT : CAIRO_EXTEND_NONE;
attr->filter = CAIRO_FILTER_NEAREST;
attr->acquired = FALSE;
@@ -971,22 +1076,16 @@ _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t *pattern,
cairo_surface_t **out,
cairo_surface_attributes_t *attribs)
{
- cairo_color_t color;
-
- _cairo_color_init (&color);
- _cairo_color_set_rgb (&color, pattern->red, pattern->green, pattern->blue);
- _cairo_color_set_alpha (&color, pattern->base.alpha);
-
*out = _cairo_surface_create_similar_solid (dst,
CAIRO_FORMAT_ARGB32,
1, 1,
- &color);
+ &pattern->color);
if (*out == NULL)
return CAIRO_STATUS_NO_MEMORY;
attribs->x_offset = attribs->y_offset = 0;
- cairo_matrix_set_identity (&attribs->matrix);
+ cairo_matrix_init_identity (&attribs->matrix);
attribs->extend = CAIRO_EXTEND_REPEAT;
attribs->filter = CAIRO_FILTER_NEAREST;
attribs->acquired = FALSE;
@@ -996,28 +1095,27 @@ _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t *pattern,
/**
- * _cairo_pattern_is_opaque
+ * _cairo_pattern_is_opaque_solid
*
- * Convenience function to determine whether a pattern has an opaque
- * alpha value. This is done by testing whether the pattern's alpha
- * value when converted to a byte is 255, so if a backend actually
- * supported deep alpha channels this function might not do the right
- * thing.
+ * Convenience function to determine whether a pattern is an opaque
+ * (alpha==1.0) solid color pattern. This is done by testing whether
+ * the pattern's alpha value when converted to a byte is 255, so if a
+ * backend actually supported deep alpha channels this function might
+ * not do the right thing.
*
- * Note that for a gradient or surface pattern, the overall resulting
- * alpha for the pattern can be non-opaque even this function returns
- * %TRUE, since the resulting alpha is the multiplication of the
- * alpha of the gradient or surface with the pattern's alpha. In
- * the future, alpha will be moved from the base pattern to the
- * solid pattern subtype, at which point this function should
- * probably be renamed to _cairo_pattern_is_opaque_solid()
- *
- * Return value: %TRUE if the pattern is opaque
+ * Return value: %TRUE if the pattern is an opaque, solid color.
**/
cairo_bool_t
-_cairo_pattern_is_opaque (cairo_pattern_t *pattern)
+_cairo_pattern_is_opaque_solid (cairo_pattern_t *pattern)
{
- return (pattern->alpha >= ((double)0xff00 / (double)0xffff));
+ cairo_solid_pattern_t *solid;
+
+ if (pattern->type != CAIRO_PATTERN_SOLID)
+ return FALSE;
+
+ solid = (cairo_solid_pattern_t *) pattern;
+
+ return CAIRO_ALPHA_IS_OPAQUE (solid->color.alpha);
}
static cairo_int_status_t
@@ -1031,84 +1129,42 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
cairo_surface_attributes_t *attr)
{
cairo_int_status_t status;
+ int tx, ty;
attr->acquired = FALSE;
-
- /* handle pattern opacity */
- if (!_cairo_pattern_is_opaque (&pattern->base))
+
+ if (_cairo_surface_is_image (dst))
{
- cairo_surface_pattern_t tmp;
- cairo_color_t color;
-
- _cairo_color_init (&color);
- _cairo_color_set_alpha (&color, pattern->base.alpha);
-
- *out = _cairo_surface_create_similar_solid (dst,
- CAIRO_FORMAT_ARGB32,
- width, height,
- &color);
- if (*out == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- status = _cairo_pattern_init_copy (&tmp.base, &pattern->base);
- if (CAIRO_OK (status))
- {
- tmp.base.alpha = 1.0;
- status = _cairo_surface_composite (CAIRO_OPERATOR_IN,
- &tmp.base,
- NULL,
- *out,
- x, y, 0, 0, 0, 0,
- width, height);
-
- _cairo_pattern_fini (&tmp.base);
- }
-
- if (status) {
- cairo_surface_destroy (*out);
- return status;
- }
-
- attr->x_offset = -x;
- attr->y_offset = -y;
- attr->extend = CAIRO_EXTEND_NONE;
- attr->filter = CAIRO_FILTER_NEAREST;
+ cairo_image_surface_t *image;
- cairo_matrix_set_identity (&attr->matrix);
+ status = _cairo_surface_acquire_source_image (pattern->surface,
+ &image,
+ &attr->extra);
+ if (status)
+ return status;
+
+ *out = &image->base;
+ attr->acquired = TRUE;
}
else
{
- int tx, ty;
-
- if (_cairo_surface_is_image (dst))
- {
- cairo_image_surface_t *image;
-
- status = _cairo_surface_acquire_source_image (pattern->surface,
- &image,
- &attr->extra);
- if (CAIRO_OK (status))
- *out = &image->base;
-
- attr->acquired = TRUE;
- }
- else
- status = _cairo_surface_clone_similar (dst, pattern->surface, out);
-
- attr->extend = pattern->base.extend;
- attr->filter = pattern->base.filter;
- if (_cairo_matrix_is_integer_translation (&pattern->base.matrix,
- &tx, &ty))
- {
- cairo_matrix_set_identity (&attr->matrix);
- attr->x_offset = tx;
- attr->y_offset = ty;
- }
- else
- {
- attr->matrix = pattern->base.matrix;
- attr->x_offset = attr->y_offset = 0;
- }
+ status = _cairo_surface_clone_similar (dst, pattern->surface, out);
+ }
+
+ attr->extend = pattern->base.extend;
+ attr->filter = pattern->base.filter;
+ if (_cairo_matrix_is_integer_translation (&pattern->base.matrix,
+ &tx, &ty))
+ {
+ cairo_matrix_init_identity (&attr->matrix);
+ attr->x_offset = tx;
+ attr->y_offset = ty;
+ attr->filter = CAIRO_FILTER_NEAREST;
+ }
+ else
+ {
+ attr->matrix = pattern->base.matrix;
+ attr->x_offset = attr->y_offset = 0;
}
return status;
@@ -1141,14 +1197,19 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
cairo_surface_t **surface_out,
cairo_surface_attributes_t *attributes)
{
+ cairo_status_t status;
+
+ if (pattern->status)
+ return pattern->status;
+
switch (pattern->type) {
case CAIRO_PATTERN_SOLID: {
cairo_solid_pattern_t *src = (cairo_solid_pattern_t *) pattern;
- return _cairo_pattern_acquire_surface_for_solid (src, dst,
- x, y, width, height,
- surface_out,
- attributes);
+ status = _cairo_pattern_acquire_surface_for_solid (src, dst,
+ x, y, width, height,
+ surface_out,
+ attributes);
} break;
case CAIRO_PATTERN_LINEAR:
case CAIRO_PATTERN_RADIAL: {
@@ -1157,47 +1218,44 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
/* fast path for gradients with less than 2 color stops */
if (src->n_stops < 2)
{
+ const cairo_color_t *color;
cairo_solid_pattern_t solid;
if (src->n_stops)
- {
- _cairo_pattern_init_solid (&solid,
- src->stops->color.red,
- src->stops->color.green,
- src->stops->color.blue);
- _cairo_pattern_set_alpha (&solid.base,
- src->stops->color.alpha);
- }
+ color = &src->stops->color;
else
- {
- _cairo_pattern_init_solid (&solid, 0.0, 0.0, 0.0);
- _cairo_pattern_set_alpha (&solid.base, 0.0);
- }
+ color = CAIRO_COLOR_TRANSPARENT;
- return _cairo_pattern_acquire_surface_for_solid (&solid, dst,
- x, y,
- width, height,
- surface_out,
- attributes);
+ _cairo_pattern_init_solid (&solid, color);
+
+ status = _cairo_pattern_acquire_surface_for_solid (&solid, dst,
+ x, y,
+ width, height,
+ surface_out,
+ attributes);
}
else
- return _cairo_pattern_acquire_surface_for_gradient (src, dst,
- x, y,
- width, height,
- surface_out,
- attributes);
+ {
+ status = _cairo_pattern_acquire_surface_for_gradient (src, dst,
+ x, y,
+ width, height,
+ surface_out,
+ attributes);
+ }
} break;
case CAIRO_PATTERN_SURFACE: {
cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) pattern;
- return _cairo_pattern_acquire_surface_for_surface (src, dst,
- x, y, width, height,
- surface_out,
- attributes);
+ status = _cairo_pattern_acquire_surface_for_surface (src, dst,
+ x, y, width, height,
+ surface_out,
+ attributes);
} break;
+ default:
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
}
- return CAIRO_INT_STATUS_UNSUPPORTED;
+ return status;
}
/**
@@ -1214,11 +1272,15 @@ _cairo_pattern_release_surface (cairo_surface_t *dst,
cairo_surface_attributes_t *attributes)
{
if (attributes->acquired)
+ {
_cairo_surface_release_source_image (dst,
(cairo_image_surface_t *) surface,
attributes->extra);
+ }
else
+ {
cairo_surface_destroy (surface);
+ }
}
cairo_int_status_t
@@ -1237,71 +1299,51 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src,
cairo_surface_attributes_t *mask_attributes)
{
cairo_int_status_t status;
-
cairo_pattern_union_t tmp;
- cairo_bool_t src_opaque, mask_opaque;
- double src_alpha, mask_alpha;
- src_opaque = _cairo_pattern_is_opaque (src);
- mask_opaque = !mask || _cairo_pattern_is_opaque (mask);
-
- /* For surface patterns, we move any translucency from src->alpha
- * to mask->alpha so we can use the source unchanged. Otherwise we
- * move the translucency from mask->alpha to src->alpha so that
- * we can drop the mask if possible.
- */
- if (src->type == CAIRO_PATTERN_SURFACE)
+ if (src->status)
+ return src->status;
+ if (mask && mask->status)
+ return mask->status;
+
+ /* If src and mask are both solid, then the mask alpha can be
+ * combined into src and mask can be ignored. */
+
+ /* XXX: This optimization assumes that there is no color
+ * information in mask, so this will need to change when we
+ * support RENDER-style 4-channel masks. */
+ if (src->type == CAIRO_PATTERN_SOLID &&
+ mask && mask->type == CAIRO_PATTERN_SOLID)
{
- if (mask) {
- mask_opaque = mask_opaque && src_opaque;
- mask_alpha = mask->alpha * src->alpha;
- } else {
- mask_opaque = src_opaque;
- mask_alpha = src->alpha;
- }
-
- src_alpha = 1.0;
- src_opaque = TRUE;
+ cairo_color_t combined;
+ cairo_solid_pattern_t *src_solid = (cairo_solid_pattern_t *) src;
+ cairo_solid_pattern_t *mask_solid = (cairo_solid_pattern_t *) mask;
+
+ combined = src_solid->color;
+ _cairo_color_multiply_alpha (&combined, mask_solid->color.alpha);
+
+ _cairo_pattern_init_solid (&tmp.solid, &combined);
+
+ mask = NULL;
}
else
{
- if (mask)
- {
- src_opaque = mask_opaque && src_opaque;
- src_alpha = mask->alpha * src->alpha;
- /* FIXME: This needs changing when we support RENDER
- * style 4-channel masks.
- */
- if (mask->type == CAIRO_PATTERN_SOLID)
- mask = NULL;
- } else
- src_alpha = src->alpha;
-
- mask_alpha = 1.0;
- mask_opaque = TRUE;
+ _cairo_pattern_init_copy (&tmp.base, src);
}
- _cairo_pattern_init_copy (&tmp.base, src);
- _cairo_pattern_set_alpha (&tmp.base, src_alpha);
-
status = _cairo_pattern_acquire_surface (&tmp.base, dst,
src_x, src_y,
width, height,
src_out, src_attributes);
-
+
_cairo_pattern_fini (&tmp.base);
if (status)
return status;
- if (mask || !mask_opaque)
+ if (mask)
{
- if (mask)
- _cairo_pattern_init_copy (&tmp.base, mask);
- else
- _cairo_pattern_init_solid (&tmp.solid, 0.0, 0.0, 0.0);
-
- _cairo_pattern_set_alpha (&tmp.base, mask_alpha);
+ _cairo_pattern_init_copy (&tmp.base, mask);
status = _cairo_pattern_acquire_surface (&tmp.base, dst,
mask_x, mask_y,
diff --git a/src/cairo_pdf_surface.c b/src/cairo-pdf-surface.c
index fee9183..3d65aa7 100644
--- a/src/cairo_pdf_surface.c
+++ b/src/cairo-pdf-surface.c
@@ -126,7 +126,7 @@ struct cairo_pdf_ft_font {
cairo_pdf_font_t base;
ft_subset_glyph_t *glyphs;
FT_Face face;
- unsigned long *checksum_location;
+ int checksum_index;
cairo_array_t output;
int *parent_to_subset;
cairo_status_t status;
@@ -153,13 +153,15 @@ struct cairo_pdf_stream {
};
struct cairo_pdf_document {
- FILE *file;
+ cairo_output_stream_t *output_stream;
unsigned long refcount;
+ cairo_surface_t *owner;
+ cairo_bool_t finished;
- double width_inches;
- double height_inches;
- double x_ppi;
- double y_ppi;
+ double width;
+ double height;
+ double x_dpi;
+ double y_dpi;
unsigned int next_available_id;
unsigned int pages_id;
@@ -175,8 +177,8 @@ struct cairo_pdf_document {
struct cairo_pdf_surface {
cairo_surface_t base;
- double width_inches;
- double height_inches;
+ double width;
+ double height;
cairo_pdf_document_t *document;
cairo_pdf_stream_t *current_stream;
@@ -186,19 +188,22 @@ struct cairo_pdf_surface {
cairo_array_t streams;
cairo_array_t alphas;
cairo_array_t fonts;
+ cairo_bool_t has_clip;
};
+#define DEFAULT_DPI 300
static cairo_pdf_document_t *
-_cairo_pdf_document_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
+_cairo_pdf_document_create (cairo_output_stream_t *stream,
+ double width,
+ double height);
static void
_cairo_pdf_document_destroy (cairo_pdf_document_t *document);
+static cairo_status_t
+_cairo_pdf_document_finish (cairo_pdf_document_t *document);
+
static void
_cairo_pdf_document_reference (cairo_pdf_document_t *document);
@@ -214,11 +219,12 @@ _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface);
static cairo_pdf_stream_t *
_cairo_pdf_document_open_stream (cairo_pdf_document_t *document,
- const char *extra_entries);
+ const char *fmt,
+ ...);
static cairo_surface_t *
_cairo_pdf_surface_create_for_document (cairo_pdf_document_t *document,
- double width_inches,
- double height_inches);
+ double width,
+ double height);
static void
_cairo_pdf_surface_add_stream (cairo_pdf_surface_t *surface,
cairo_pdf_stream_t *stream);
@@ -286,6 +292,9 @@ cairo_pdf_font_generate (cairo_pdf_font_t *font,
static void
cairo_pdf_font_destroy (cairo_pdf_font_t *font)
{
+ if (font == NULL)
+ return;
+
font->backend->destroy (font);
}
@@ -319,8 +328,6 @@ cairo_pdf_ft_font_create (cairo_pdf_document_t *document,
if (_cairo_array_grow_by (&font->output, 4096) != CAIRO_STATUS_SUCCESS)
goto fail1;
- font->base.unscaled_font = unscaled_font;
- _cairo_unscaled_font_reference (unscaled_font);
font->glyphs = calloc (face->num_glyphs + 1, sizeof (ft_subset_glyph_t));
if (font->glyphs == NULL)
goto fail2;
@@ -375,6 +382,9 @@ cairo_pdf_ft_font_destroy (void *abstract_font)
{
cairo_pdf_ft_font_t *font = abstract_font;
+ if (font == NULL)
+ return;
+
_cairo_unscaled_font_destroy (font->base.unscaled_font);
free (font->base.base_font);
free (font->parent_to_subset);
@@ -457,7 +467,7 @@ static int
cairo_pdf_ft_font_write_generic_table (cairo_pdf_ft_font_t *font,
unsigned long tag)
{
- char *buffer;
+ unsigned char *buffer;
unsigned long size;
size = 0;
@@ -475,7 +485,7 @@ cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font,
unsigned long start_offset, index, size;
TT_Header *header;
unsigned long begin, end;
- char *buffer;
+ unsigned char *buffer;
int i;
union {
unsigned char *bytes;
@@ -502,8 +512,7 @@ cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font,
if (header->Index_To_Loc_Format == 0) {
begin = be16_to_cpu (u.short_offsets[index]) * 2;
end = be16_to_cpu (u.short_offsets[index + 1]) * 2;
- }
- else {
+ } else {
begin = be32_to_cpu (u.long_offsets[index]);
end = be32_to_cpu (u.long_offsets[index + 1]);
}
@@ -538,9 +547,7 @@ cairo_pdf_ft_font_write_head_table (cairo_pdf_ft_font_t *font,
cairo_pdf_ft_font_write_be32 (font, head->Table_Version);
cairo_pdf_ft_font_write_be32 (font, head->Font_Revision);
- font->checksum_location =
- (unsigned long *) _cairo_array_index (&font->output, 0) +
- _cairo_array_num_elements (&font->output) / sizeof (long);
+ font->checksum_index = _cairo_array_num_elements (&font->output);
cairo_pdf_ft_font_write_be32 (font, 0);
cairo_pdf_ft_font_write_be32 (font, head->Magic_Number);
@@ -630,8 +637,7 @@ cairo_pdf_ft_font_write_loca_table (cairo_pdf_ft_font_t *font,
if (header->Index_To_Loc_Format == 0) {
for (i = 0; i < font->base.num_glyphs + 1; i++)
cairo_pdf_ft_font_write_be16 (font, font->glyphs[i].location / 2);
- }
- else {
+ } else {
for (i = 0; i < font->base.num_glyphs + 1; i++)
cairo_pdf_ft_font_write_be32 (font, font->glyphs[i].location);
}
@@ -751,6 +757,7 @@ cairo_pdf_ft_font_generate (void *abstract_font,
{
cairo_pdf_ft_font_t *font = abstract_font;
unsigned long start, end, next, checksum;
+ unsigned long *checksum_location;
int i;
font->face = _cairo_ft_unscaled_font_lock_face (font->base.unscaled_font);
@@ -775,7 +782,8 @@ cairo_pdf_ft_font_generate (void *abstract_font,
checksum =
0xb1b0afba - cairo_pdf_ft_font_calculate_checksum (font, 0, end);
- *font->checksum_location = cpu_to_be32 (checksum);
+ checksum_location = _cairo_array_index (&font->output, font->checksum_index);
+ *checksum_location = cpu_to_be32 (checksum);
*data = _cairo_array_index (&font->output, 0);
*length = _cairo_array_num_elements (&font->output);
@@ -814,7 +822,7 @@ _cairo_pdf_document_new_object (cairo_pdf_document_t *document)
{
cairo_pdf_object_t object;
- object.offset = ftell (document->file);
+ object.offset = _cairo_output_stream_get_position (document->output_stream);
if (_cairo_array_append (&document->objects, &object, 1) == NULL)
return 0;
@@ -828,7 +836,7 @@ _cairo_pdf_document_update_object (cairo_pdf_document_t *document,
cairo_pdf_object_t *object;
object = _cairo_array_index (&document->objects, id - 1);
- object->offset = ftell (document->file);
+ object->offset = _cairo_output_stream_get_position (document->output_stream);
}
static void
@@ -899,37 +907,70 @@ _cairo_pdf_surface_add_font (cairo_pdf_surface_t *surface, unsigned int id)
_cairo_array_append (&surface->fonts, &resource, 1);
}
-cairo_surface_t *
-cairo_pdf_surface_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch)
+static cairo_surface_t *
+_cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t *stream,
+ double width,
+ double height)
{
cairo_pdf_document_t *document;
cairo_surface_t *surface;
- document = _cairo_pdf_document_create (file,
- width_inches,
- height_inches,
- x_pixels_per_inch,
- y_pixels_per_inch);
+ document = _cairo_pdf_document_create (stream, width, height);
if (document == NULL)
return NULL;
- surface = _cairo_pdf_surface_create_for_document (document,
- width_inches,
- height_inches);
+ surface = _cairo_pdf_surface_create_for_document (document, width, height);
+ document->owner = surface;
_cairo_pdf_document_destroy (document);
return surface;
}
+cairo_surface_t *
+cairo_pdf_surface_create_for_stream (cairo_write_func_t write,
+ void *closure,
+ double width,
+ double height)
+{
+ cairo_output_stream_t *stream;
+
+ stream = _cairo_output_stream_create (write, closure);
+ if (stream == NULL)
+ return NULL;
+
+ return _cairo_pdf_surface_create_for_stream_internal (stream, width, height);
+}
+
+cairo_surface_t *
+cairo_pdf_surface_create (const char *filename,
+ double width,
+ double height)
+{
+ cairo_output_stream_t *stream;
+
+ stream = _cairo_output_stream_create_for_file (filename);
+ if (stream == NULL)
+ return NULL;
+
+ return _cairo_pdf_surface_create_for_stream_internal (stream, width, height);
+}
+
+void
+cairo_pdf_surface_set_dpi (cairo_surface_t *surface,
+ double x_dpi,
+ double y_dpi)
+{
+ cairo_pdf_surface_t *pdf_surface = (cairo_pdf_surface_t *) surface;
+
+ pdf_surface->document->x_dpi = x_dpi;
+ pdf_surface->document->y_dpi = y_dpi;
+}
+
static cairo_surface_t *
_cairo_pdf_surface_create_for_document (cairo_pdf_document_t *document,
- double width_inches,
- double height_inches)
+ double width,
+ double height)
{
cairo_pdf_surface_t *surface;
@@ -939,8 +980,8 @@ _cairo_pdf_surface_create_for_document (cairo_pdf_document_t *document,
_cairo_surface_init (&surface->base, &cairo_pdf_surface_backend);
- surface->width_inches = width_inches;
- surface->height_inches = height_inches;
+ surface->width = width;
+ surface->height = height;
_cairo_pdf_document_reference (document);
surface->document = document;
@@ -949,6 +990,7 @@ _cairo_pdf_surface_create_for_document (cairo_pdf_document_t *document,
_cairo_array_init (&surface->xobjects, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&surface->alphas, sizeof (double));
_cairo_array_init (&surface->fonts, sizeof (cairo_pdf_resource_t));
+ surface->has_clip = FALSE;
return &surface->base;
}
@@ -975,7 +1017,6 @@ _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
static cairo_surface_t *
_cairo_pdf_surface_create_similar (void *abstract_src,
cairo_format_t format,
- int drawable,
int width,
int height)
{
@@ -987,10 +1028,12 @@ _cairo_pdf_surface_create_similar (void *abstract_src,
static cairo_pdf_stream_t *
_cairo_pdf_document_open_stream (cairo_pdf_document_t *document,
- const char *extra_entries)
+ const char *fmt,
+ ...)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output_stream = document->output_stream;
cairo_pdf_stream_t *stream;
+ va_list ap;
stream = malloc (sizeof (cairo_pdf_stream_t));
if (stream == NULL) {
@@ -1000,17 +1043,23 @@ _cairo_pdf_document_open_stream (cairo_pdf_document_t *document,
stream->id = _cairo_pdf_document_new_object (document);
stream->length_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Length %d 0 R\r\n"
- "%s"
- ">>\r\n"
- "stream\r\n",
- stream->id,
- stream->length_id,
- extra_entries);
+ _cairo_output_stream_printf (output_stream,
+ "%d 0 obj\r\n"
+ "<< /Length %d 0 R\r\n",
+ stream->id,
+ stream->length_id);
+
+ if (fmt != NULL) {
+ va_start (ap, fmt);
+ _cairo_output_stream_vprintf (output_stream, fmt, ap);
+ va_end (ap);
+ }
+
+ _cairo_output_stream_printf (output_stream,
+ ">>\r\n"
+ "stream\r\n");
- stream->start_offset = ftell (file);
+ stream->start_offset = _cairo_output_stream_get_position (output_stream);
document->current_stream = stream;
@@ -1020,7 +1069,7 @@ _cairo_pdf_document_open_stream (cairo_pdf_document_t *document,
static void
_cairo_pdf_document_close_stream (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output_stream = document->output_stream;
long length;
cairo_pdf_stream_t *stream;
@@ -1028,44 +1077,41 @@ _cairo_pdf_document_close_stream (cairo_pdf_document_t *document)
if (stream == NULL)
return;
- length = ftell(file) - stream->start_offset;
- fprintf (file,
- "\r\n"
- "endstream\r\n"
- "endobj\r\n");
+ length = _cairo_output_stream_get_position (output_stream) -
+ stream->start_offset;
+ _cairo_output_stream_printf (output_stream,
+ "endstream\r\n"
+ "endobj\r\n");
_cairo_pdf_document_update_object (document, stream->length_id);
- fprintf (file,
- "%d 0 obj\r\n"
- " %ld\r\n"
- "endobj\r\n",
- stream->length_id,
- length);
+ _cairo_output_stream_printf (output_stream,
+ "%d 0 obj\r\n"
+ " %ld\r\n"
+ "endobj\r\n",
+ stream->length_id,
+ length);
document->current_stream = NULL;
}
-static void
-_cairo_pdf_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_pdf_surface_finish (void *abstract_surface)
{
+ cairo_status_t status;
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_document_t *document = surface->document;
if (surface->current_stream == document->current_stream)
_cairo_pdf_document_close_stream (document);
- _cairo_pdf_document_destroy (document);
+ if (document->owner == &surface->base)
+ status = _cairo_pdf_document_finish (document);
+ else
+ status = CAIRO_STATUS_SUCCESS;
- free (surface);
-}
+ _cairo_pdf_document_destroy (document);
-/* XXX: We should re-work this interface to return both X/Y ppi values. */
-static double
-_cairo_pdf_surface_pixels_per_inch (void *abstract_surface)
-{
- cairo_pdf_surface_t *surface = abstract_surface;
-
- return surface->document->y_ppi;
+ return status;
}
static void
@@ -1073,71 +1119,29 @@ _cairo_pdf_surface_ensure_stream (cairo_pdf_surface_t *surface)
{
cairo_pdf_document_t *document = surface->document;
cairo_pdf_stream_t *stream;
- FILE *file = document->file;
- char extra[200];
+ cairo_output_stream_t *output = document->output_stream;
if (document->current_stream == NULL ||
document->current_stream != surface->current_stream) {
_cairo_pdf_document_close_stream (document);
- snprintf (extra, sizeof extra,
- " /Type /XObject\r\n"
- " /Subtype /Form\r\n"
- " /BBox [ 0 0 %f %f ]\r\n",
- surface->width_inches * document->x_ppi,
- surface->height_inches * document->y_ppi);
- stream = _cairo_pdf_document_open_stream (document, extra);
+ stream = _cairo_pdf_document_open_stream (document,
+ " /Type /XObject\r\n"
+ " /Subtype /Form\r\n"
+ " /BBox [ 0 0 %f %f ]\r\n",
+ surface->width,
+ surface->height);
+
_cairo_pdf_surface_add_stream (surface, stream);
/* If this is the first stream we open for this surface,
* output the cairo to PDF transformation matrix. */
if (_cairo_array_num_elements (&surface->streams) == 1)
- fprintf (file, "1 0 0 -1 0 %f cm\r\n",
- document->height_inches * document->y_ppi);
+ _cairo_output_stream_printf (output,
+ "1 0 0 -1 0 %f cm\r\n",
+ document->height);
}
}
-static cairo_status_t
-_cairo_pdf_surface_acquire_source_image (void *abstract_surface,
- cairo_image_surface_t **image_out,
- void **image_extra)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static void
-_cairo_pdf_surface_release_source_image (void *abstract_surface,
- cairo_image_surface_t *image,
- void *image_extra)
-{
-}
-
-static cairo_status_t
-_cairo_pdf_surface_acquire_dest_image (void *abstract_surface,
- cairo_rectangle_t *interest_rect,
- cairo_image_surface_t **image_out,
- cairo_rectangle_t *image_rect,
- void **image_extra)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static void
-_cairo_pdf_surface_release_dest_image (void *abstract_surface,
- cairo_rectangle_t *interest_rect,
- cairo_image_surface_t *image,
- cairo_rectangle_t *image_rect,
- void *image_extra)
-{
-}
-
-static cairo_status_t
-_cairo_pdf_surface_clone_similar (void *abstract_surface,
- cairo_surface_t *src,
- cairo_surface_t **clone_out)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
static void *
compress_dup (const void *data, unsigned long data_size,
unsigned long *compressed_size)
@@ -1159,9 +1163,8 @@ static unsigned int
emit_image_data (cairo_pdf_document_t *document,
cairo_image_surface_t *image)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
cairo_pdf_stream_t *stream;
- char entries[200];
char *rgb, *compressed;
int i, x, y;
unsigned long rgb_size, compressed_size;
@@ -1191,18 +1194,19 @@ emit_image_data (cairo_pdf_document_t *document,
_cairo_pdf_document_close_stream (document);
- snprintf (entries, sizeof entries,
- " /Type /XObject\r\n"
- " /Subtype /Image\r\n"
- " /Width %d\r\n"
- " /Height %d\r\n"
- " /ColorSpace /DeviceRGB\r\n"
- " /BitsPerComponent 8\r\n"
- " /Filter /FlateDecode\r\n",
- image->width, image->height);
-
- stream = _cairo_pdf_document_open_stream (document, entries);
- fwrite (compressed, 1, compressed_size, file);
+ stream = _cairo_pdf_document_open_stream (document,
+ " /Type /XObject\r\n"
+ " /Subtype /Image\r\n"
+ " /Width %d\r\n"
+ " /Height %d\r\n"
+ " /ColorSpace /DeviceRGB\r\n"
+ " /BitsPerComponent 8\r\n"
+ " /Filter /FlateDecode\r\n",
+ image->width, image->height);
+
+ _cairo_output_stream_write (output, compressed, compressed_size);
+ _cairo_output_stream_printf (output,
+ "\r\n");
_cairo_pdf_document_close_stream (document);
free (rgb);
@@ -1216,7 +1220,7 @@ _cairo_pdf_surface_composite_image (cairo_pdf_surface_t *dst,
cairo_surface_pattern_t *pattern)
{
cairo_pdf_document_t *document = dst->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned id;
cairo_matrix_t i2u;
cairo_status_t status;
@@ -1226,7 +1230,7 @@ _cairo_pdf_surface_composite_image (cairo_pdf_surface_t *dst,
src = pattern->surface;
status = _cairo_surface_acquire_source_image (src, &image, &image_extra);
- if (!CAIRO_OK (status))
+ if (status)
return status;
id = emit_image_data (dst->document, image);
@@ -1239,17 +1243,17 @@ _cairo_pdf_surface_composite_image (cairo_pdf_surface_t *dst,
_cairo_pdf_surface_ensure_stream (dst);
- cairo_matrix_copy (&i2u, &pattern->base.matrix);
+ i2u = pattern->base.matrix;
cairo_matrix_invert (&i2u);
cairo_matrix_translate (&i2u, 0, image->height);
cairo_matrix_scale (&i2u, image->width, -image->height);
- fprintf (file,
- "q %f %f %f %f %f %f cm /res%d Do Q\r\n",
- i2u.m[0][0], i2u.m[0][1],
- i2u.m[1][0], i2u.m[1][1],
- i2u.m[2][0], i2u.m[2][1],
- id);
+ _cairo_output_stream_printf (output,
+ "q %f %f %f %f %f %f cm /res%d Do Q\r\n",
+ i2u.xx, i2u.yx,
+ i2u.xy, i2u.yy,
+ i2u.x0, i2u.y0,
+ id);
bail:
_cairo_surface_release_source_image (src, image, image_extra);
@@ -1272,7 +1276,7 @@ _cairo_pdf_surface_composite_pdf (cairo_pdf_surface_t *dst,
cairo_surface_pattern_t *pattern)
{
cairo_pdf_document_t *document = dst->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
cairo_matrix_t i2u;
cairo_pdf_stream_t *stream;
int num_streams, i;
@@ -1282,30 +1286,28 @@ _cairo_pdf_surface_composite_pdf (cairo_pdf_surface_t *dst,
src = (cairo_pdf_surface_t *) pattern->surface;
- cairo_matrix_copy (&i2u, &src->base.matrix);
+ i2u = pattern->base.matrix;
cairo_matrix_invert (&i2u);
- cairo_matrix_scale (&i2u,
- 1.0 / (src->width_inches * document->x_ppi),
- 1.0 / (src->height_inches * document->y_ppi));
+ cairo_matrix_scale (&i2u, 1.0 / src->width, 1.0 / src->height);
- fprintf (file,
- "q %f %f %f %f %f %f cm",
- i2u.m[0][0], i2u.m[0][1],
- i2u.m[1][0], i2u.m[1][1],
- i2u.m[2][0], i2u.m[2][1]);
+ _cairo_output_stream_printf (output,
+ "q %f %f %f %f %f %f cm",
+ i2u.xx, i2u.yx,
+ i2u.xy, i2u.yy,
+ i2u.x0, i2u.y0);
num_streams = _cairo_array_num_elements (&src->streams);
for (i = 0; i < num_streams; i++) {
_cairo_array_copy_element (&src->streams, i, &stream);
- fprintf (file,
- " /res%d Do",
- stream->id);
+ _cairo_output_stream_printf (output,
+ " /res%d Do",
+ stream->id);
_cairo_pdf_surface_add_xobject (dst, stream->id);
}
- fprintf (file, " Q\r\n");
+ _cairo_output_stream_printf (output, " Q\r\n");
return CAIRO_STATUS_SUCCESS;
}
@@ -1348,20 +1350,20 @@ _cairo_pdf_surface_fill_rectangles (void *abstract_surface,
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
int i;
_cairo_pdf_surface_ensure_stream (surface);
- fprintf (file,
- "%f %f %f rg\r\n",
- color->red, color->green, color->blue);
+ _cairo_output_stream_printf (output,
+ "%f %f %f rg\r\n",
+ color->red, color->green, color->blue);
for (i = 0; i < num_rects; i++) {
- fprintf (file,
- "%d %d %d %d re f\r\n",
- rects[i].x, rects[i].y,
- rects[i].width, rects[i].height);
+ _cairo_output_stream_printf (output,
+ "%d %d %d %d re f\r\n",
+ rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height);
}
return CAIRO_STATUS_SUCCESS;
@@ -1372,17 +1374,17 @@ emit_solid_pattern (cairo_pdf_surface_t *surface,
cairo_solid_pattern_t *pattern)
{
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int alpha;
- alpha = _cairo_pdf_surface_add_alpha (surface, pattern->base.alpha);
+ alpha = _cairo_pdf_surface_add_alpha (surface, pattern->color.alpha);
_cairo_pdf_surface_ensure_stream (surface);
- fprintf (file,
- "%f %f %f rg /a%d gs\r\n",
- pattern->red,
- pattern->green,
- pattern->blue,
- alpha);
+ _cairo_output_stream_printf (output,
+ "%f %f %f rg /a%d gs\r\n",
+ pattern->color.red,
+ pattern->color.green,
+ pattern->color.blue,
+ alpha);
}
static void
@@ -1390,12 +1392,11 @@ emit_surface_pattern (cairo_pdf_surface_t *dst,
cairo_surface_pattern_t *pattern)
{
cairo_pdf_document_t *document = dst->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
cairo_pdf_stream_t *stream;
cairo_image_surface_t *image;
void *image_extra;
cairo_status_t status;
- char entries[250];
unsigned int id, alpha;
cairo_matrix_t pm;
@@ -1404,7 +1405,7 @@ emit_surface_pattern (cairo_pdf_surface_t *dst,
}
status = _cairo_surface_acquire_source_image (pattern->surface, &image, &image_extra);
- if (!CAIRO_OK (status))
+ if (status)
return;
_cairo_pdf_document_close_stream (document);
@@ -1414,36 +1415,33 @@ emit_surface_pattern (cairo_pdf_surface_t *dst,
/* BBox must be smaller than XStep by YStep or acroread wont
* display the pattern. */
- cairo_matrix_set_identity (&pm);
+ cairo_matrix_init_identity (&pm);
cairo_matrix_scale (&pm, image->width, image->height);
- cairo_matrix_copy (&pm, &pattern->base.matrix);
+ pm = pattern->base.matrix;
cairo_matrix_invert (&pm);
- snprintf (entries, sizeof entries,
- " /BBox [ 0 0 256 256 ]\r\n"
- " /XStep 256\r\n"
- " /YStep 256\r\n"
- " /PatternType 1\r\n"
- " /TilingType 1\r\n"
- " /PaintType 1\r\n"
- " /Resources << /XObject << /res%d %d 0 R >> >>\r\n"
- " /Matrix [ %f %f %f %f %f %f ]\r\n",
- id, id,
- pm.m[0][0], pm.m[0][1],
- pm.m[1][0], pm.m[1][1],
- pm.m[2][0], pm.m[2][1]);
+ stream = _cairo_pdf_document_open_stream (document,
+ " /BBox [ 0 0 256 256 ]\r\n"
+ " /XStep 256\r\n"
+ " /YStep 256\r\n"
+ " /PatternType 1\r\n"
+ " /TilingType 1\r\n"
+ " /PaintType 1\r\n"
+ " /Resources << /XObject << /res%d %d 0 R >> >>\r\n",
+ id, id);
- stream = _cairo_pdf_document_open_stream (document, entries);
- /* FIXME: emit code to show surface here. */
+ _cairo_output_stream_printf (output,
+ " /res%d Do\r\n",
+ id);
_cairo_pdf_surface_add_pattern (dst, stream->id);
_cairo_pdf_surface_ensure_stream (dst);
alpha = _cairo_pdf_surface_add_alpha (dst, 1.0);
- fprintf (file,
- "/Pattern cs /res%d scn /a%d gs\r\n",
- stream->id, alpha);
+ _cairo_output_stream_printf (output,
+ "/Pattern cs /res%d scn /a%d gs\r\n",
+ stream->id, alpha);
_cairo_surface_release_source_image (pattern->surface, image, image_extra);
}
@@ -1452,33 +1450,37 @@ static unsigned int
emit_pattern_stops (cairo_pdf_surface_t *surface, cairo_gradient_pattern_t *pattern)
{
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int function_id;
+ char stops[2][3];
function_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /FunctionType 0\r\n"
- " /Domain [ 0.0 1.0 ]\r\n"
- " /Size [ 2 ]\r\n"
- " /BitsPerSample 8\r\n"
- " /Range [ 0.0 1.0 0.0 1.0 0.0 1.0 ]\r\n"
- " /Length 6\r\n"
- ">>\r\n"
- "stream\r\n",
- function_id);
-
- fputc (pattern->stops[0].color.red * 0xff, file);
- fputc (pattern->stops[0].color.green * 0xff, file);
- fputc (pattern->stops[0].color.blue * 0xff, file);
- fputc (pattern->stops[1].color.red * 0xff, file);
- fputc (pattern->stops[1].color.green * 0xff, file);
- fputc (pattern->stops[1].color.blue * 0xff, file);
-
- fprintf (file,
- "\r\n"
- "endstream\r\n"
- "endobj\r\n");
+
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /FunctionType 0\r\n"
+ " /Domain [ 0.0 1.0 ]\r\n"
+ " /Size [ 2 ]\r\n"
+ " /BitsPerSample 8\r\n"
+ " /Range [ 0.0 1.0 0.0 1.0 0.0 1.0 ]\r\n"
+ " /Length 6\r\n"
+ ">>\r\n"
+ "stream\r\n",
+ function_id);
+
+ stops[0][0] = pattern->stops[0].color.red * 0xff + 0.5;
+ stops[0][1] = pattern->stops[0].color.green * 0xff + 0.5;
+ stops[0][2] = pattern->stops[0].color.blue * 0xff + 0.5;
+ stops[1][0] = pattern->stops[1].color.red * 0xff + 0.5;
+ stops[1][1] = pattern->stops[1].color.green * 0xff + 0.5;
+ stops[1][2] = pattern->stops[1].color.blue * 0xff + 0.5;
+
+ _cairo_output_stream_write (output, stops, sizeof (stops));
+
+ _cairo_output_stream_printf (output,
+ "\r\n"
+ "endstream\r\n"
+ "endobj\r\n");
return function_id;
}
@@ -1487,7 +1489,7 @@ static void
emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *pattern)
{
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int function_id, pattern_id, alpha;
double x0, y0, x1, y1;
cairo_matrix_t p2u;
@@ -1496,7 +1498,7 @@ emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *patte
function_id = emit_pattern_stops (surface, &pattern->base);
- cairo_matrix_copy (&p2u, &pattern->base.base.matrix);
+ p2u = pattern->base.base.matrix;
cairo_matrix_invert (&p2u);
x0 = pattern->point0.x;
@@ -1507,24 +1509,24 @@ emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *patte
cairo_matrix_transform_point (&p2u, &x1, &y1);
pattern_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /Pattern\r\n"
- " /PatternType 2\r\n"
- " /Matrix [ 1 0 0 -1 0 %f ]\r\n"
- " /Shading\r\n"
- " << /ShadingType 2\r\n"
- " /ColorSpace /DeviceRGB\r\n"
- " /Coords [ %f %f %f %f ]\r\n"
- " /Function %d 0 R\r\n"
- " /Extend [ true true ]\r\n"
- " >>\r\n"
- ">>\r\n"
- "endobj\r\n",
- pattern_id,
- document->height_inches * document->y_ppi,
- x0, y0, x1, y1,
- function_id);
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Type /Pattern\r\n"
+ " /PatternType 2\r\n"
+ " /Matrix [ 1 0 0 -1 0 %f ]\r\n"
+ " /Shading\r\n"
+ " << /ShadingType 2\r\n"
+ " /ColorSpace /DeviceRGB\r\n"
+ " /Coords [ %f %f %f %f ]\r\n"
+ " /Function %d 0 R\r\n"
+ " /Extend [ true true ]\r\n"
+ " >>\r\n"
+ ">>\r\n"
+ "endobj\r\n",
+ pattern_id,
+ document->height,
+ x0, y0, x1, y1,
+ function_id);
_cairo_pdf_surface_add_pattern (surface, pattern_id);
@@ -1532,16 +1534,16 @@ emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *patte
alpha = _cairo_pdf_surface_add_alpha (surface, 1.0);
/* Use pattern */
- fprintf (file,
- "/Pattern cs /res%d scn /a%d gs\r\n",
- pattern_id, alpha);
+ _cairo_output_stream_printf (output,
+ "/Pattern cs /res%d scn /a%d gs\r\n",
+ pattern_id, alpha);
}
static void
emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *pattern)
{
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int function_id, pattern_id, alpha;
double x0, y0, x1, y1, r0, r1;
cairo_matrix_t p2u;
@@ -1550,7 +1552,7 @@ emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *patte
function_id = emit_pattern_stops (surface, &pattern->base);
- cairo_matrix_copy (&p2u, &pattern->base.base.matrix);
+ p2u = pattern->base.base.matrix;
cairo_matrix_invert (&p2u);
x0 = pattern->center0.x;
@@ -1574,24 +1576,24 @@ emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *patte
* behavoir, not yet sure how to implement the cairo mirror and
* repeat behaviour. */
pattern_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /Pattern\r\n"
- " /PatternType 2\r\n"
- " /Matrix [ 1 0 0 -1 0 %f ]\r\n"
- " /Shading\r\n"
- " << /ShadingType 3\r\n"
- " /ColorSpace /DeviceRGB\r\n"
- " /Coords [ %f %f %f %f %f %f ]\r\n"
- " /Function %d 0 R\r\n"
- " /Extend [ true true ]\r\n"
- " >>\r\n"
- ">>\r\n"
- "endobj\r\n",
- pattern_id,
- document->height_inches * document->y_ppi,
- x0, y0, r0, x1, y1, r1,
- function_id);
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Type /Pattern\r\n"
+ " /PatternType 2\r\n"
+ " /Matrix [ 1 0 0 -1 0 %f ]\r\n"
+ " /Shading\r\n"
+ " << /ShadingType 3\r\n"
+ " /ColorSpace /DeviceRGB\r\n"
+ " /Coords [ %f %f %f %f %f %f ]\r\n"
+ " /Function %d 0 R\r\n"
+ " /Extend [ true true ]\r\n"
+ " >>\r\n"
+ ">>\r\n"
+ "endobj\r\n",
+ pattern_id,
+ document->height,
+ x0, y0, r0, x1, y1, r1,
+ function_id);
_cairo_pdf_surface_add_pattern (surface, pattern_id);
@@ -1599,9 +1601,9 @@ emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *patte
alpha = _cairo_pdf_surface_add_alpha (surface, 1.0);
/* Use pattern */
- fprintf (file,
- "/Pattern cs /res%d scn /a%d gs\r\n",
- pattern_id, alpha);
+ _cairo_output_stream_printf (output,
+ "/Pattern cs /res%d scn /a%d gs\r\n",
+ pattern_id, alpha);
}
static void
@@ -1635,6 +1637,129 @@ intersect (cairo_line_t *line, cairo_fixed_t y)
_cairo_fixed_to_double (line->p2.y - line->p1.y);
}
+typedef struct
+{
+ cairo_output_stream_t *output_stream;
+ cairo_bool_t has_current_point;
+} pdf_path_info_t;
+
+static cairo_status_t
+_cairo_pdf_path_move_to (void *closure, cairo_point_t *point)
+{
+ pdf_path_info_t *info = closure;
+
+ _cairo_output_stream_printf (info->output_stream,
+ "%f %f m ",
+ _cairo_fixed_to_double (point->x),
+ _cairo_fixed_to_double (point->y));
+ info->has_current_point = TRUE;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_pdf_path_line_to (void *closure, cairo_point_t *point)
+{
+ pdf_path_info_t *info = closure;
+ const char *pdf_operator;
+
+ if (info->has_current_point)
+ pdf_operator = "l";
+ else
+ pdf_operator = "m";
+
+ _cairo_output_stream_printf (info->output_stream,
+ "%f %f %s ",
+ _cairo_fixed_to_double (point->x),
+ _cairo_fixed_to_double (point->y),
+ pdf_operator);
+ info->has_current_point = TRUE;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_pdf_path_curve_to (void *closure,
+ cairo_point_t *b,
+ cairo_point_t *c,
+ cairo_point_t *d)
+{
+ pdf_path_info_t *info = closure;
+
+ _cairo_output_stream_printf (info->output_stream,
+ "%f %f %f %f %f %f c ",
+ _cairo_fixed_to_double (b->x),
+ _cairo_fixed_to_double (b->y),
+ _cairo_fixed_to_double (c->x),
+ _cairo_fixed_to_double (c->y),
+ _cairo_fixed_to_double (d->x),
+ _cairo_fixed_to_double (d->y));
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_pdf_path_close_path (void *closure)
+{
+ pdf_path_info_t *info = closure;
+
+ _cairo_output_stream_printf (info->output_stream,
+ "h\r\n");
+ info->has_current_point = FALSE;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_cairo_pdf_surface_fill_path (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ void *abstract_dst,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance)
+{
+ cairo_pdf_surface_t *surface = abstract_dst;
+ cairo_pdf_document_t *document = surface->document;
+ const char *pdf_operator;
+ cairo_status_t status;
+ pdf_path_info_t info;
+
+ emit_pattern (surface, pattern);
+
+ /* After the above switch the current stream should belong to this
+ * surface, so no need to _cairo_pdf_surface_ensure_stream() */
+ assert (document->current_stream != NULL &&
+ document->current_stream == surface->current_stream);
+
+ info.output_stream = document->output_stream;
+ info.has_current_point = FALSE;
+
+ status = _cairo_path_fixed_interpret (path,
+ CAIRO_DIRECTION_FORWARD,
+ _cairo_pdf_path_move_to,
+ _cairo_pdf_path_line_to,
+ _cairo_pdf_path_curve_to,
+ _cairo_pdf_path_close_path,
+ &info);
+
+ switch (fill_rule) {
+ case CAIRO_FILL_RULE_WINDING:
+ pdf_operator = "f";
+ break;
+ case CAIRO_FILL_RULE_EVEN_ODD:
+ pdf_operator = "f*";
+ break;
+ default:
+ ASSERT_NOT_REACHED;
+ }
+
+ _cairo_output_stream_printf (document->output_stream,
+ "%s\r\n",
+ pdf_operator);
+
+ return status;
+}
+
static cairo_int_status_t
_cairo_pdf_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
@@ -1650,7 +1775,7 @@ _cairo_pdf_surface_composite_trapezoids (cairo_operator_t operator,
{
cairo_pdf_surface_t *surface = abstract_dst;
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
int i;
emit_pattern (surface, pattern);
@@ -1668,16 +1793,16 @@ _cairo_pdf_surface_composite_trapezoids (cairo_operator_t operator,
right_x1 = intersect (&traps[i].right, traps[i].top);
right_x2 = intersect (&traps[i].right, traps[i].bottom);
- fprintf (file,
- "%f %f m %f %f l %f %f l %f %f l h\r\n",
- left_x1, _cairo_fixed_to_double (traps[i].top),
- left_x2, _cairo_fixed_to_double (traps[i].bottom),
- right_x2, _cairo_fixed_to_double (traps[i].bottom),
- right_x1, _cairo_fixed_to_double (traps[i].top));
+ _cairo_output_stream_printf (output,
+ "%f %f m %f %f l %f %f l %f %f l h\r\n",
+ left_x1, _cairo_fixed_to_double (traps[i].top),
+ left_x2, _cairo_fixed_to_double (traps[i].bottom),
+ right_x2, _cairo_fixed_to_double (traps[i].bottom),
+ right_x1, _cairo_fixed_to_double (traps[i].top));
}
- fprintf (file,
- "f\r\n");
+ _cairo_output_stream_printf (output,
+ "f\r\n");
return CAIRO_STATUS_SUCCESS;
}
@@ -1699,28 +1824,42 @@ _cairo_pdf_surface_show_page (void *abstract_surface)
cairo_int_status_t status;
status = _cairo_pdf_document_add_page (document, surface);
- if (status == CAIRO_STATUS_SUCCESS)
- _cairo_pdf_surface_clear (surface);
+ if (status)
+ return status;
- return status;
+ _cairo_pdf_surface_clear (surface);
+
+ return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
-_cairo_pdf_surface_set_clip_region (void *abstract_surface,
- pixman_region16_t *region)
+_cairo_pdf_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
{
- return CAIRO_INT_STATUS_UNSUPPORTED;
+ cairo_pdf_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+
+ /* XXX: The conversion to integers here is pretty bogus, (not to
+ * mention the aribitray limitation of width to a short(!). We
+ * may need to come up with a better interface for get_size.
+ */
+ rectangle->width = (int) ceil (surface->width);
+ rectangle->height = (int) ceil (surface->height);
+
+ return CAIRO_STATUS_SUCCESS;
}
static cairo_pdf_font_t *
_cairo_pdf_document_get_font (cairo_pdf_document_t *document,
- cairo_font_t *font)
+ cairo_scaled_font_t *scaled_font)
{
cairo_unscaled_font_t *unscaled_font;
cairo_pdf_font_t *pdf_font;
unsigned int num_fonts, i;
- unscaled_font = _cairo_ft_font_get_unscaled_font (font);
+ unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font);
num_fonts = _cairo_array_num_elements (&document->fonts);
for (i = 0; i < num_fonts; i++) {
@@ -1743,8 +1882,8 @@ _cairo_pdf_document_get_font (cairo_pdf_document_t *document,
return pdf_font;
}
-static cairo_status_t
-_cairo_pdf_surface_show_glyphs (cairo_font_t *font,
+static cairo_int_status_t
+_cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
@@ -1759,62 +1898,120 @@ _cairo_pdf_surface_show_glyphs (cairo_font_t *font,
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_document_t *document = surface->document;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
cairo_pdf_font_t *pdf_font;
int i, index;
- pdf_font = _cairo_pdf_document_get_font (document, font);
+ pdf_font = _cairo_pdf_document_get_font (document, scaled_font);
if (pdf_font == NULL)
return CAIRO_STATUS_NO_MEMORY;
emit_pattern (surface, pattern);
- fprintf (file, "BT /res%u 1 Tf", pdf_font->font_id);
+ _cairo_output_stream_printf (output,
+ "BT /res%u 1 Tf", pdf_font->font_id);
for (i = 0; i < num_glyphs; i++) {
index = cairo_pdf_font_use_glyph (pdf_font, glyphs[i].index);
- fprintf (file,
- " %f %f %f %f %f %f Tm (\\%o) Tj",
- font->scale.matrix[0][0],
- font->scale.matrix[0][1],
- font->scale.matrix[1][0],
- -font->scale.matrix[1][1],
- glyphs[i].x,
- glyphs[i].y,
- index);
+ _cairo_output_stream_printf (output,
+ " %f %f %f %f %f %f Tm (\\%o) Tj",
+ scaled_font->scale.xx,
+ scaled_font->scale.yx,
+ -scaled_font->scale.xy,
+ -scaled_font->scale.yy,
+ glyphs[i].x,
+ glyphs[i].y,
+ index);
}
- fprintf (file, " ET\r\n");
+ _cairo_output_stream_printf (output,
+ " ET\r\n");
_cairo_pdf_surface_add_font (surface, pdf_font->font_id);
return CAIRO_STATUS_SUCCESS;
}
+static cairo_int_status_t
+_cairo_pdf_surface_intersect_clip_path (void *dst,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance)
+{
+ cairo_pdf_surface_t *surface = dst;
+ cairo_pdf_document_t *document = surface->document;
+ cairo_output_stream_t *output = document->output_stream;
+ cairo_status_t status;
+ pdf_path_info_t info;
+ const char *pdf_operator;
+
+ _cairo_pdf_surface_ensure_stream (surface);
+
+ if (path == NULL) {
+ if (surface->has_clip)
+ _cairo_output_stream_printf (output, "Q\r\n");
+ surface->has_clip = FALSE;
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ if (!surface->has_clip) {
+ _cairo_output_stream_printf (output, "q ");
+ surface->has_clip = TRUE;
+ }
+
+ info.output_stream = document->output_stream;
+ info.has_current_point = FALSE;
+
+ status = _cairo_path_fixed_interpret (path,
+ CAIRO_DIRECTION_FORWARD,
+ _cairo_pdf_path_move_to,
+ _cairo_pdf_path_line_to,
+ _cairo_pdf_path_curve_to,
+ _cairo_pdf_path_close_path,
+ &info);
+
+ switch (fill_rule) {
+ case CAIRO_FILL_RULE_WINDING:
+ pdf_operator = "W";
+ break;
+ case CAIRO_FILL_RULE_EVEN_ODD:
+ pdf_operator = "W*";
+ break;
+ default:
+ ASSERT_NOT_REACHED;
+ }
+
+ _cairo_output_stream_printf (document->output_stream,
+ "%s n\r\n",
+ pdf_operator);
+
+ return status;
+}
+
static const cairo_surface_backend_t cairo_pdf_surface_backend = {
_cairo_pdf_surface_create_similar,
- _cairo_pdf_surface_destroy,
- _cairo_pdf_surface_pixels_per_inch,
- _cairo_pdf_surface_acquire_source_image,
- _cairo_pdf_surface_release_source_image,
- _cairo_pdf_surface_acquire_dest_image,
- _cairo_pdf_surface_release_dest_image,
- _cairo_pdf_surface_clone_similar,
+ _cairo_pdf_surface_finish,
+ NULL, /* acquire_source_image */
+ NULL, /* release_source_image */
+ NULL, /* acquire_dest_image */
+ NULL, /* release_dest_image */
+ NULL, /* clone_similar */
_cairo_pdf_surface_composite,
_cairo_pdf_surface_fill_rectangles,
_cairo_pdf_surface_composite_trapezoids,
_cairo_pdf_surface_copy_page,
_cairo_pdf_surface_show_page,
- _cairo_pdf_surface_set_clip_region,
- _cairo_pdf_surface_show_glyphs
+ NULL, /* set_clip_region */
+ _cairo_pdf_surface_intersect_clip_path,
+ _cairo_pdf_surface_get_extents,
+ _cairo_pdf_surface_show_glyphs,
+ _cairo_pdf_surface_fill_path
};
static cairo_pdf_document_t *
-_cairo_pdf_document_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch)
+_cairo_pdf_document_create (cairo_output_stream_t *output_stream,
+ double width,
+ double height)
{
cairo_pdf_document_t *document;
@@ -1822,12 +2019,14 @@ _cairo_pdf_document_create (FILE *file,
if (document == NULL)
return NULL;
- document->file = file;
+ document->output_stream = output_stream;
document->refcount = 1;
- document->width_inches = width_inches;
- document->height_inches = height_inches;
- document->x_ppi = x_pixels_per_inch;
- document->y_ppi = y_pixels_per_inch;
+ document->owner = NULL;
+ document->finished = FALSE;
+ document->width = width;
+ document->height = height;
+ document->x_dpi = DEFAULT_DPI;
+ document->y_dpi = DEFAULT_DPI;
_cairo_array_init (&document->objects, sizeof (cairo_pdf_object_t));
_cairo_array_init (&document->pages, sizeof (unsigned int));
@@ -1840,7 +2039,8 @@ _cairo_pdf_document_create (FILE *file,
_cairo_array_init (&document->fonts, sizeof (cairo_pdf_font_t *));
/* Document header */
- fprintf (file, "%%PDF-1.4\r\n");
+ _cairo_output_stream_printf (output_stream,
+ "%%PDF-1.4\r\n");
return document;
}
@@ -1848,17 +2048,17 @@ _cairo_pdf_document_create (FILE *file,
static unsigned int
_cairo_pdf_document_write_info (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int id;
id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Creator (cairographics.org)\r\n"
- " /Producer (cairographics.org)\r\n"
- ">>\r\n"
- "endobj\r\n",
- id);
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Creator (cairographics.org)\r\n"
+ " /Producer (cairographics.org)\r\n"
+ ">>\r\n"
+ "endobj\r\n",
+ id);
return id;
}
@@ -1866,40 +2066,40 @@ _cairo_pdf_document_write_info (cairo_pdf_document_t *document)
static void
_cairo_pdf_document_write_pages (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
+ cairo_output_stream_t *stream = document->output_stream;
unsigned int page_id;
int num_pages, i;
_cairo_pdf_document_update_object (document, document->pages_id);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /Pages\r\n"
- " /Kids [ ",
- document->pages_id);
+ _cairo_output_stream_printf (stream,
+ "%d 0 obj\r\n"
+ "<< /Type /Pages\r\n"
+ " /Kids [ ",
+ document->pages_id);
num_pages = _cairo_array_num_elements (&document->pages);
for (i = 0; i < num_pages; i++) {
_cairo_array_copy_element (&document->pages, i, &page_id);
- fprintf (file, "%d 0 R ", page_id);
+ _cairo_output_stream_printf (stream, "%d 0 R ", page_id);
}
- fprintf (file, "]\r\n");
- fprintf (file, " /Count %d\r\n", num_pages);
+ _cairo_output_stream_printf (stream, "]\r\n");
+ _cairo_output_stream_printf (stream, " /Count %d\r\n", num_pages);
/* TODO: Figure out wich other defaults to be inherited by /Page
* objects. */
- fprintf (file,
- " /MediaBox [ 0 0 %f %f ]\r\n"
- ">>\r\n"
- "endobj\r\n",
- document->width_inches * document->x_ppi,
- document->height_inches * document->y_ppi);
+ _cairo_output_stream_printf (stream,
+ " /MediaBox [ 0 0 %f %f ]\r\n"
+ ">>\r\n"
+ "endobj\r\n",
+ document->width,
+ document->height);
}
static cairo_status_t
_cairo_pdf_document_write_fonts (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
cairo_pdf_font_t *font;
int num_fonts, i, j;
const char *data;
@@ -1923,76 +2123,76 @@ _cairo_pdf_document_write_fonts (cairo_pdf_document_t *document)
}
stream_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Filter /FlateDecode\r\n"
- " /Length %lu\r\n"
- " /Length1 %lu\r\n"
- ">>\r\n"
- "stream\r\n",
- stream_id,
- compressed_size,
- data_size);
- fwrite (compressed, 1, compressed_size, file);
- fprintf (file,
- "\r\n"
- "endstream\r\n"
- "endobj\r\n");
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Filter /FlateDecode\r\n"
+ " /Length %lu\r\n"
+ " /Length1 %lu\r\n"
+ ">>\r\n"
+ "stream\r\n",
+ stream_id,
+ compressed_size,
+ data_size);
+ _cairo_output_stream_write (output, compressed, compressed_size);
+ _cairo_output_stream_printf (output,
+ "\r\n"
+ "endstream\r\n"
+ "endobj\r\n");
free (compressed);
descriptor_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /FontDescriptor\r\n"
- " /FontName /7%s\r\n"
- " /Flags 4\r\n"
- " /FontBBox [ %ld %ld %ld %ld ]\r\n"
- " /ItalicAngle 0\r\n"
- " /Ascent %ld\r\n"
- " /Descent %ld\r\n"
- " /CapHeight 500\r\n"
- " /StemV 80\r\n"
- " /StemH 80\r\n"
- " /FontFile2 %u 0 R\r\n"
- ">>\r\n"
- "endobj\r\n",
- descriptor_id,
- font->base_font,
- font->x_min,
- font->y_min,
- font->x_max,
- font->y_max,
- font->ascent,
- font->descent,
- stream_id);
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Type /FontDescriptor\r\n"
+ " /FontName /7%s\r\n"
+ " /Flags 4\r\n"
+ " /FontBBox [ %ld %ld %ld %ld ]\r\n"
+ " /ItalicAngle 0\r\n"
+ " /Ascent %ld\r\n"
+ " /Descent %ld\r\n"
+ " /CapHeight 500\r\n"
+ " /StemV 80\r\n"
+ " /StemH 80\r\n"
+ " /FontFile2 %u 0 R\r\n"
+ ">>\r\n"
+ "endobj\r\n",
+ descriptor_id,
+ font->base_font,
+ font->x_min,
+ font->y_min,
+ font->x_max,
+ font->y_max,
+ font->ascent,
+ font->descent,
+ stream_id);
_cairo_pdf_document_update_object (document, font->font_id);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /Font\r\n"
- " /Subtype /TrueType\r\n"
- " /BaseFont /%s\r\n"
- " /FirstChar 0\r\n"
- " /LastChar %d\r\n"
- " /FontDescriptor %d 0 R\r\n"
- " /Widths ",
- font->font_id,
- font->base_font,
- font->num_glyphs,
- descriptor_id);
-
- fprintf (file,
- "[");
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Type /Font\r\n"
+ " /Subtype /TrueType\r\n"
+ " /BaseFont /%s\r\n"
+ " /FirstChar 0\r\n"
+ " /LastChar %d\r\n"
+ " /FontDescriptor %d 0 R\r\n"
+ " /Widths ",
+ font->font_id,
+ font->base_font,
+ font->num_glyphs,
+ descriptor_id);
+
+ _cairo_output_stream_printf (output,
+ "[");
for (j = 0; j < font->num_glyphs; j++)
- fprintf (file,
- " %d",
- font->widths[j]);
+ _cairo_output_stream_printf (output,
+ " %d",
+ font->widths[j]);
- fprintf (file,
- " ]\r\n"
- ">>\r\n"
- "endobj\r\n");
+ _cairo_output_stream_printf (output,
+ " ]\r\n"
+ ">>\r\n"
+ "endobj\r\n");
fail:
cairo_pdf_ft_font_destroy (font);
@@ -2004,17 +2204,17 @@ _cairo_pdf_document_write_fonts (cairo_pdf_document_t *document)
static unsigned int
_cairo_pdf_document_write_catalog (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int id;
id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /Catalog\r\n"
- " /Pages %d 0 R\r\n"
- ">>\r\n"
- "endobj\r\n",
- id, document->pages_id);
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Type /Catalog\r\n"
+ " /Pages %d 0 R\r\n"
+ ">>\r\n"
+ "endobj\r\n",
+ id, document->pages_id);
return id;
}
@@ -2022,23 +2222,27 @@ _cairo_pdf_document_write_catalog (cairo_pdf_document_t *document)
static long
_cairo_pdf_document_write_xref (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
cairo_pdf_object_t *object;
int num_objects, i;
long offset;
+ char buffer[11];
num_objects = _cairo_array_num_elements (&document->objects);
- offset = ftell(file);
- fprintf (document->file,
- "xref\r\n"
- "%d %d\r\n",
- 0, num_objects + 1);
+ offset = _cairo_output_stream_get_position (output);
+ _cairo_output_stream_printf (output,
+ "xref\r\n"
+ "%d %d\r\n",
+ 0, num_objects + 1);
- fprintf (file, "0000000000 65535 f\r\n");
+ _cairo_output_stream_printf (output,
+ "0000000000 65535 f\r\n");
for (i = 0; i < num_objects; i++) {
object = _cairo_array_index (&document->objects, i);
- fprintf (file, "%010ld 00000 n\r\n", object->offset);
+ snprintf (buffer, sizeof buffer, "%010ld", object->offset);
+ _cairo_output_stream_printf (output,
+ "%s 00000 n\r\n", buffer);
}
return offset;
@@ -2053,14 +2257,26 @@ _cairo_pdf_document_reference (cairo_pdf_document_t *document)
static void
_cairo_pdf_document_destroy (cairo_pdf_document_t *document)
{
- FILE *file = document->file;
- long offset;
- unsigned int info_id, catalog_id;
-
document->refcount--;
if (document->refcount > 0)
return;
+ _cairo_pdf_document_finish (document);
+
+ free (document);
+}
+
+static cairo_status_t
+_cairo_pdf_document_finish (cairo_pdf_document_t *document)
+{
+ cairo_status_t status;
+ cairo_output_stream_t *output = document->output_stream;
+ long offset;
+ unsigned int info_id, catalog_id;
+
+ if (document->finished)
+ return CAIRO_STATUS_SUCCESS;
+
_cairo_pdf_document_close_stream (document);
_cairo_pdf_document_write_pages (document);
_cairo_pdf_document_write_fonts (document);
@@ -2068,23 +2284,28 @@ _cairo_pdf_document_destroy (cairo_pdf_document_t *document)
catalog_id = _cairo_pdf_document_write_catalog (document);
offset = _cairo_pdf_document_write_xref (document);
- fprintf (file,
- "trailer\r\n"
- "<< /Size %d\r\n"
- " /Root %d 0 R\r\n"
- " /Info %d 0 R\r\n"
- ">>\r\n",
- document->next_available_id,
- catalog_id,
- info_id);
-
- fprintf (file,
- "startxref\r\n"
- "%ld\r\n"
- "%%%%EOF\r\n",
- offset);
+ _cairo_output_stream_printf (output,
+ "trailer\r\n"
+ "<< /Size %d\r\n"
+ " /Root %d 0 R\r\n"
+ " /Info %d 0 R\r\n"
+ ">>\r\n",
+ document->next_available_id,
+ catalog_id,
+ info_id);
+
+ _cairo_output_stream_printf (output,
+ "startxref\r\n"
+ "%ld\r\n"
+ "%%%%EOF\r\n",
+ offset);
+
+ status = _cairo_output_stream_get_status (output);
+ _cairo_output_stream_destroy (output);
+
+ document->finished = TRUE;
- free (document);
+ return status;
}
static cairo_status_t
@@ -2093,130 +2314,110 @@ _cairo_pdf_document_add_page (cairo_pdf_document_t *document,
{
cairo_pdf_stream_t *stream;
cairo_pdf_resource_t *res;
- FILE *file = document->file;
+ cairo_output_stream_t *output = document->output_stream;
unsigned int page_id;
double alpha;
int num_streams, num_alphas, num_resources, i;
+ assert (!document->finished);
+
+ _cairo_pdf_surface_ensure_stream (surface);
+
+ if (surface->has_clip)
+ _cairo_output_stream_printf (output, "Q\r\n");
+
_cairo_pdf_document_close_stream (document);
page_id = _cairo_pdf_document_new_object (document);
- fprintf (file,
- "%d 0 obj\r\n"
- "<< /Type /Page\r\n"
- " /Parent %d 0 R\r\n"
- " /Contents [",
- page_id,
- document->pages_id);
+ _cairo_output_stream_printf (output,
+ "%d 0 obj\r\n"
+ "<< /Type /Page\r\n"
+ " /Parent %d 0 R\r\n"
+ " /Contents [",
+ page_id,
+ document->pages_id);
num_streams = _cairo_array_num_elements (&surface->streams);
for (i = 0; i < num_streams; i++) {
_cairo_array_copy_element (&surface->streams, i, &stream);
- fprintf (file,
- " %d 0 R",
- stream->id);
+ _cairo_output_stream_printf (output,
+ " %d 0 R",
+ stream->id);
}
- fprintf (file,
- " ]\r\n"
- " /Resources <<\r\n");
+ _cairo_output_stream_printf (output,
+ " ]\r\n"
+ " /Resources <<\r\n");
num_resources = _cairo_array_num_elements (&surface->fonts);
if (num_resources > 0) {
- fprintf (file,
- " /Font <<");
+ _cairo_output_stream_printf (output,
+ " /Font <<");
for (i = 0; i < num_resources; i++) {
res = _cairo_array_index (&surface->fonts, i);
- fprintf (file,
- " /res%d %d 0 R",
- res->id, res->id);
+ _cairo_output_stream_printf (output,
+ " /res%d %d 0 R",
+ res->id, res->id);
}
- fprintf (file,
- " >>\r\n");
+ _cairo_output_stream_printf (output,
+ " >>\r\n");
}
num_alphas = _cairo_array_num_elements (&surface->alphas);
if (num_alphas > 0) {
- fprintf (file,
- " /ExtGState <<\r\n");
+ _cairo_output_stream_printf (output,
+ " /ExtGState <<\r\n");
for (i = 0; i < num_alphas; i++) {
_cairo_array_copy_element (&surface->alphas, i, &alpha);
- fprintf (file,
- " /a%d << /ca %f >>\r\n",
- i, alpha);
+ _cairo_output_stream_printf (output,
+ " /a%d << /ca %f >>\r\n",
+ i, alpha);
}
- fprintf (file,
- " >>\r\n");
+ _cairo_output_stream_printf (output,
+ " >>\r\n");
}
num_resources = _cairo_array_num_elements (&surface->patterns);
if (num_resources > 0) {
- fprintf (file,
- " /Pattern <<");
+ _cairo_output_stream_printf (output,
+ " /Pattern <<");
for (i = 0; i < num_resources; i++) {
res = _cairo_array_index (&surface->patterns, i);
- fprintf (file,
- " /res%d %d 0 R",
- res->id, res->id);
+ _cairo_output_stream_printf (output,
+ " /res%d %d 0 R",
+ res->id, res->id);
}
- fprintf (file,
- " >>\r\n");
+ _cairo_output_stream_printf (output,
+ " >>\r\n");
}
num_resources = _cairo_array_num_elements (&surface->xobjects);
if (num_resources > 0) {
- fprintf (file,
- " /XObject <<");
+ _cairo_output_stream_printf (output,
+ " /XObject <<");
for (i = 0; i < num_resources; i++) {
res = _cairo_array_index (&surface->xobjects, i);
- fprintf (file,
- " /res%d %d 0 R",
- res->id, res->id);
+ _cairo_output_stream_printf (output,
+ " /res%d %d 0 R",
+ res->id, res->id);
}
- fprintf (file,
- " >>\r\n");
+ _cairo_output_stream_printf (output,
+ " >>\r\n");
}
- fprintf (file,
- " >>\r\n"
- ">>\r\n"
- "endobj\r\n");
+ _cairo_output_stream_printf (output,
+ " >>\r\n"
+ ">>\r\n"
+ "endobj\r\n");
_cairo_array_append (&document->pages, &page_id, 1);
return CAIRO_STATUS_SUCCESS;
}
-
-void
-cairo_set_target_pdf (cairo_t *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch)
-{
- cairo_surface_t *surface;
-
- surface = cairo_pdf_surface_create (file,
- width_inches,
- height_inches,
- x_pixels_per_inch,
- y_pixels_per_inch);
-
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface (cr, surface);
-
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy (surface);
-}
diff --git a/src/cairo-pdf.h b/src/cairo-pdf.h
index 701a7b4..61bf7a8 100644
--- a/src/cairo-pdf.h
+++ b/src/cairo-pdf.h
@@ -39,29 +39,30 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_PDF_SURFACE
-
-#include <stdio.h>
+#if CAIRO_HAS_PDF_SURFACE
CAIRO_BEGIN_DECLS
-void
-cairo_set_target_pdf (cairo_t *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
-
+cairo_surface_t *
+cairo_pdf_surface_create (const char *filename,
+ double width_in_points,
+ double height_in_points);
cairo_surface_t *
-cairo_pdf_surface_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
+cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points);
+
+void
+cairo_pdf_surface_set_dpi (cairo_surface_t *surface,
+ double x_dpi,
+ double y_dpi);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_PDF_SURFACE */
+# error Cairo was not compiled with support for the pdf backend
#endif /* CAIRO_HAS_PDF_SURFACE */
+
#endif /* CAIRO_PDF_H */
diff --git a/src/cairo_pen.c b/src/cairo-pen.c
index 6ecaa00..18b9ddb 100644
--- a/src/cairo_pen.c
+++ b/src/cairo-pen.c
@@ -36,6 +36,8 @@
#include "cairoint.h"
+#include "cairo-gstate-private.h"
+
static int
_cairo_pen_vertices_needed (double tolerance, double radius, cairo_matrix_t *matrix);
@@ -372,8 +374,8 @@ _cairo_pen_vertices_needed (double tolerance,
double radius,
cairo_matrix_t *matrix)
{
- double a = matrix->m[0][0], c = matrix->m[0][1];
- double b = matrix->m[1][0], d = matrix->m[1][1];
+ double a = matrix->xx, b = matrix->yx;
+ double c = matrix->xy, d = matrix->yy;
double i = a*a + c*c;
double j = b*b + d*d;
diff --git a/src/cairo-png.c b/src/cairo-png.c
new file mode 100644
index 0000000..d729784
--- /dev/null
+++ b/src/cairo-png.c
@@ -0,0 +1,469 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2003 University of Southern California
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ * Kristian Høgsberg <krh@redhat.com>
+ */
+
+#include <png.h>
+#include "cairoint.h"
+
+static void
+unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
+{
+ int i;
+
+ for (i = 0; i < row_info->rowbytes; i += 4) {
+ uint8_t *b = &data[i];
+ uint32_t pixel;
+ uint8_t alpha;
+
+ memcpy (&pixel, b, sizeof (uint32_t));
+ alpha = (pixel & 0xff000000) >> 24;
+ if (alpha == 0) {
+ b[0] = b[1] = b[2] = b[3] = 0;
+ } else {
+ b[0] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha;
+ b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha;
+ b[2] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha;
+ b[3] = alpha;
+ }
+ }
+}
+
+static cairo_status_t
+write_png (cairo_surface_t *surface,
+ png_rw_ptr write_func,
+ void *closure)
+{
+ int i;
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+ cairo_image_surface_t *image;
+ void *image_extra;
+ png_struct *png;
+ png_info *info;
+ png_time pt;
+ png_byte **rows;
+ png_color_16 white;
+ int png_color_type;
+ int depth;
+
+ status = _cairo_surface_acquire_source_image (surface,
+ &image,
+ &image_extra);
+
+ if (status == CAIRO_STATUS_NO_MEMORY)
+ return CAIRO_STATUS_NO_MEMORY;
+ else if (status != CAIRO_STATUS_SUCCESS)
+ return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
+
+ rows = malloc (image->height * sizeof(png_byte*));
+ if (rows == NULL) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto BAIL1;
+ }
+
+ for (i = 0; i < image->height; i++)
+ rows[i] = (png_byte *) image->data + i * image->stride;
+
+ png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (png == NULL) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto BAIL2;
+ }
+
+ info = png_create_info_struct (png);
+ if (info == NULL) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto BAIL3;
+ }
+
+ if (setjmp (png_jmpbuf (png))) {
+ status = CAIRO_STATUS_NO_MEMORY;
+ goto BAIL3;
+ }
+
+ png_set_write_fn (png, closure, write_func, NULL);
+
+ switch (image->format) {
+ case CAIRO_FORMAT_ARGB32:
+ depth = 8;
+ png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
+ break;
+ case CAIRO_FORMAT_RGB24:
+ depth = 8;
+ png_color_type = PNG_COLOR_TYPE_RGB;
+ break;
+ case CAIRO_FORMAT_A8:
+ depth = 8;
+ png_color_type = PNG_COLOR_TYPE_GRAY;
+ break;
+ case CAIRO_FORMAT_A1:
+ depth = 1;
+ png_color_type = PNG_COLOR_TYPE_GRAY;
+ break;
+ default:
+ status = CAIRO_STATUS_NULL_POINTER;
+ goto BAIL3;
+ }
+
+ png_set_IHDR (png, info,
+ image->width,
+ image->height, depth,
+ png_color_type,
+ PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_DEFAULT,
+ PNG_FILTER_TYPE_DEFAULT);
+
+ white.red = 0xff;
+ white.blue = 0xff;
+ white.green = 0xff;
+ png_set_bKGD (png, info, &white);
+
+ png_convert_from_time_t (&pt, time (NULL));
+ png_set_tIME (png, info, &pt);
+
+ png_set_write_user_transform_fn (png, unpremultiply_data);
+ if (image->format == CAIRO_FORMAT_ARGB32 ||
+ image->format == CAIRO_FORMAT_RGB24)
+ png_set_bgr (png);
+ if (image->format == CAIRO_FORMAT_RGB24)
+ png_set_filler (png, 0, PNG_FILLER_AFTER);
+
+ png_write_info (png, info);
+ png_write_image (png, rows);
+ png_write_end (png, info);
+
+BAIL3:
+ png_destroy_write_struct (&png, &info);
+BAIL2:
+ free (rows);
+BAIL1:
+ _cairo_surface_release_source_image (surface, image, image_extra);
+
+ return status;
+}
+
+static void
+stdio_write_func (png_structp png, png_bytep data, png_size_t size)
+{
+ FILE *fp;
+
+ fp = png_get_io_ptr (png);
+ if (fwrite (data, 1, size, fp) != size)
+ png_error(png, "Write Error");
+}
+
+/**
+ * cairo_surface_write_to_png:
+ * @surface: a #cairo_surface_t with pixel contents
+ * @filename: the name of a file to write to
+ *
+ * Writes the contents of @surface to a new file @filename as a PNG
+ * image.
+ *
+ * Return value: CAIRO_STATUS_SUCCESS if the PNG file was written
+ * successfully. Otherwise, CAIRO_STATUS_NO_MEMORY if memory could not
+ * be allocated for the operation or
+ * CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
+ * pixel contents, or CAIRO_STATUS_WRITE_ERROR if an I/O error occurs
+ * while attempting to write the file.
+ **/
+cairo_status_t
+cairo_surface_write_to_png (cairo_surface_t *surface,
+ const char *filename)
+{
+ FILE *fp;
+ cairo_status_t status;
+
+ fp = fopen (filename, "wb");
+ if (fp == NULL)
+ return CAIRO_STATUS_WRITE_ERROR;
+
+ status = write_png (surface, stdio_write_func, fp);
+
+ if (fclose (fp) && status == CAIRO_STATUS_SUCCESS)
+ status = CAIRO_STATUS_WRITE_ERROR;
+
+ return status;
+}
+
+struct png_write_closure_t {
+ cairo_write_func_t write_func;
+ void *closure;
+};
+
+static void
+stream_write_func (png_structp png, png_bytep data, png_size_t size)
+{
+ cairo_status_t status;
+ struct png_write_closure_t *png_closure;
+
+ png_closure = png_get_io_ptr (png);
+ status = png_closure->write_func (png_closure->closure, data, size);
+ if (status)
+ png_error(png, "Write Error");
+}
+
+/**
+ * cairo_surface_write_to_png_stream:
+ * @surface: a #cairo_surface_t with pixel contents
+ * @write_func: a #cairo_write_func_t
+ * @closure: closure data for the write function
+ *
+ * Writes the image surface to the write function.
+ *
+ * Return value: CAIRO_STATUS_SUCCESS if the PNG file was written
+ * successfully. Otherwise, CAIRO_STATUS_NO_MEMORY is returned if
+ * memory could not be allocated for the operation,
+ * CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
+ * pixel contents.
+ **/
+cairo_status_t
+cairo_surface_write_to_png_stream (cairo_surface_t *surface,
+ cairo_write_func_t write_func,
+ void *closure)
+{
+ struct png_write_closure_t png_closure;
+
+ png_closure.write_func = write_func;
+ png_closure.closure = closure;
+
+ return write_png (surface, stream_write_func, &png_closure);
+}
+
+static void
+premultiply_data (png_structp png,
+ png_row_infop row_info,
+ png_bytep data)
+{
+ int i;
+
+ for (i = 0; i < row_info->rowbytes; i += 4) {
+ uint8_t *base = &data[i];
+ uint8_t blue = base[0];
+ uint8_t green = base[1];
+ uint8_t red = base[2];
+ uint8_t alpha = base[3];
+ uint32_t p;
+
+ red = ((unsigned) red * (unsigned) alpha + 127) / 255;
+ green = ((unsigned) green * (unsigned) alpha + 127) / 255;
+ blue = ((unsigned) blue * (unsigned) alpha + 127) / 255;
+ p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
+ memcpy (base, &p, sizeof (uint32_t));
+ }
+}
+
+static cairo_surface_t *
+read_png (png_rw_ptr read_func,
+ void *closure)
+{
+ cairo_surface_t *surface;
+ png_byte *data;
+ int i;
+ png_struct *png;
+ png_info *info;
+ png_uint_32 png_width, png_height, stride;
+ int depth, color_type, interlace;
+ unsigned int pixel_size;
+ png_byte **row_pointers;
+
+ surface = NULL;
+ data = NULL;
+ row_pointers = NULL;
+
+ /* XXX: Perhaps we'll want some other error handlers? */
+ png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
+ NULL,
+ NULL,
+ NULL);
+ if (png == NULL)
+ return NULL;
+
+ info = png_create_info_struct (png);
+ if (info == NULL)
+ goto BAIL;
+
+ png_set_read_fn (png, closure, read_func);
+
+ if (setjmp (png_jmpbuf (png)))
+ goto BAIL;
+
+ png_read_info (png, info);
+
+ png_get_IHDR (png, info,
+ &png_width, &png_height, &depth,
+ &color_type, &interlace, NULL, NULL);
+ stride = 4 * png_width;
+
+ /* convert palette/gray image to rgb */
+ if (color_type == PNG_COLOR_TYPE_PALETTE)
+ png_set_palette_to_rgb (png);
+
+ /* expand gray bit depth if needed */
+ if (color_type == PNG_COLOR_TYPE_GRAY && depth < 8)
+ png_set_gray_1_2_4_to_8 (png);
+ /* transform transparency to alpha */
+ if (png_get_valid(png, info, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha (png);
+
+ if (depth == 16)
+ png_set_strip_16 (png);
+
+ if (depth < 8)
+ png_set_packing (png);
+
+ /* convert grayscale to RGB */
+ if (color_type == PNG_COLOR_TYPE_GRAY
+ || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ png_set_gray_to_rgb (png);
+
+ if (interlace != PNG_INTERLACE_NONE)
+ png_set_interlace_handling (png);
+
+ png_set_bgr (png);
+ png_set_filler (png, 0xff, PNG_FILLER_AFTER);
+
+ png_set_read_user_transform_fn (png, premultiply_data);
+
+ png_read_update_info (png, info);
+
+ pixel_size = 4;
+ data = malloc (png_width * png_height * pixel_size);
+ if (data == NULL)
+ goto BAIL;
+
+ row_pointers = malloc (png_height * sizeof(char *));
+ if (row_pointers == NULL)
+ goto BAIL;
+
+ for (i = 0; i < png_height; i++)
+ row_pointers[i] = &data[i * png_width * pixel_size];
+
+ png_read_image (png, row_pointers);
+ png_read_end (png, info);
+
+ surface = cairo_image_surface_create_for_data (data,
+ CAIRO_FORMAT_ARGB32,
+ png_width, png_height, stride);
+ _cairo_image_surface_assume_ownership_of_data ((cairo_image_surface_t*)surface);
+ data = NULL;
+
+ BAIL:
+ free (row_pointers);
+ free (data);
+ png_destroy_read_struct (&png, NULL, NULL);
+
+ return surface;
+}
+
+static void
+stdio_read_func (png_structp png, png_bytep data, png_size_t size)
+{
+ FILE *fp;
+
+ fp = png_get_io_ptr (png);
+ if (fread (data, 1, size, fp) != size)
+ png_error(png, "Read Error");
+}
+
+/**
+ * cairo_image_surface_create_from_png:
+ * @filename: name of PNG file to load
+ *
+ * Creates a new image surface and initializes the contents to the
+ * given PNG file.
+ *
+ * Return value: a new #cairo_surface_t initialized with the contents
+ * of the PNG file or %NULL if the file is not a valid PNG file or
+ * memory could not be allocated for the operation.
+ **/
+cairo_surface_t *
+cairo_image_surface_create_from_png (const char *filename)
+{
+ FILE *fp;
+ cairo_surface_t *surface;
+
+ fp = fopen (filename, "rb");
+ if (fp == NULL)
+ return NULL;
+
+ surface = read_png (stdio_read_func, fp);
+
+ fclose (fp);
+
+ return surface;
+}
+
+struct png_read_closure_t {
+ cairo_read_func_t read_func;
+ void *closure;
+};
+
+static void
+stream_read_func (png_structp png, png_bytep data, png_size_t size)
+{
+ cairo_status_t status;
+ struct png_read_closure_t *png_closure;
+
+ png_closure = png_get_io_ptr (png);
+ status = png_closure->read_func (png_closure->closure, data, size);
+ if (status)
+ png_error(png, "Read Error");
+}
+
+/**
+ * cairo_image_surface_create_from_png_stream:
+ * @read_func: function called to read the data of the file
+ * @closure: data to pass to @read_func.
+ *
+ * Creates a new image surface from PNG data read incrementally
+ * via the @read_func function.
+ *
+ * Return value: a new #cairo_surface_t initialized with the contents
+ * of the PNG file or %NULL if the data read is not a valid PNG image or
+ * memory could not be allocated for the operation.
+ **/
+cairo_surface_t *
+cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ void *closure)
+{
+ struct png_read_closure_t png_closure;
+
+ png_closure.read_func = read_func;
+ png_closure.closure = closure;
+
+ return read_png (stream_read_func, &closure);
+}
+
diff --git a/src/cairo_polygon.c b/src/cairo-polygon.c
index 59c615d..59c615d 100644
--- a/src/cairo_polygon.c
+++ b/src/cairo-polygon.c
diff --git a/src/cairo-private.h b/src/cairo-private.h
new file mode 100644
index 0000000..7051f7e
--- /dev/null
+++ b/src/cairo-private.h
@@ -0,0 +1,52 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@redhat.com>
+ */
+
+#ifndef CAIRO_PRIVATE_H
+#define CAIRO_PRIVATE_H
+
+#include "cairo-gstate-private.h"
+#include "cairo-path-fixed-private.h"
+
+struct _cairo {
+ unsigned int ref_count;
+
+ cairo_status_t status;
+
+ cairo_path_fixed_t path;
+
+ cairo_gstate_t *gstate;
+};
+
+#endif /* CAIRO_PRIVATE_H */
diff --git a/src/cairo_ps_surface.c b/src/cairo-ps-surface.c
index 4a45fc6..dd12c2c 100644
--- a/src/cairo_ps_surface.c
+++ b/src/cairo-ps-surface.c
@@ -42,74 +42,34 @@
static const cairo_surface_backend_t cairo_ps_surface_backend;
-/**
- * cairo_set_target_ps:
- * @cr: a #cairo_t
- * @file: an open, writeable file
- * @width_inches: width of the output page, in inches
- * @height_inches: height of the output page, in inches
- * @x_pixels_per_inch: X resolution to use for image fallbacks;
- * not all Cairo drawing can be represented in a postscript
- * file, so Cairo will write out images for some portions
- * of the output.
- * @y_pixels_per_inch: Y resolution to use for image fallbacks.
- *
- * Directs output for a #cairo_t to a postscript file. The file must
- * be kept open until the #cairo_t is destroyed or set to have a
- * different target, and then must be closed by the application.
- **/
-void
-cairo_set_target_ps (cairo_t *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch)
-{
- cairo_surface_t *surface;
-
- surface = cairo_ps_surface_create (file,
- width_inches, height_inches,
- x_pixels_per_inch, y_pixels_per_inch);
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface (cr, surface);
-
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy (surface);
-}
-
typedef struct cairo_ps_surface {
cairo_surface_t base;
/* PS-specific fields */
- FILE *file;
+ cairo_output_stream_t *stream;
- double width_inches;
- double height_inches;
- double x_ppi;
- double y_ppi;
+ double width_in_points;
+ double height_in_points;
+ double x_dpi;
+ double y_dpi;
int pages;
cairo_image_surface_t *image;
} cairo_ps_surface_t;
+#define PS_SURFACE_DPI_DEFAULT 300.0
+
static void
_cairo_ps_surface_erase (cairo_ps_surface_t *surface);
-cairo_surface_t *
-cairo_ps_surface_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch)
+static cairo_surface_t *
+_cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream,
+ double width_in_points,
+ double height_in_points)
{
cairo_ps_surface_t *surface;
- int width, height;
+ int width_in_pixels, height_in_pixels;
time_t now = time (0);
surface = malloc (sizeof (cairo_ps_surface_t));
@@ -118,20 +78,21 @@ cairo_ps_surface_create (FILE *file,
_cairo_surface_init (&surface->base, &cairo_ps_surface_backend);
- surface->file = file;
+ surface->stream = stream;
- surface->width_inches = width_inches;
- surface->height_inches = height_inches;
- surface->x_ppi = x_pixels_per_inch;
- surface->y_ppi = x_pixels_per_inch;
+ surface->width_in_points = width_in_points;
+ surface->height_in_points = height_in_points;
+ surface->x_dpi = PS_SURFACE_DPI_DEFAULT;
+ surface->y_dpi = PS_SURFACE_DPI_DEFAULT;
surface->pages = 0;
- width = (int) (x_pixels_per_inch * width_inches + 1.0);
- height = (int) (y_pixels_per_inch * height_inches + 1.0);
+ width_in_pixels = (int) (surface->x_dpi * width_in_points / 72.0 + 1.0);
+ height_in_pixels = (int) (surface->y_dpi * height_in_points / 72.0 + 1.0);
surface->image = (cairo_image_surface_t *)
- cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+ cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ width_in_pixels, height_in_pixels);
if (surface->image == NULL) {
free (surface);
return NULL;
@@ -140,74 +101,95 @@ cairo_ps_surface_create (FILE *file,
_cairo_ps_surface_erase (surface);
/* Document header */
- fprintf (file,
- "%%!PS-Adobe-3.0\n"
- "%%%%Creator: Cairo (http://cairographics.org)\n");
- fprintf (file,
- "%%%%CreationDate: %s",
- ctime (&now));
- fprintf (file,
- "%%%%BoundingBox: %d %d %d %d\n",
- 0, 0, (int) (surface->width_inches * 72.0), (int) (surface->height_inches * 72.0));
+ _cairo_output_stream_printf (surface->stream,
+ "%%!PS-Adobe-3.0\n"
+ "%%%%Creator: Cairo (http://cairographics.org)\n");
+ _cairo_output_stream_printf (surface->stream,
+ "%%%%CreationDate: %s",
+ ctime (&now));
+ _cairo_output_stream_printf (surface->stream,
+ "%%%%BoundingBox: %f %f %f %f\n",
+ 0.0, 0.0,
+ surface->width_in_points,
+ surface->height_in_points);
/* The "/FlateDecode filter" currently used is a feature of LanguageLevel 3 */
- fprintf (file,
- "%%%%DocumentData: Clean7Bit\n"
- "%%%%LanguageLevel: 3\n");
- fprintf (file,
- "%%%%Orientation: Portrait\n"
- "%%%%EndComments\n");
+ _cairo_output_stream_printf (surface->stream,
+ "%%%%DocumentData: Clean7Bit\n"
+ "%%%%LanguageLevel: 3\n");
+ _cairo_output_stream_printf (surface->stream,
+ "%%%%Orientation: Portrait\n"
+ "%%%%EndComments\n");
return &surface->base;
}
+cairo_surface_t *
+cairo_ps_surface_create (const char *filename,
+ double width_in_points,
+ double height_in_points)
+{
+ cairo_output_stream_t *stream;
+
+ stream = _cairo_output_stream_create_for_file (filename);
+ if (stream == NULL)
+ return NULL;
+
+ return _cairo_ps_surface_create_for_stream_internal (stream,
+ width_in_points,
+ height_in_points);
+}
+
+cairo_surface_t *
+cairo_ps_surface_create_for_stream (cairo_write_func_t write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points)
+{
+ cairo_output_stream_t *stream;
+
+ stream = _cairo_output_stream_create (write_func, closure);
+ if (stream == NULL)
+ return NULL;
+
+ return _cairo_ps_surface_create_for_stream_internal (stream,
+ width_in_points,
+ height_in_points);
+}
+
static cairo_surface_t *
_cairo_ps_surface_create_similar (void *abstract_src,
cairo_format_t format,
- int drawable,
int width,
int height)
{
return NULL;
}
-static void
-_cairo_ps_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_ps_surface_finish (void *abstract_surface)
{
cairo_ps_surface_t *surface = abstract_surface;
/* Document footer */
- fprintf (surface->file, "%%%%EOF\n");
+ _cairo_output_stream_printf (surface->stream,
+ "%%%%EOF\n");
cairo_surface_destroy (&surface->image->base);
- free (surface);
+ return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_ps_surface_erase (cairo_ps_surface_t *surface)
{
- cairo_color_t transparent;
-
- _cairo_color_init (&transparent);
- _cairo_color_set_rgb (&transparent, 0., 0., 0.);
- _cairo_color_set_alpha (&transparent, 0.);
_cairo_surface_fill_rectangle (&surface->image->base,
- CAIRO_OPERATOR_SRC,
- &transparent,
+ CAIRO_OPERATOR_SOURCE,
+ CAIRO_COLOR_TRANSPARENT,
0, 0,
surface->image->width,
surface->image->height);
}
-/* XXX: We should re-work this interface to return both X/Y ppi values. */
-static double
-_cairo_ps_surface_pixels_per_inch (void *abstract_surface)
-{
- cairo_ps_surface_t *surface = abstract_surface;
-
- return surface->y_ppi;
-}
-
static cairo_status_t
_cairo_ps_surface_acquire_source_image (void *abstract_surface,
cairo_image_surface_t **image_out,
@@ -220,13 +202,6 @@ _cairo_ps_surface_acquire_source_image (void *abstract_surfac
return CAIRO_STATUS_SUCCESS;
}
-static void
-_cairo_ps_surface_release_source_image (void *abstract_surface,
- cairo_image_surface_t *image,
- void *image_extra)
-{
-}
-
static cairo_status_t
_cairo_ps_surface_acquire_dest_image (void *abstract_surface,
cairo_rectangle_t *interest_rect,
@@ -246,66 +221,6 @@ _cairo_ps_surface_acquire_dest_image (void *abstract_surface,
return CAIRO_STATUS_SUCCESS;
}
-static void
-_cairo_ps_surface_release_dest_image (void *abstract_surface,
- cairo_rectangle_t *interest_rect,
- cairo_image_surface_t *image,
- cairo_rectangle_t *image_rect,
- void *image_extra)
-{
-}
-
-static cairo_status_t
-_cairo_ps_surface_clone_similar (void *abstract_surface,
- cairo_surface_t *src,
- cairo_surface_t **clone_out)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_ps_surface_composite (cairo_operator_t operator,
- cairo_pattern_t *src,
- cairo_pattern_t *mask,
- void *abstract_dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_ps_surface_fill_rectangles (void *abstract_surface,
- cairo_operator_t operator,
- const cairo_color_t *color,
- cairo_rectangle_t *rects,
- int num_rects)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_ps_surface_composite_trapezoids (cairo_operator_t operator,
- cairo_pattern_t *generic_src,
- void *abstract_dst,
- int x_src,
- int y_src,
- int x_dst,
- int y_dst,
- unsigned int width,
- unsigned int height,
- cairo_trapezoid_t *traps,
- int num_traps)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
static cairo_int_status_t
_cairo_ps_surface_copy_page (void *abstract_surface)
{
@@ -313,13 +228,13 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
cairo_ps_surface_t *surface = abstract_surface;
int width = surface->image->width;
int height = surface->image->height;
- FILE *file = surface->file;
+ cairo_output_stream_t *stream = surface->stream;
int i, x, y;
cairo_solid_pattern_t white_pattern;
- char *rgb, *compressed;
- long rgb_size, compressed_size;
+ unsigned char *rgb, *compressed;
+ unsigned long rgb_size, compressed_size;
rgb_size = 3 * width * height;
rgb = malloc (rgb_size);
@@ -338,9 +253,9 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
/* PostScript can not represent the alpha channel, so we blend the
current image over a white RGB surface to eliminate it. */
- _cairo_pattern_init_solid (&white_pattern, 1.0, 1.0, 1.0);
+ _cairo_pattern_init_solid (&white_pattern, CAIRO_COLOR_WHITE);
- _cairo_surface_composite (CAIRO_OPERATOR_OVER_REVERSE,
+ _cairo_surface_composite (CAIRO_OPERATOR_DEST_OVER,
&white_pattern.base,
NULL,
&surface->image->base,
@@ -364,34 +279,34 @@ _cairo_ps_surface_copy_page (void *abstract_surface)
compress (compressed, &compressed_size, rgb, rgb_size);
/* Page header */
- fprintf (file, "%%%%Page: %d\n", ++surface->pages);
+ _cairo_output_stream_printf (stream, "%%%%Page: %d\n", ++surface->pages);
- fprintf (file, "gsave\n");
+ _cairo_output_stream_printf (stream, "gsave\n");
/* Image header goop */
- fprintf (file, "%g %g translate\n", 0.0, surface->height_inches * 72.0);
- fprintf (file, "%g %g scale\n", 72.0 / surface->x_ppi, 72.0 / surface->y_ppi);
- fprintf (file, "/DeviceRGB setcolorspace\n");
- fprintf (file, "<<\n");
- fprintf (file, " /ImageType 1\n");
- fprintf (file, " /Width %d\n", width);
- fprintf (file, " /Height %d\n", height);
- fprintf (file, " /BitsPerComponent 8\n");
- fprintf (file, " /Decode [ 0 1 0 1 0 1 ]\n");
- fprintf (file, " /DataSource currentfile /FlateDecode filter\n");
- fprintf (file, " /ImageMatrix [ 1 0 0 -1 0 1 ]\n");
- fprintf (file, ">>\n");
- fprintf (file, "image\n");
+ _cairo_output_stream_printf (stream, "%f %f translate\n",
+ 0.0, surface->height_in_points);
+ _cairo_output_stream_printf (stream, "/DeviceRGB setcolorspace\n");
+ _cairo_output_stream_printf (stream, "<<\n");
+ _cairo_output_stream_printf (stream, " /ImageType 1\n");
+ _cairo_output_stream_printf (stream, " /Width %d\n", width);
+ _cairo_output_stream_printf (stream, " /Height %d\n", height);
+ _cairo_output_stream_printf (stream, " /BitsPerComponent 8\n");
+ _cairo_output_stream_printf (stream, " /Decode [ 0 1 0 1 0 1 ]\n");
+ _cairo_output_stream_printf (stream, " /DataSource currentfile /FlateDecode filter\n");
+ _cairo_output_stream_printf (stream, " /ImageMatrix [ 1 0 0 -1 0 1 ]\n");
+ _cairo_output_stream_printf (stream, ">>\n");
+ _cairo_output_stream_printf (stream, "image\n");
/* Compressed image data */
- fwrite (compressed, 1, compressed_size, file);
+ _cairo_output_stream_write (stream, compressed, compressed_size);
- fprintf (file, "showpage\n");
+ _cairo_output_stream_printf (stream, "showpage\n");
- fprintf (file, "grestore\n");
+ _cairo_output_stream_printf (stream, "grestore\n");
/* Page footer */
- fprintf (file, "%%%%EndPage\n");
+ _cairo_output_stream_printf (stream, "%%%%EndPage\n");
free (compressed);
BAIL1:
@@ -424,20 +339,40 @@ _cairo_ps_surface_set_clip_region (void *abstract_surface,
return _cairo_image_surface_set_clip_region (surface->image, region);
}
+static cairo_int_status_t
+_cairo_ps_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_ps_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+
+ /* XXX: The conversion to integers here is pretty bogus, (not to
+ * mention the aribitray limitation of width to a short(!). We
+ * may need to come up with a better interface for get_size.
+ */
+ rectangle->width = (surface->width_in_points + 0.5);
+ rectangle->height = (surface->height_in_points + 0.5);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static const cairo_surface_backend_t cairo_ps_surface_backend = {
_cairo_ps_surface_create_similar,
- _cairo_ps_surface_destroy,
- _cairo_ps_surface_pixels_per_inch,
+ _cairo_ps_surface_finish,
_cairo_ps_surface_acquire_source_image,
- _cairo_ps_surface_release_source_image,
+ NULL, /* release_source_image */
_cairo_ps_surface_acquire_dest_image,
- _cairo_ps_surface_release_dest_image,
- _cairo_ps_surface_clone_similar,
- _cairo_ps_surface_composite,
- _cairo_ps_surface_fill_rectangles,
- _cairo_ps_surface_composite_trapezoids,
+ NULL, /* release_dest_image */
+ NULL, /* clone_similar */
+ NULL, /* composite */
+ NULL, /* fill_rectangles */
+ NULL, /* composite_trapezoids */
_cairo_ps_surface_copy_page,
_cairo_ps_surface_show_page,
_cairo_ps_surface_set_clip_region,
+ NULL, /* intersect_clip_path */
+ _cairo_ps_surface_get_extents,
NULL /* show_glyphs */
};
diff --git a/src/cairo-ps.h b/src/cairo-ps.h
index 8838292..ea2d53d 100644
--- a/src/cairo-ps.h
+++ b/src/cairo-ps.h
@@ -39,30 +39,34 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_PS_SURFACE
+#if CAIRO_HAS_PS_SURFACE
#include <stdio.h>
CAIRO_BEGIN_DECLS
-void
-cairo_set_target_ps (cairo_t *cr,
- FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
-
/* PS-surface functions */
cairo_surface_t *
-cairo_ps_surface_create (FILE *file,
- double width_inches,
- double height_inches,
- double x_pixels_per_inch,
- double y_pixels_per_inch);
+cairo_ps_surface_create (const char *filename,
+ double width_in_points,
+ double height_in_points);
+
+cairo_surface_t *
+cairo_ps_surface_create_for_stream (cairo_write_func_t write_func,
+ void *closure,
+ double width_in_points,
+ double height_in_points);
+
+void
+cairo_ps_surface_set_dpi (cairo_surface_t *surface,
+ double x_dpi,
+ double y_dpi);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_PS_SURFACE */
+# error Cairo was not compiled with support for the ps backend
#endif /* CAIRO_HAS_PS_SURFACE */
+
#endif /* CAIRO_PS_H */
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
new file mode 100644
index 0000000..5668425
--- /dev/null
+++ b/src/cairo-quartz-surface.c
@@ -0,0 +1,257 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2004 Calum Robinson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Calum Robinson
+ *
+ * Contributor(s):
+ * Calum Robinson <calumr@mac.com>
+ */
+
+#include "cairoint.h"
+#include "cairo-private.h"
+#include "cairo-quartz.h"
+
+typedef struct cairo_quartz_surface {
+ cairo_surface_t base;
+
+ CGContextRef context;
+
+ int width;
+ int height;
+
+ cairo_image_surface_t *image;
+
+ CGImageRef cgImage;
+} cairo_quartz_surface_t;
+
+static void
+ImageDataReleaseFunc(void *info, const void *data, size_t size)
+{
+ if (data != NULL) {
+ free((void *) data);
+ }
+}
+
+static cairo_surface_t *_cairo_quartz_surface_create_similar(void
+ *abstract_src,
+ cairo_format_t
+ format,
+ int width,
+ int height)
+{
+ return NULL;
+}
+
+static cairo_status_t
+_cairo_quartz_surface_finish(void *abstract_surface)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+
+ if (surface->image)
+ cairo_surface_destroy(&surface->image->base);
+
+ if (surface->cgImage)
+ CGImageRelease(surface->cgImage);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_quartz_surface_acquire_source_image(void *abstract_surface,
+ cairo_image_surface_t **image_out,
+ void **image_extra)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+ CGColorSpaceRef colorSpace;
+ void *imageData;
+ UInt32 imageDataSize, rowBytes;
+ CGDataProviderRef dataProvider;
+
+ // We keep a cached (cairo_image_surface_t *) in the cairo_quartz_surface_t
+ // struct. If the window is ever drawn to without going through Cairo, then
+ // we would need to refetch the pixel data from the window into the cached
+ // image surface.
+ if (surface->image) {
+ cairo_surface_reference(&surface->image->base);
+
+ *image_out = surface->image;
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ colorSpace = CGColorSpaceCreateDeviceRGB();
+
+
+ rowBytes = surface->width * 4;
+ imageDataSize = rowBytes * surface->height;
+ imageData = malloc(imageDataSize);
+
+ dataProvider =
+ CGDataProviderCreateWithData(NULL, imageData, imageDataSize,
+ ImageDataReleaseFunc);
+
+ surface->cgImage = CGImageCreate(surface->width,
+ surface->height,
+ 8,
+ 32,
+ rowBytes,
+ colorSpace,
+ kCGImageAlphaPremultipliedFirst,
+ dataProvider,
+ NULL,
+ false, kCGRenderingIntentDefault);
+
+ CGColorSpaceRelease(colorSpace);
+ CGDataProviderRelease(dataProvider);
+
+ surface->image = (cairo_image_surface_t *)
+ cairo_image_surface_create_for_data(imageData,
+ CAIRO_FORMAT_ARGB32,
+ surface->width,
+ surface->height, rowBytes);
+
+
+ // Set the image surface Cairo state to match our own.
+ _cairo_image_surface_set_repeat(surface->image, surface->base.repeat);
+ _cairo_image_surface_set_matrix(surface->image,
+ &(surface->base.matrix));
+
+ *image_out = surface->image;
+ *image_extra = NULL;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_quartz_surface_acquire_dest_image(void *abstract_surface,
+ cairo_rectangle_t * interest_rect,
+ cairo_image_surface_t **
+ image_out,
+ cairo_rectangle_t * image_rect,
+ void **image_extra)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+
+ image_rect->x = 0;
+ image_rect->y = 0;
+ image_rect->width = surface->image->width;
+ image_rect->height = surface->image->height;
+
+ *image_out = surface->image;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+
+static void
+_cairo_quartz_surface_release_dest_image(void *abstract_surface,
+ cairo_rectangle_t *
+ intersect_rect,
+ cairo_image_surface_t * image,
+ cairo_rectangle_t * image_rect,
+ void *image_extra)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+
+ if (surface->image == image) {
+ CGRect rect;
+
+ rect = CGRectMake(0, 0, surface->width, surface->height);
+
+ CGContextDrawImage(surface->context, rect, surface->cgImage);
+
+ memset(surface->image->data, 0, surface->width * surface->height * 4);
+ }
+}
+
+static cairo_int_status_t
+_cairo_quartz_surface_set_clip_region(void *abstract_surface,
+ pixman_region16_t * region)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+
+ return _cairo_surface_set_clip_region(&surface->image->base, region);
+}
+
+static cairo_int_status_t
+_cairo_quartz_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t * rectangle)
+{
+ cairo_quartz_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+ rectangle->width = surface->width;
+ rectangle->height = surface->height;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
+ _cairo_quartz_surface_create_similar,
+ _cairo_quartz_surface_finish,
+ _cairo_quartz_surface_acquire_source_image,
+ NULL, /* release_source_image */
+ _cairo_quartz_surface_acquire_dest_image,
+ _cairo_quartz_surface_release_dest_image,
+ NULL, /* clone_similar */
+ NULL, /* composite */
+ NULL, /* fill_rectangles */
+ NULL, /* composite_trapezoids */
+ NULL, /* copy_page */
+ NULL, /* show_page */
+ _cairo_quartz_surface_set_clip_region,
+ NULL, /* intersect_clip_path */
+ _cairo_quartz_surface_get_extents,
+ NULL /* show_glyphs */
+};
+
+
+cairo_surface_t *cairo_quartz_surface_create(CGContextRef context,
+ int width, int height)
+{
+ cairo_quartz_surface_t *surface;
+
+ surface = malloc(sizeof(cairo_quartz_surface_t));
+ if (surface == NULL)
+ return NULL;
+
+ _cairo_surface_init(&surface->base, &cairo_quartz_surface_backend);
+
+ surface->context = context;
+ surface->width = width;
+ surface->height = height;
+ surface->image = NULL;
+ surface->cgImage = NULL;
+
+ // Set up the image surface which Cairo draws into and we blit to & from.
+ void *foo;
+ _cairo_quartz_surface_acquire_source_image(surface, &surface->image, &foo);
+
+ return (cairo_surface_t *) surface;
+}
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index 5afd464..6f59f6a 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -39,18 +39,12 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
+#if CAIRO_HAS_QUARTZ_SURFACE
#include <Carbon/Carbon.h>
CAIRO_BEGIN_DECLS
-void
-cairo_set_target_quartz_context( cairo_t *cr,
- CGContextRef context,
- int width,
- int height);
-
cairo_surface_t *
cairo_quartz_surface_create ( CGContextRef context,
int width,
@@ -58,6 +52,9 @@ cairo_quartz_surface_create ( CGContextRef context,
CAIRO_END_DECLS
+#else /* CAIRO_HAS_QUARTZ_SURFACE */
+# error Cairo was not compiled with support for the quartz backend
#endif /* CAIRO_HAS_QUARTZ_SURFACE */
+
#endif /* CAIRO_QUARTZ_H */
diff --git a/src/cairo_slope.c b/src/cairo-slope.c
index a2edec0..a2edec0 100644
--- a/src/cairo_slope.c
+++ b/src/cairo-slope.c
diff --git a/src/cairo_spline.c b/src/cairo-spline.c
index 5119a8e..60ad6c5 100644
--- a/src/cairo_spline.c
+++ b/src/cairo-spline.c
@@ -64,23 +64,21 @@ _cairo_spline_init (cairo_spline_t *spline,
spline->c = *c;
spline->d = *d;
- if (a->x != b->x || a->y != b->y) {
+ if (a->x != b->x || a->y != b->y)
_cairo_slope_init (&spline->initial_slope, &spline->a, &spline->b);
- } else if (a->x != c->x || a->y != c->y) {
+ else if (a->x != c->x || a->y != c->y)
_cairo_slope_init (&spline->initial_slope, &spline->a, &spline->c);
- } else if (a->x != d->x || a->y != d->y) {
+ else if (a->x != d->x || a->y != d->y)
_cairo_slope_init (&spline->initial_slope, &spline->a, &spline->d);
- } else {
+ else
return CAIRO_INT_STATUS_DEGENERATE;
- }
- if (c->x != d->x || c->y != d->y) {
+ if (c->x != d->x || c->y != d->y)
_cairo_slope_init (&spline->final_slope, &spline->c, &spline->d);
- } else if (b->x != d->x || b->y != d->y) {
+ else if (b->x != d->x || b->y != d->y)
_cairo_slope_init (&spline->final_slope, &spline->b, &spline->d);
- } else {
+ else
_cairo_slope_init (&spline->final_slope, &spline->a, &spline->d);
- }
spline->num_points = 0;
spline->points_size = 0;
diff --git a/src/cairo_surface.c b/src/cairo-surface.c
index 330d58b..318ee87 100644
--- a/src/cairo_surface.c
+++ b/src/cairo-surface.c
@@ -1,6 +1,7 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -37,6 +38,7 @@
#include <stdlib.h>
#include "cairoint.h"
+#include "cairo-gstate-private.h"
void
_cairo_surface_init (cairo_surface_t *surface,
@@ -45,35 +47,27 @@ _cairo_surface_init (cairo_surface_t *surface,
surface->backend = backend;
surface->ref_count = 1;
+ surface->finished = FALSE;
- _cairo_matrix_init (&surface->matrix);
- surface->filter = CAIRO_FILTER_NEAREST;
- surface->repeat = 0;
-}
+ _cairo_user_data_array_init (&surface->user_data);
-cairo_surface_t *
-cairo_surface_create_for_image (char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride)
-{
- return cairo_image_surface_create_for_data (data, format, width, height, stride);
+ surface->device_x_offset = 0;
+ surface->device_y_offset = 0;
+
+ surface->next_clip_serial = 0;
+ surface->current_clip_serial = 0;
}
-slim_hidden_def(cairo_surface_create_for_image);
cairo_surface_t *
_cairo_surface_create_similar_scratch (cairo_surface_t *other,
cairo_format_t format,
- int drawable,
int width,
int height)
{
if (other == NULL)
return NULL;
- return other->backend->create_similar (other, format, drawable,
- width, height);
+ return other->backend->create_similar (other, format, width, height);
}
cairo_surface_t *
@@ -82,36 +76,32 @@ cairo_surface_create_similar (cairo_surface_t *other,
int width,
int height)
{
- cairo_color_t empty;
-
if (other == NULL)
return NULL;
- _cairo_color_init (&empty);
- _cairo_color_set_rgb (&empty, 0., 0., 0.);
- _cairo_color_set_alpha (&empty, 0.);
-
- return _cairo_surface_create_similar_solid (other, format, width, height, &empty);
+ return _cairo_surface_create_similar_solid (other, format,
+ width, height,
+ CAIRO_COLOR_TRANSPARENT);
}
cairo_surface_t *
-_cairo_surface_create_similar_solid (cairo_surface_t *other,
- cairo_format_t format,
- int width,
- int height,
- cairo_color_t *color)
+_cairo_surface_create_similar_solid (cairo_surface_t *other,
+ cairo_format_t format,
+ int width,
+ int height,
+ const cairo_color_t *color)
{
cairo_status_t status;
cairo_surface_t *surface;
- surface = _cairo_surface_create_similar_scratch (other, format, 1,
+ surface = _cairo_surface_create_similar_scratch (other, format,
width, height);
if (surface == NULL)
surface = cairo_image_surface_create (format, width, height);
status = _cairo_surface_fill_rectangle (surface,
- CAIRO_OPERATOR_SRC, color,
+ CAIRO_OPERATOR_SOURCE, color,
0, 0, width, height);
if (status) {
cairo_surface_destroy (surface);
@@ -121,6 +111,17 @@ _cairo_surface_create_similar_solid (cairo_surface_t *other,
return surface;
}
+cairo_clip_mode_t
+_cairo_surface_get_clip_mode (cairo_surface_t *surface)
+{
+ if (surface->backend->intersect_clip_path != NULL)
+ return CAIRO_CLIP_MODE_PATH;
+ else if (surface->backend->set_clip_region != NULL)
+ return CAIRO_CLIP_MODE_REGION;
+ else
+ return CAIRO_CLIP_MODE_MASK;
+}
+
void
cairo_surface_reference (cairo_surface_t *surface)
{
@@ -140,15 +141,126 @@ cairo_surface_destroy (cairo_surface_t *surface)
if (surface->ref_count)
return;
- if (surface->backend->destroy)
- surface->backend->destroy (surface);
+ cairo_surface_finish (surface);
+
+ _cairo_user_data_array_fini (&surface->user_data);
+
+ free (surface);
}
slim_hidden_def(cairo_surface_destroy);
-double
-_cairo_surface_pixels_per_inch (cairo_surface_t *surface)
+/**
+ * cairo_surface_finish:
+ * @surface: the #cairo_surface_t to finish
+ *
+ * This function finishes the surface and drops all references to
+ * external resources. For example, for the Xlib backend it means
+ * that cairo will no longer access the drawable, which can be freed.
+ * After calling cairo_surface_finish() the only valid operations on a
+ * surface are getting and setting user data and referencing and
+ * destroying it. Further drawing the the surface will not affect the
+ * surface but set the surface status to
+ * CAIRO_STATUS_SURFACE_FINISHED.
+ *
+ * When the last call to cairo_surface_destroy() decreases the
+ * reference count to zero, cairo will call cairo_surface_finish() if
+ * it hasn't been called already, before freeing the resources
+ * associated with the surface.
+ *
+ * Return value: CAIRO_STATUS_SUCCESS if the surface was finished
+ * successfully, otherwise CAIRO_STATUS_NO_MEMORY or
+ * CAIRO_STATUS_WRITE_ERROR.
+ **/
+cairo_status_t
+cairo_surface_finish (cairo_surface_t *surface)
+{
+ cairo_status_t status;
+
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ if (surface->backend->finish) {
+ status = surface->backend->finish (surface);
+ if (status)
+ return status;
+ }
+
+ surface->finished = TRUE;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/**
+ * cairo_surface_get_user_data:
+ * @surface: a #cairo_surface_t
+ * @key: the address of the #cairo_user_data_key_t the user data was
+ * attached to
+ *
+ * Return user data previously attached to @surface using the specified
+ * key. If no user data has been attached with the given key this
+ * function returns %NULL.
+ *
+ * Return value: the user data previously attached or %NULL.
+ **/
+void *
+cairo_surface_get_user_data (cairo_surface_t *surface,
+ const cairo_user_data_key_t *key)
+{
+ return _cairo_user_data_array_get_data (&surface->user_data,
+ key);
+}
+
+/**
+ * cairo_surface_set_user_data:
+ * @surface: a #cairo_surface_t
+ * @key: the address of a #cairo_user_data_key_t to attach the user data to
+ * @user_data: the user data to attach to the surface
+ * @destroy: a #cairo_destroy_func_t which will be called when the
+ * surface is destroyed or when new user data is attached using the
+ * same key.
+ *
+ * Attach user data to @surface. To remove user data from a surface,
+ * call this function with the key that was used to set it and %NULL
+ * for @data.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY if a
+ * slot could not be allocated for the user data.
+ **/
+cairo_status_t
+cairo_surface_set_user_data (cairo_surface_t *surface,
+ const cairo_user_data_key_t *key,
+ void *user_data,
+ cairo_destroy_func_t destroy)
+{
+ return _cairo_user_data_array_set_data (&surface->user_data,
+ key, user_data, destroy);
+}
+
+/**
+ * cairo_surface_set_device_offset:
+ * @surface: a #cairo_surface_t
+ * @x_offset: the offset in the X direction, in device units
+ * @y_offset: the offset in the Y direction, in device units
+ *
+ * Sets an offset that is added to the device coordinates determined
+ * by the CTM when drawing to @surface. One use case for this function
+ * is when we want to create a #cairo_surface_t that redirects drawing
+ * for a portion of an onscreen surface to an offscreen surface in a
+ * way that is completely invisible to the user of the cairo
+ * API. Setting a transformation via cairo_translate() isn't
+ * sufficient to do this, since functions like
+ * cairo_device_to_user() will expose the hidden offset.
+ *
+ * Note that the offset only affects drawing to the surface, not using
+ * the surface in a surface pattern.
+ **/
+void
+cairo_surface_set_device_offset (cairo_surface_t *surface,
+ double x_offset,
+ double y_offset)
{
- return surface->backend->pixels_per_inch (surface);
+ surface->device_x_offset = x_offset;
+ surface->device_y_offset = y_offset;
}
/**
@@ -173,6 +285,8 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface,
cairo_image_surface_t **image_out,
void **image_extra)
{
+ assert (!surface->finished);
+
return surface->backend->acquire_source_image (surface, image_out, image_extra);
}
@@ -188,7 +302,10 @@ _cairo_surface_release_source_image (cairo_surface_t *surface,
cairo_image_surface_t *image,
void *image_extra)
{
- surface->backend->release_source_image (surface, image, image_extra);
+ assert (!surface->finished);
+
+ if (surface->backend->release_source_image)
+ surface->backend->release_source_image (surface, image, image_extra);
}
/**
@@ -226,6 +343,8 @@ _cairo_surface_acquire_dest_image (cairo_surface_t *surface,
cairo_rectangle_t *image_rect,
void **image_extra)
{
+ assert (!surface->finished);
+
return surface->backend->acquire_dest_image (surface, interest_rect,
image_out, image_rect, image_extra);
}
@@ -249,8 +368,11 @@ _cairo_surface_release_dest_image (cairo_surface_t *surface,
cairo_rectangle_t *image_rect,
void *image_extra)
{
- surface->backend->release_dest_image (surface, interest_rect,
- image, image_rect, image_extra);
+ assert (!surface->finished);
+
+ if (surface->backend->release_dest_image)
+ surface->backend->release_dest_image (surface, interest_rect,
+ image, image_rect, image_extra);
}
/**
@@ -278,9 +400,14 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
cairo_image_surface_t *image;
void *image_extra;
- status = surface->backend->clone_similar (surface, src, clone_out);
- if (status != CAIRO_INT_STATUS_UNSUPPORTED)
- return status;
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ if (surface->backend->clone_similar) {
+ status = surface->backend->clone_similar (surface, src, clone_out);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+ }
status = _cairo_surface_acquire_source_image (src, &image, &image_extra);
if (status != CAIRO_STATUS_SUCCESS)
@@ -298,69 +425,6 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
return status;
}
-cairo_status_t
-cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix)
-{
- if (surface == NULL)
- return CAIRO_STATUS_NULL_POINTER;
-
- return cairo_matrix_copy (&surface->matrix, matrix);
-}
-slim_hidden_def(cairo_surface_set_matrix);
-
-cairo_status_t
-cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix)
-{
- if (surface == NULL)
- return CAIRO_STATUS_NULL_POINTER;
-
- return cairo_matrix_copy (matrix, &surface->matrix);
-}
-slim_hidden_def(cairo_surface_get_matrix);
-
-cairo_status_t
-cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter)
-{
- if (surface == NULL)
- return CAIRO_STATUS_NULL_POINTER;
-
- surface->filter = filter;
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_filter_t
-cairo_surface_get_filter (cairo_surface_t *surface)
-{
- return surface->filter;
-}
-
-/* XXX: NYI
-cairo_status_t
-cairo_surface_clip_rectangle (cairo_surface_t *surface,
- int x, int y,
- int width, int height)
-{
-
-}
-*/
-
-/* XXX: NYI
-cairo_status_t
-cairo_surface_clip_restore (cairo_surface_t *surface);
-*/
-
-cairo_status_t
-cairo_surface_set_repeat (cairo_surface_t *surface, int repeat)
-{
- if (surface == NULL)
- return CAIRO_STATUS_NULL_POINTER;
-
- surface->repeat = repeat;
-
- return CAIRO_STATUS_SUCCESS;
-}
-slim_hidden_def(cairo_surface_set_repeat);
-
typedef struct {
cairo_surface_t *dst;
cairo_rectangle_t extents;
@@ -413,7 +477,7 @@ _fallback_composite (cairo_operator_t operator,
cairo_status_t status;
status = _fallback_init (&state, dst, dst_x, dst_y, width, height);
- if (!CAIRO_OK (status) || !state.image)
+ if (status || !state.image)
return status;
state.image->base.backend->composite (operator, src, mask,
@@ -444,14 +508,19 @@ _cairo_surface_composite (cairo_operator_t operator,
{
cairo_int_status_t status;
- status = dst->backend->composite (operator,
- src, mask, dst,
- src_x, src_y,
- mask_x, mask_y,
- dst_x, dst_y,
- width, height);
- if (status != CAIRO_INT_STATUS_UNSUPPORTED)
- return status;
+ if (dst->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ if (dst->backend->composite) {
+ status = dst->backend->composite (operator,
+ src, mask, dst,
+ src_x, src_y,
+ mask_x, mask_y,
+ dst_x, dst_y,
+ width, height);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+ }
return _fallback_composite (operator,
src, mask, dst,
@@ -462,16 +531,19 @@ _cairo_surface_composite (cairo_operator_t operator,
}
cairo_status_t
-_cairo_surface_fill_rectangle (cairo_surface_t *surface,
- cairo_operator_t operator,
- cairo_color_t *color,
- int x,
- int y,
- int width,
- int height)
+_cairo_surface_fill_rectangle (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ const cairo_color_t *color,
+ int x,
+ int y,
+ int width,
+ int height)
{
cairo_rectangle_t rect;
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
rect.x = x;
rect.y = y;
rect.width = width;
@@ -505,19 +577,19 @@ _fallback_fill_rectangles (cairo_surface_t *surface,
y2 = rects[0].y + rects[0].height;
for (i = 1; i < num_rects; i++) {
- if (rects[0].x < x1)
- x1 = rects[0].x;
- if (rects[0].y < y1)
- y1 = rects[0].y;
-
- if (rects[0].x + rects[0].width > x2)
- x2 = rects[0].x + rects[0].width;
- if (rects[0].y + rects[0].height > y2)
- y2 = rects[0].y + rects[0].height;
+ if (rects[i].x < x1)
+ x1 = rects[i].x;
+ if (rects[i].y < y1)
+ y1 = rects[i].y;
+
+ if (rects[i].x + rects[i].width > x2)
+ x2 = rects[i].x + rects[i].width;
+ if (rects[i].y + rects[i].height > y2)
+ y2 = rects[i].y + rects[i].height;
}
status = _fallback_init (&state, surface, x1, y1, x2 - x1, y2 - y1);
- if (!CAIRO_OK (status) || !state.image)
+ if (status || !state.image)
return status;
/* If the fetched image isn't at 0,0, we need to offset the rectangles */
@@ -560,19 +632,40 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface,
{
cairo_int_status_t status;
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
if (num_rects == 0)
return CAIRO_STATUS_SUCCESS;
- status = surface->backend->fill_rectangles (surface,
- operator,
- color,
- rects, num_rects);
- if (status != CAIRO_INT_STATUS_UNSUPPORTED)
- return status;
+ if (surface->backend->fill_rectangles) {
+ status = surface->backend->fill_rectangles (surface,
+ operator,
+ color,
+ rects, num_rects);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+ }
return _fallback_fill_rectangles (surface, operator, color, rects, num_rects);
}
+cairo_private cairo_int_status_t
+_cairo_surface_fill_path (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *dst,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance)
+{
+ if (dst->backend->fill_path)
+ return dst->backend->fill_path (operator, pattern, dst, path,
+ fill_rule, tolerance);
+ else
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+}
+
+
static cairo_status_t
_fallback_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
@@ -592,7 +685,7 @@ _fallback_composite_trapezoids (cairo_operator_t operator,
int i;
status = _fallback_init (&state, dst, dst_x, dst_y, width, height);
- if (!CAIRO_OK (status) || !state.image)
+ if (status || !state.image)
return status;
/* If the destination image isn't at 0,0, we need to offset the trapezoids */
@@ -655,14 +748,19 @@ _cairo_surface_composite_trapezoids (cairo_operator_t operator,
{
cairo_int_status_t status;
- status = dst->backend->composite_trapezoids (operator,
- pattern, dst,
- src_x, src_y,
- dst_x, dst_y,
- width, height,
- traps, num_traps);
- if (status != CAIRO_INT_STATUS_UNSUPPORTED)
- return status;
+ if (dst->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ if (dst->backend->composite_trapezoids) {
+ status = dst->backend->composite_trapezoids (operator,
+ pattern, dst,
+ src_x, src_y,
+ dst_x, dst_y,
+ width, height,
+ traps, num_traps);
+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+ return status;
+ }
return _fallback_composite_trapezoids (operator, pattern, dst,
src_x, src_y,
@@ -674,35 +772,234 @@ _cairo_surface_composite_trapezoids (cairo_operator_t operator,
cairo_status_t
_cairo_surface_copy_page (cairo_surface_t *surface)
{
- cairo_int_status_t status;
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
- status = surface->backend->copy_page (surface);
/* It's fine if some backends just don't support this. */
- if (status == CAIRO_INT_STATUS_UNSUPPORTED)
+ if (surface->backend->copy_page == NULL)
return CAIRO_STATUS_SUCCESS;
- if (status)
- return status;
- return CAIRO_STATUS_SUCCESS;
+ return surface->backend->copy_page (surface);
}
cairo_status_t
_cairo_surface_show_page (cairo_surface_t *surface)
{
- cairo_int_status_t status;
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
- status = surface->backend->show_page (surface);
/* It's fine if some backends just don't support this. */
- if (status == CAIRO_INT_STATUS_UNSUPPORTED)
+ if (surface->backend->show_page == NULL)
return CAIRO_STATUS_SUCCESS;
+
+ return surface->backend->show_page (surface);
+}
+
+/**
+ * _cairo_surface_get_current_clip_serial:
+ * @surface: the #cairo_surface_t to return the serial number for
+ *
+ * Returns the serial number associated with the current
+ * clip in the surface. All gstate functions must
+ * verify that the correct clip is set in the surface before
+ * invoking any surface drawing function
+ */
+cairo_private unsigned int
+_cairo_surface_get_current_clip_serial (cairo_surface_t *surface)
+{
+ return surface->current_clip_serial;
+}
+
+/**
+ * _cairo_surface_allocate_clip_serial:
+ * @surface: the #cairo_surface_t to allocate a serial number from
+ *
+ * Each surface has a separate set of clipping serial numbers,
+ * and this function allocates one from the specified surface.
+ * As zero is reserved for the special no-clipping case,
+ * this function will not return that.
+ */
+cairo_private unsigned int
+_cairo_surface_allocate_clip_serial (cairo_surface_t *surface)
+{
+ unsigned int serial;
+
+ if ((serial = ++(surface->next_clip_serial)) == 0)
+ serial = ++(surface->next_clip_serial);
+ return serial;
+}
+
+/**
+ * _cairo_surface_reset_clip:
+ * @surface: the #cairo_surface_t to reset the clip on
+ *
+ * This function sets the clipping for the surface to
+ * None, which is to say that drawing is entirely
+ * unclipped. It also sets the clip serial number
+ * to zero.
+ */
+cairo_private cairo_status_t
+_cairo_surface_reset_clip (cairo_surface_t *surface)
+{
+ cairo_status_t status;
+
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ surface->current_clip_serial = 0;
+
+ if (surface->backend->intersect_clip_path) {
+ status = surface->backend->intersect_clip_path (surface,
+ NULL,
+ CAIRO_FILL_RULE_WINDING,
+ 0);
+ if (status)
+ return status;
+ }
+
+ if (surface->backend->set_clip_region != NULL) {
+ status = surface->backend->set_clip_region (surface, NULL);
+ if (status)
+ return status;
+ }
+ return CAIRO_STATUS_SUCCESS;
+}
+
+/**
+ * _cairo_surface_set_clip_region:
+ * @surface: the #cairo_surface_t to reset the clip on
+ * @region: the #pixman_region16_t to use for clipping
+ * @serial: the clip serial number associated with the region
+ *
+ * This function sets the clipping for the surface to
+ * the specified region and sets the surface clipping
+ * serial number to the associated serial number.
+ */
+cairo_private cairo_status_t
+_cairo_surface_set_clip_region (cairo_surface_t *surface,
+ pixman_region16_t *region,
+ unsigned int serial)
+{
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ assert (surface->backend->set_clip_region != NULL);
+
+ surface->current_clip_serial = serial;
+ return surface->backend->set_clip_region (surface, region);
+}
+
+static cairo_status_t
+_cairo_surface_set_clip_path_recursive (cairo_surface_t *surface,
+ cairo_clip_path_t *clip_path)
+{
+ cairo_status_t status;
+
+ if (clip_path == NULL)
+ return CAIRO_STATUS_SUCCESS;
+
+ status = _cairo_surface_set_clip_path_recursive (surface, clip_path->prev);
+ if (status)
+ return status;
+
+ return surface->backend->intersect_clip_path (surface,
+ &clip_path->path,
+ clip_path->fill_rule,
+ clip_path->tolerance);
+}
+
+
+/**
+ * _cairo_surface_set_clip_path:
+ * @surface: the #cairo_surface_t to reset the clip on
+ * @path: the path to intersect against the current clipping path
+ * @fill_rule: fill rule to use for clipping
+ * @tolerance: tesselation to use for tesselating clipping path
+ * @serial: the clip serial number associated with the region
+ *
+ * Sets the clipping path to be the intersection of the current
+ * clipping path of the surface and the given path.
+ **/
+cairo_private cairo_status_t
+_cairo_surface_set_clip_path (cairo_surface_t *surface,
+ cairo_clip_path_t *clip_path,
+ unsigned int serial)
+{
+ cairo_status_t status;
+
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ assert (surface->backend->intersect_clip_path != NULL);
+
+ status = surface->backend->intersect_clip_path (surface,
+ NULL,
+ CAIRO_FILL_RULE_WINDING,
+ 0);
+ if (status)
+ return status;
+
+ status = _cairo_surface_set_clip_path_recursive (surface, clip_path);
if (status)
return status;
+ surface->current_clip_serial = serial;
+
return CAIRO_STATUS_SUCCESS;
}
+/**
+ * _cairo_surface_get_extents:
+ * @surface: the #cairo_surface_t to fetch extents for
+ *
+ * This function returns a bounding box for the surface. The
+ * surface bounds are defined as a region beyond which no
+ * rendering will possibly be recorded, in otherwords,
+ * it is the maximum extent of potentially usable
+ * coordinates. For simple pixel-based surfaces,
+ * it can be a close bound on the retained pixel
+ * region. For virtual surfaces (PDF et al), it
+ * cannot and must extend to the reaches of the
+ * target system coordinate space.
+ */
+
+cairo_status_t
+_cairo_surface_get_extents (cairo_surface_t *surface,
+ cairo_rectangle_t *rectangle)
+{
+ if (surface->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ return surface->backend->get_extents (surface, rectangle);
+}
+
cairo_status_t
-_cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region)
+_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *dst,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs)
{
- return surface->backend->set_clip_region (surface, region);
+ cairo_status_t status;
+
+ if (dst->finished)
+ return CAIRO_STATUS_SURFACE_FINISHED;
+
+ if (dst->backend->show_glyphs)
+ status = dst->backend->show_glyphs (scaled_font, operator, pattern, dst,
+ source_x, source_y,
+ dest_x, dest_y,
+ width, height,
+ glyphs, num_glyphs);
+ else
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+
+ return status;
}
diff --git a/src/cairo_traps.c b/src/cairo-traps.c
index 79c7e16..a97d584 100644
--- a/src/cairo_traps.c
+++ b/src/cairo-traps.c
@@ -88,6 +88,43 @@ _cairo_traps_fini (cairo_traps_t *traps)
}
}
+/**
+ * _cairo_traps_init_box:
+ * @traps: a #cairo_traps_t
+ * @box: a box that will be converted to a single trapezoid
+ * to store in @traps.
+ *
+ * Initializes a cairo_traps_t to contain a single rectangular
+ * trapezoid.
+ **/
+cairo_status_t
+_cairo_traps_init_box (cairo_traps_t *traps,
+ cairo_box_t *box)
+{
+ cairo_status_t status;
+
+ _cairo_traps_init (traps);
+
+ status = _cairo_traps_grow_by (traps, 1);
+ if (status)
+ return status;
+
+ traps->num_traps = 1;
+
+ traps->traps[0].top = box->p1.y;
+ traps->traps[0].bottom = box->p2.y;
+ traps->traps[0].left.p1 = box->p1;
+ traps->traps[0].left.p2.x = box->p1.x;
+ traps->traps[0].left.p2.y = box->p2.y;
+ traps->traps[0].right.p1.x = box->p2.x;
+ traps->traps[0].right.p1.y = box->p1.y;
+ traps->traps[0].right.p2 = box->p2;
+
+ traps->extents = *box;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static cairo_status_t
_cairo_traps_add_trap (cairo_traps_t *traps, cairo_fixed_t top, cairo_fixed_t bottom,
cairo_line_t *left, cairo_line_t *right)
@@ -738,3 +775,65 @@ _cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents)
{
*extents = traps->extents;
}
+
+/**
+ * _cairo_traps_extract_region:
+ * @traps: a #cairo_traps_t
+ * @region: on return, %NULL is stored here if the trapezoids aren't
+ * exactly representable as a pixman region, otherwise a
+ * a pointer to such a region, newly allocated.
+ * (free with pixman region destroy)
+ *
+ * Determines if a set of trapezoids are exactly representable as a
+ * pixman region, and if so creates such a region.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY
+ **/
+cairo_status_t
+_cairo_traps_extract_region (cairo_traps_t *traps,
+ pixman_region16_t **region)
+{
+ int i;
+
+ for (i = 0; i < traps->num_traps; i++)
+ if (!(traps->traps[i].left.p1.x == traps->traps[i].left.p2.x
+ && traps->traps[i].right.p1.x == traps->traps[i].right.p2.x
+ && traps->traps[i].left.p1.y == traps->traps[i].right.p1.y
+ && traps->traps[i].left.p2.y == traps->traps[i].right.p2.y
+ && _cairo_fixed_is_integer(traps->traps[i].left.p1.x)
+ && _cairo_fixed_is_integer(traps->traps[i].left.p1.y)
+ && _cairo_fixed_is_integer(traps->traps[i].left.p2.x)
+ && _cairo_fixed_is_integer(traps->traps[i].left.p2.y)
+ && _cairo_fixed_is_integer(traps->traps[i].right.p1.x)
+ && _cairo_fixed_is_integer(traps->traps[i].right.p1.y)
+ && _cairo_fixed_is_integer(traps->traps[i].right.p2.x)
+ && _cairo_fixed_is_integer(traps->traps[i].right.p2.y))) {
+ *region = NULL;
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ *region = pixman_region_create ();
+
+ for (i = 0; i < traps->num_traps; i++) {
+ int x = _cairo_fixed_integer_part(traps->traps[i].left.p1.x);
+ int y = _cairo_fixed_integer_part(traps->traps[i].left.p1.y);
+ int width = _cairo_fixed_integer_part(traps->traps[i].right.p1.x) - x;
+ int height = _cairo_fixed_integer_part(traps->traps[i].left.p2.y) - y;
+
+ /* XXX: Sometimes we get degenerate trapezoids from the tesellator,
+ * if we call pixman_region_union_rect(), it bizarrly fails on such
+ * an empty rectangle, so skip them.
+ */
+ if (width == 0 || height == 0)
+ continue;
+
+ if (pixman_region_union_rect (*region, *region,
+ x, y, width, height) != PIXMAN_REGION_STATUS_SUCCESS) {
+ pixman_region_destroy (*region);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+ }
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
diff --git a/src/cairo_unicode.c b/src/cairo-unicode.c
index 9220139..8929baa 100644
--- a/src/cairo_unicode.c
+++ b/src/cairo-unicode.c
@@ -117,14 +117,14 @@ static const char utf8_skip_data[256] = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
};
-#define UTF8_NEXT_CHAR(p) (char *)((p) + utf8_skip_data[*(unsigned char *)(p)])
+#define UTF8_NEXT_CHAR(p) ((p) + utf8_skip_data[*(unsigned char *)(p)])
/* Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
* If @p does not point to a valid UTF-8 encoded character, results are
* undefined.
**/
static uint32_t
-_utf8_get_char (const char *p)
+_utf8_get_char (const unsigned char *p)
{
int i, mask = 0, len;
uint32_t result;
@@ -142,8 +142,8 @@ _utf8_get_char (const char *p)
* and return (uint32_t)-2 on incomplete trailing character
*/
static uint32_t
-_utf8_get_char_extended (const char *p,
- long max_len)
+_utf8_get_char_extended (const unsigned char *p,
+ long max_len)
{
int i, len;
uint32_t wc = (unsigned char) *p;
@@ -220,14 +220,14 @@ _utf8_get_char_extended (const char *p,
* an invalid sequence was found.
**/
cairo_status_t
-_cairo_utf8_to_ucs4 (const char *str,
- int len,
- uint32_t **result,
- int *items_written)
+_cairo_utf8_to_ucs4 (const unsigned char *str,
+ int len,
+ uint32_t **result,
+ int *items_written)
{
uint32_t *str32 = NULL;
int n_chars, i;
- const char *in;
+ const unsigned char *in;
in = str;
n_chars = 0;
@@ -284,14 +284,14 @@ _cairo_utf8_to_ucs4 (const char *str,
* an invalid sequence was found.
**/
cairo_status_t
-_cairo_utf8_to_utf16 (const char *str,
- int len,
- uint16_t **result,
- int *items_written)
+_cairo_utf8_to_utf16 (const unsigned char *str,
+ int len,
+ uint16_t **result,
+ int *items_written)
{
uint16_t *str16 = NULL;
int n16, i;
- const char *in;
+ const unsigned char *in;
in = str;
n16 = 0;
diff --git a/src/cairo_wideint.c b/src/cairo-wideint.c
index fc61435..ee5141b 100644
--- a/src/cairo_wideint.c
+++ b/src/cairo-wideint.c
@@ -1,5 +1,5 @@
/*
- * $Id: cairo_wideint.c,v 1.4 2005/01/19 15:07:00 cworth Exp $
+ * $Id: cairo-wideint.c,v 1.5 2005/06/03 21:51:57 cworth Exp $
*
* Copyright © 2004 Keith Packard
*
@@ -421,7 +421,9 @@ _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den)
num = _cairo_uint64_sub (num, den);
}
else
+ {
q0 = 0;
+ }
q1 = 0;
r0 = num.lo;
@@ -937,7 +939,9 @@ _cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den)
num = _cairo_uint128_sub (num, den);
}
else
+ {
q0 = _cairo_uint32_to_uint64 (0);
+ }
q1 = _cairo_uint32_to_uint64 (0);
r0 = num.lo;
diff --git a/src/cairo-wideint.h b/src/cairo-wideint.h
index dfdb6d9..08136df 100644
--- a/src/cairo-wideint.h
+++ b/src/cairo-wideint.h
@@ -1,5 +1,5 @@
/*
- * $Id: cairo-wideint.h,v 1.6 2005/01/19 15:11:14 cworth Exp $
+ * $Id: cairo-wideint.h,v 1.10 2005/05/10 19:42:32 cworth Exp $
*
* Copyright © 2004 Keith Packard
*
@@ -38,7 +38,15 @@
#ifndef CAIRO_WIDEINT_H
#define CAIRO_WIDEINT_H
-#include <stdint.h>
+#if HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INT_TYPES_H
+# include <sys/int_types.h>
+#else
+#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
+#endif
/*
* 64-bit datatypes. Two separate implementations, one using
diff --git a/src/cairo_win32_font.c b/src/cairo-win32-font.c
index 02f0cff..eef2b4e 100644
--- a/src/cairo_win32_font.c
+++ b/src/cairo-win32-font.c
@@ -34,7 +34,7 @@
#include <string.h>
#include <stdio.h>
-
+#include "cairoint.h"
#include "cairo-win32-private.h"
#ifndef SPI_GETFONTSMOOTHINGTYPE
@@ -47,12 +47,12 @@
#define CLEARTYPE_QUALITY 5
#endif
-const cairo_font_backend_t cairo_win32_font_backend;
+const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend;
#define LOGICAL_SCALE 32
typedef struct {
- cairo_font_t base;
+ cairo_scaled_font_t base;
LOGFONTW logfont;
@@ -93,73 +93,73 @@ typedef struct {
*/
int em_square;
- HFONT scaled_font;
- HFONT unscaled_font;
+ HFONT scaled_hfont;
+ HFONT unscaled_hfont;
-} cairo_win32_font_t;
+} cairo_win32_scaled_font_t;
#define NEARLY_ZERO(d) (fabs(d) < (1. / 65536.))
static void
-_compute_transform (cairo_win32_font_t *font,
- cairo_font_scale_t *sc)
+_compute_transform (cairo_win32_scaled_font_t *scaled_font,
+ cairo_matrix_t *sc)
{
- if (NEARLY_ZERO (sc->matrix[0][1]) && NEARLY_ZERO (sc->matrix[1][0])) {
- font->preserve_axes = TRUE;
- font->x_scale = sc->matrix[0][0];
- font->swap_x = (sc->matrix[0][0] < 0);
- font->y_scale = sc->matrix[1][1];
- font->swap_y = (sc->matrix[1][1] < 0);
- font->swap_axes = FALSE;
+ cairo_status_t status;
+
+ if (NEARLY_ZERO (sc->yx) && NEARLY_ZERO (sc->xy)) {
+ scaled_font->preserve_axes = TRUE;
+ scaled_font->x_scale = sc->xx;
+ scaled_font->swap_x = (sc->xx < 0);
+ scaled_font->y_scale = sc->yy;
+ scaled_font->swap_y = (sc->yy < 0);
+ scaled_font->swap_axes = FALSE;
- } else if (NEARLY_ZERO (sc->matrix[0][0]) && NEARLY_ZERO (sc->matrix[1][1])) {
- font->preserve_axes = TRUE;
- font->x_scale = sc->matrix[0][1];
- font->swap_x = (sc->matrix[0][1] < 0);
- font->y_scale = sc->matrix[1][0];
- font->swap_y = (sc->matrix[1][0] < 0);
- font->swap_axes = TRUE;
+ } else if (NEARLY_ZERO (sc->xx) && NEARLY_ZERO (sc->yy)) {
+ scaled_font->preserve_axes = TRUE;
+ scaled_font->x_scale = sc->yx;
+ scaled_font->swap_x = (sc->yx < 0);
+ scaled_font->y_scale = sc->xy;
+ scaled_font->swap_y = (sc->xy < 0);
+ scaled_font->swap_axes = TRUE;
} else {
- font->preserve_axes = FALSE;
- font->swap_x = font->swap_y = font->swap_axes = FALSE;
+ scaled_font->preserve_axes = FALSE;
+ scaled_font->swap_x = scaled_font->swap_y = scaled_font->swap_axes = FALSE;
}
- if (font->preserve_axes) {
- if (font->swap_x)
- font->x_scale = - font->x_scale;
- if (font->swap_y)
- font->y_scale = - font->y_scale;
+ if (scaled_font->preserve_axes) {
+ if (scaled_font->swap_x)
+ scaled_font->x_scale = - scaled_font->x_scale;
+ if (scaled_font->swap_y)
+ scaled_font->y_scale = - scaled_font->y_scale;
- font->logical_scale = LOGICAL_SCALE * font->y_scale;
- font->logical_size = LOGICAL_SCALE * floor (font->y_scale + 0.5);
+ scaled_font->logical_scale = LOGICAL_SCALE * scaled_font->y_scale;
+ scaled_font->logical_size = LOGICAL_SCALE * floor (scaled_font->y_scale + 0.5);
}
/* The font matrix has x and y "scale" components which we extract and
* use as character scale values.
*/
- cairo_matrix_set_affine (&font->logical_to_device,
- sc->matrix[0][0],
- sc->matrix[0][1],
- sc->matrix[1][0],
- sc->matrix[1][1],
- 0, 0);
-
- if (!font->preserve_axes) {
- _cairo_matrix_compute_scale_factors (&font->logical_to_device,
- &font->x_scale, &font->y_scale,
+ cairo_matrix_init (&scaled_font->logical_to_device,
+ sc->xx, sc->yx, sc->xy, sc->yy, 0, 0);
+
+ if (!scaled_font->preserve_axes) {
+ _cairo_matrix_compute_scale_factors (&scaled_font->logical_to_device,
+ &scaled_font->x_scale, &scaled_font->y_scale,
TRUE); /* XXX: Handle vertical text */
- font->logical_size = floor (LOGICAL_SCALE * font->y_scale + 0.5);
- font->logical_scale = LOGICAL_SCALE * font->y_scale;
+ scaled_font->logical_size = floor (LOGICAL_SCALE * scaled_font->y_scale + 0.5);
+ scaled_font->logical_scale = LOGICAL_SCALE * scaled_font->y_scale;
}
- cairo_matrix_scale (&font->logical_to_device,
- 1.0 / font->logical_scale, 1.0 / font->logical_scale);
+ cairo_matrix_scale (&scaled_font->logical_to_device,
+ 1.0 / scaled_font->logical_scale, 1.0 / scaled_font->logical_scale);
- font->device_to_logical = font->logical_to_device;
- if (!CAIRO_OK (cairo_matrix_invert (&font->device_to_logical)))
- cairo_matrix_set_identity (&font->device_to_logical);
+ scaled_font->device_to_logical = scaled_font->logical_to_device;
+
+ status = cairo_matrix_invert (&scaled_font->device_to_logical);
+ if (status)
+ cairo_matrix_init_identity (&scaled_font->device_to_logical);
}
static BYTE
@@ -198,57 +198,61 @@ _get_system_quality (void)
}
return ANTIALIASED_QUALITY;
- } else
+ } else {
return DEFAULT_QUALITY;
+ }
}
-static cairo_font_t *
-_win32_font_create (LOGFONTW *logfont,
- cairo_font_scale_t *scale)
+static cairo_scaled_font_t *
+_win32_scaled_font_create (LOGFONTW *logfont,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm)
{
- cairo_win32_font_t *f;
+ cairo_win32_scaled_font_t *f;
+ cairo_matrix_t scale;
- f = malloc (sizeof(cairo_win32_font_t));
+ f = malloc (sizeof(cairo_win32_scaled_font_t));
if (f == NULL)
return NULL;
f->logfont = *logfont;
f->quality = _get_system_quality ();
f->em_square = 0;
- f->scaled_font = NULL;
- f->unscaled_font = NULL;
+ f->scaled_hfont = NULL;
+ f->unscaled_hfont = NULL;
- _compute_transform (f, scale);
-
- _cairo_font_init ((cairo_font_t *)f, scale, &cairo_win32_font_backend);
+ cairo_matrix_multiply (&scale, font_matrix, ctm);
+ _compute_transform (f, &scale);
+
+ _cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_win32_scaled_font_backend);
- return (cairo_font_t *)f;
+ return &f->base;
}
static cairo_status_t
-_win32_font_set_world_transform (cairo_win32_font_t *font,
- HDC hdc)
+_win32_scaled_font_set_world_transform (cairo_win32_scaled_font_t *scaled_font,
+ HDC hdc)
{
XFORM xform;
- xform.eM11 = font->logical_to_device.m[0][0];
- xform.eM21 = font->logical_to_device.m[1][0];
- xform.eM12 = font->logical_to_device.m[0][1];
- xform.eM22 = font->logical_to_device.m[1][1];
- xform.eDx = font->logical_to_device.m[2][0];
- xform.eDy = font->logical_to_device.m[2][1];
+ xform.eM11 = scaled_font->logical_to_device.xx;
+ xform.eM21 = scaled_font->logical_to_device.xy;
+ xform.eM12 = scaled_font->logical_to_device.yx;
+ xform.eM22 = scaled_font->logical_to_device.yy;
+ xform.eDx = scaled_font->logical_to_device.x0;
+ xform.eDy = scaled_font->logical_to_device.y0;
if (!SetWorldTransform (hdc, &xform))
- return _cairo_win32_print_gdi_error ("_win32_font_set_world_transform");
+ return _cairo_win32_print_gdi_error ("_win32_scaled_font_set_world_transform");
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
-_win32_font_set_identity_transform (HDC hdc)
+_win32_scaled_font_set_identity_transform (HDC hdc)
{
if (!ModifyWorldTransform (hdc, NULL, MWT_IDENTITY))
- return _cairo_win32_print_gdi_error ("_win32_font_set_identity_transform");
+ return _cairo_win32_print_gdi_error ("_win32_scaled_font_set_identity_transform");
return CAIRO_STATUS_SUCCESS;
}
@@ -276,48 +280,48 @@ _get_global_font_dc (void)
}
static HFONT
-_win32_font_get_scaled_font (cairo_win32_font_t *font)
+_win32_scaled_font_get_scaled_hfont (cairo_win32_scaled_font_t *scaled_font)
{
- if (!font->scaled_font) {
- LOGFONTW logfont = font->logfont;
- logfont.lfHeight = font->logical_size;
+ if (!scaled_font->scaled_hfont) {
+ LOGFONTW logfont = scaled_font->logfont;
+ logfont.lfHeight = scaled_font->logical_size;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
- logfont.lfQuality = font->quality;
+ logfont.lfQuality = scaled_font->quality;
- font->scaled_font = CreateFontIndirectW (&logfont);
- if (!font->scaled_font) {
- _cairo_win32_print_gdi_error ("_win32_font_get_scaled_font");
+ scaled_font->scaled_hfont = CreateFontIndirectW (&logfont);
+ if (!scaled_font->scaled_hfont) {
+ _cairo_win32_print_gdi_error ("_win32_scaled_font_get_scaled_hfont");
return NULL;
}
}
- return font->scaled_font;
+ return scaled_font->scaled_hfont;
}
static HFONT
-_win32_font_get_unscaled_font (cairo_win32_font_t *font,
- HDC hdc)
+_win32_scaled_font_get_unscaled_hfont (cairo_win32_scaled_font_t *scaled_font,
+ HDC hdc)
{
- if (!font->unscaled_font) {
+ if (!scaled_font->unscaled_hfont) {
OUTLINETEXTMETRIC *otm;
unsigned int otm_size;
- HFONT scaled_font;
+ HFONT scaled_hfont;
LOGFONTW logfont;
- scaled_font = _win32_font_get_scaled_font (font);
- if (!scaled_font)
+ scaled_hfont = _win32_scaled_font_get_scaled_hfont (scaled_font);
+ if (!scaled_hfont)
return NULL;
- if (!SelectObject (hdc, scaled_font)) {
- _cairo_win32_print_gdi_error ("_win32_font_get_unscaled_font:SelectObject");
+ if (!SelectObject (hdc, scaled_hfont)) {
+ _cairo_win32_print_gdi_error ("_win32_scaled_font_get_unscaled_hfont:SelectObject");
return NULL;
}
otm_size = GetOutlineTextMetrics (hdc, 0, NULL);
if (!otm_size) {
- _cairo_win32_print_gdi_error ("_win32_font_get_unscaled_font:GetOutlineTextMetrics");
+ _cairo_win32_print_gdi_error ("_win32_scaled_font_get_unscaled_hfont:GetOutlineTextMetrics");
return NULL;
}
@@ -326,49 +330,49 @@ _win32_font_get_unscaled_font (cairo_win32_font_t *font,
return NULL;
if (!GetOutlineTextMetrics (hdc, otm_size, otm)) {
- _cairo_win32_print_gdi_error ("_win32_font_get_unscaled_font:GetOutlineTextMetrics");
+ _cairo_win32_print_gdi_error ("_win32_scaled_font_get_unscaled_hfont:GetOutlineTextMetrics");
free (otm);
return NULL;
}
- font->em_square = otm->otmEMSquare;
+ scaled_font->em_square = otm->otmEMSquare;
free (otm);
- logfont = font->logfont;
- logfont.lfHeight = font->em_square;
+ logfont = scaled_font->logfont;
+ logfont.lfHeight = scaled_font->em_square;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
- logfont.lfQuality = font->quality;
+ logfont.lfQuality = scaled_font->quality;
- font->unscaled_font = CreateFontIndirectW (&logfont);
- if (!font->unscaled_font) {
- _cairo_win32_print_gdi_error ("_win32_font_get_unscaled_font:CreateIndirect");
+ scaled_font->unscaled_hfont = CreateFontIndirectW (&logfont);
+ if (!scaled_font->unscaled_hfont) {
+ _cairo_win32_print_gdi_error ("_win32_scaled_font_get_unscaled_hfont:CreateIndirect");
return NULL;
}
}
- return font->unscaled_font;
+ return scaled_font->unscaled_hfont;
}
static cairo_status_t
-_cairo_win32_font_select_unscaled_font (cairo_font_t *font,
- HDC hdc)
+_cairo_win32_scaled_font_select_unscaled_font (cairo_scaled_font_t *scaled_font,
+ HDC hdc)
{
cairo_status_t status;
HFONT hfont;
HFONT old_hfont = NULL;
- hfont = _win32_font_get_unscaled_font ((cairo_win32_font_t *)font, hdc);
+ hfont = _win32_scaled_font_get_unscaled_hfont ((cairo_win32_scaled_font_t *)scaled_font, hdc);
if (!hfont)
return CAIRO_STATUS_NO_MEMORY;
old_hfont = SelectObject (hdc, hfont);
if (!old_hfont)
- return _cairo_win32_print_gdi_error ("_cairo_win32_font_select_unscaled_font");
+ return _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_select_unscaled_font");
- status = _win32_font_set_identity_transform (hdc);
- if (!CAIRO_OK (status)) {
+ status = _win32_scaled_font_set_identity_transform (hdc);
+ if (status) {
SelectObject (hdc, old_hfont);
return status;
}
@@ -379,27 +383,28 @@ _cairo_win32_font_select_unscaled_font (cairo_font_t *font,
}
static void
-_cairo_win32_font_done_unscaled_font (cairo_font_t *font)
+_cairo_win32_scaled_font_done_unscaled_font (cairo_scaled_font_t *scaled_font)
{
}
/* implement the font backend interface */
static cairo_status_t
-_cairo_win32_font_create (const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight,
- cairo_font_scale_t *scale,
- cairo_font_t **font_out)
+_cairo_win32_scaled_font_create (const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **scaled_font_out)
{
LOGFONTW logfont;
- cairo_font_t *font;
+ cairo_scaled_font_t *scaled_font;
uint16_t *face_name;
int face_name_len;
cairo_status_t status;
status = _cairo_utf8_to_utf16 (family, -1, &face_name, &face_name_len);
- if (!CAIRO_OK (status))
+ if (status)
return status;
if (face_name_len > LF_FACESIZE - 1) {
@@ -451,47 +456,43 @@ _cairo_win32_font_create (const char *family,
if (!logfont.lfFaceName)
return CAIRO_STATUS_NO_MEMORY;
- font = _win32_font_create (&logfont, scale);
- if (!font)
+ scaled_font = _win32_scaled_font_create (&logfont, font_matrix, ctm);
+ if (!scaled_font)
return CAIRO_STATUS_NO_MEMORY;
- *font_out = font;
+ *scaled_font_out = scaled_font;
return CAIRO_STATUS_SUCCESS;
}
static void
-_cairo_win32_font_destroy_font (void *abstract_font)
+_cairo_win32_scaled_font_destroy (void *abstract_font)
{
- cairo_win32_font_t *font = abstract_font;
+ cairo_win32_scaled_font_t *scaled_font = abstract_font;
- if (font->scaled_font)
- DeleteObject (font->scaled_font);
+ if (scaled_font == NULL)
+ return;
- if (font->unscaled_font)
- DeleteObject (font->unscaled_font);
+ if (scaled_font->scaled_hfont)
+ DeleteObject (scaled_font->scaled_hfont);
- free (font);
-}
-
-static void
-_cairo_win32_font_destroy_unscaled_font (void *abstract_font)
-{
+ if (scaled_font->unscaled_hfont)
+ DeleteObject (scaled_font->unscaled_hfont);
}
static void
-_cairo_win32_font_get_glyph_cache_key (void *abstract_font,
- cairo_glyph_cache_key_t *key)
+_cairo_win32_scaled_font_get_glyph_cache_key (void *abstract_font,
+ cairo_glyph_cache_key_t *key)
{
}
static cairo_status_t
-_cairo_win32_font_text_to_glyphs (void *abstract_font,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs)
+_cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs)
{
- cairo_win32_font_t *font = abstract_font;
+ cairo_win32_scaled_font_t *scaled_font = abstract_font;
uint16_t *utf16;
int n16;
GCP_RESULTSW gcp_results;
@@ -503,7 +504,7 @@ _cairo_win32_font_text_to_glyphs (void *abstract_font,
HDC hdc = NULL;
status = _cairo_utf8_to_utf16 (utf8, -1, &utf16, &n16);
- if (!CAIRO_OK (status))
+ if (status)
return status;
gcp_results.lStructSize = sizeof (GCP_RESULTS);
@@ -524,8 +525,8 @@ _cairo_win32_font_text_to_glyphs (void *abstract_font,
goto FAIL1;
}
- status = cairo_win32_font_select_font (&font->base, hdc);
- if (!CAIRO_OK (status))
+ status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
+ if (status)
goto FAIL1;
while (TRUE) {
@@ -553,7 +554,7 @@ _cairo_win32_font_text_to_glyphs (void *abstract_font,
0,
&gcp_results,
GCP_DIACRITIC | GCP_LIGATE | GCP_GLYPHSHAPE | GCP_REORDER)) {
- status = _cairo_win32_print_gdi_error ("_cairo_win32_font_text_to_glyphs");
+ status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_text_to_glyphs");
goto FAIL2;
}
@@ -582,7 +583,7 @@ _cairo_win32_font_text_to_glyphs (void *abstract_font,
(*glyphs)[i].x = x_pos ;
(*glyphs)[i].y = 0;
- x_pos += dx[i] / font->logical_scale;
+ x_pos += dx[i] / scaled_font->logical_scale;
}
FAIL2:
@@ -591,7 +592,7 @@ _cairo_win32_font_text_to_glyphs (void *abstract_font,
if (dx)
free (dx);
- cairo_win32_font_done_font (&font->base);
+ cairo_win32_scaled_font_done_font (&scaled_font->base);
FAIL1:
free (utf16);
@@ -600,10 +601,10 @@ _cairo_win32_font_text_to_glyphs (void *abstract_font,
}
static cairo_status_t
-_cairo_win32_font_font_extents (void *abstract_font,
- cairo_font_extents_t *extents)
+_cairo_win32_scaled_font_font_extents (void *abstract_font,
+ cairo_font_extents_t *extents)
{
- cairo_win32_font_t *font = abstract_font;
+ cairo_win32_scaled_font_t *scaled_font = abstract_font;
cairo_status_t status;
TEXTMETRIC metrics;
HDC hdc;
@@ -612,21 +613,21 @@ _cairo_win32_font_font_extents (void *abstract_font,
if (!hdc)
return CAIRO_STATUS_NO_MEMORY;
- if (font->preserve_axes) {
+ if (scaled_font->preserve_axes) {
/* For 90-degree rotations (including 0), we get the metrics
* from the GDI in logical space, then convert back to font space
*/
- status = cairo_win32_font_select_font (&font->base, hdc);
- if (!CAIRO_OK (status))
+ status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
+ if (status)
return status;
GetTextMetrics (hdc, &metrics);
- cairo_win32_font_done_font (&font->base);
+ cairo_win32_scaled_font_done_font (&scaled_font->base);
- extents->ascent = metrics.tmAscent / font->logical_scale;
- extents->descent = metrics.tmDescent / font->logical_scale;
+ extents->ascent = metrics.tmAscent / scaled_font->logical_scale;
+ extents->descent = metrics.tmDescent / scaled_font->logical_scale;
- extents->height = (metrics.tmHeight + metrics.tmExternalLeading) / font->logical_scale;
- extents->max_x_advance = metrics.tmMaxCharWidth / font->logical_scale;
+ extents->height = (metrics.tmHeight + metrics.tmExternalLeading) / scaled_font->logical_scale;
+ extents->max_x_advance = metrics.tmMaxCharWidth / scaled_font->logical_scale;
extents->max_y_advance = 0;
} else {
@@ -635,16 +636,16 @@ _cairo_win32_font_font_extents (void *abstract_font,
* transformed font are inexplicably large and we want to
* avoid them.
*/
- status = _cairo_win32_font_select_unscaled_font (&font->base, hdc);
- if (!CAIRO_OK (status))
+ status = _cairo_win32_scaled_font_select_unscaled_font (&scaled_font->base, hdc);
+ if (status)
return status;
GetTextMetrics (hdc, &metrics);
- _cairo_win32_font_done_unscaled_font (&font->base);
+ _cairo_win32_scaled_font_done_unscaled_font (&scaled_font->base);
- extents->ascent = (double)metrics.tmAscent / font->em_square;
- extents->descent = metrics.tmDescent * font->em_square;
- extents->height = (double)(metrics.tmHeight + metrics.tmExternalLeading) / font->em_square;
- extents->max_x_advance = (double)(metrics.tmMaxCharWidth) / font->em_square;
+ extents->ascent = (double)metrics.tmAscent / scaled_font->em_square;
+ extents->descent = metrics.tmDescent * scaled_font->em_square;
+ extents->height = (double)(metrics.tmHeight + metrics.tmExternalLeading) / scaled_font->em_square;
+ extents->max_x_advance = (double)(metrics.tmMaxCharWidth) / scaled_font->em_square;
extents->max_y_advance = 0;
}
@@ -653,12 +654,12 @@ _cairo_win32_font_font_extents (void *abstract_font,
}
static cairo_status_t
-_cairo_win32_font_glyph_extents (void *abstract_font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents)
+_cairo_win32_scaled_font_glyph_extents (void *abstract_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents)
{
- cairo_win32_font_t *font = abstract_font;
+ cairo_win32_scaled_font_t *scaled_font = abstract_font;
static const MAT2 matrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
GLYPHMETRICS metrics;
cairo_status_t status;
@@ -674,39 +675,39 @@ _cairo_win32_font_glyph_extents (void *abstract_font,
*/
assert (num_glyphs == 1);
- if (font->preserve_axes) {
+ if (scaled_font->preserve_axes) {
/* If we aren't rotating / skewing the axes, then we get the metrics
* from the GDI in device space and convert to font space.
*/
- status = cairo_win32_font_select_font (&font->base, hdc);
- if (!CAIRO_OK (status))
+ status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
+ if (status)
return status;
GetGlyphOutlineW (hdc, glyphs[0].index, GGO_METRICS | GGO_GLYPH_INDEX,
&metrics, 0, NULL, &matrix);
- cairo_win32_font_done_font (&font->base);
-
- if (font->swap_axes) {
- extents->x_bearing = - metrics.gmptGlyphOrigin.y / font->y_scale;
- extents->y_bearing = metrics.gmptGlyphOrigin.x / font->x_scale;
- extents->width = metrics.gmBlackBoxY / font->y_scale;
- extents->height = metrics.gmBlackBoxX / font->x_scale;
- extents->x_advance = metrics.gmCellIncY / font->x_scale;
- extents->y_advance = metrics.gmCellIncX / font->y_scale;
+ cairo_win32_scaled_font_done_font (&scaled_font->base);
+
+ if (scaled_font->swap_axes) {
+ extents->x_bearing = - metrics.gmptGlyphOrigin.y / scaled_font->y_scale;
+ extents->y_bearing = metrics.gmptGlyphOrigin.x / scaled_font->x_scale;
+ extents->width = metrics.gmBlackBoxY / scaled_font->y_scale;
+ extents->height = metrics.gmBlackBoxX / scaled_font->x_scale;
+ extents->x_advance = metrics.gmCellIncY / scaled_font->x_scale;
+ extents->y_advance = metrics.gmCellIncX / scaled_font->y_scale;
} else {
- extents->x_bearing = metrics.gmptGlyphOrigin.x / font->x_scale;
- extents->y_bearing = - metrics.gmptGlyphOrigin.y / font->y_scale;
- extents->width = metrics.gmBlackBoxX / font->x_scale;
- extents->height = metrics.gmBlackBoxY / font->y_scale;
- extents->x_advance = metrics.gmCellIncX / font->x_scale;
- extents->y_advance = metrics.gmCellIncY / font->y_scale;
+ extents->x_bearing = metrics.gmptGlyphOrigin.x / scaled_font->x_scale;
+ extents->y_bearing = - metrics.gmptGlyphOrigin.y / scaled_font->y_scale;
+ extents->width = metrics.gmBlackBoxX / scaled_font->x_scale;
+ extents->height = metrics.gmBlackBoxY / scaled_font->y_scale;
+ extents->x_advance = metrics.gmCellIncX / scaled_font->x_scale;
+ extents->y_advance = metrics.gmCellIncY / scaled_font->y_scale;
}
- if (font->swap_x) {
+ if (scaled_font->swap_x) {
extents->x_bearing = (- extents->x_bearing - extents->width);
extents->x_advance = - extents->x_advance;
}
- if (font->swap_y) {
+ if (scaled_font->swap_y) {
extents->y_bearing = (- extents->y_bearing - extents->height);
extents->y_advance = - extents->y_advance;
}
@@ -715,17 +716,17 @@ _cairo_win32_font_glyph_extents (void *abstract_font,
/* For all other transformations, we use the design metrics
* of the font.
*/
- status = _cairo_win32_font_select_unscaled_font (&font->base, hdc);
+ status = _cairo_win32_scaled_font_select_unscaled_font (&scaled_font->base, hdc);
GetGlyphOutlineW (hdc, glyphs[0].index, GGO_METRICS | GGO_GLYPH_INDEX,
&metrics, 0, NULL, &matrix);
- _cairo_win32_font_done_unscaled_font (&font->base);
-
- extents->x_bearing = (double)metrics.gmptGlyphOrigin.x / font->em_square;
- extents->y_bearing = (double)metrics.gmptGlyphOrigin.y / font->em_square;
- extents->width = (double)metrics.gmBlackBoxX / font->em_square;
- extents->height = (double)metrics.gmBlackBoxY / font->em_square;
- extents->x_advance = (double)metrics.gmCellIncX / font->em_square;
- extents->y_advance = (double)metrics.gmCellIncY / font->em_square;
+ _cairo_win32_scaled_font_done_unscaled_font (&scaled_font->base);
+
+ extents->x_bearing = (double)metrics.gmptGlyphOrigin.x / scaled_font->em_square;
+ extents->y_bearing = - (double)metrics.gmptGlyphOrigin.y / scaled_font->em_square;
+ extents->width = (double)metrics.gmBlackBoxX / scaled_font->em_square;
+ extents->height = (double)metrics.gmBlackBoxY / scaled_font->em_square;
+ extents->x_advance = (double)metrics.gmCellIncX / scaled_font->em_square;
+ extents->y_advance = (double)metrics.gmCellIncY / scaled_font->em_square;
}
return CAIRO_STATUS_SUCCESS;
@@ -733,13 +734,13 @@ _cairo_win32_font_glyph_extents (void *abstract_font,
static cairo_status_t
-_cairo_win32_font_glyph_bbox (void *abstract_font,
- const cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_box_t *bbox)
+_cairo_win32_scaled_font_glyph_bbox (void *abstract_font,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_box_t *bbox)
{
static const MAT2 matrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
- cairo_win32_font_t *font = abstract_font;
+ cairo_win32_scaled_font_t *scaled_font = abstract_font;
int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
if (num_glyphs > 0) {
@@ -751,8 +752,8 @@ _cairo_win32_font_glyph_bbox (void *abstract_font,
if (!hdc)
return CAIRO_STATUS_NO_MEMORY;
- status = cairo_win32_font_select_font (&font->base, hdc);
- if (!CAIRO_OK (status))
+ status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
+ if (status)
return status;
for (i = 0; i < num_glyphs; i++) {
@@ -772,7 +773,7 @@ _cairo_win32_font_glyph_bbox (void *abstract_font,
y2 = y - metrics.gmptGlyphOrigin.y + metrics.gmBlackBoxY;
}
- cairo_win32_font_done_font (&font->base);
+ cairo_win32_scaled_font_done_font (&scaled_font->base);
}
bbox->p1.x = _cairo_fixed_from_int (x1);
@@ -784,7 +785,7 @@ _cairo_win32_font_glyph_bbox (void *abstract_font,
}
typedef struct {
- cairo_win32_font_t *font;
+ cairo_win32_scaled_font_t *scaled_font;
HDC hdc;
cairo_array_t glyphs;
@@ -796,12 +797,12 @@ typedef struct {
} cairo_glyph_state_t;
static void
-_start_glyphs (cairo_glyph_state_t *state,
- cairo_win32_font_t *font,
- HDC hdc)
+_start_glyphs (cairo_glyph_state_t *state,
+ cairo_win32_scaled_font_t *scaled_font,
+ HDC hdc)
{
state->hdc = hdc;
- state->font = font;
+ state->scaled_font = scaled_font;
_cairo_array_init (&state->glyphs, sizeof (WCHAR));
_cairo_array_init (&state->dx, sizeof (int));
@@ -841,7 +842,7 @@ _add_glyph (cairo_glyph_state_t *state,
WCHAR glyph_index = index;
int logical_x, logical_y;
- cairo_matrix_transform_point (&state->font->device_to_logical, &user_x, &user_y);
+ cairo_matrix_transform_point (&state->scaled_font->device_to_logical, &user_x, &user_y);
logical_x = floor (user_x + 0.5);
logical_y = floor (user_y + 0.5);
@@ -851,7 +852,7 @@ _add_glyph (cairo_glyph_state_t *state,
if (logical_y != state->last_y) {
cairo_status_t status = _flush_glyphs (state);
- if (!CAIRO_OK (status))
+ if (status)
return status;
state->start_x = logical_x;
}
@@ -881,13 +882,13 @@ _finish_glyphs (cairo_glyph_state_t *state)
}
static cairo_status_t
-_draw_glyphs_on_surface (cairo_win32_surface_t *surface,
- cairo_win32_font_t *font,
- COLORREF color,
- int x_offset,
- int y_offset,
- const cairo_glyph_t *glyphs,
- int num_glyphs)
+_draw_glyphs_on_surface (cairo_win32_surface_t *surface,
+ cairo_win32_scaled_font_t *scaled_font,
+ COLORREF color,
+ int x_offset,
+ int y_offset,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs)
{
cairo_glyph_state_t state;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
@@ -896,26 +897,26 @@ _draw_glyphs_on_surface (cairo_win32_surface_t *surface,
if (!SaveDC (surface->dc))
return _cairo_win32_print_gdi_error ("_draw_glyphs_on_surface:SaveDC");
- status = cairo_win32_font_select_font (&font->base, surface->dc);
- if (!CAIRO_OK (status))
+ status = cairo_win32_scaled_font_select_font (&scaled_font->base, surface->dc);
+ if (status)
goto FAIL1;
SetTextColor (surface->dc, color);
SetTextAlign (surface->dc, TA_BASELINE | TA_LEFT);
SetBkMode (surface->dc, TRANSPARENT);
- _start_glyphs (&state, font, surface->dc);
+ _start_glyphs (&state, scaled_font, surface->dc);
for (i = 0; i < num_glyphs; i++) {
status = _add_glyph (&state, glyphs[i].index,
glyphs[i].x - x_offset, glyphs[i].y - y_offset);
- if (!CAIRO_OK (status))
+ if (status)
goto FAIL2;
}
FAIL2:
_finish_glyphs (&state);
- cairo_win32_font_done_font (&font->base);
+ cairo_win32_scaled_font_done_font (&scaled_font->base);
FAIL1:
RestoreDC (surface->dc, 1);
@@ -986,20 +987,20 @@ _compute_a8_mask (cairo_win32_surface_t *mask_surface)
}
static cairo_status_t
-_cairo_win32_font_show_glyphs (void *abstract_font,
- cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *generic_surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height,
- const cairo_glyph_t *glyphs,
- int num_glyphs)
+_cairo_win32_scaled_font_show_glyphs (void *abstract_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *generic_surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs)
{
- cairo_win32_font_t *font = abstract_font;
+ cairo_win32_scaled_font_t *scaled_font = abstract_font;
cairo_win32_surface_t *surface = (cairo_win32_surface_t *)generic_surface;
cairo_status_t status;
@@ -1009,8 +1010,7 @@ _cairo_win32_font_show_glyphs (void *abstract_font,
if (_cairo_surface_is_win32 (generic_surface) &&
surface->format == CAIRO_FORMAT_RGB24 &&
operator == CAIRO_OPERATOR_OVER &&
- pattern->type == CAIRO_PATTERN_SOLID &&
- _cairo_pattern_is_opaque (pattern)) {
+ _cairo_pattern_is_opaque_solid (pattern)) {
cairo_solid_pattern_t *solid_pattern = (cairo_solid_pattern_t *)pattern;
@@ -1019,11 +1019,12 @@ _cairo_win32_font_show_glyphs (void *abstract_font,
*/
COLORREF new_color;
- new_color = RGB (((int)(0xffff * solid_pattern->red)) >> 8,
- ((int)(0xffff * solid_pattern->green)) >> 8,
- ((int)(0xffff * solid_pattern->blue)) >> 8);
+ /* XXX Use the unpremultiplied or premultiplied color? */
+ new_color = RGB (((int)solid_pattern->color.red_short) >> 8,
+ ((int)solid_pattern->color.green_short) >> 8,
+ ((int)solid_pattern->color.blue_short) >> 8);
- status = _draw_glyphs_on_surface (surface, font, new_color,
+ status = _draw_glyphs_on_surface (surface, scaled_font, new_color,
0, 0,
glyphs, num_glyphs);
@@ -1050,11 +1051,11 @@ _cairo_win32_font_show_glyphs (void *abstract_font,
r.bottom = height;
FillRect (tmp_surface->dc, &r, GetStockObject (WHITE_BRUSH));
- _draw_glyphs_on_surface (tmp_surface, font, RGB (0, 0, 0),
+ _draw_glyphs_on_surface (tmp_surface, scaled_font, RGB (0, 0, 0),
dest_x, dest_y,
glyphs, num_glyphs);
- if (font->quality == CLEARTYPE_QUALITY) {
+ if (scaled_font->quality == CLEARTYPE_QUALITY) {
/* For ClearType, we need a 4-channel mask. If we are compositing on
* a surface with alpha, we need to compute the alpha channel of
* the mask (we just copy the green channel). But for a destination
@@ -1101,84 +1102,109 @@ _cairo_win32_font_show_glyphs (void *abstract_font,
}
static cairo_status_t
-_cairo_win32_font_glyph_path (void *abstract_font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_t *path)
+_cairo_win32_scaled_font_glyph_path (void *abstract_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path)
{
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
-_cairo_win32_font_create_glyph (cairo_image_glyph_cache_entry_t *val)
-{
- return CAIRO_STATUS_NO_MEMORY;
-}
+const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend = {
+ _cairo_win32_scaled_font_create,
+ _cairo_win32_scaled_font_destroy,
+ _cairo_win32_scaled_font_font_extents,
+ _cairo_win32_scaled_font_text_to_glyphs,
+ _cairo_win32_scaled_font_glyph_extents,
+ _cairo_win32_scaled_font_glyph_bbox,
+ _cairo_win32_scaled_font_show_glyphs,
+ _cairo_win32_scaled_font_glyph_path,
+ _cairo_win32_scaled_font_get_glyph_cache_key,
+};
+
+/* cairo_win32_font_face_t */
-const cairo_font_backend_t cairo_win32_font_backend = {
- _cairo_win32_font_create,
- _cairo_win32_font_destroy_font,
- _cairo_win32_font_destroy_unscaled_font,
- _cairo_win32_font_font_extents,
- _cairo_win32_font_text_to_glyphs,
- _cairo_win32_font_glyph_extents,
- _cairo_win32_font_glyph_bbox,
- _cairo_win32_font_show_glyphs,
- _cairo_win32_font_glyph_path,
- _cairo_win32_font_get_glyph_cache_key,
- _cairo_win32_font_create_glyph
+typedef struct _cairo_win32_font_face cairo_win32_font_face_t;
+
+struct _cairo_win32_font_face {
+ cairo_font_face_t base;
+ LOGFONTW logfont;
};
/* implement the platform-specific interface */
+static void
+_cairo_win32_font_face_destroy (void *abstract_face)
+{
+}
+
+static cairo_status_t
+_cairo_win32_font_face_create_font (void *abstract_face,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **font)
+{
+ cairo_win32_font_face_t *font_face = abstract_face;
+
+ *font = _win32_scaled_font_create (&font_face->logfont,
+ font_matrix, ctm);
+ if (*font)
+ return CAIRO_STATUS_SUCCESS;
+ else
+ return CAIRO_STATUS_NO_MEMORY;
+}
+
+static const cairo_font_face_backend_t _cairo_win32_font_face_backend = {
+ _cairo_win32_font_face_destroy,
+ _cairo_win32_font_face_create_font,
+};
+
/**
- * cairo_win32_font_create_for_logfontw:
+ * cairo_win32_font_face_create_for_logfontw:
* @logfont: A #LOGFONTW structure specifying the font to use.
* The lfHeight, lfWidth, lfOrientation and lfEscapement
- * fields of this structure are ignored; information from
- * @scale will be used instead.
- * @scale: The scale at which this font will be used. The
- * scale is given by multiplying the font matrix (see
- * cairo_transform_font()) by the current transformation matrix.
- * The translation elements of the resulting matrix are ignored.
+ * fields of this structure are ignored.
*
* Creates a new font for the Win32 font backend based on a
* #LOGFONT. This font can then be used with
- * cairo_set_font(), cairo_font_glyph_extents(), or FreeType backend
- * specific functions like cairo_win32_font_select_font().
+ * cairo_set_font_face() or cairo_font_create(). The #cairo_scaled_font_t
+ * returned from cairo_font_create() is also for the Win32 backend
+ * and can be used with functions such as cairo_win32_scaled_font_select_font().
*
- * Return value: a newly created #cairo_font_t. Free with
- * cairo_font_destroy() when you are done using it.
+ * Return value: a newly created #cairo_font_face_t. Free with
+ * cairo_font_face_destroy() when you are done using it.
**/
-cairo_font_t *
-cairo_win32_font_create_for_logfontw (LOGFONTW *logfont,
- cairo_matrix_t *scale)
+cairo_font_face_t *
+cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont)
{
- cairo_font_scale_t sc;
+ cairo_win32_font_face_t *font_face;
+
+ font_face = malloc (sizeof (cairo_win32_font_face_t));
+ if (!font_face)
+ return NULL;
+
+ font_face->logfont = *logfont;
- cairo_matrix_get_affine (scale,
- &sc.matrix[0][0], &sc.matrix[0][1],
- &sc.matrix[1][0], &sc.matrix[1][1],
- NULL, NULL);
+ _cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
- return _win32_font_create (logfont, &sc);
+ return &font_face->base;
}
/**
- * cairo_win32_font_select_font:
- * @font: A #cairo_font_t from the Win32 font backend. Such an
- * object can be created with cairo_win32_font_create_for_logfontw().
+ * cairo_win32_scaled_font_select_font:
+ * @scaled_font: A #cairo_scaled_font_t from the Win32 font backend. Such an
+ * object can be created with cairo_win32_scaled_font_create_for_logfontw().
* @hdc: a device context
*
* Selects the font into the given device context and changes the
* map mode and world transformation of the device context to match
* that of the font. This function is intended for use when using
* layout APIs such as Uniscribe to do text layout with the
- * Cairo font. After finishing using the device context, you must call
- * cairo_win32_font_done_font() to release any resources allocated
+ * cairo font. After finishing using the device context, you must call
+ * cairo_win32_scaled_font_done_font() to release any resources allocated
* by this function.
*
- * See cairo_win32_font_get_scale_factor() for converting logical
+ * See cairo_win32_scaled_font_get_metrics_factor() for converting logical
* coordinates from the device context to font space.
*
* Normally, calls to SaveDC() and RestoreDC() would be made around
@@ -1189,31 +1215,31 @@ cairo_win32_font_create_for_logfontw (LOGFONTW *logfont,
* the device context is unchanged.
**/
cairo_status_t
-cairo_win32_font_select_font (cairo_font_t *font,
- HDC hdc)
+cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font,
+ HDC hdc)
{
cairo_status_t status;
HFONT hfont;
HFONT old_hfont = NULL;
int old_mode;
- hfont = _win32_font_get_scaled_font ((cairo_win32_font_t *)font);
+ hfont = _win32_scaled_font_get_scaled_hfont ((cairo_win32_scaled_font_t *)scaled_font);
if (!hfont)
return CAIRO_STATUS_NO_MEMORY;
old_hfont = SelectObject (hdc, hfont);
if (!old_hfont)
- return _cairo_win32_print_gdi_error ("cairo_win32_font_select_font");
+ return _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font");
old_mode = SetGraphicsMode (hdc, GM_ADVANCED);
if (!old_mode) {
- status = _cairo_win32_print_gdi_error ("cairo_win32_font_select_font");
+ status = _cairo_win32_print_gdi_error ("cairo_win32_scaled_font_select_font");
SelectObject (hdc, old_hfont);
return status;
}
- status = _win32_font_set_world_transform ((cairo_win32_font_t *)font, hdc);
- if (!CAIRO_OK (status)) {
+ status = _win32_scaled_font_set_world_transform ((cairo_win32_scaled_font_t *)scaled_font, hdc);
+ if (status) {
SetGraphicsMode (hdc, old_mode);
SelectObject (hdc, old_hfont);
return status;
@@ -1225,28 +1251,30 @@ cairo_win32_font_select_font (cairo_font_t *font,
}
/**
- * cairo_win32_font_done_font:
- * @font: A #cairo_font_t from the Win32 font backend.
+ * cairo_win32_scaled_font_done_font:
+ * @scaled_font: A #cairo_scaled_font_t from the Win32 font backend.
*
- * Releases any resources allocated by cairo_win32_font_select_font()
+ * Releases any resources allocated by cairo_win32_scaled_font_select_font()
**/
void
-cairo_win32_font_done_font (cairo_font_t *font)
+cairo_win32_scaled_font_done_font (cairo_scaled_font_t *scaled_font)
{
}
/**
- * cairo_win32_font_get_scale_factor:
- * @font: a #cairo_font_t from the Win32 font backend
+ * cairo_win32_scaled_font_get_metrics_factor:
+ * @scaled_font: a #cairo_scaled_font_t from the Win32 font backend
*
* Gets a scale factor between logical coordinates in the coordinate
- * space used by cairo_win32_font_select_font() and font space coordinates.
+ * space used by cairo_win32_scaled_font_select_font() (that is, the
+ * coordinate system used by the Windows functions to return metrics) and
+ * font space coordinates.
*
* Return value: factor to multiply logical units by to get font space
* coordinates.
**/
double
-cairo_win32_font_get_scale_factor (cairo_font_t *font)
+cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font)
{
- return 1. / ((cairo_win32_font_t *)font)->logical_scale;
+ return 1. / ((cairo_win32_scaled_font_t *)scaled_font)->logical_scale;
}
diff --git a/src/cairo_win32_surface.c b/src/cairo-win32-surface.c
index dcfe6d0..8d63adb 100644
--- a/src/cairo_win32_surface.c
+++ b/src/cairo-win32-surface.c
@@ -34,7 +34,7 @@
*/
#include <stdio.h>
-
+#include "cairoint.h"
#include "cairo-win32-private.h"
static const cairo_surface_backend_t cairo_win32_surface_backend;
@@ -46,7 +46,7 @@ static const cairo_surface_backend_t cairo_win32_surface_backend;
* Helper function to dump out a human readable form of the
* current error code.
*
- * Return value: A Cairo status code for the error code
+ * Return value: A cairo status code for the error code
**/
cairo_status_t
_cairo_win32_print_gdi_error (const char *context)
@@ -76,27 +76,6 @@ _cairo_win32_print_gdi_error (const char *context)
return CAIRO_STATUS_NO_MEMORY;
}
-void
-cairo_set_target_win32 (cairo_t *cr,
- HDC hdc)
-{
- cairo_surface_t *surface;
-
- if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
- return;
-
- surface = cairo_win32_surface_create (hdc);
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface (cr, surface);
-
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy (surface);
-}
-
static cairo_status_t
_create_dc_and_bitmap (cairo_win32_surface_t *surface,
HDC original_dc,
@@ -215,7 +194,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
*bits_out = bits;
if (rowstride_out) {
- /* Windows bitmaps are padded to 16-bit (word) boundaries */
+ /* Windows bitmaps are padded to 32-bit (dword) boundaries */
switch (format) {
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB24:
@@ -223,11 +202,11 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
break;
case CAIRO_FORMAT_A8:
- *rowstride_out = (width + 1) & -2;
+ *rowstride_out = (width + 3) & ~3;
break;
case CAIRO_FORMAT_A1:
- *rowstride_out = ((width + 15) & -16) / 8;
+ *rowstride_out = ((width + 31) & ~31) / 8;
break;
}
}
@@ -313,7 +292,6 @@ _cairo_win32_surface_create_for_dc (HDC original_dc,
static cairo_surface_t *
_cairo_win32_surface_create_similar (void *abstract_src,
cairo_format_t format,
- int drawable,
int width,
int height)
{
@@ -345,8 +323,8 @@ _cairo_win32_surface_create_dib (cairo_format_t format,
width, height);
}
-static void
-_cairo_win32_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_win32_surface_finish (void *abstract_surface)
{
cairo_win32_surface_t *surface = abstract_surface;
@@ -362,15 +340,8 @@ _cairo_win32_surface_destroy (void *abstract_surface)
DeleteObject (surface->bitmap);
DeleteDC (surface->dc);
}
-
- free (surface);
-}
-static double
-_cairo_win32_surface_pixels_per_inch (void *abstract_surface)
-{
- /* XXX: We should really get this value from somewhere */
- return 96.0;
+ return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
@@ -387,7 +358,6 @@ _cairo_win32_surface_get_subimage (cairo_win32_surface_t *surface,
local =
(cairo_win32_surface_t *) _cairo_win32_surface_create_similar (surface,
surface->format,
- 0,
width, height);
if (!local)
return CAIRO_STATUS_NO_MEMORY;
@@ -432,16 +402,13 @@ _cairo_win32_surface_acquire_source_image (void *abstract_sur
status = _cairo_win32_surface_get_subimage (abstract_surface, 0, 0,
surface->clip_rect.width,
surface->clip_rect.height, &local);
- if (CAIRO_OK (status)) {
- cairo_surface_set_filter (&local->base, surface->base.filter);
- cairo_surface_set_matrix (&local->base, &surface->base.matrix);
- cairo_surface_set_repeat (&local->base, surface->base.repeat);
-
- *image_out = (cairo_image_surface_t *)local->image;
- *image_extra = local;
- }
+ if (status)
+ return status;
- return status;
+ *image_out = (cairo_image_surface_t *)local->image;
+ *image_extra = local;
+
+ return CAIRO_STATUS_SUCCESS;
}
static void
@@ -507,17 +474,18 @@ _cairo_win32_surface_acquire_dest_image (void *abstract_surfa
status = _cairo_win32_surface_get_subimage (abstract_surface,
x1, y1, x2 - x1, y2 - y1,
&local);
- if (CAIRO_OK (status)) {
- *image_out = (cairo_image_surface_t *)local->image;
- *image_extra = local;
-
- image_rect->x = x1;
- image_rect->y = y1;
- image_rect->width = x2 - x1;
- image_rect->height = y2 - y1;
- }
+ if (status)
+ return status;
- return status;
+ *image_out = (cairo_image_surface_t *)local->image;
+ *image_extra = local;
+
+ image_rect->x = x1;
+ image_rect->y = y1;
+ image_rect->width = x2 - x1;
+ image_rect->height = y2 - y1;
+
+ return CAIRO_STATUS_SUCCESS;
}
static void
@@ -544,14 +512,6 @@ _cairo_win32_surface_release_dest_image (void *abstract_surfac
cairo_surface_destroy ((cairo_surface_t *)local);
}
-static cairo_status_t
-_cairo_win32_surface_clone_similar (void *surface,
- cairo_surface_t *src,
- cairo_surface_t **clone_out)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
static cairo_int_status_t
_cairo_win32_surface_composite (cairo_operator_t operator,
cairo_pattern_t *pattern,
@@ -584,9 +544,9 @@ _cairo_win32_surface_composite (cairo_operator_t operator,
if (mask_pattern->type != CAIRO_PATTERN_SOLID)
return CAIRO_INT_STATUS_UNSUPPORTED;
- alpha = (int)(0xffff * pattern->alpha * mask_pattern->alpha) >> 8;
+ alpha = ((cairo_solid_pattern_t *)mask_pattern)->color.alpha_short >> 8;
} else {
- alpha = (int)(0xffff * pattern->alpha) >> 8;
+ alpha = 255;
}
src_surface_pattern = (cairo_surface_pattern_t *)pattern;
@@ -601,7 +561,7 @@ _cairo_win32_surface_composite (cairo_operator_t operator,
if (alpha == 255 &&
src->format == dst->format &&
- (operator == CAIRO_OPERATOR_SRC ||
+ (operator == CAIRO_OPERATOR_SOURCE ||
(src->format == CAIRO_FORMAT_RGB24 && operator == CAIRO_OPERATOR_OVER))) {
if (!BitBlt (dst->dc,
@@ -642,6 +602,81 @@ _cairo_win32_surface_composite (cairo_operator_t operator,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
+/* This big function tells us how to optimize operators for the
+ * case of solid destination and constant-alpha source
+ *
+ * NOTE: This function needs revisiting if we add support for
+ * super-luminescent colors (a == 0, r,g,b > 0)
+ */
+static enum { DO_CLEAR, DO_SOURCE, DO_NOTHING, DO_UNSUPPORTED }
+categorize_solid_dest_operator (cairo_operator_t operator,
+ unsigned short alpha)
+{
+ enum { SOURCE_TRANSPARENT, SOURCE_LIGHT, SOURCE_SOLID, SOURCE_OTHER } source;
+
+ if (alpha >= 0xff00)
+ source = SOURCE_SOLID;
+ else if (alpha < 0x100)
+ source = SOURCE_TRANSPARENT;
+ else
+ source = SOURCE_OTHER;
+
+ switch (operator) {
+ case CAIRO_OPERATOR_CLEAR: /* 0 0 */
+ case CAIRO_OPERATOR_OUT: /* 1 - Ab 0 */
+ return DO_CLEAR;
+ break;
+
+ case CAIRO_OPERATOR_SOURCE: /* 1 0 */
+ case CAIRO_OPERATOR_IN: /* Ab 0 */
+ return DO_SOURCE;
+ break;
+
+ case CAIRO_OPERATOR_OVER: /* 1 1 - Aa */
+ case CAIRO_OPERATOR_ATOP: /* Ab 1 - Aa */
+ if (source == SOURCE_SOLID)
+ return DO_SOURCE;
+ else if (source == SOURCE_TRANSPARENT)
+ return DO_NOTHING;
+ else
+ return DO_UNSUPPORTED;
+ break;
+
+ case CAIRO_OPERATOR_DEST_OUT: /* 0 1 - Aa */
+ case CAIRO_OPERATOR_XOR: /* 1 - Ab 1 - Aa */
+ if (source == SOURCE_SOLID)
+ return DO_CLEAR;
+ else if (source == SOURCE_TRANSPARENT)
+ return DO_NOTHING;
+ else
+ return DO_UNSUPPORTED;
+ break;
+
+ case CAIRO_OPERATOR_DEST: /* 0 1 */
+ case CAIRO_OPERATOR_DEST_OVER:/* 1 - Ab 1 */
+ case CAIRO_OPERATOR_SATURATE: /* min(1,(1-Ab)/Aa) 1 */
+ return DO_NOTHING;
+ break;
+
+ case CAIRO_OPERATOR_DEST_IN: /* 0 Aa */
+ case CAIRO_OPERATOR_DEST_ATOP:/* 1 - Ab Aa */
+ if (source == SOURCE_SOLID)
+ return DO_NOTHING;
+ else if (source == SOURCE_TRANSPARENT)
+ return DO_CLEAR;
+ else
+ return DO_UNSUPPORTED;
+ break;
+
+ case CAIRO_OPERATOR_ADD: /* 1 1 */
+ if (source == SOURCE_TRANSPARENT)
+ return DO_NOTHING;
+ else
+ return DO_UNSUPPORTED;
+ break;
+ }
+}
+
static cairo_int_status_t
_cairo_win32_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t operator,
@@ -660,17 +695,24 @@ _cairo_win32_surface_fill_rectangles (void *abstract_surface,
*/
if (surface->image)
return CAIRO_INT_STATUS_UNSUPPORTED;
-
- /* We could support possibly support more operators for color->alpha = 0xffff.
- * for CAIRO_OPERATOR_SRC, alpha doesn't matter since we know the destination
- * image doesn't have alpha. (surface->pixman_image is non-NULL for all
+
+ /* Optimize for no destination alpha (surface->pixman_image is non-NULL for all
* surfaces with alpha.)
*/
- if (operator != CAIRO_OPERATOR_SRC)
+ switch (categorize_solid_dest_operator (operator, color->alpha_short)) {
+ case DO_CLEAR:
+ new_color = RGB (0, 0, 0);
+ break;
+ case DO_SOURCE:
+ new_color = RGB (color->red_short >> 8, color->blue_short >> 8, color->green_short >> 8);
+ break;
+ case DO_NOTHING:
+ return CAIRO_STATUS_SUCCESS;
+ case DO_UNSUPPORTED:
+ default:
return CAIRO_INT_STATUS_UNSUPPORTED;
-
- new_color = RGB (color->red_short >> 8, color->green_short >> 8, color->blue_short >> 8);
-
+ }
+
new_brush = CreateSolidBrush (new_color);
if (!new_brush)
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_fill_rectangles");
@@ -700,35 +742,6 @@ _cairo_win32_surface_fill_rectangles (void *abstract_surface,
}
static cairo_int_status_t
-_cairo_win32_surface_composite_trapezoids (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_dst,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height,
- cairo_trapezoid_t *traps,
- int num_traps)
-
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_win32_surface_copy_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_win32_surface_show_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
_cairo_win32_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
@@ -741,14 +754,14 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface,
if (surface->image)
_cairo_surface_set_clip_region (surface->image, region);
- /* The semantics we want is that any clip set by Cairo combines
+ /* The semantics we want is that any clip set by cairo combines
* is intersected with the clip on device context that the
* surface was created for. To implement this, we need to
* save the original clip when first setting a clip on surface.
*/
if (region == NULL) {
- /* Clear any clip set by Cairo, return to the original */
+ /* Clear any clip set by cairo, return to the original */
if (surface->set_clip) {
if (SelectClipRgn (surface->dc, surface->saved_clip) == ERROR)
@@ -845,21 +858,22 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface,
}
}
-static cairo_status_t
-_cairo_win32_surface_show_glyphs (cairo_font_t *font,
- cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height,
- const cairo_glyph_t *glyphs,
- int num_glyphs)
+static cairo_int_status_t
+_cairo_win32_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
{
- return CAIRO_INT_STATUS_UNSUPPORTED;
+ cairo_win32_surface_t *surface = abstract_surface;
+ RECT clip_box;
+
+ if (GetClipBox (surface->dc, &clip_box) == ERROR)
+ return _cairo_win32_print_gdi_error ("_cairo_win3_surface_acquire_dest_image");
+
+ rectangle->x = clip_box.left;
+ rectangle->y = clip_box.top;
+ rectangle->width = clip_box.right - clip_box.left;
+ rectangle->height = clip_box.bottom - clip_box.top;
+
+ return CAIRO_STATUS_SUCCESS;
}
cairo_surface_t *
@@ -884,6 +898,7 @@ cairo_win32_surface_create (HDC hdc)
surface->dc = hdc;
surface->bitmap = NULL;
+ surface->saved_dc_bitmap = NULL;
surface->clip_rect.x = rect.left;
surface->clip_rect.y = rect.top;
@@ -914,18 +929,19 @@ _cairo_surface_is_win32 (cairo_surface_t *surface)
static const cairo_surface_backend_t cairo_win32_surface_backend = {
_cairo_win32_surface_create_similar,
- _cairo_win32_surface_destroy,
- _cairo_win32_surface_pixels_per_inch,
+ _cairo_win32_surface_finish,
_cairo_win32_surface_acquire_source_image,
_cairo_win32_surface_release_source_image,
_cairo_win32_surface_acquire_dest_image,
_cairo_win32_surface_release_dest_image,
- _cairo_win32_surface_clone_similar,
+ NULL, /* clone_similar */
_cairo_win32_surface_composite,
_cairo_win32_surface_fill_rectangles,
- _cairo_win32_surface_composite_trapezoids,
- _cairo_win32_surface_copy_page,
- _cairo_win32_surface_show_page,
+ NULL, /* composite_trapezoids */
+ NULL, /* copy_page */
+ NULL, /* show_page */
_cairo_win32_surface_set_clip_region,
- _cairo_win32_surface_show_glyphs
+ NULL, /* intersect_clip_path */
+ _cairo_win32_surface_get_extents,
+ NULL /* show_glyphs */
};
diff --git a/src/cairo-win32.h b/src/cairo-win32.h
index fab497a..9398345 100644
--- a/src/cairo-win32.h
+++ b/src/cairo-win32.h
@@ -34,38 +34,36 @@
*/
#ifndef _CAIRO_WIN32_H_
+#define _CAIRO_WIN32_H_
#include <cairo.h>
-#ifdef CAIRO_HAS_WIN32_SURFACE
+#if CAIRO_HAS_WIN32_SURFACE
#include <windows.h>
CAIRO_BEGIN_DECLS
-void
-cairo_set_target_win32 (cairo_t *cr,
- HDC hdc);
-
cairo_surface_t *
cairo_win32_surface_create (HDC hdc);
-cairo_font_t *
-cairo_win32_font_create_for_logfontw (LOGFONTW *logfont,
- cairo_matrix_t *scale);
+cairo_font_face_t *
+cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);
cairo_status_t
-cairo_win32_font_select_font (cairo_font_t *font,
- HDC hdc);
+cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font,
+ HDC hdc);
void
-cairo_win32_font_done_font (cairo_font_t *font);
+cairo_win32_scaled_font_done_font (cairo_scaled_font_t *scaled_font);
double
-cairo_win32_font_get_scale_factor (cairo_font_t *font);
-
-#endif /* CAIRO_HAS_WIN32_SURFACE */
+cairo_win32_scaled_font_get_metrics_factor (cairo_scaled_font_t *scaled_font);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_WIN32_SURFACE */
+# error Cairo was not compiled with support for the win32 backend
+#endif /* CAIRO_HAS_WIN32_SURFACE */
+
#endif /* _CAIRO_WIN32_H_ */
diff --git a/src/cairo_xcb_surface.c b/src/cairo-xcb-surface.c
index 0694b77..4e32044 100644
--- a/src/cairo_xcb_surface.c
+++ b/src/cairo-xcb-surface.c
@@ -36,12 +36,7 @@
#include "cairoint.h"
#include "cairo-xcb.h"
-
-cairo_surface_t *
-cairo_xcb_surface_create (XCBConnection *dpy,
- XCBDRAWABLE drawable,
- XCBVISUALTYPE *visual,
- cairo_format_t format);
+#include "cairo-xcb-xrender.h"
#define AllPlanes ((unsigned long)~0L)
@@ -71,10 +66,12 @@ format_from_visual(XCBConnection *c, XCBVISUALID visual)
return nil;
}
-static XCBRenderPICTFORMAT
-format_from_cairo(XCBConnection *c, cairo_format_t fmt)
+/* XXX: Why is this ridiculously complex compared to the equivalent
+ * function in cairo-xlib-surface.c */
+static XCBRenderPICTFORMINFO
+_format_from_cairo(XCBConnection *c, cairo_format_t fmt)
{
- XCBRenderPICTFORMAT ret = { 0 };
+ XCBRenderPICTFORMINFO ret = {{ 0 }};
struct tmpl_t {
XCBRenderDIRECTFORMAT direct;
CARD8 depth;
@@ -151,36 +148,20 @@ format_from_cairo(XCBConnection *c, cairo_format_t fmt)
if(t->alpha_mask && (t->alpha_mask != f->alpha_mask || t->alpha_shift != f->alpha_shift))
continue;
- ret = fi.data->id;
+ ret = *fi.data;
}
free(r);
return ret;
}
-void
-cairo_set_target_xcb (cairo_t *cr,
- XCBConnection *dpy,
- XCBDRAWABLE drawable,
- XCBVISUALTYPE *visual,
- cairo_format_t format)
-{
- cairo_surface_t *surface;
-
- if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
- return;
-
- surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface (cr, surface);
+/*
+ * Instead of taking two round trips for each blending request,
+ * assume that if a particular drawable fails GetImage that it will
+ * fail for a "while"; use temporary pixmaps to avoid the errors
+ */
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy (surface);
-}
+#define CAIRO_ASSUME_PIXMAP 20
typedef struct cairo_xcb_surface {
cairo_surface_t base;
@@ -190,15 +171,19 @@ typedef struct cairo_xcb_surface {
XCBDRAWABLE drawable;
int owns_pixmap;
XCBVISUALTYPE *visual;
- cairo_format_t format;
+
+ int use_pixmap;
int render_major;
int render_minor;
int width;
int height;
+ int depth;
XCBRenderPICTURE picture;
+ XCBRenderPICTFORMINFO format;
+ int has_format;
} cairo_xcb_surface_t;
#define CAIRO_SURFACE_RENDER_AT_LEAST(surface, major, minor) \
@@ -222,6 +207,9 @@ typedef struct cairo_xcb_surface {
#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
+static void
+_cairo_xcb_surface_ensure_gc (cairo_xcb_surface_t *surface);
+
static int
_CAIRO_FORMAT_DEPTH (cairo_format_t format)
{
@@ -239,46 +227,42 @@ _CAIRO_FORMAT_DEPTH (cairo_format_t format)
}
static cairo_surface_t *
-_cairo_xcb_surface_create_similar (void *abstract_src,
- cairo_format_t format,
- int drawable,
- int width,
- int height)
+_cairo_xcb_surface_create_similar (void *abstract_src,
+ cairo_format_t format,
+ int width,
+ int height)
{
cairo_xcb_surface_t *src = abstract_src;
XCBConnection *dpy = src->dpy;
XCBDRAWABLE d;
cairo_xcb_surface_t *surface;
+ XCBRenderPICTFORMINFO xrender_format = _format_from_cairo (dpy, format);
- /* XXX: There's a pretty lame heuristic here. This assumes that
- * all non-Render X servers do not support depth-32 pixmaps, (and
- * that they do support depths 1, 8, and 24). Obviously, it would
- * be much better to check the depths that are actually
- * supported. */
- if (!dpy
- || (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (src)
- && format == CAIRO_FORMAT_ARGB32))
- {
- return NULL;
+ /* As a good first approximation, if the display doesn't have COMPOSITE,
+ * we're better off using image surfaces for all temporary operations
+ */
+ if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (src)) {
+ return cairo_image_surface_create (format, width, height);
}
d.pixmap = XCBPIXMAPNew (dpy);
XCBCreatePixmap (dpy, _CAIRO_FORMAT_DEPTH (format),
d.pixmap, src->drawable,
- width, height);
+ width <= 0 ? 1 : width,
+ height <= 0 ? 1 : height);
surface = (cairo_xcb_surface_t *)
- cairo_xcb_surface_create (dpy, d, NULL, format);
- surface->owns_pixmap = 1;
+ cairo_xcb_surface_create_with_xrender_format (dpy, d,
+ &xrender_format,
+ width, height);
- surface->width = width;
- surface->height = height;
+ surface->owns_pixmap = TRUE;
return &surface->base;
}
-static void
-_cairo_xcb_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_xcb_surface_finish (void *abstract_surface)
{
cairo_xcb_surface_t *surface = abstract_surface;
if (surface->picture.xid)
@@ -290,20 +274,13 @@ _cairo_xcb_surface_destroy (void *abstract_surface)
if (surface->gc.xid)
XCBFreeGC (surface->dpy, surface->gc);
- surface->dpy = 0;
+ surface->dpy = NULL;
- free (surface);
-}
-
-static double
-_cairo_xcb_surface_pixels_per_inch (void *abstract_surface)
-{
- /* XXX: We should really get this value from somewhere like Xft.dpy */
- return 96.0;
+ return CAIRO_STATUS_SUCCESS;
}
static int
-bits_per_pixel(XCBConnection *c, int depth)
+_bits_per_pixel(XCBConnection *c, int depth)
{
XCBFORMAT *fmt = XCBConnSetupSuccessRepPixmapFormats(XCBGetSetup(c));
XCBFORMAT *fmtend = fmt + XCBConnSetupSuccessRepPixmapFormatsLength(XCBGetSetup(c));
@@ -322,12 +299,52 @@ bits_per_pixel(XCBConnection *c, int depth)
}
static int
-bytes_per_line(XCBConnection *c, int width, int bpp)
+_bytes_per_line(XCBConnection *c, int width, int bpp)
{
int bitmap_pad = XCBGetSetup(c)->bitmap_format_scanline_pad;
return ((bpp * width + bitmap_pad - 1) & -bitmap_pad) >> 3;
}
+static cairo_bool_t
+_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
+{
+ switch (masks->bpp) {
+ case 32:
+ if (masks->alpha_mask == 0xff000000 &&
+ masks->red_mask == 0x00ff0000 &&
+ masks->green_mask == 0x0000ff00 &&
+ masks->blue_mask == 0x000000ff)
+ {
+ *format = CAIRO_FORMAT_ARGB32;
+ return 1;
+ }
+ if (masks->alpha_mask == 0x00000000 &&
+ masks->red_mask == 0x00ff0000 &&
+ masks->green_mask == 0x0000ff00 &&
+ masks->blue_mask == 0x000000ff)
+ {
+ *format = CAIRO_FORMAT_RGB24;
+ return 1;
+ }
+ break;
+ case 8:
+ if (masks->alpha_mask == 0xff)
+ {
+ *format = CAIRO_FORMAT_A8;
+ return 1;
+ }
+ break;
+ case 1:
+ if (masks->alpha_mask == 0x1)
+ {
+ *format = CAIRO_FORMAT_A1;
+ return 1;
+ }
+ break;
+ }
+ return 0;
+}
+
static cairo_status_t
_get_image_surface (cairo_xcb_surface_t *surface,
cairo_rectangle_t *interest_rect,
@@ -335,18 +352,12 @@ _get_image_surface (cairo_xcb_surface_t *surface,
cairo_rectangle_t *image_rect)
{
cairo_image_surface_t *image;
- XCBGetGeometryRep *geomrep;
XCBGetImageRep *imagerep;
- int bpp;
+ int bpp, bytes_per_line;
int x1, y1, x2, y2;
-
- geomrep = XCBGetGeometryReply(surface->dpy, XCBGetGeometry(surface->dpy, surface->drawable), 0);
- if(!geomrep)
- return 0;
-
- surface->width = geomrep->width;
- surface->height = geomrep->height;
- free(geomrep);
+ unsigned char *data;
+ cairo_format_t format;
+ cairo_format_masks_t masks;
x1 = 0;
y1 = 0;
@@ -354,14 +365,21 @@ _get_image_surface (cairo_xcb_surface_t *surface,
y2 = surface->height;
if (interest_rect) {
- if (interest_rect->x > x1)
- x1 = interest_rect->x;
- if (interest_rect->y > y1)
- y1 = interest_rect->y;
- if (interest_rect->x + interest_rect->width < x2)
- x2 = interest_rect->x + interest_rect->width;
- if (interest_rect->y + interest_rect->height < y2)
- y2 = interest_rect->y + interest_rect->height;
+ cairo_rectangle_t rect;
+
+ rect.x = interest_rect->x;
+ rect.y = interest_rect->y;
+ rect.width = interest_rect->width;
+ rect.height = interest_rect->height;
+
+ if (rect.x > x1)
+ x1 = rect.x;
+ if (rect.y > y1)
+ y1 = rect.y;
+ if (rect.x + rect.width < x2)
+ x2 = rect.x + rect.width;
+ if (rect.y + rect.height < y2)
+ y2 = rect.y + rect.height;
if (x1 >= x2 || y1 >= y2) {
*image_out = NULL;
@@ -376,49 +394,131 @@ _get_image_surface (cairo_xcb_surface_t *surface,
image_rect->height = y2 - y1;
}
- imagerep = XCBGetImageReply(surface->dpy,
- XCBGetImage(surface->dpy, ZPixmap,
- surface->drawable,
- x1, y1,
- x2 - x1, y2 - y1,
- AllPlanes), 0);
- if(!imagerep)
- return 0;
+ /* XXX: This should try to use the XShm extension if available */
- bpp = bits_per_pixel(surface->dpy, imagerep->depth);
+ if (surface->use_pixmap == 0)
+ {
+ XCBGenericError *error;
+ imagerep = XCBGetImageReply(surface->dpy,
+ XCBGetImage(surface->dpy, ZPixmap,
+ surface->drawable,
+ x1, y1,
+ x2 - x1, y2 - y1,
+ AllPlanes), &error);
+
+ /* If we get an error, the surface must have been a window,
+ * so retry with the safe code path.
+ */
+ if (error)
+ surface->use_pixmap = CAIRO_ASSUME_PIXMAP;
+ }
+ else
+ {
+ surface->use_pixmap--;
+ imagerep = NULL;
+ }
- if (surface->visual) {
- cairo_format_masks_t masks;
+ if (!imagerep)
+ {
+ /* XCBGetImage from a window is dangerous because it can
+ * produce errors if the window is unmapped or partially
+ * outside the screen. We could check for errors and
+ * retry, but to keep things simple, we just create a
+ * temporary pixmap
+ */
+ XCBDRAWABLE drawable;
+ drawable.pixmap = XCBPIXMAPNew (surface->dpy);
+ XCBCreatePixmap (surface->dpy,
+ surface->depth,
+ drawable.pixmap,
+ surface->drawable,
+ x2 - x1, y2 - y1);
+ _cairo_xcb_surface_ensure_gc (surface);
+
+ XCBCopyArea (surface->dpy, surface->drawable, drawable, surface->gc,
+ x1, y1, 0, 0, x2 - x1, y2 - y1);
+
+ imagerep = XCBGetImageReply(surface->dpy,
+ XCBGetImage(surface->dpy, ZPixmap,
+ drawable,
+ x1, y1,
+ x2 - x1, y2 - y1,
+ AllPlanes), 0);
+ XCBFreePixmap (surface->dpy, drawable.pixmap);
+
+ }
+ if (!imagerep)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ bpp = _bits_per_pixel(surface->dpy, imagerep->depth);
+ bytes_per_line = _bytes_per_line(surface->dpy, surface->width, bpp);
- /* XXX: Add support here for pictures with external alpha? */
+ data = malloc (bytes_per_line * surface->height);
+ if (data == NULL) {
+ free (imagerep);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+ memcpy (data, XCBGetImageData (imagerep), bytes_per_line * surface->height);
+ free (imagerep);
+
+ /*
+ * Compute the pixel format masks from either an XCBVISUALTYPE or
+ * a XCBRenderPCTFORMINFO, failing we assume the drawable is an
+ * alpha-only pixmap as it could only have been created that way
+ * through the cairo_xlib_surface_create_for_bitmap function.
+ */
+ if (surface->visual) {
masks.bpp = bpp;
masks.alpha_mask = 0;
masks.red_mask = surface->visual->red_mask;
masks.green_mask = surface->visual->green_mask;
masks.blue_mask = surface->visual->blue_mask;
-
- image = _cairo_image_surface_create_with_masks (XCBGetImageData(imagerep),
- &masks,
- x2 - x1,
- y2 - y1,
- bytes_per_line(surface->dpy, surface->width, bpp));
+ } else if (surface->has_format) {
+ masks.bpp = bpp;
+ masks.red_mask = surface->format.direct.red_mask << surface->format.direct.red_shift;
+ masks.green_mask = surface->format.direct.green_mask << surface->format.direct.green_shift;
+ masks.blue_mask = surface->format.direct.blue_mask << surface->format.direct.blue_shift;
+ masks.alpha_mask = surface->format.direct.alpha_mask << surface->format.direct.alpha_shift;
} else {
+ masks.bpp = bpp;
+ masks.red_mask = 0;
+ masks.green_mask = 0;
+ masks.blue_mask = 0;
+ if (surface->depth < 32)
+ masks.alpha_mask = (1 << surface->depth) - 1;
+ else
+ masks.alpha_mask = 0xffffffff;
+ }
+
+ /*
+ * Prefer to use a standard pixman format instead of the
+ * general masks case.
+ */
+ if (_CAIRO_MASK_FORMAT (&masks, &format)) {
image = (cairo_image_surface_t *)
- cairo_image_surface_create_for_data (XCBGetImageData(imagerep),
- surface->format,
+ cairo_image_surface_create_for_data (data,
+ format,
x2 - x1,
y2 - y1,
- bytes_per_line(surface->dpy, surface->width, bpp));
+ bytes_per_line);
+ } else {
+ /*
+ * XXX This can't work. We must convert the data to one of the
+ * supported pixman formats. Pixman needs another function
+ * which takes data in an arbitrary format and converts it
+ * to something supported by that library.
+ */
+ image = _cairo_image_surface_create_with_masks (data,
+ &masks,
+ x2 - x1,
+ y2 - y1,
+ bytes_per_line);
+
}
/* Let the surface take ownership of the data */
- /* XXX: Can probably come up with a cleaner API here. */
_cairo_image_surface_assume_ownership_of_data (image);
- /* FIXME: imagerep can't be freed correctly, I think. must copy. :-( */
-
- _cairo_image_surface_set_repeat (image, surface->base.repeat);
- _cairo_image_surface_set_matrix (image, &(surface->base.matrix));
*image_out = image;
return CAIRO_STATUS_SUCCESS;
@@ -443,8 +543,8 @@ _draw_image_surface (cairo_xcb_surface_t *surface,
int bpp, data_len;
_cairo_xcb_surface_ensure_gc (surface);
- bpp = bits_per_pixel(surface->dpy, image->depth);
- data_len = bytes_per_line(surface->dpy, image->width, bpp) * image->height;
+ bpp = _bits_per_pixel(surface->dpy, image->depth);
+ data_len = _bytes_per_line(surface->dpy, image->width, bpp) * image->height;
XCBPutImage(surface->dpy, ZPixmap, surface->drawable, surface->gc,
image->width,
image->height,
@@ -465,15 +565,12 @@ _cairo_xcb_surface_acquire_source_image (void *abstract_surfa
cairo_status_t status;
status = _get_image_surface (surface, NULL, &image, NULL);
- if (status == CAIRO_STATUS_SUCCESS) {
- cairo_surface_set_filter (&image->base, surface->base.filter);
- cairo_surface_set_matrix (&image->base, &surface->base.matrix);
- cairo_surface_set_repeat (&image->base, surface->base.repeat);
+ if (status)
+ return status;
- *image_out = image;
- }
+ *image_out = image;
- return status;
+ return CAIRO_STATUS_SUCCESS;
}
static void
@@ -496,10 +593,12 @@ _cairo_xcb_surface_acquire_dest_image (void *abstract_surface
cairo_status_t status;
status = _get_image_surface (surface, interest_rect, &image, image_rect_out);
- if (status == CAIRO_STATUS_SUCCESS)
- *image_out = image;
+ if (status)
+ return status;
- return status;
+ *image_out = image;
+
+ return CAIRO_STATUS_SUCCESS;
}
static void
@@ -538,7 +637,7 @@ _cairo_xcb_surface_clone_similar (void *abstract_surface,
cairo_image_surface_t *image_src = (cairo_image_surface_t *)src;
clone = (cairo_xcb_surface_t *)
- _cairo_xcb_surface_create_similar (surface, image_src->format, 0,
+ _cairo_xcb_surface_create_similar (surface, image_src->format,
image_src->width, image_src->height);
if (clone == NULL)
return CAIRO_STATUS_NO_MEMORY;
@@ -562,13 +661,13 @@ _cairo_xcb_surface_set_matrix (cairo_xcb_surface_t *surface,
if (!surface->picture.xid)
return CAIRO_STATUS_SUCCESS;
- xtransform.matrix11 = _cairo_fixed_from_double (matrix->m[0][0]);
- xtransform.matrix12 = _cairo_fixed_from_double (matrix->m[1][0]);
- xtransform.matrix13 = _cairo_fixed_from_double (matrix->m[2][0]);
+ xtransform.matrix11 = _cairo_fixed_from_double (matrix->xx);
+ xtransform.matrix12 = _cairo_fixed_from_double (matrix->xy);
+ xtransform.matrix13 = _cairo_fixed_from_double (matrix->x0);
- xtransform.matrix21 = _cairo_fixed_from_double (matrix->m[0][1]);
- xtransform.matrix22 = _cairo_fixed_from_double (matrix->m[1][1]);
- xtransform.matrix23 = _cairo_fixed_from_double (matrix->m[2][1]);
+ xtransform.matrix21 = _cairo_fixed_from_double (matrix->yx);
+ xtransform.matrix22 = _cairo_fixed_from_double (matrix->yy);
+ xtransform.matrix23 = _cairo_fixed_from_double (matrix->y0);
xtransform.matrix31 = 0;
xtransform.matrix32 = 0;
@@ -685,25 +784,25 @@ _render_operator (cairo_operator_t operator)
switch (operator) {
case CAIRO_OPERATOR_CLEAR:
return XCBRenderPictOpClear;
- case CAIRO_OPERATOR_SRC:
+ case CAIRO_OPERATOR_SOURCE:
return XCBRenderPictOpSrc;
- case CAIRO_OPERATOR_DST:
+ case CAIRO_OPERATOR_DEST:
return XCBRenderPictOpDst;
case CAIRO_OPERATOR_OVER:
return XCBRenderPictOpOver;
- case CAIRO_OPERATOR_OVER_REVERSE:
+ case CAIRO_OPERATOR_DEST_OVER:
return XCBRenderPictOpOverReverse;
case CAIRO_OPERATOR_IN:
return XCBRenderPictOpIn;
- case CAIRO_OPERATOR_IN_REVERSE:
+ case CAIRO_OPERATOR_DEST_IN:
return XCBRenderPictOpInReverse;
case CAIRO_OPERATOR_OUT:
return XCBRenderPictOpOut;
- case CAIRO_OPERATOR_OUT_REVERSE:
+ case CAIRO_OPERATOR_DEST_OUT:
return XCBRenderPictOpOutReverse;
case CAIRO_OPERATOR_ATOP:
return XCBRenderPictOpAtop;
- case CAIRO_OPERATOR_ATOP_REVERSE:
+ case CAIRO_OPERATOR_DEST_ATOP:
return XCBRenderPictOpAtopReverse;
case CAIRO_OPERATOR_XOR:
return XCBRenderPictOpXor;
@@ -751,12 +850,12 @@ _cairo_xcb_surface_composite (cairo_operator_t operator,
return status;
status = _cairo_xcb_surface_set_attributes (src, &src_attr);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
{
if (mask)
{
status = _cairo_xcb_surface_set_attributes (mask, &mask_attr);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
XCBRenderComposite (dst->dpy,
_render_operator (operator),
src->picture,
@@ -840,6 +939,7 @@ _cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator,
cairo_int_status_t status;
int render_reference_x, render_reference_y;
int render_src_x, render_src_y;
+ XCBRenderPICTFORMINFO render_format;
if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -863,13 +963,14 @@ _cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator,
render_src_y = src_y + render_reference_y - dst_y;
/* XXX: The XTrapezoid cast is evil and needs to go away somehow. */
- /* XXX: format_from_cairo is slow. should cache something. */
+ /* XXX: _format_from_cairo is slow. should cache something. */
+ render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
status = _cairo_xcb_surface_set_attributes (src, &attributes);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
XCBRenderTrapezoids (dst->dpy,
_render_operator (operator),
src->picture, dst->picture,
- format_from_cairo (dst->dpy, CAIRO_FORMAT_A8),
+ render_format.id,
render_src_x + attributes.x_offset,
render_src_y + attributes.y_offset,
num_traps, (XCBRenderTRAP *) traps);
@@ -880,29 +981,23 @@ _cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator,
}
static cairo_int_status_t
-_cairo_xcb_surface_copy_page (void *abstract_surface)
+_cairo_xcb_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
+ cairo_xcb_surface_t *surface = abstract_surface;
-static cairo_int_status_t
-_cairo_xcb_surface_show_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
+ rectangle->x = 0;
+ rectangle->y = 0;
-static cairo_int_status_t
-_cairo_xcb_surface_set_clip_region (void *abstract_surface,
- pixman_region16_t *region)
-{
- /* FIXME */
- return CAIRO_INT_STATUS_UNSUPPORTED;
+ rectangle->width = surface->width;
+ rectangle->height = surface->height;
+
+ return CAIRO_STATUS_SUCCESS;
}
static const cairo_surface_backend_t cairo_xcb_surface_backend = {
_cairo_xcb_surface_create_similar,
- _cairo_xcb_surface_destroy,
- _cairo_xcb_surface_pixels_per_inch,
+ _cairo_xcb_surface_finish,
_cairo_xcb_surface_acquire_source_image,
_cairo_xcb_surface_release_source_image,
_cairo_xcb_surface_acquire_dest_image,
@@ -911,12 +1006,28 @@ static const cairo_surface_backend_t cairo_xcb_surface_backend = {
_cairo_xcb_surface_composite,
_cairo_xcb_surface_fill_rectangles,
_cairo_xcb_surface_composite_trapezoids,
- _cairo_xcb_surface_copy_page,
- _cairo_xcb_surface_show_page,
- _cairo_xcb_surface_set_clip_region,
+ NULL, /* copy_page */
+ NULL, /* show_page */
+ NULL, /* _cairo_xcb_surface_set_clip_region */
+ NULL, /* intersect_clip_path */
+ _cairo_xcb_surface_get_extents,
NULL /* show_glyphs */
};
+/**
+ * _cairo_surface_is_xcb:
+ * @surface: a #cairo_surface_t
+ *
+ * Checks if a surface is a #cairo_xcb_surface_t
+ *
+ * Return value: True if the surface is an xcb surface
+ **/
+static cairo_bool_t
+_cairo_surface_is_xcb (cairo_surface_t *surface)
+{
+ return surface->backend == &cairo_xcb_surface_backend;
+}
+
static void
query_render_version (XCBConnection *c, cairo_xcb_surface_t *surface)
{
@@ -937,11 +1048,14 @@ query_render_version (XCBConnection *c, cairo_xcb_surface_t *surface)
free(r);
}
-cairo_surface_t *
-cairo_xcb_surface_create (XCBConnection *dpy,
- XCBDRAWABLE drawable,
- XCBVISUALTYPE *visual,
- cairo_format_t format)
+static cairo_surface_t *
+_cairo_xcb_surface_create_internal (XCBConnection *dpy,
+ XCBDRAWABLE drawable,
+ XCBVISUALTYPE *visual,
+ XCBRenderPICTFORMINFO *format,
+ int width,
+ int height,
+ int depth)
{
cairo_xcb_surface_t *surface;
@@ -952,27 +1066,199 @@ cairo_xcb_surface_create (XCBConnection *dpy,
_cairo_surface_init (&surface->base, &cairo_xcb_surface_backend);
surface->dpy = dpy;
+
surface->gc.xid = 0;
surface->drawable = drawable;
- surface->owns_pixmap = 0;
+ surface->owns_pixmap = FALSE;
surface->visual = visual;
- surface->format = format;
+ if (format) {
+ surface->format = *format;
+ surface->has_format = 1;
+ } else {
+ surface->format.id.xid = 0;
+ surface->has_format = 0;
+ }
+ surface->use_pixmap = 0;
+ surface->width = width;
+ surface->height = height;
+ surface->depth = depth;
+
+ if (format) {
+ surface->depth = format->depth;
+ } else if (visual) {
+ XCBSCREENIter roots;
+ XCBDEPTHIter depths;
+ XCBVISUALTYPEIter visuals;
+
+ /* This is ugly, but we have to walk over all visuals
+ * for the display to find the depth.
+ */
+ roots = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(surface->dpy));
+ for(; roots.rem; XCBSCREENNext(&roots))
+ {
+ depths = XCBSCREENAllowedDepthsIter(roots.data);
+ for(; depths.rem; XCBDEPTHNext(&depths))
+ {
+ visuals = XCBDEPTHVisualsIter(depths.data);
+ for(; visuals.rem; XCBVISUALTYPENext(&visuals))
+ {
+ if(visuals.data->visual_id.id == visual->visual_id.id)
+ {
+ surface->depth = depths.data->depth;
+ goto found;
+ }
+ }
+ }
+ }
+ found:
+ ;
+ }
query_render_version(dpy, surface);
+ surface->picture.xid = 0;
+
if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface))
{
- XCBRenderPICTFORMAT fmt;
- if(visual)
- fmt = format_from_visual (dpy, visual->visual_id);
- else
- fmt = format_from_cairo (dpy, format);
+ XCBRenderPICTFORMAT pict_format = {0};
+ XCBRenderPICTFORMINFO format_info;
+
surface->picture = XCBRenderPICTURENew(dpy);
- XCBRenderCreatePicture (dpy, surface->picture, drawable,
- fmt, 0, NULL);
+
+ if (!format) {
+ if (visual) {
+ pict_format = format_from_visual (dpy, visual->visual_id);
+ } else if (depth == 1) {
+ format_info = _format_from_cairo (dpy, CAIRO_FORMAT_A1);
+ pict_format = format_info.id;
+ }
+ XCBRenderCreatePicture (dpy, surface->picture, drawable,
+ pict_format, 0, NULL);
+ } else {
+ XCBRenderCreatePicture (dpy, surface->picture, drawable,
+ format->id, 0, NULL);
+ }
}
- else
- surface->picture.xid = 0;
return (cairo_surface_t *) surface;
}
+
+/**
+ * cairo_xcb_surface_create:
+ * @c: an XCB connection
+ * @drawable: an XCB drawable
+ * @visual: the visual to use for drawing to @drawable. The depth
+ * of the visual must match the depth of the drawable.
+ * Currently, only TrueColor visuals are fully supported.
+ * @width: the current width of @drawable.
+ * @height: the current height of @drawable.
+ *
+ * Creates an XCB surface that draws to the given drawable.
+ * The way that colors are represented in the drawable is specified
+ * by the provided visual.
+ *
+ * NOTE: If @drawable is a window, then the function
+ * cairo_xcb_surface_set_size must be called whenever the size of the
+ * window changes.
+ *
+ * Return value: the newly created surface
+ **/
+cairo_surface_t *
+cairo_xcb_surface_create (XCBConnection *c,
+ XCBDRAWABLE drawable,
+ XCBVISUALTYPE *visual,
+ int width,
+ int height)
+{
+ return _cairo_xcb_surface_create_internal (c, drawable,
+ visual, NULL,
+ width, height, 0);
+}
+
+/**
+ * cairo_xcb_surface_create_for_bitmap:
+ * @c: an XCB connection
+ * @bitmap: an XCB Pixmap (a depth-1 pixmap)
+ * @width: the current width of @bitmap
+ * @height: the current height of @bitmap
+ *
+ * Creates an XCB surface that draws to the given bitmap.
+ * This will be drawn to as a CAIRO_FORMAT_A1 object.
+ *
+ * Return value: the newly created surface
+ **/
+cairo_surface_t *
+cairo_xcb_surface_create_for_bitmap (XCBConnection *c,
+ XCBPIXMAP bitmap,
+ int width,
+ int height)
+{
+ XCBDRAWABLE drawable;
+ drawable.pixmap = bitmap;
+ return _cairo_xcb_surface_create_internal (c, drawable,
+ NULL, NULL,
+ width, height, 1);
+}
+
+/**
+ * cairo_xcb_surface_create_with_xrender_format:
+ * @c: an XCB connection
+ * @drawable: an XCB drawable
+ * @format: the picture format to use for drawing to @drawable. The
+ * depth of @format mush match the depth of the drawable.
+ * @width: the current width of @drawable
+ * @height: the current height of @drawable
+ *
+ * Creates an XCB surface that draws to the given drawable.
+ * The way that colors are represented in the drawable is specified
+ * by the provided picture format.
+ *
+ * NOTE: If @drawable is a Window, then the function
+ * cairo_xlib_surface_set_size must be called whenever the size of the
+ * window changes.
+ *
+ * Return value: the newly created surface.
+ **/
+cairo_surface_t *
+cairo_xcb_surface_create_with_xrender_format (XCBConnection *c,
+ XCBDRAWABLE drawable,
+ XCBRenderPICTFORMINFO *format,
+ int width,
+ int height)
+{
+ return _cairo_xcb_surface_create_internal (c, drawable,
+ NULL, format,
+ width, height, 0);
+}
+
+/**
+ * cairo_xcb_surface_set_size:
+ * @surface: a #cairo_surface_t for the XCB backend
+ * @width: the new width of the surface
+ * @height: the new height of the surface
+ *
+ * Informs cairo of the new size of the XCB drawable underlying the
+ * surface. For a surface created for a window (rather than a pixmap),
+ * this function must be called each time the size of the window
+ * changes. (For a subwindow, you are normally resizing the window
+ * yourself, but for a toplevel window, it is necessary to listen for
+ * ConfigureNotify events.)
+ *
+ * A pixmap can never change size, so it is never necessary to call
+ * this function on a surface created for a pixmap.
+ **/
+void
+cairo_xcb_surface_set_size (cairo_surface_t *surface,
+ int width,
+ int height)
+{
+ cairo_xcb_surface_t *xcb_surface = (cairo_xcb_surface_t *)surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _cairo_surface_is_xcb (surface))
+ return;
+
+ xcb_surface->width = width;
+ xcb_surface->height = height;
+}
+
diff --git a/src/cairo-xcb-xrender.h b/src/cairo-xcb-xrender.h
new file mode 100644
index 0000000..ef4baa9
--- /dev/null
+++ b/src/cairo-xcb-xrender.h
@@ -0,0 +1,62 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2002 University of Southern California
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is University of Southern
+ * California.
+ *
+ * Contributor(s):
+ * Carl D. Worth <cworth@cworth.org>
+ */
+
+#ifndef CAIRO_XCB_XRENDER_H
+#define CAIRO_XCB_XRENDER_H
+
+#include <cairo.h>
+
+#if CAIRO_HAS_XCB_SURFACE
+
+#include <X11/XCB/xcb.h>
+#include <X11/XCB/render.h>
+
+CAIRO_BEGIN_DECLS
+
+cairo_surface_t *
+cairo_xcb_surface_create_with_xrender_format (XCBConnection *c,
+ XCBDRAWABLE drawable,
+ XCBRenderPICTFORMINFO *format,
+ int width,
+ int height);
+
+CAIRO_END_DECLS
+
+#else /* CAIRO_HAS_XCB_SURFACE */
+# error Cairo was not compiled with support for the xcb backend
+#endif /* CAIRO_HAS_XCB_SURFACE */
+
+#endif /* CAIRO_XCB_XRENDER_H */
diff --git a/src/cairo-xcb.h b/src/cairo-xcb.h
index a5c65f4..17dfafa 100644
--- a/src/cairo-xcb.h
+++ b/src/cairo-xcb.h
@@ -39,21 +39,34 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_XCB_SURFACE
+#if CAIRO_HAS_XCB_SURFACE
#include <X11/XCB/xcb.h>
-#include <X11/XCB/render.h>
CAIRO_BEGIN_DECLS
+cairo_surface_t *
+cairo_xcb_surface_create (XCBConnection *c,
+ XCBDRAWABLE drawable,
+ XCBVISUALTYPE *visual,
+ int width,
+ int height);
+
+cairo_surface_t *
+cairo_xcb_surface_create_for_bitmap (XCBConnection *c,
+ XCBPIXMAP bitmap,
+ int width,
+ int height);
+
void
-cairo_set_target_xcb (cairo_t *cr,
- XCBConnection *dpy,
- XCBDRAWABLE drawable,
- XCBVISUALTYPE *visual,
- cairo_format_t format);
+cairo_xcb_surface_set_size (cairo_surface_t *surface,
+ int width,
+ int height);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_XCB_SURFACE */
+# error Cairo was not compiled with support for the xcb backend
#endif /* CAIRO_HAS_XCB_SURFACE */
+
#endif /* CAIRO_XCB_H */
diff --git a/src/cairo_xlib_surface.c b/src/cairo-xlib-surface.c
index 3eaef57..f06d409 100644
--- a/src/cairo_xlib_surface.c
+++ b/src/cairo-xlib-surface.c
@@ -36,66 +36,71 @@
#include "cairoint.h"
#include "cairo-xlib.h"
+#include "cairo-xlib-xrender.h"
+#include "cairo-xlib-test.h"
+#include <X11/extensions/Xrender.h>
-/**
- * cairo_set_target_drawable:
- * @cr: a #cairo_t
- * @dpy: an X display
- * @drawable: a window or pixmap on the default screen of @dpy
- *
- * Directs output for a #cairo_t to an Xlib drawable. @drawable must
- * be a Window or Pixmap on the default screen of @dpy using the
- * default colormap and visual. Using this function is slow because
- * the function must retrieve information about @drawable from the X
- * server.
-
- * The combination of cairo_xlib_surface_create() and
- * cairo_set_target_surface() is somewhat more flexible, although
- * it still is slow.
- **/
-void
-cairo_set_target_drawable (cairo_t *cr,
- Display *dpy,
- Drawable drawable)
-{
- cairo_surface_t *surface;
+/* Xlib doesn't define a typedef, so define one ourselves */
+typedef int (*cairo_xlib_error_func_t) (Display *display,
+ XErrorEvent *event);
- if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
- return;
+typedef struct _cairo_xlib_surface cairo_xlib_surface_t;
- surface = cairo_xlib_surface_create (dpy, drawable,
- DefaultVisual (dpy, DefaultScreen (dpy)),
- 0,
- DefaultColormap (dpy, DefaultScreen (dpy)));
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
+static void
+_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
- cairo_set_target_surface (cr, surface);
+static void
+_cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface);
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy (surface);
-}
+static void
+_cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface);
-typedef struct _cairo_xlib_surface {
+static cairo_bool_t
+_cairo_surface_is_xlib (cairo_surface_t *surface);
+
+/*
+ * Instead of taking two round trips for each blending request,
+ * assume that if a particular drawable fails GetImage that it will
+ * fail for a "while"; use temporary pixmaps to avoid the errors
+ */
+
+#define CAIRO_ASSUME_PIXMAP 20
+
+struct _cairo_xlib_surface {
cairo_surface_t base;
Display *dpy;
GC gc;
Drawable drawable;
- int owns_pixmap;
+ cairo_bool_t owns_pixmap;
Visual *visual;
- cairo_format_t format;
+
+ int use_pixmap;
int render_major;
int render_minor;
+ /* TRUE if the server has a bug with repeating pictures
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=3566
+ *
+ * We can't test for this because it depends on whether the
+ * picture is in video memory or not.
+ */
+ cairo_bool_t buggy_repeat;
+
int width;
int height;
+ int depth;
+
+ Picture dst_picture, src_picture;
- Picture picture;
-} cairo_xlib_surface_t;
+ cairo_bool_t have_clip_rects;
+ XRectangle *clip_rects;
+ int num_clip_rects;
+
+ XRenderPictFormat *format;
+};
#define CAIRO_SURFACE_RENDER_AT_LEAST(surface, major, minor) \
(((surface)->render_major > major) || \
@@ -120,6 +125,25 @@ typedef struct _cairo_xlib_surface {
#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
+static cairo_bool_t cairo_xlib_render_disabled = FALSE;
+
+/**
+ * cairo_test_xlib_disable_render:
+ *
+ * Disables the use of the RENDER extension.
+ *
+ * <note>
+ * This function is <emphasis>only</emphasis> intended for internal
+ * testing use within the cairo distribution. It is not installed in
+ * any public header file.
+ * </note>
+ **/
+void
+cairo_test_xlib_disable_render (void)
+{
+ cairo_xlib_render_disabled = TRUE;
+}
+
static int
_CAIRO_FORMAT_DEPTH (cairo_format_t format)
{
@@ -136,20 +160,27 @@ _CAIRO_FORMAT_DEPTH (cairo_format_t format)
}
}
-static cairo_surface_t *
-_cairo_xlib_surface_create_with_size (Display *dpy,
- Drawable drawable,
- Visual *visual,
- cairo_format_t format,
- Colormap colormap,
- int width,
- int height);
-
+static XRenderPictFormat *
+_CAIRO_FORMAT_XRENDER_FORMAT(Display *dpy, cairo_format_t format)
+{
+ int pict_format;
+ switch (format) {
+ case CAIRO_FORMAT_A1:
+ pict_format = PictStandardA1; break;
+ case CAIRO_FORMAT_A8:
+ pict_format = PictStandardA8; break;
+ case CAIRO_FORMAT_RGB24:
+ pict_format = PictStandardRGB24; break;
+ case CAIRO_FORMAT_ARGB32:
+ default:
+ pict_format = PictStandardARGB32; break;
+ }
+ return XRenderFindStandardFormat (dpy, pict_format);
+}
static cairo_surface_t *
_cairo_xlib_surface_create_similar (void *abstract_src,
cairo_format_t format,
- int drawable,
int width,
int height)
{
@@ -158,6 +189,9 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
int scr;
Pixmap pix;
cairo_xlib_surface_t *surface;
+ int depth = _CAIRO_FORMAT_DEPTH (format);
+ XRenderPictFormat *xrender_format = _CAIRO_FORMAT_XRENDER_FORMAT (dpy,
+ format);
/* As a good first approximation, if the display doesn't have COMPOSITE,
* we're better off using image surfaces for all temporary operations
@@ -170,26 +204,27 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
pix = XCreatePixmap (dpy, DefaultRootWindow (dpy),
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
- _CAIRO_FORMAT_DEPTH (format));
+ depth);
surface = (cairo_xlib_surface_t *)
- _cairo_xlib_surface_create_with_size (dpy, pix, NULL, format,
- DefaultColormap (dpy, scr),
- width, height);
- surface->owns_pixmap = 1;
-
- surface->width = width;
- surface->height = height;
+ cairo_xlib_surface_create_with_xrender_format (dpy, pix,
+ xrender_format,
+ width, height);
+
+ surface->owns_pixmap = TRUE;
return &surface->base;
}
-static void
-_cairo_xlib_surface_destroy (void *abstract_surface)
+static cairo_status_t
+_cairo_xlib_surface_finish (void *abstract_surface)
{
cairo_xlib_surface_t *surface = abstract_surface;
- if (surface->picture)
- XRenderFreePicture (surface->dpy, surface->picture);
+ if (surface->dst_picture)
+ XRenderFreePicture (surface->dpy, surface->dst_picture);
+
+ if (surface->src_picture)
+ XRenderFreePicture (surface->dpy, surface->src_picture);
if (surface->owns_pixmap)
XFreePixmap (surface->dpy, surface->drawable);
@@ -197,16 +232,59 @@ _cairo_xlib_surface_destroy (void *abstract_surface)
if (surface->gc)
XFreeGC (surface->dpy, surface->gc);
- surface->dpy = 0;
+ if (surface->clip_rects)
+ free (surface->clip_rects);
+
+ surface->dpy = NULL;
- free (surface);
+ return CAIRO_STATUS_SUCCESS;
}
-static double
-_cairo_xlib_surface_pixels_per_inch (void *abstract_surface)
+static int
+_noop_error_handler (Display *display,
+ XErrorEvent *event)
{
- /* XXX: We should really get this value from somewhere like Xft.dpy */
- return 96.0;
+ return False; /* return value is ignored */
+}
+
+static cairo_bool_t
+_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
+{
+ switch (masks->bpp) {
+ case 32:
+ if (masks->alpha_mask == 0xff000000 &&
+ masks->red_mask == 0x00ff0000 &&
+ masks->green_mask == 0x0000ff00 &&
+ masks->blue_mask == 0x000000ff)
+ {
+ *format = CAIRO_FORMAT_ARGB32;
+ return True;
+ }
+ if (masks->alpha_mask == 0x00000000 &&
+ masks->red_mask == 0x00ff0000 &&
+ masks->green_mask == 0x0000ff00 &&
+ masks->blue_mask == 0x000000ff)
+ {
+ *format = CAIRO_FORMAT_RGB24;
+ return True;
+ }
+ break;
+ case 8:
+ if (masks->alpha_mask == 0xff)
+ {
+ *format = CAIRO_FORMAT_A8;
+ return True;
+ }
+ break;
+ case 1:
+ if (masks->alpha_mask == 0x1)
+ {
+ *format = CAIRO_FORMAT_A1;
+ return True;
+ }
+ break;
+ }
+ return False;
}
static cairo_status_t
@@ -217,15 +295,9 @@ _get_image_surface (cairo_xlib_surface_t *surface,
{
cairo_image_surface_t *image;
XImage *ximage;
- Window root_ignore;
- int x_ignore, y_ignore, bwidth_ignore, depth_ignore;
int x1, y1, x2, y2;
-
- XGetGeometry (surface->dpy,
- surface->drawable,
- &root_ignore, &x_ignore, &y_ignore,
- &surface->width, &surface->height,
- &bwidth_ignore, &depth_ignore);
+ cairo_format_masks_t masks;
+ cairo_format_t format;
x1 = 0;
y1 = 0;
@@ -233,14 +305,21 @@ _get_image_surface (cairo_xlib_surface_t *surface,
y2 = surface->height;
if (interest_rect) {
- if (interest_rect->x > x1)
- x1 = interest_rect->x;
- if (interest_rect->y > y1)
- y1 = interest_rect->y;
- if (interest_rect->x + interest_rect->width < x2)
- x2 = interest_rect->x + interest_rect->width;
- if (interest_rect->y + interest_rect->height < y2)
- y2 = interest_rect->y + interest_rect->height;
+ cairo_rectangle_t rect;
+
+ rect.x = interest_rect->x;
+ rect.y = interest_rect->y;
+ rect.width = interest_rect->width;
+ rect.height = interest_rect->height;
+
+ if (rect.x > x1)
+ x1 = rect.x;
+ if (rect.y > y1)
+ y1 = rect.y;
+ if (rect.x + rect.width < x2)
+ x2 = rect.x + rect.width;
+ if (rect.y + rect.height < y2)
+ y2 = rect.y + rect.height;
if (x1 >= x2 || y1 >= y2) {
*image_out = NULL;
@@ -255,36 +334,118 @@ _get_image_surface (cairo_xlib_surface_t *surface,
image_rect->height = y2 - y1;
}
- /* XXX: This should try to use the XShm extension if availible */
- ximage = XGetImage (surface->dpy,
- surface->drawable,
- x1, y1,
- x2 - x1, y2 - y1,
- AllPlanes, ZPixmap);
+ /* XXX: This should try to use the XShm extension if available */
- if (surface->visual) {
- cairo_format_masks_t masks;
+ if (surface->use_pixmap == 0)
+ {
+ cairo_xlib_error_func_t old_handler;
- /* XXX: Add support here for pictures with external alpha? */
+ old_handler = XSetErrorHandler (_noop_error_handler);
+
+ ximage = XGetImage (surface->dpy,
+ surface->drawable,
+ x1, y1,
+ x2 - x1, y2 - y1,
+ AllPlanes, ZPixmap);
+ XSetErrorHandler (old_handler);
+
+ /* If we get an error, the surface must have been a window,
+ * so retry with the safe code path.
+ */
+ if (!ximage)
+ surface->use_pixmap = CAIRO_ASSUME_PIXMAP;
+ }
+ else
+ {
+ surface->use_pixmap--;
+ ximage = 0;
+ }
+
+ if (!ximage)
+ {
+
+ /* XGetImage from a window is dangerous because it can
+ * produce errors if the window is unmapped or partially
+ * outside the screen. We could check for errors and
+ * retry, but to keep things simple, we just create a
+ * temporary pixmap
+ */
+ Pixmap pixmap = XCreatePixmap (surface->dpy,
+ surface->drawable,
+ x2 - x1, y2 - y1,
+ surface->depth);
+ _cairo_xlib_surface_ensure_gc (surface);
+
+ XCopyArea (surface->dpy, surface->drawable, pixmap, surface->gc,
+ x1, y1, x2 - x1, y2 - y1, 0, 0);
+
+ ximage = XGetImage (surface->dpy,
+ pixmap,
+ 0, 0,
+ x2 - x1, y2 - y1,
+ AllPlanes, ZPixmap);
+
+ XFreePixmap (surface->dpy, pixmap);
+ }
+ if (!ximage)
+ return CAIRO_STATUS_NO_MEMORY;
+
+ /*
+ * Compute the pixel format masks from either a visual or a
+ * XRenderFormat, failing we assume the drawable is an
+ * alpha-only pixmap as it could only have been created
+ * that way through the cairo_xlib_surface_create_for_bitmap
+ * function.
+ */
+ if (surface->visual) {
masks.bpp = ximage->bits_per_pixel;
masks.alpha_mask = 0;
masks.red_mask = surface->visual->red_mask;
masks.green_mask = surface->visual->green_mask;
masks.blue_mask = surface->visual->blue_mask;
+ } else if (surface->format) {
+ masks.bpp = ximage->bits_per_pixel;
+ masks.red_mask = surface->format->direct.redMask << surface->format->direct.red;
+ masks.green_mask = surface->format->direct.greenMask << surface->format->direct.green;
+ masks.blue_mask = surface->format->direct.blueMask << surface->format->direct.blue;
+ masks.alpha_mask = surface->format->direct.alphaMask << surface->format->direct.alpha;
+ } else {
+ masks.bpp = ximage->bits_per_pixel;
+ masks.red_mask = 0;
+ masks.green_mask = 0;
+ masks.blue_mask = 0;
+ if (surface->depth < 32)
+ masks.alpha_mask = (1 << surface->depth) - 1;
+ else
+ masks.alpha_mask = 0xffffffff;
+ }
- image = _cairo_image_surface_create_with_masks (ximage->data,
+ /*
+ * Prefer to use a standard pixman format instead of the
+ * general masks case.
+ */
+ if (_CAIRO_MASK_FORMAT (&masks, &format))
+ {
+ image = (cairo_image_surface_t *) cairo_image_surface_create_for_data ((unsigned char *) ximage->data,
+ format,
+ ximage->width,
+ ximage->height,
+ ximage->bytes_per_line);
+ }
+ else
+ {
+ /*
+ * XXX This can't work. We must convert the data to one of the
+ * supported pixman formats. Pixman needs another function
+ * which takes data in an arbitrary format and converts it
+ * to something supported by that library.
+ */
+ image = _cairo_image_surface_create_with_masks ((unsigned char *) ximage->data,
&masks,
ximage->width,
ximage->height,
ximage->bytes_per_line);
- } else {
- image = (cairo_image_surface_t *)
- cairo_image_surface_create_for_data (ximage->data,
- surface->format,
- ximage->width,
- ximage->height,
- ximage->bytes_per_line);
}
/* Let the surface take ownership of the data */
@@ -293,20 +454,65 @@ _get_image_surface (cairo_xlib_surface_t *surface,
ximage->data = NULL;
XDestroyImage (ximage);
- _cairo_image_surface_set_repeat (image, surface->base.repeat);
- _cairo_image_surface_set_matrix (image, &(surface->base.matrix));
-
*image_out = image;
return CAIRO_STATUS_SUCCESS;
}
static void
+_cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface)
+{
+ if (!surface->src_picture)
+ surface->src_picture = XRenderCreatePicture (surface->dpy,
+ surface->drawable,
+ surface->format,
+ 0, NULL);
+}
+
+static void
+_cairo_xlib_surface_set_picture_clip_rects (cairo_xlib_surface_t *surface)
+{
+ if (surface->have_clip_rects)
+ XRenderSetPictureClipRectangles (surface->dpy, surface->dst_picture,
+ 0, 0,
+ surface->clip_rects,
+ surface->num_clip_rects);
+}
+
+static void
+_cairo_xlib_surface_set_gc_clip_rects (cairo_xlib_surface_t *surface)
+{
+ if (surface->have_clip_rects)
+ XSetClipRectangles(surface->dpy, surface->gc,
+ 0, 0,
+ surface->clip_rects,
+ surface->num_clip_rects, YXSorted);
+}
+
+static void
+_cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface)
+{
+ if (!surface->dst_picture) {
+ surface->dst_picture = XRenderCreatePicture (surface->dpy,
+ surface->drawable,
+ surface->format,
+ 0, NULL);
+ _cairo_xlib_surface_set_picture_clip_rects (surface);
+ }
+
+}
+
+static void
_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface)
{
+ XGCValues gcv;
+
if (surface->gc)
return;
- surface->gc = XCreateGC (surface->dpy, surface->drawable, 0, NULL);
+ gcv.graphics_exposures = False;
+ surface->gc = XCreateGC (surface->dpy, surface->drawable,
+ GCGraphicsExposures, &gcv);
+ _cairo_xlib_surface_set_gc_clip_rects (surface);
}
static cairo_status_t
@@ -318,6 +524,7 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
XImage *ximage;
unsigned bitmap_pad;
+ /* XXX this is wrong */
if (image->depth > 16)
bitmap_pad = 32;
else if (image->depth > 8)
@@ -330,7 +537,7 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
image->depth,
ZPixmap,
0,
- image->data,
+ (char *) image->data,
image->width,
image->height,
bitmap_pad,
@@ -362,15 +569,12 @@ _cairo_xlib_surface_acquire_source_image (void *abstract_surf
cairo_status_t status;
status = _get_image_surface (surface, NULL, &image, NULL);
- if (status == CAIRO_STATUS_SUCCESS) {
- cairo_surface_set_filter (&image->base, surface->base.filter);
- cairo_surface_set_matrix (&image->base, &surface->base.matrix);
- cairo_surface_set_repeat (&image->base, surface->base.repeat);
+ if (status)
+ return status;
- *image_out = image;
- }
+ *image_out = image;
- return status;
+ return CAIRO_STATUS_SUCCESS;
}
static void
@@ -393,10 +597,12 @@ _cairo_xlib_surface_acquire_dest_image (void *abstract_surfac
cairo_status_t status;
status = _get_image_surface (surface, interest_rect, &image, image_rect_out);
- if (status == CAIRO_STATUS_SUCCESS)
- *image_out = image;
+ if (status)
+ return status;
- return status;
+ *image_out = image;
+
+ return CAIRO_STATUS_SUCCESS;
}
static void
@@ -435,7 +641,7 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
cairo_image_surface_t *image_src = (cairo_image_surface_t *)src;
clone = (cairo_xlib_surface_t *)
- _cairo_xlib_surface_create_similar (surface, image_src->format, 0,
+ _cairo_xlib_surface_create_similar (surface, image_src->format,
image_src->width, image_src->height);
if (clone == NULL)
return CAIRO_STATUS_NO_MEMORY;
@@ -456,16 +662,16 @@ _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
{
XTransform xtransform;
- if (!surface->picture)
+ if (!surface->src_picture)
return CAIRO_STATUS_SUCCESS;
- xtransform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]);
- xtransform.matrix[0][1] = _cairo_fixed_from_double (matrix->m[1][0]);
- xtransform.matrix[0][2] = _cairo_fixed_from_double (matrix->m[2][0]);
+ xtransform.matrix[0][0] = _cairo_fixed_from_double (matrix->xx);
+ xtransform.matrix[0][1] = _cairo_fixed_from_double (matrix->xy);
+ xtransform.matrix[0][2] = _cairo_fixed_from_double (matrix->x0);
- xtransform.matrix[1][0] = _cairo_fixed_from_double (matrix->m[0][1]);
- xtransform.matrix[1][1] = _cairo_fixed_from_double (matrix->m[1][1]);
- xtransform.matrix[1][2] = _cairo_fixed_from_double (matrix->m[2][1]);
+ xtransform.matrix[1][0] = _cairo_fixed_from_double (matrix->yx);
+ xtransform.matrix[1][1] = _cairo_fixed_from_double (matrix->yy);
+ xtransform.matrix[1][2] = _cairo_fixed_from_double (matrix->y0);
xtransform.matrix[2][0] = 0;
xtransform.matrix[2][1] = 0;
@@ -485,7 +691,7 @@ _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
- XRenderSetPictureTransform (surface->dpy, surface->picture, &xtransform);
+ XRenderSetPictureTransform (surface->dpy, surface->src_picture, &xtransform);
return CAIRO_STATUS_SUCCESS;
}
@@ -496,7 +702,7 @@ _cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface,
{
char *render_filter;
- if (!surface->picture)
+ if (!surface->src_picture)
return CAIRO_STATUS_SUCCESS;
if (!CAIRO_SURFACE_RENDER_HAS_FILTERS (surface))
@@ -528,7 +734,7 @@ _cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface,
break;
}
- XRenderSetPictureFilter (surface->dpy, surface->picture,
+ XRenderSetPictureFilter (surface->dpy, surface->src_picture,
render_filter, NULL, 0);
return CAIRO_STATUS_SUCCESS;
@@ -540,13 +746,13 @@ _cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat)
XRenderPictureAttributes pa;
unsigned long mask;
- if (!surface->picture)
+ if (!surface->src_picture)
return CAIRO_STATUS_SUCCESS;
mask = CPRepeat;
pa.repeat = repeat;
- XRenderChangePicture (surface->dpy, surface->picture, mask, &pa);
+ XRenderChangePicture (surface->dpy, surface->src_picture, mask, &pa);
return CAIRO_STATUS_SUCCESS;
}
@@ -557,6 +763,8 @@ _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t *surface,
{
cairo_int_status_t status;
+ _cairo_xlib_surface_ensure_src_picture (surface);
+
status = _cairo_xlib_surface_set_matrix (surface, &attributes->matrix);
if (status)
return status;
@@ -579,32 +787,168 @@ _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t *surface,
return CAIRO_STATUS_SUCCESS;
}
+/* Checks whether we can can directly draw from src to dst with
+ * the core protocol: either with CopyArea or using src as a
+ * a tile in a GC.
+ */
+static cairo_bool_t
+_surfaces_compatible (cairo_xlib_surface_t *src,
+ cairo_xlib_surface_t *dst)
+{
+
+ if (src->dpy != dst->dpy)
+ return FALSE;
+
+ /* We must not only match depth and format/visual, we must also
+ * match screen. We don't have that information, and rather than
+ * asking for it round-trip, we'll just return FALSE if we have
+ * more than one screen on the display.
+ */
+ if (ScreenCount (dst->dpy) > 1)
+ return FALSE;
+
+ return (src->depth == dst->depth &&
+ ((src->format != NULL && src->format == dst->format) ||
+ (src->visual != NULL && src->visual == dst->visual)));
+}
+
+static cairo_bool_t
+_surface_has_alpha (cairo_xlib_surface_t *surface)
+{
+ if (surface->format) {
+ if (surface->format->type == PictTypeDirect &&
+ surface->format->direct.alphaMask != 0)
+ return TRUE;
+ else
+ return FALSE;
+ } else {
+
+ /* In the no-render case, we never have alpha */
+ return FALSE;
+ }
+}
+
+/* There is a bug in most older X servers with compositing using a repeating
+ * source pattern when the source is in off-screen video memory. When that
+ * bug could be triggered, we need a fallback: in the common case where we have no
+ * transformation and the source and destination have the same format/visual,
+ * we can do the operation using the core protocol, otherwise, we need
+ * a software fallback.
+ */
+typedef enum {
+ DO_RENDER, /* use render */
+ DO_XLIB, /* core protocol fallback */
+ DO_UNSUPPORTED /* software fallback */
+} composite_operation_t;
+
+/* Initial check for the bug; we need to recheck after we turn
+ * patterns into surfaces, since that may introduce a repeating
+ * pattern for gradient patterns.
+ *
+ * All we do here is reject cases where we *know* are going to
+ * hit the bug and won't be able to use a core protocol fallback.
+ */
+static composite_operation_t
+_categorize_composite_repeat (cairo_xlib_surface_t *dst,
+ cairo_operator_t operator,
+ cairo_pattern_t *src_pattern,
+ cairo_bool_t have_mask)
+
+{
+ if (!dst->buggy_repeat)
+ return DO_RENDER;
+
+ if (src_pattern->type == CAIRO_PATTERN_SURFACE)
+ {
+ cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *)src_pattern;
+
+ if (_cairo_matrix_is_integer_translation (&src_pattern->matrix, NULL, NULL) &&
+ src_pattern->extend == CAIRO_EXTEND_REPEAT)
+ {
+ /* This is the case where we have a bug; reject some cases where a
+ * core protocol fallback is impossible.
+ */
+ if (have_mask ||
+ !(operator == CAIRO_OPERATOR_SOURCE || operator == CAIRO_OPERATOR_OVER))
+ return DO_UNSUPPORTED;
+
+ if (_cairo_surface_is_xlib (surface_pattern->surface)) {
+ cairo_xlib_surface_t *src = (cairo_xlib_surface_t *)surface_pattern->surface;
+
+ if (operator == CAIRO_OPERATOR_OVER && _surface_has_alpha (src))
+ return DO_UNSUPPORTED;
+
+ if (src->dpy == dst->dpy && !_surfaces_compatible (src, dst))
+ return DO_UNSUPPORTED;
+ }
+ }
+ }
+
+ return DO_RENDER;
+}
+
+/* Recheck for composite-repeat once we've turned patterns into Xlib surfaces
+ * If we end up returning DO_UNSUPPORTED here, we're throwing away work we
+ * did to turn gradients into a pattern, but most of the time we can handle
+ * that case with core protocol fallback.
+ */
+static composite_operation_t
+_recategorize_composite_repeat (cairo_xlib_surface_t *dst,
+ cairo_operator_t operator,
+ cairo_xlib_surface_t *src,
+ cairo_surface_attributes_t *src_attr,
+ cairo_bool_t have_mask)
+{
+ if (!dst->buggy_repeat)
+ return DO_RENDER;
+
+ if (_cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) &&
+ src_attr->extend == CAIRO_EXTEND_REPEAT &&
+ (src->width != 1 || src->height != 1))
+ {
+ if (!have_mask &&
+ (operator == CAIRO_OPERATOR_SOURCE ||
+ (operator == CAIRO_OPERATOR_OVER && !_surface_has_alpha (src))))
+ {
+ if (_surfaces_compatible (dst, src))
+ return DO_XLIB;
+ }
+
+ return DO_UNSUPPORTED;
+ }
+
+ return DO_RENDER;
+}
+
static int
_render_operator (cairo_operator_t operator)
{
switch (operator) {
case CAIRO_OPERATOR_CLEAR:
return PictOpClear;
- case CAIRO_OPERATOR_SRC:
+
+ case CAIRO_OPERATOR_SOURCE:
return PictOpSrc;
- case CAIRO_OPERATOR_DST:
- return PictOpDst;
case CAIRO_OPERATOR_OVER:
return PictOpOver;
- case CAIRO_OPERATOR_OVER_REVERSE:
- return PictOpOverReverse;
case CAIRO_OPERATOR_IN:
return PictOpIn;
- case CAIRO_OPERATOR_IN_REVERSE:
- return PictOpInReverse;
case CAIRO_OPERATOR_OUT:
return PictOpOut;
- case CAIRO_OPERATOR_OUT_REVERSE:
- return PictOpOutReverse;
case CAIRO_OPERATOR_ATOP:
return PictOpAtop;
- case CAIRO_OPERATOR_ATOP_REVERSE:
+
+ case CAIRO_OPERATOR_DEST:
+ return PictOpDst;
+ case CAIRO_OPERATOR_DEST_OVER:
+ return PictOpOverReverse;
+ case CAIRO_OPERATOR_DEST_IN:
+ return PictOpInReverse;
+ case CAIRO_OPERATOR_DEST_OUT:
+ return PictOpOutReverse;
+ case CAIRO_OPERATOR_DEST_ATOP:
return PictOpAtopReverse;
+
case CAIRO_OPERATOR_XOR:
return PictOpXor;
case CAIRO_OPERATOR_ADD:
@@ -635,10 +979,16 @@ _cairo_xlib_surface_composite (cairo_operator_t operator,
cairo_xlib_surface_t *src;
cairo_xlib_surface_t *mask;
cairo_int_status_t status;
+ composite_operation_t operation;
if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
+ operation = _categorize_composite_repeat (dst, operator, src_pattern,
+ mask_pattern != NULL);
+ if (operation == DO_UNSUPPORTED)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
status = _cairo_pattern_acquire_surfaces (src_pattern, mask_pattern,
&dst->base,
src_x, src_y,
@@ -650,32 +1000,40 @@ _cairo_xlib_surface_composite (cairo_operator_t operator,
if (status)
return status;
+ operation = _recategorize_composite_repeat (dst, operator, src, &src_attr,
+ mask_pattern != NULL);
+ if (operation == DO_UNSUPPORTED) {
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ goto FAIL;
+ }
+
status = _cairo_xlib_surface_set_attributes (src, &src_attr);
- if (CAIRO_OK (status))
+ if (status)
+ goto FAIL;
+
+ if (operation == DO_RENDER)
{
- if (mask)
- {
+ _cairo_xlib_surface_ensure_dst_picture (dst);
+ if (mask) {
status = _cairo_xlib_surface_set_attributes (mask, &mask_attr);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
XRenderComposite (dst->dpy,
_render_operator (operator),
- src->picture,
- mask->picture,
- dst->picture,
+ src->src_picture,
+ mask->src_picture,
+ dst->dst_picture,
src_x + src_attr.x_offset,
src_y + src_attr.y_offset,
mask_x + mask_attr.x_offset,
mask_y + mask_attr.y_offset,
dst_x, dst_y,
width, height);
- }
- else
- {
+ } else {
XRenderComposite (dst->dpy,
_render_operator (operator),
- src->picture,
+ src->src_picture,
0,
- dst->picture,
+ dst->dst_picture,
src_x + src_attr.x_offset,
src_y + src_attr.y_offset,
0, 0,
@@ -683,6 +1041,30 @@ _cairo_xlib_surface_composite (cairo_operator_t operator,
width, height);
}
}
+ else /* DO_XLIB */
+ {
+ /* This case is only used for bug fallbacks, though it is theoretically
+ * applicable to the case where we don't have the RENDER extension as
+ * well.
+ *
+ * We've checked that we have a repeating unscaled source in
+ * _recategorize_composite_repeat.
+ */
+ int itx, ity;
+
+ _cairo_xlib_surface_ensure_gc (dst);
+ _cairo_matrix_is_integer_translation (&src_attr.matrix, &itx, &ity);
+
+ XSetTSOrigin (dst->dpy, dst->gc,
+ - (itx + src_attr.x_offset), - (ity + src_attr.y_offset));
+ XSetTile (dst->dpy, dst->gc, src->drawable);
+ XSetFillStyle (dst->dpy, dst->gc, FillTiled);
+
+ XFillRectangle (dst->dpy, dst->drawable, dst->gc,
+ dst_x, dst_y, width, height);
+ }
+
+ FAIL:
if (mask)
_cairo_pattern_release_surface (&dst->base, &mask->base, &mask_attr);
@@ -711,9 +1093,10 @@ _cairo_xlib_surface_fill_rectangles (void *abstract_surface,
render_color.alpha = color->alpha_short;
/* XXX: This XRectangle cast is evil... it needs to go away somehow. */
+ _cairo_xlib_surface_ensure_dst_picture (surface);
XRenderFillRectangles (surface->dpy,
_render_operator (operator),
- surface->picture,
+ surface->dst_picture,
&render_color, (XRectangle *) rects, num_rects);
return CAIRO_STATUS_SUCCESS;
@@ -736,11 +1119,16 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator,
cairo_xlib_surface_t *dst = abstract_dst;
cairo_xlib_surface_t *src;
cairo_int_status_t status;
+ composite_operation_t operation;
int render_reference_x, render_reference_y;
int render_src_x, render_src_y;
if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
+
+ operation = _categorize_composite_repeat (dst, operator, pattern, TRUE);
+ if (operation == DO_UNSUPPORTED)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
src_x, src_y, width, height,
@@ -748,7 +1136,13 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator,
&attributes);
if (status)
return status;
-
+
+ operation = _recategorize_composite_repeat (dst, operator, src, &attributes, TRUE);
+ if (operation == DO_UNSUPPORTED) {
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ goto FAIL;
+ }
+
if (traps[0].left.p1.y < traps[0].left.p2.y) {
render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x);
render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p1.y);
@@ -761,99 +1155,101 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator,
render_src_y = src_y + render_reference_y - dst_y;
/* XXX: The XTrapezoid cast is evil and needs to go away somehow. */
+ _cairo_xlib_surface_ensure_dst_picture (dst);
status = _cairo_xlib_surface_set_attributes (src, &attributes);
- if (CAIRO_OK (status))
+ if (status == CAIRO_STATUS_SUCCESS)
XRenderCompositeTrapezoids (dst->dpy,
_render_operator (operator),
- src->picture, dst->picture,
+ src->src_picture, dst->dst_picture,
XRenderFindStandardFormat (dst->dpy, PictStandardA8),
render_src_x + attributes.x_offset,
render_src_y + attributes.y_offset,
(XTrapezoid *) traps, num_traps);
+ FAIL:
_cairo_pattern_release_surface (&dst->base, &src->base, &attributes);
return status;
}
static cairo_int_status_t
-_cairo_xlib_surface_copy_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_xlib_surface_show_page (void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_xlib_surface_set_clip_region (void *abstract_surface,
+_cairo_xlib_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
+ cairo_xlib_surface_t *surface = (cairo_xlib_surface_t *) abstract_surface;
- Region xregion;
- XRectangle xr;
- XRectangle *rects = NULL;
- XGCValues gc_values;
- pixman_box16_t *box;
- cairo_xlib_surface_t *surf;
- int n, m;
+ if (surface->clip_rects) {
+ free (surface->clip_rects);
+ surface->clip_rects = NULL;
+ }
- surf = (cairo_xlib_surface_t *) abstract_surface;
+ surface->have_clip_rects = FALSE;
+ surface->num_clip_rects = 0;
if (region == NULL) {
- /* NULL region == reset the clip */
- xregion = XCreateRegion();
- xr.x = 0;
- xr.y = 0;
- xr.width = surf->width;
- xr.height = surf->height;
- XUnionRectWithRegion (&xr, xregion, xregion);
- rects = malloc(sizeof(XRectangle));
- if (rects == NULL)
- return CAIRO_STATUS_NO_MEMORY;
- rects[0] = xr;
- m = 1;
-
+ if (surface->gc)
+ XSetClipMask (surface->dpy, surface->gc, None);
+
+ if (surface->format && surface->dst_picture) {
+ XRenderPictureAttributes pa;
+ pa.clip_mask = None;
+ XRenderChangePicture (surface->dpy, surface->dst_picture,
+ CPClipMask, &pa);
+ }
} else {
- n = pixman_region_num_rects (region);
- /* XXX: Are we sure these are the semantics we want for an
- * empty, (not null) region? */
- if (n == 0)
- return CAIRO_STATUS_SUCCESS;
- rects = malloc(sizeof(XRectangle) * n);
- if (rects == NULL)
- return CAIRO_STATUS_NO_MEMORY;
- box = pixman_region_rects (region);
- xregion = XCreateRegion();
+ pixman_box16_t *boxes;
+ XRectangle *rects = NULL;
+ int n_boxes, i;
- m = n;
- for (; n > 0; --n, ++box) {
- xr.x = (short) box->x1;
- xr.y = (short) box->y1;
- xr.width = (unsigned short) (box->x2 - box->x1);
- xr.height = (unsigned short) (box->y2 - box->y1);
- rects[n-1] = xr;
- XUnionRectWithRegion (&xr, xregion, xregion);
- }
+ n_boxes = pixman_region_num_rects (region);
+ if (n_boxes > 0) {
+ rects = malloc (sizeof(XRectangle) * n_boxes);
+ if (rects == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+ } else {
+ rects = NULL;
+ }
+
+ boxes = pixman_region_rects (region);
+
+ for (i = 0; i < n_boxes; i++) {
+ rects[i].x = boxes[i].x1;
+ rects[i].y = boxes[i].y1;
+ rects[i].width = boxes[i].x2 - boxes[i].x1;
+ rects[i].height = boxes[i].y2 - boxes[i].y1;
+ }
+
+ surface->have_clip_rects = TRUE;
+ surface->clip_rects = rects;
+ surface->num_clip_rects = n_boxes;
+
+ if (surface->gc)
+ _cairo_xlib_surface_set_gc_clip_rects (surface);
+
+ if (surface->dst_picture)
+ _cairo_xlib_surface_set_picture_clip_rects (surface);
}
- _cairo_xlib_surface_ensure_gc (surf);
- XGetGCValues(surf->dpy, surf->gc, GCGraphicsExposures, &gc_values);
- XSetGraphicsExposures(surf->dpy, surf->gc, False);
- XSetClipRectangles(surf->dpy, surf->gc, 0, 0, rects, m, Unsorted);
- free(rects);
- if (surf->picture)
- XRenderSetPictureClipRegion (surf->dpy, surf->picture, xregion);
- XDestroyRegion(xregion);
- XSetGraphicsExposures(surf->dpy, surf->gc, gc_values.graphics_exposures);
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
-_cairo_xlib_surface_show_glyphs (cairo_font_t *font,
+static cairo_int_status_t
+_cairo_xlib_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_t *rectangle)
+{
+ cairo_xlib_surface_t *surface = abstract_surface;
+
+ rectangle->x = 0;
+ rectangle->y = 0;
+
+ rectangle->width = surface->width;
+ rectangle->height = surface->height;
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
@@ -868,8 +1264,7 @@ _cairo_xlib_surface_show_glyphs (cairo_font_t *font,
static const cairo_surface_backend_t cairo_xlib_surface_backend = {
_cairo_xlib_surface_create_similar,
- _cairo_xlib_surface_destroy,
- _cairo_xlib_surface_pixels_per_inch,
+ _cairo_xlib_surface_finish,
_cairo_xlib_surface_acquire_source_image,
_cairo_xlib_surface_release_source_image,
_cairo_xlib_surface_acquire_dest_image,
@@ -878,23 +1273,38 @@ static const cairo_surface_backend_t cairo_xlib_surface_backend = {
_cairo_xlib_surface_composite,
_cairo_xlib_surface_fill_rectangles,
_cairo_xlib_surface_composite_trapezoids,
- _cairo_xlib_surface_copy_page,
- _cairo_xlib_surface_show_page,
+ NULL, /* copy_page */
+ NULL, /* show_page */
_cairo_xlib_surface_set_clip_region,
+ NULL, /* intersect_clip_path */
+ _cairo_xlib_surface_get_extents,
_cairo_xlib_surface_show_glyphs
};
+/**
+ * _cairo_surface_is_xlib:
+ * @surface: a #cairo_surface_t
+ *
+ * Checks if a surface is a #cairo_xlib_surface_t
+ *
+ * Return value: True if the surface is an xlib surface
+ **/
+static cairo_bool_t
+_cairo_surface_is_xlib (cairo_surface_t *surface)
+{
+ return surface->backend == &cairo_xlib_surface_backend;
+}
+
static cairo_surface_t *
-_cairo_xlib_surface_create_with_size (Display *dpy,
- Drawable drawable,
- Visual *visual,
- cairo_format_t format,
- Colormap colormap,
- int width,
- int height)
+_cairo_xlib_surface_create_internal (Display *dpy,
+ Drawable drawable,
+ Visual *visual,
+ XRenderPictFormat *format,
+ int width,
+ int height,
+ int depth)
{
cairo_xlib_surface_t *surface;
- int render_standard;
surface = malloc (sizeof (cairo_xlib_surface_t));
if (surface == NULL)
@@ -902,76 +1312,189 @@ _cairo_xlib_surface_create_with_size (Display *dpy,
_cairo_surface_init (&surface->base, &cairo_xlib_surface_backend);
- surface->visual = visual;
- surface->format = format;
-
surface->dpy = dpy;
- surface->gc = 0;
+ surface->gc = NULL;
surface->drawable = drawable;
- surface->owns_pixmap = 0;
- surface->visual = visual;
+ surface->owns_pixmap = FALSE;
+ surface->use_pixmap = 0;
surface->width = width;
surface->height = height;
- if (! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) {
+ if (format) {
+ depth = format->depth;
+ } else if (visual) {
+ int i, j, k;
+
+ /* This is ugly, but we have to walk over all visuals
+ * for the display to find the depth.
+ */
+ for (i = 0; i < ScreenCount (dpy); i++) {
+ Screen *screen = ScreenOfDisplay (dpy, i);
+ for (j = 0; j < screen->ndepths; j++) {
+ Depth *d = &screen->depths[j];
+ for (k = 0; k < d->nvisuals; k++) {
+ if (&d->visuals[k] == visual) {
+ depth = d->depth;
+ goto found;
+ }
+ }
+ }
+ }
+ found:
+ ;
+ }
+
+ if (cairo_xlib_render_disabled ||
+ ! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) {
surface->render_major = -1;
surface->render_minor = -1;
}
- switch (format) {
- case CAIRO_FORMAT_A1:
- render_standard = PictStandardA1;
- break;
- case CAIRO_FORMAT_A8:
- render_standard = PictStandardA8;
- break;
- case CAIRO_FORMAT_RGB24:
- render_standard = PictStandardRGB24;
- break;
- case CAIRO_FORMAT_ARGB32:
- default:
- render_standard = PictStandardARGB32;
- break;
+ surface->buggy_repeat = FALSE;
+ if (strcmp (ServerVendor (dpy), "The X.Org Foundation") == 0) {
+ if (VendorRelease (dpy) <= 60802000)
+ surface->buggy_repeat = TRUE;
}
- /* XXX: I'm currently ignoring the colormap. Is that bad? */
- if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface))
- surface->picture = XRenderCreatePicture (dpy, drawable,
- visual ?
- XRenderFindVisualFormat (dpy, visual) :
- XRenderFindStandardFormat (dpy, render_standard),
- 0, NULL);
- else
- surface->picture = 0;
+ surface->dst_picture = None;
+ surface->src_picture = None;
+
+ if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface)) {
+ if (!format) {
+ if (visual)
+ format = XRenderFindVisualFormat (dpy, visual);
+ else if (depth == 1)
+ format = XRenderFindStandardFormat (dpy, PictStandardA1);
+ }
+ } else {
+ format = NULL;
+ }
+
+ surface->visual = visual;
+ surface->format = format;
+ surface->depth = depth;
+
+ surface->have_clip_rects = FALSE;
+ surface->clip_rects = NULL;
+ surface->num_clip_rects = 0;
return (cairo_surface_t *) surface;
}
+/**
+ * cairo_xlib_surface_create:
+ * @dpy: an X Display
+ * @drawable: an X Drawable, (a Pixmap or a Window)
+ * @visual: the visual to use for drawing to @drawable. The depth
+ * of the visual must match the depth of the drawable.
+ * Currently, only TrueColor visuals are fully supported.
+ * @width: the current width of @drawable.
+ * @height: the current height of @drawable.
+ *
+ * Creates an Xlib surface that draws to the given drawable.
+ * The way that colors are represented in the drawable is specified
+ * by the provided visual.
+ *
+ * NOTE: If @drawable is a Window, then the function
+ * cairo_xlib_surface_set_size must be called whenever the size of the
+ * window changes.
+ *
+ * Return value: the newly created surface
+ **/
cairo_surface_t *
-cairo_xlib_surface_create (Display *dpy,
- Drawable drawable,
- Visual *visual,
- cairo_format_t format,
- Colormap colormap)
+cairo_xlib_surface_create (Display *dpy,
+ Drawable drawable,
+ Visual *visual,
+ int width,
+ int height)
{
- Window window_ignore;
- unsigned int int_ignore;
- unsigned int width, height;
+ return _cairo_xlib_surface_create_internal (dpy, drawable,
+ visual, NULL, width, height, 0);
+}
- /* XXX: This call is a round-trip. We probably want to instead (or
- * also?) export a version that accepts width/height. Then, we'll
- * likely also need a resize function too.
- */
- XGetGeometry(dpy, drawable,
- &window_ignore, &int_ignore, &int_ignore,
- &width, &height,
- &int_ignore, &int_ignore);
+/**
+ * cairo_xlib_surface_create_for_bitmap:
+ * @dpy: an X Display
+ * @bitmap: an X Drawable, (a depth-1 Pixmap)
+ * @width: the current width of @bitmap.
+ * @height: the current height of @bitmap.
+ *
+ * Creates an Xlib surface that draws to the given bitmap.
+ * This will be drawn to as a CAIRO_FORMAT_A1 object.
+ *
+ * Return value: the newly created surface
+ **/
+cairo_surface_t *
+cairo_xlib_surface_create_for_bitmap (Display *dpy,
+ Pixmap bitmap,
+ int width,
+ int height)
+{
+ return _cairo_xlib_surface_create_internal (dpy, bitmap,
+ NULL, NULL, width, height, 1);
+}
- return _cairo_xlib_surface_create_with_size (dpy, drawable, visual, format,
- colormap, width, height);
+/**
+ * cairo_xlib_surface_create_with_xrender_format:
+ * @dpy: an X Display
+ * @drawable: an X Drawable, (a Pixmap or a Window)
+ * @format: the picture format to use for drawing to @drawable. The depth
+ * of @format must match the depth of the drawable.
+ * @width: the current width of @drawable.
+ * @height: the current height of @drawable.
+ *
+ * Creates an Xlib surface that draws to the given drawable.
+ * The way that colors are represented in the drawable is specified
+ * by the provided picture format.
+ *
+ * NOTE: If @drawable is a Window, then the function
+ * cairo_xlib_surface_set_size must be called whenever the size of the
+ * window changes.
+ *
+ * Return value: the newly created surface
+ **/
+cairo_surface_t *
+cairo_xlib_surface_create_with_xrender_format (Display *dpy,
+ Drawable drawable,
+ XRenderPictFormat *format,
+ int width,
+ int height)
+{
+ return _cairo_xlib_surface_create_internal (dpy, drawable,
+ NULL, format, width, height, 0);
+}
+
+/**
+ * cairo_xlib_surface_set_size:
+ * @surface: a #cairo_surface_t for the XLib backend
+ * @width: the new width of the surface
+ * @height: the new height of the surface
+ *
+ * Informs cairo of the new size of the X Drawable underlying the
+ * surface. For a surface created for a Window (rather than a Pixmap),
+ * this function must be called each time the size of the window
+ * changes. (For a subwindow, you are normally resizing the window
+ * yourself, but for a toplevel window, it is necessary to listen for
+ * ConfigureNotify events.)
+ *
+ * A Pixmap can never change size, so it is never necessary to call
+ * this function on a surface created for a Pixmap.
+ **/
+void
+cairo_xlib_surface_set_size (cairo_surface_t *surface,
+ int width,
+ int height)
+{
+ cairo_xlib_surface_t *xlib_surface = (cairo_xlib_surface_t *)surface;
+
+ /* XXX: How do we want to handle this error case? */
+ if (! _cairo_surface_is_xlib (surface))
+ return;
+
+ xlib_surface->width = width;
+ xlib_surface->height = height;
}
-DEPRECATE (cairo_surface_create_for_drawable, cairo_xlib_surface_create);
/* RENDER glyphset cache code */
@@ -1079,7 +1602,7 @@ _xlib_glyphset_cache_create_entry (void *cache,
XRenderAddGlyphs (g->display, g->glyphset,
&(v->glyph), &(v->info), 1,
- im->image ? im->image->data : NULL,
+ im->image ? (char *) im->image->data : NULL,
im->image ? v->info.height * v->info.width : 0);
v->key.base.memory = im->image ? im->image->width * im->image->stride : 0;
@@ -1186,7 +1709,7 @@ _get_glyphset_cache (Display *d)
#define N_STACK_BUF 1024
static cairo_status_t
-_cairo_xlib_surface_show_glyphs32 (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
glyphset_cache_t *g,
cairo_glyph_cache_key_t *key,
@@ -1239,8 +1762,8 @@ _cairo_xlib_surface_show_glyphs32 (cairo_font_t *font,
XRenderCompositeText32 (self->dpy,
_render_operator (operator),
- src->picture,
- self->picture,
+ src->src_picture,
+ self->dst_picture,
g->a8_pict_format,
source_x, source_y,
0, 0,
@@ -1263,7 +1786,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_font_t *font,
static cairo_status_t
-_cairo_xlib_surface_show_glyphs16 (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
glyphset_cache_t *g,
cairo_glyph_cache_key_t *key,
@@ -1316,8 +1839,8 @@ _cairo_xlib_surface_show_glyphs16 (cairo_font_t *font,
XRenderCompositeText16 (self->dpy,
_render_operator (operator),
- src->picture,
- self->picture,
+ src->src_picture,
+ self->dst_picture,
g->a8_pict_format,
source_x, source_y,
0, 0,
@@ -1339,7 +1862,7 @@ _cairo_xlib_surface_show_glyphs16 (cairo_font_t *font,
}
static cairo_status_t
-_cairo_xlib_surface_show_glyphs8 (cairo_font_t *font,
+_cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
glyphset_cache_t *g,
cairo_glyph_cache_key_t *key,
@@ -1392,8 +1915,8 @@ _cairo_xlib_surface_show_glyphs8 (cairo_font_t *font,
XRenderCompositeText8 (self->dpy,
_render_operator (operator),
- src->picture,
- self->picture,
+ src->src_picture,
+ self->dst_picture,
g->a8_pict_format,
source_x, source_y,
0, 0,
@@ -1415,8 +1938,8 @@ _cairo_xlib_surface_show_glyphs8 (cairo_font_t *font,
}
-static cairo_status_t
-_cairo_xlib_surface_show_glyphs (cairo_font_t *font,
+static cairo_int_status_t
+_cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_operator_t operator,
cairo_pattern_t *pattern,
void *abstract_surface,
@@ -1438,11 +1961,16 @@ _cairo_xlib_surface_show_glyphs (cairo_font_t *font,
cairo_glyph_cache_key_t key;
glyphset_cache_entry_t **entries;
glyphset_cache_entry_t *stack_entries [N_STACK_BUF];
+ composite_operation_t operation;
int i;
- if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT (self))
+ if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT (self) || !self->format)
return CAIRO_INT_STATUS_UNSUPPORTED;
+ operation = _categorize_composite_repeat (self, operator, pattern, TRUE);
+ if (operation == DO_UNSUPPORTED)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
status = _cairo_pattern_acquire_surface (pattern, &self->base,
source_x, source_y, width, height,
(cairo_surface_t **) &src,
@@ -1450,6 +1978,12 @@ _cairo_xlib_surface_show_glyphs (cairo_font_t *font,
if (status)
return status;
+ operation = _recategorize_composite_repeat (self, operator, src, &attributes, TRUE);
+ if (operation == DO_UNSUPPORTED) {
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ goto FAIL;
+ }
+
status = _cairo_xlib_surface_set_attributes (src, &attributes);
if (status)
goto FAIL;
@@ -1471,7 +2005,7 @@ _cairo_xlib_surface_show_glyphs (cairo_font_t *font,
/* Work out the index size to use. */
elt_size = 8;
- _cairo_font_get_glyph_cache_key (font, &key);
+ _cairo_scaled_font_get_glyph_cache_key (scaled_font, &key);
for (i = 0; i < num_glyphs; ++i) {
key.index = glyphs[i].index;
@@ -1498,21 +2032,28 @@ _cairo_xlib_surface_show_glyphs (cairo_font_t *font,
/* Call the appropriate sub-function. */
+ _cairo_xlib_surface_ensure_dst_picture (self);
if (elt_size == 8)
- status = _cairo_xlib_surface_show_glyphs8 (font, operator, g, &key, src, self,
+ {
+ status = _cairo_xlib_surface_show_glyphs8 (scaled_font, operator, g, &key, src, self,
source_x + attributes.x_offset,
source_y + attributes.y_offset,
glyphs, entries, num_glyphs);
+ }
else if (elt_size == 16)
- status = _cairo_xlib_surface_show_glyphs16 (font, operator, g, &key, src, self,
+ {
+ status = _cairo_xlib_surface_show_glyphs16 (scaled_font, operator, g, &key, src, self,
source_x + attributes.x_offset,
source_y + attributes.y_offset,
glyphs, entries, num_glyphs);
+ }
else
- status = _cairo_xlib_surface_show_glyphs32 (font, operator, g, &key, src, self,
+ {
+ status = _cairo_xlib_surface_show_glyphs32 (scaled_font, operator, g, &key, src, self,
source_x + attributes.x_offset,
source_y + attributes.y_offset,
glyphs, entries, num_glyphs);
+ }
for (i = 0; i < num_glyphs; ++i)
_xlib_glyphset_cache_destroy_entry (g, entries[i]);
diff --git a/src/cairo-png.h b/src/cairo-xlib-test.h
index 3e86210..44b986c 100644
--- a/src/cairo-png.h
+++ b/src/cairo-xlib-test.h
@@ -1,6 +1,6 @@
/* cairo - a vector graphics library with display and print output
*
- * Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -34,31 +34,22 @@
* Carl D. Worth <cworth@cworth.org>
*/
-#ifndef CAIRO_PNG_H
-#define CAIRO_PNG_H
+#ifndef CAIRO_XLIB_TEST_H
+#define CAIRO_XLIB_TEST_H
#include <cairo.h>
-#ifdef CAIRO_HAS_PNG_SURFACE
+#if CAIRO_HAS_XLIB_SURFACE
-#include <stdio.h>
+#include <cairo-xlib.h>
CAIRO_BEGIN_DECLS
void
-cairo_set_target_png (cairo_t *cr,
- FILE *file,
- cairo_format_t format,
- int width,
- int height);
-
-cairo_surface_t *
-cairo_png_surface_create (FILE *file,
- cairo_format_t format,
- int width,
- int height);
+cairo_test_xlib_disable_render (void);
CAIRO_END_DECLS
-#endif /* CAIRO_HAS_PNG_SURFACE */
-#endif /* CAIRO_PNG_H */
+#endif /* CAIRO_HAS_XLIB_SURFACE */
+#endif /* CAIRO_XLIB_H */
+
diff --git a/src/cairo_color.c b/src/cairo-xlib-xrender.h
index f203d96..08a8624 100644
--- a/src/cairo_color.c
+++ b/src/cairo-xlib-xrender.h
@@ -34,64 +34,29 @@
* Carl D. Worth <cworth@cworth.org>
*/
-#include "cairoint.h"
+#ifndef CAIRO_XLIB_XRENDER_H
+#define CAIRO_XLIB_XRENDER_H
-static cairo_color_t const CAIRO_COLOR_WHITE = {
- 1.0, 1.0, 1.0, 1.0,
- 0xffff, 0xffff, 0xffff, 0xffff
-};
+#include <cairo.h>
-static void
-_cairo_color_compute_shorts (cairo_color_t *color);
+#if CAIRO_HAS_XLIB_SURFACE
-void
-_cairo_color_init (cairo_color_t *color)
-{
- *color = CAIRO_COLOR_WHITE;
-}
+#include <X11/extensions/Xrender.h>
-void
-_cairo_color_fini (cairo_color_t *color)
-{
- /* Nothing to do here */
-}
+CAIRO_BEGIN_DECLS
-void
-_cairo_color_set_rgb (cairo_color_t *color, double red, double green, double blue)
-{
- color->red = red;
- color->green = green;
- color->blue = blue;
+cairo_surface_t *
+cairo_xlib_surface_create_with_xrender_format (Display *dpy,
+ Drawable drawable,
+ XRenderPictFormat *format,
+ int width,
+ int height);
- _cairo_color_compute_shorts (color);
-}
-void
-_cairo_color_get_rgb (const cairo_color_t *color,
- double *red, double *green, double *blue)
-{
- if (red)
- *red = color->red;
- if (green)
- *green = color->green;
- if (blue)
- *blue = color->blue;
-}
+CAIRO_END_DECLS
-void
-_cairo_color_set_alpha (cairo_color_t *color, double alpha)
-{
- color->alpha = alpha;
-
- _cairo_color_compute_shorts (color);
-}
-
-static void
-_cairo_color_compute_shorts (cairo_color_t *color)
-{
- color->red_short = (color->red * color->alpha) * 0xffff;
- color->green_short = (color->green * color->alpha) * 0xffff;
- color->blue_short = (color->blue * color->alpha) * 0xffff;
- color->alpha_short = color->alpha * 0xffff;
-}
+#else /* CAIRO_HAS_XLIB_SURFACE */
+# error Cairo was not compiled with support for the xlib backend
+#endif /* CAIRO_HAS_XLIB_SURFACE */
+#endif /* CAIRO_XLIB_XRENDER_H */
diff --git a/src/cairo-xlib.h b/src/cairo-xlib.h
index 18db7b1..3fe285f 100644
--- a/src/cairo-xlib.h
+++ b/src/cairo-xlib.h
@@ -39,38 +39,35 @@
#include <cairo.h>
-#ifdef CAIRO_HAS_XLIB_SURFACE
+#if CAIRO_HAS_XLIB_SURFACE
-#include <X11/extensions/Xrender.h>
+#include <X11/Xlib.h>
CAIRO_BEGIN_DECLS
-/* XXX: This shold be renamed to cairo_set_target_xlib to match the
- * other backends */
-void
-cairo_set_target_drawable (cairo_t *cr,
- Display *dpy,
- Drawable drawable);
+cairo_surface_t *
+cairo_xlib_surface_create (Display *dpy,
+ Drawable drawable,
+ Visual *visual,
+ int width,
+ int height);
-/* XXX: This is a mess from the user's POV. Should the Visual or the
- cairo_format_t control what render format is used? Maybe I can have
- cairo_surface_create_for_window with a visual, and
- cairo_surface_create_for_pixmap with a cairo_format_t. Would that work?
-*/
cairo_surface_t *
-cairo_xlib_surface_create (Display *dpy,
- Drawable drawable,
- Visual *visual,
- cairo_format_t format,
- Colormap colormap);
-
-/* XXX: This has been proposed
-cairo_status_t
-cairo_xlib_surface_set_size (cairo_surface_t *surface, int width, int height);
-*/
+cairo_xlib_surface_create_for_bitmap (Display *dpy,
+ Pixmap bitmap,
+ int width,
+ int height);
+
+void
+cairo_xlib_surface_set_size (cairo_surface_t *surface,
+ int width,
+ int height);
CAIRO_END_DECLS
+#else /* CAIRO_HAS_XLIB_SURFACE */
+# error Cairo was not compiled with support for the xlib backend
#endif /* CAIRO_HAS_XLIB_SURFACE */
+
#endif /* CAIRO_XLIB_H */
diff --git a/src/cairo.c b/src/cairo.c
index fd10b5c..73dfc2c 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -1,6 +1,7 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -34,69 +35,121 @@
* Carl D. Worth <cworth@cworth.org>
*/
-
#include "cairoint.h"
+#include "cairo-private.h"
+
+#include "cairo-arc-private.h"
+#include "cairo-path-data-private.h"
#define CAIRO_TOLERANCE_MINIMUM 0.0002 /* We're limited by 16 bits of sub-pixel precision */
-#ifdef CAIRO_DO_SANITY_CHECKING
+static const cairo_t cairo_nil = {
+ (unsigned int)-1, /* ref_count */
+ CAIRO_STATUS_NO_MEMORY, /* status */
+ { /* path */
+ NULL, NULL, /* op_buf_head, op_buf_tail */
+ NULL, NULL, /* arg_buf_head, arg_buf_tail */
+ { 0, 0 }, /* last_move_point */
+ { 0, 0 }, /* current point */
+ FALSE, /* has_current_point */
+ },
+ NULL /* gstate */
+};
+
#include <assert.h>
-static int
-cairo_sane_state (cairo_t *cr)
-{
- if (cr == NULL)
- return 0;
- switch (cr->status) {
- case CAIRO_STATUS_SUCCESS:
- case CAIRO_STATUS_NO_MEMORY:
- case CAIRO_STATUS_INVALID_RESTORE:
- case CAIRO_STATUS_INVALID_POP_GROUP:
- case CAIRO_STATUS_NO_CURRENT_POINT:
- case CAIRO_STATUS_INVALID_MATRIX:
- case CAIRO_STATUS_NO_TARGET_SURFACE:
- case CAIRO_STATUS_NULL_POINTER:
- break;
- default:
- return 0;
- }
- return 1;
-}
-#define CAIRO_CHECK_SANITY(cr) assert(cairo_sane_state ((cr)))
-#else
-#define CAIRO_CHECK_SANITY(cr)
-#endif
+/* This has to be updated whenever cairo_status_t is extended. That's
+ * a bit of a pain, but it should be easy to always catch as long as
+ * one adds a new test case to test a trigger of the new status value.
+ */
+#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_SURFACE_TYPE_MISMATCH
+
+/**
+ * _cairo_error:
+ * @cr: a cairo context
+ * @status: a status value indicating an error, (eg. not
+ * CAIRO_STATUS_SUCCESS)
+ *
+ * Sets cr->status to @status.
+ *
+ * All assignments of an error status to cr->status should happen
+ * either inside of _cairo_error(), or else _cairo_error() should be
+ * called immediately after the assignment.
+ *
+ * The purpose of this function is to allow the user to set a
+ * breakpoint in _cairo_error() to generate a stack trace for when the
+ * user causes cairo to detect an error.
+ *
+ * _cairo_error also calls the error notify callback function that the
+ * user may have set with cairo_set_error_notify.
+ **/
+static void
+_cairo_error (cairo_t *cr, cairo_status_t status)
+{
+ assert (status > CAIRO_STATUS_SUCCESS &&
+ status <= CAIRO_STATUS_LAST_STATUS);
+ cr->status = status;
+}
/**
* cairo_create:
+ * @target: target surface for the context
*
- * Creates a new #cairo_t with default values. The target
- * surface must be set on the #cairo_t with cairo_set_target_surface(),
- * or a backend-specific function like cairo_set_target_image() before
- * drawing with the #cairo_t.
+ * Creates a new #cairo_t with all graphics state parameters set to
+ * default values and with @target as a target surface. The target
+ * surface should be constructed with a backend-specific function such
+ * as cairo_image_surface_create (or any other
+ * cairo_&lt;backend&gt;_surface_create variant).
+ *
+ * This function references @target, so you can immediately
+ * call cairo_surface_destroy() on it if you don't need to
+ * maintain a separate reference to it.
+ *
+ * Note that there are restrictions on using the same surface in
+ * multiple contexts at the same time. If, after creating @cr_a with
+ * @surface you also create @cr_b with the same surface, you must
+ * ensure that @cr_b has finished using @surface before resuming use
+ * of @cr_a. Currently, the only way time at which this is guaranteed
+ * is when the the last reference to @cr_b is released with
+ * cairo_destroy(). (XXX: We need to add a cairo_finish() call to
+ * provide a way to achieve this explicitly). See also the
+ * %CAIRO_STATUS_BAD_NESTING status.
*
* Return value: a newly allocated #cairo_t with a reference
* count of 1. The initial reference count should be released
* with cairo_destroy() when you are done using the #cairo_t.
+ * This function never returns %NULL. If memory cannot be
+ * allocated, a special #cairo_t object will be returned on
+ * which cairo_status() returns %CAIRO_STATUS_NO_MEMORY.
+ * You can use this object normally, but no drawing will
+ * be done.
**/
cairo_t *
-cairo_create (void)
+cairo_create (cairo_surface_t *target)
{
cairo_t *cr;
cr = malloc (sizeof (cairo_t));
if (cr == NULL)
- return NULL;
+ return (cairo_t *) &cairo_nil;
- cr->status = CAIRO_STATUS_SUCCESS;
cr->ref_count = 1;
- cr->gstate = _cairo_gstate_create ();
+ cr->status = CAIRO_STATUS_SUCCESS;
+
+ _cairo_path_fixed_init (&cr->path);
+
+ if (target == NULL) {
+ cr->gstate = NULL;
+ _cairo_error (cr, CAIRO_STATUS_NULL_POINTER);
+ return cr;
+ }
+
+ cr->gstate = _cairo_gstate_create (target);
if (cr->gstate == NULL)
- cr->status = CAIRO_STATUS_NO_MEMORY;
+ _cairo_error (cr, CAIRO_STATUS_NO_MEMORY);
- CAIRO_CHECK_SANITY (cr);
return cr;
}
@@ -111,12 +164,10 @@ cairo_create (void)
void
cairo_reference (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->ref_count == (unsigned int)-1)
return;
-
+
cr->ref_count++;
- CAIRO_CHECK_SANITY (cr);
}
/**
@@ -125,12 +176,14 @@ cairo_reference (cairo_t *cr)
*
* Decreases the reference count on @cr by one. If the result
* is zero, then @cr and all associated resources are freed.
- * See cairo_destroy().
+ * See cairo_reference().
**/
void
cairo_destroy (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
+ if (cr->ref_count == (unsigned int)-1)
+ return;
+
cr->ref_count--;
if (cr->ref_count)
return;
@@ -142,6 +195,8 @@ cairo_destroy (cairo_t *cr)
_cairo_gstate_destroy (tmp);
}
+ _cairo_path_fixed_fini (&cr->path);
+
free (cr);
}
@@ -166,25 +221,20 @@ cairo_save (cairo_t *cr)
{
cairo_gstate_t *top;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
-
- if (cr->gstate) {
- top = _cairo_gstate_clone (cr->gstate);
- } else {
- top = _cairo_gstate_create ();
}
+ top = _cairo_gstate_clone (cr->gstate);
+
if (top == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- CAIRO_CHECK_SANITY (cr);
+ _cairo_error (cr, CAIRO_STATUS_NO_MEMORY);
return;
}
top->next = cr->gstate;
cr->gstate = top;
- CAIRO_CHECK_SANITY (cr);
}
slim_hidden_def(cairo_save);
@@ -201,9 +251,10 @@ cairo_restore (cairo_t *cr)
{
cairo_gstate_t *top;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
top = cr->gstate;
cr->gstate = top->next;
@@ -211,49 +262,10 @@ cairo_restore (cairo_t *cr)
_cairo_gstate_destroy (top);
if (cr->gstate == NULL)
- cr->status = CAIRO_STATUS_INVALID_RESTORE;
-
- if (cr->status)
- return;
-
- cr->status = _cairo_gstate_restore_external_state (cr->gstate);
-
- CAIRO_CHECK_SANITY (cr);
+ _cairo_error (cr, CAIRO_STATUS_INVALID_RESTORE);
}
slim_hidden_def(cairo_restore);
-/**
- * cairo_copy:
- * @dest: a #cairo_t
- * @src: another #cairo_t
- *
- * This function copies all current state information from src to
- * dest. This includes the current point and path, the target surface,
- * the transformation matrix, and so forth.
- *
- * The stack of states saved with cairo_save() is <emphasis>not</emphasis>
- * not copied; nor are any saved states on @dest cleared. The
- * operation only copies the current state of @src to the current
- * state of @dest.
- **/
-void
-cairo_copy (cairo_t *dest, cairo_t *src)
-{
- CAIRO_CHECK_SANITY (src);
- CAIRO_CHECK_SANITY (dest);
- if (dest->status)
- return;
-
- if (src->status) {
- dest->status = src->status;
- return;
- }
-
- dest->status = _cairo_gstate_copy (dest->gstate, src->gstate);
- CAIRO_CHECK_SANITY (src);
- CAIRO_CHECK_SANITY (dest);
-}
-
/* XXX: I want to rethink this API
void
cairo_push_group (cairo_t *cr)
@@ -283,130 +295,196 @@ cairo_pop_group (cairo_t *cr)
*/
/**
- * cairo_set_target_surface:
+ * cairo_set_operator:
* @cr: a #cairo_t
- * @surface: a #cairo_surface_t
+ * @op: a compositing operator, specified as a #cairo_operator_t
*
- * Directs output for a #cairo_t to a given surface. The surface
- * will be referenced by the #cairo_t, so you can immediately
- * call cairo_surface_destroy() on it if you don't need to
- * keep a reference to it around.
+ * Sets the compositing operator to be used for all drawing
+ * operations. See #cairo_operator_t for details on the semantics of
+ * each available drawing operator.
+ *
+ * XXX: I'd also like to direct the reader's attention to some
+ * (not-yet-written) section on cairo's imaging model. How would I do
+ * that if such a section existed? (cworth).
**/
void
-cairo_set_target_surface (cairo_t *cr, cairo_surface_t *surface)
+cairo_set_operator (cairo_t *cr, cairo_operator_t op)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_set_target_surface (cr->gstate, surface);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_set_operator (cr->gstate, op);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
-slim_hidden_def(cairo_set_target_surface);
-/**
- * cairo_set_target_image:
- * @cr: a #cairo_t
- * @data: a pointer to a buffer supplied by the application
- * in which to write contents.
- * @format: the format of pixels in the buffer
- * @width: the width of the image to be stored in the buffer
- * @height: the eight of the image to be stored in the buffer
- * @stride: the number of bytes between the start of rows
- * in the buffer. Having this be specified separate from @width
- * allows for padding at the end of rows, or for writing
- * to a subportion of a larger image.
- *
- * Directs output for a #cairo_t to an in-memory image. The output
- * buffer must be kept around until the #cairo_t is destroyed or set
- * to to have a different target. The initial contents of @buffer
- * will be used as the inital image contents; you must explicitely
- * clear the buffer, using, for example, cairo_rectangle() and
- * cairo_fill() if you want it cleared.
- **/
-void
-cairo_set_target_image (cairo_t *cr,
- char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride)
+static void
+_cairo_set_source_solid (cairo_t *cr, const cairo_color_t *color)
{
- cairo_surface_t *surface;
-
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
- return;
+ cairo_pattern_t *source;
- surface = cairo_surface_create_for_image (data,
- format,
- width, height, stride);
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- CAIRO_CHECK_SANITY (cr);
- return;
- }
+ source = _cairo_pattern_create_solid (color);
- cairo_set_target_surface (cr, surface);
+ cairo_set_source (cr, source);
- cairo_surface_destroy (surface);
- CAIRO_CHECK_SANITY (cr);
+ cairo_pattern_destroy (source);
}
+/**
+ * cairo_set_source_rgb
+ * @cr: a cairo context
+ * @red: red component of color
+ * @green: green component of color
+ * @blue: blue component of color
+ *
+ * Sets the source pattern within @cr to an opaque color. This opaque
+ * color will then be used for any subsequent drawing operation until
+ * a new source pattern is set.
+ *
+ * The color components are floating point numbers in the range 0 to
+ * 1. If the values passed in are outside that range, they will be
+ * clamped.
+ **/
void
-cairo_set_operator (cairo_t *cr, cairo_operator_t op)
+cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_color_t color;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_set_operator (cr->gstate, op);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_restrict_value (&red, 0.0, 1.0);
+ _cairo_restrict_value (&green, 0.0, 1.0);
+ _cairo_restrict_value (&blue, 0.0, 1.0);
+
+ _cairo_color_init_rgb (&color, red, green, blue);
+
+ _cairo_set_source_solid (cr, &color);
}
/**
- * cairo_set_rgb_color:
- * @cr: a #cairo_t
+ * cairo_set_source_rgba:
+ * @cr: a cairo context
* @red: red component of color
* @green: green component of color
* @blue: blue component of color
+ * @alpha: alpha component of color
*
- * Sets a constant color for filling and stroking. This replaces any
- * pattern set with cairo_set_pattern(). The color components are
- * floating point numbers in the range 0 to 1. If the values passed in
- * are outside that range, they will be clamped.
+ * Sets the source pattern within @cr to a translucent color. This
+ * color will then be used for any subsequent drawing operation until
+ * a new source pattern is set.
+ *
+ * The color and alpha components are floating point numbers in the
+ * range 0 to 1. If the values passed in are outside that range, they
+ * will be clamped.
**/
void
-cairo_set_rgb_color (cairo_t *cr, double red, double green, double blue)
+cairo_set_source_rgba (cairo_t *cr,
+ double red, double green, double blue,
+ double alpha)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_color_t color;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- _cairo_restrict_value (&red, 0.0, 1.0);
+ _cairo_restrict_value (&red, 0.0, 1.0);
_cairo_restrict_value (&green, 0.0, 1.0);
- _cairo_restrict_value (&blue, 0.0, 1.0);
+ _cairo_restrict_value (&blue, 0.0, 1.0);
+ _cairo_restrict_value (&alpha, 0.0, 1.0);
- cr->status = _cairo_gstate_set_rgb_color (cr->gstate, red, green, blue);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_color_init_rgba (&color, red, green, blue, alpha);
+
+ _cairo_set_source_solid (cr, &color);
}
void
-cairo_set_pattern (cairo_t *cr, cairo_pattern_t *pattern)
+cairo_set_source_surface (cairo_t *cr,
+ cairo_surface_t *surface,
+ double x,
+ double y)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_pattern_t *pattern;
+ cairo_matrix_t matrix;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ pattern = cairo_pattern_create_for_surface (surface);
+
+ cairo_matrix_init_translate (&matrix, -x, -y);
+ cairo_pattern_set_matrix (pattern, &matrix);
+
+ cairo_set_source (cr, pattern);
+ cairo_pattern_destroy (pattern);
+}
+
+/**
+ * cairo_set_source
+ * @cr: a cairo context
+ * @source: a #cairo_pattern_t to be used as the source for
+ * subsequent drawing operations.
+ *
+ * Sets the source pattern within @cr to @source. This pattern
+ * will then be used for any subsequent drawing operation until a new
+ * source pattern is set.
+ *
+ * XXX: I'd also like to direct the reader's attention to some
+ * (not-yet-written) section on cairo's imaging model. How would I do
+ * that if such a section existed? (cworth).
+ **/
+void
+cairo_set_source (cairo_t *cr, cairo_pattern_t *source)
+{
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ if (source == NULL) {
+ _cairo_error (cr, CAIRO_STATUS_NULL_POINTER);
+ return;
+ }
- cr->status = _cairo_gstate_set_pattern (cr->gstate, pattern);
- CAIRO_CHECK_SANITY (cr);
+ if (source->status) {
+ _cairo_error (cr, source->status);
+ return;
+ }
+
+ cr->status = _cairo_gstate_set_source (cr->gstate, source);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_get_source:
+ * @cr: a cairo context
+ *
+ * Gets the current source pattern for @cr.
+ *
+ * Return value: the current source pattern. This object is owned by
+ * cairo. To keep a reference to it, you must call
+ * cairo_pattern_reference().
+ **/
cairo_pattern_t *
-cairo_current_pattern (cairo_t *cr)
+cairo_get_source (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_pattern (cr->gstate);
+ if (cr->status) {
+ cairo_pattern_t *pattern;
+ pattern = _cairo_pattern_create_in_error (cr->status);
+ _cairo_error (cr, cr->status);
+ return pattern;
+ }
+
+ return _cairo_gstate_get_source (cr->gstate);
}
/**
@@ -425,263 +503,437 @@ cairo_current_pattern (cairo_t *cr)
void
cairo_set_tolerance (cairo_t *cr, double tolerance)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
_cairo_restrict_value (&tolerance, CAIRO_TOLERANCE_MINIMUM, tolerance);
cr->status = _cairo_gstate_set_tolerance (cr->gstate, tolerance);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
/**
- * cairo_set_alpha:
+ * cairo_set_fill_rule:
* @cr: a #cairo_t
- * @alpha: the alpha value. 0 is transparent, 1 fully opaque.
- * if the value is outside the range 0 to 1, it will be
- * clamped to that range.
- *
- * Sets an overall alpha value used for stroking and filling. This
- * value is multiplied with any alpha value coming from a gradient or
- * image pattern.
+ * @fill_rule: a fill rule, specified as a #cairo_fill_rule_t
+ *
+ * Set the current fill rule within the cairo context. The fill rule
+ * is used to determine which regions are inside or outside a complex
+ * (potentially self-intersecting) path. The current fill rule affects
+ * both cairo_fill and cairo_clip. See #cairo_fill_rule_t for details
+ * on the semantics of each available fill rule.
**/
void
-cairo_set_alpha (cairo_t *cr, double alpha)
-{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
- return;
-
- _cairo_restrict_value (&alpha, 0.0, 1.0);
-
- cr->status = _cairo_gstate_set_alpha (cr->gstate, alpha);
- CAIRO_CHECK_SANITY (cr);
-}
-
-void
cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_set_fill_rule (cr->gstate, fill_rule);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_set_line_width:
+ * @cr: a #cairo_t
+ * @width: a line width, as a user-space value
+ *
+ * Sets the current line width within the cairo context. The line
+ * width specifies the diameter of a pen that is circular in
+ * user-space.
+ *
+ * As with the other stroke parameters, the current line cap style is
+ * examined by cairo_stroke(), cairo_stroke_extents(), and
+ * cairo_stroke_to_path(), but does not have any effect during path
+ * construction.
+ **/
void
cairo_set_line_width (cairo_t *cr, double width)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
_cairo_restrict_value (&width, 0.0, width);
cr->status = _cairo_gstate_set_line_width (cr->gstate, width);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_set_line_cap:
+ * @cr: a cairo context, as a #cairo_t
+ * @line_cap: a line cap style, as a #cairo_line_cap_t
+ *
+ * Sets the current line cap style within the cairo context. See
+ * #cairo_line_cap_t for details about how the available line cap
+ * styles are drawn.
+ *
+ * As with the other stroke parameters, the current line cap style is
+ * examined by cairo_stroke(), cairo_stroke_extents(), and
+ * cairo_stroke_to_path(), but does not have any effect during path
+ * construction.
+ **/
void
cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_set_line_cap (cr->gstate, line_cap);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_set_line_join:
+ * @cr: a cairo context, as a #cairo_t
+ * @line_join: a line joint style, as a #cairo_line_join_t
+ *
+ * Sets the current line join style within the cairo context. See
+ * #cairo_line_join_t for details about how the available line join
+ * styles are drawn.
+ *
+ * As with the other stroke parameters, the current line join style is
+ * examined by cairo_stroke(), cairo_stroke_extents(), and
+ * cairo_stroke_to_path(), but does not have any effect during path
+ * construction.
+ **/
void
cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_set_line_join (cr->gstate, line_join);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_set_dash (cairo_t *cr, double *dashes, int ndash, double offset)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_set_dash (cr->gstate, dashes, ndash, offset);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_set_miter_limit (cairo_t *cr, double limit)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_set_miter_limit (cr->gstate, limit);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+
+/**
+ * cairo_translate:
+ * @cr: a cairo context
+ * @tx: amount to translate in the X direction
+ * @ty: amount to translate in the Y direction
+ *
+ * Modifies the current transformation matrix (CTM) by tanslating the
+ * user-space origin by (@tx, @ty). This offset is interpreted as a
+ * user-space coordinate according to the CTM in place before the new
+ * call to cairo_translate. In other words, the translation of the
+ * user-space origin takes place after any existing transformation.
+ **/
void
cairo_translate (cairo_t *cr, double tx, double ty)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_translate (cr->gstate, tx, ty);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_scale:
+ * @cr: a cairo context
+ * @sx: scale factor for the X dimension
+ * @sy: scale factor for the Y dimension
+ *
+ * Modifies the current transformation matrix (CTM) by scaling the X
+ * and Y user-space axes by @sx and @sy respectively. The scaling of
+ * the axes takes place after any existing transformation of user
+ * space.
+ **/
void
cairo_scale (cairo_t *cr, double sx, double sy)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_scale (cr->gstate, sx, sy);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+
+/**
+ * cairo_rotate:
+ * @cr: a cairo context
+ * @angle: angle (in radians) by which the user-space axes will be
+ * rotated
+ *
+ * Modifies the current transformation matrix (CTM) by rotating the
+ * user-space axes by @angle radians. The rotation of the axes takes
+ * places after any existing transformation of user space. The
+ * rotation direction for positive angles is from the positive X axis
+ * toward the positive Y axis.
+ **/
void
cairo_rotate (cairo_t *cr, double angle)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_rotate (cr->gstate, angle);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_transform:
+ * @cr: a cairo context
+ * @matrix: a transformation to be applied to the user-space axes
+ *
+ * Modifies the current transformation matrix (CTM) by applying
+ * @matrix as an additional transformation. The new transformation of
+ * user space takes place after any existing transformation.
+ **/
void
-cairo_concat_matrix (cairo_t *cr,
- cairo_matrix_t *matrix)
+cairo_transform (cairo_t *cr,
+ const cairo_matrix_t *matrix)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_concat_matrix (cr->gstate, matrix);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_transform (cr->gstate, matrix);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_set_matrix:
+ * @cr: a cairo context
+ * @matrix: a transformation matrix from user space to device space
+ *
+ * Modifies the current transformation matrix (CTM) by setting it
+ * equal to @matrix.
+ **/
void
-cairo_set_matrix (cairo_t *cr,
- cairo_matrix_t *matrix)
+cairo_set_matrix (cairo_t *cr,
+ const cairo_matrix_t *matrix)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_set_matrix (cr->gstate, matrix);
- CAIRO_CHECK_SANITY (cr);
-}
-
-void
-cairo_default_matrix (cairo_t *cr)
-{
- CAIRO_CHECK_SANITY (cr);
if (cr->status)
- return;
-
- cr->status = _cairo_gstate_default_matrix (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_identity_matrix:
+ * @cr: a cairo context
+ *
+ * Resets the current transformation matrix (CTM) by setting it equal
+ * to the identity matrix. That is, the user-space and device-space
+ * axes will be aligned and one user-space unit will transform to one
+ * device-space unit.
+ **/
void
cairo_identity_matrix (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_identity_matrix (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_user_to_device:
+ * @cr: a cairo context
+ * @x: X value of coordinate (in/out parameter)
+ * @y: Y value of coordinate (in/out parameter)
+ *
+ * Transform a coordinate from user space to device space by
+ * multiplying the given point by the current transformation matrix
+ * (CTM).
+ **/
void
-cairo_transform_point (cairo_t *cr, double *x, double *y)
+cairo_user_to_device (cairo_t *cr, double *x, double *y)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_transform_point (cr->gstate, x, y);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_user_to_device (cr->gstate, x, y);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_user_to_device_distance:
+ * @cr: a cairo context
+ * @dx: X component of a distance vector (in/out parameter)
+ * @dy: Y component of a distance vector (in/out parameter)
+ *
+ * Transform a distance vector from user space to device space. This
+ * function is similar to cairo_user_to_device() except that the
+ * translation components of the CTM will be ignored when transforming
+ * (@dx,@dy).
+ **/
void
-cairo_transform_distance (cairo_t *cr, double *dx, double *dy)
+cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_transform_distance (cr->gstate, dx, dy);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_user_to_device_distance (cr->gstate, dx, dy);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_device_to_user:
+ * @cr: a cairo
+ * @x: X value of coordinate (in/out parameter)
+ * @y: Y value of coordinate (in/out parameter)
+ *
+ * Transform a coordinate from device space to user space by
+ * multiplying the given point by the inverse of the current
+ * transformation matrix (CTM).
+ **/
void
-cairo_inverse_transform_point (cairo_t *cr, double *x, double *y)
+cairo_device_to_user (cairo_t *cr, double *x, double *y)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_inverse_transform_point (cr->gstate, x, y);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_device_to_user (cr->gstate, x, y);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_device_to_user_distance:
+ * @cr: a cairo context
+ * @dx: X component of a distance vector (in/out parameter)
+ * @dy: Y component of a distance vector (in/out parameter)
+ *
+ * Transform a distance vector from device space to user space. This
+ * function is similar to cairo_device_to_user() except that the
+ * translation components of the inverse CTM will be ignored when
+ * transforming (@dx,@dy).
+ **/
void
-cairo_inverse_transform_distance (cairo_t *cr, double *dx, double *dy)
+cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_inverse_transform_distance (cr->gstate, dx, dy);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_device_to_user_distance (cr->gstate, dx, dy);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_new_path (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_new_path (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_path_fixed_fini (&cr->path);
}
+slim_hidden_def(cairo_new_path);
void
cairo_move_to (cairo_t *cr, double x, double y)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_fixed_t x_fixed, y_fixed;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_move_to (cr->gstate, x, y);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
+ x_fixed = _cairo_fixed_from_double (x);
+ y_fixed = _cairo_fixed_from_double (y);
+
+ cr->status = _cairo_path_fixed_move_to (&cr->path, x_fixed, y_fixed);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
slim_hidden_def(cairo_move_to);
void
cairo_line_to (cairo_t *cr, double x, double y)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_fixed_t x_fixed, y_fixed;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
+ x_fixed = _cairo_fixed_from_double (x);
+ y_fixed = _cairo_fixed_from_double (y);
- cr->status = _cairo_gstate_line_to (cr->gstate, x, y);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_path_fixed_line_to (&cr->path, x_fixed, y_fixed);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
@@ -690,20 +942,39 @@ cairo_curve_to (cairo_t *cr,
double x2, double y2,
double x3, double y3)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_fixed_t x1_fixed, y1_fixed;
+ cairo_fixed_t x2_fixed, y2_fixed;
+ cairo_fixed_t x3_fixed, y3_fixed;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ _cairo_gstate_user_to_backend (cr->gstate, &x1, &y1);
+ _cairo_gstate_user_to_backend (cr->gstate, &x2, &y2);
+ _cairo_gstate_user_to_backend (cr->gstate, &x3, &y3);
- cr->status = _cairo_gstate_curve_to (cr->gstate,
- x1, y1,
- x2, y2,
- x3, y3);
- CAIRO_CHECK_SANITY (cr);
+ x1_fixed = _cairo_fixed_from_double (x1);
+ y1_fixed = _cairo_fixed_from_double (y1);
+
+ x2_fixed = _cairo_fixed_from_double (x2);
+ y2_fixed = _cairo_fixed_from_double (y2);
+
+ x3_fixed = _cairo_fixed_from_double (x3);
+ y3_fixed = _cairo_fixed_from_double (y3);
+
+ cr->status = _cairo_path_fixed_curve_to (&cr->path,
+ x1_fixed, y1_fixed,
+ x2_fixed, y2_fixed,
+ x3_fixed, y3_fixed);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
/**
* cairo_arc:
- * @cr: a Cairo context
+ * @cr: a cairo context
* @xc: X position of the center of the arc
* @yc: Y position of the center of the arc
* @radius: the radius of the arc
@@ -740,20 +1011,29 @@ cairo_arc (cairo_t *cr,
double radius,
double angle1, double angle2)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ /* Do nothing, successfully, if radius is <= 0 */
+ if (radius <= 0.0)
+ return;
+
+ while (angle2 < angle1)
+ angle2 += 2 * M_PI;
- cr->status = _cairo_gstate_arc (cr->gstate,
- xc, yc,
- radius,
- angle1, angle2);
- CAIRO_CHECK_SANITY (cr);
+ cairo_line_to (cr,
+ xc + radius * cos (angle1),
+ yc + radius * sin (angle1));
+
+ _cairo_arc_path (cr, xc, yc, radius,
+ angle1, angle2);
}
/**
* cairo_arc_negative:
- * @cr: a Cairo context
+ * @cr: a cairo context
* @xc: X position of the center of the arc
* @yc: Y position of the center of the arc
* @radius: the radius of the arc
@@ -771,15 +1051,24 @@ cairo_arc_negative (cairo_t *cr,
double radius,
double angle1, double angle2)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ /* Do nothing, successfully, if radius is <= 0 */
+ if (radius <= 0.0)
return;
- cr->status = _cairo_gstate_arc_negative (cr->gstate,
- xc, yc,
- radius,
- angle1, angle2);
- CAIRO_CHECK_SANITY (cr);
+ while (angle2 > angle1)
+ angle2 -= 2 * M_PI;
+
+ cairo_line_to (cr,
+ xc + radius * cos (angle1),
+ yc + radius * sin (angle1));
+
+ _cairo_arc_path_negative (cr, xc, yc, radius,
+ angle1, angle2);
}
/* XXX: NYI
@@ -802,23 +1091,39 @@ cairo_arc_to (cairo_t *cr,
void
cairo_rel_move_to (cairo_t *cr, double dx, double dy)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_fixed_t dx_fixed, dy_fixed;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
+ dx_fixed = _cairo_fixed_from_double (dx);
+ dy_fixed = _cairo_fixed_from_double (dy);
- cr->status = _cairo_gstate_rel_move_to (cr->gstate, dx, dy);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_path_fixed_rel_move_to (&cr->path, dx_fixed, dy_fixed);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_rel_line_to (cairo_t *cr, double dx, double dy)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_fixed_t dx_fixed, dy_fixed;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
+ dx_fixed = _cairo_fixed_from_double (dx);
+ dy_fixed = _cairo_fixed_from_double (dy);
- cr->status = _cairo_gstate_rel_line_to (cr->gstate, dx, dy);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_path_fixed_rel_line_to (&cr->path, dx_fixed, dy_fixed);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
slim_hidden_def(cairo_rel_line_to);
@@ -828,15 +1133,34 @@ cairo_rel_curve_to (cairo_t *cr,
double dx2, double dy2,
double dx3, double dy3)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ cairo_fixed_t dx1_fixed, dy1_fixed;
+ cairo_fixed_t dx2_fixed, dy2_fixed;
+ cairo_fixed_t dx3_fixed, dy3_fixed;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ _cairo_gstate_user_to_device_distance (cr->gstate, &dx1, &dy1);
+ _cairo_gstate_user_to_device_distance (cr->gstate, &dx2, &dy2);
+ _cairo_gstate_user_to_device_distance (cr->gstate, &dx3, &dy3);
+
+ dx1_fixed = _cairo_fixed_from_double (dx1);
+ dy1_fixed = _cairo_fixed_from_double (dy1);
+
+ dx2_fixed = _cairo_fixed_from_double (dx2);
+ dy2_fixed = _cairo_fixed_from_double (dy2);
+
+ dx3_fixed = _cairo_fixed_from_double (dx3);
+ dy3_fixed = _cairo_fixed_from_double (dy3);
- cr->status = _cairo_gstate_rel_curve_to (cr->gstate,
- dx1, dy1,
- dx2, dy2,
- dx3, dy3);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_path_fixed_rel_curve_to (&cr->path,
+ dx1_fixed, dy1_fixed,
+ dx2_fixed, dy2_fixed,
+ dx3_fixed, dy3_fixed);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
@@ -844,83 +1168,283 @@ cairo_rectangle (cairo_t *cr,
double x, double y,
double width, double height)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cairo_move_to (cr, x, y);
cairo_rel_line_to (cr, width, 0);
cairo_rel_line_to (cr, 0, height);
cairo_rel_line_to (cr, -width, 0);
cairo_close_path (cr);
- CAIRO_CHECK_SANITY (cr);
}
/* XXX: NYI
void
-cairo_stroke_path (cairo_t *cr)
+cairo_stroke_to_path (cairo_t *cr)
{
if (cr->status)
return;
cr->status = _cairo_gstate_stroke_path (cr->gstate);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
*/
void
cairo_close_path (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_close_path (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_path_fixed_close_path (&cr->path);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
slim_hidden_def(cairo_close_path);
+/**
+ * cairo_paint:
+ * @cr: a cairo context
+ *
+ * A drawing operator that paints the current source everywhere within
+ * the current clip region.
+ **/
void
-cairo_stroke (cairo_t *cr)
+cairo_paint (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ cr->status = _cairo_gstate_paint (cr->gstate);
if (cr->status)
+ _cairo_error (cr, cr->status);
+}
+
+/**
+ * cairo_paint_with_alpha:
+ * @cr: a cairo context
+ * @alpha: alpha value, between 0 (transparent) and 1 (opaque)
+ *
+ * A drawing operator that paints the current source everywhere within
+ * the current clip region using a mask of constant alpha value
+ * @alpha. The effect is similar to cairo_paint(), but the drawing
+ * is faded out using the alpha value.
+ **/
+void
+cairo_paint_with_alpha (cairo_t *cr,
+ double alpha)
+{
+ cairo_color_t color;
+ cairo_pattern_union_t pattern;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ if (CAIRO_ALPHA_IS_OPAQUE (alpha)) {
+ cairo_paint (cr);
return;
+ }
+
+ _cairo_color_init_rgba (&color, 1., 1., 1., alpha);
+ _cairo_pattern_init_solid (&pattern.solid, &color);
+
+ cr->status = _cairo_gstate_mask (cr->gstate, &pattern.base);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
- cr->status = _cairo_gstate_stroke (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_pattern_fini (&pattern.base);
}
+/**
+ * cairo_mask:
+ * @cr: a cairo context
+ * @pattern: a #cairo_pattern_t
+ *
+ * A drawing operator that paints the current source
+ * using the alpha channel of @pattern as a mask. (Opaque
+ * areas of @mask are painted with the source, transparent
+ * areas are not painted.)
+ */
void
-cairo_fill (cairo_t *cr)
+cairo_mask (cairo_t *cr,
+ cairo_pattern_t *pattern)
{
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ if (pattern == NULL) {
+ _cairo_error (cr, CAIRO_STATUS_NULL_POINTER);
+ return;
+ }
+
+ if (pattern->status) {
+ _cairo_error (cr, pattern->status);
+ return;
+ }
+
+ cr->status = _cairo_gstate_mask (cr->gstate, pattern);
if (cr->status)
+ _cairo_error (cr, cr->status);
+}
+
+/**
+ * cairo_mask_surface:
+ * @cr: a cairo context
+ * @surface: a #cairo_surface_t
+ * @surface_x: X coordinate at which to place the origin of @surface
+ * @surface_y: Y coordinate at which to place the origin of @surface
+ *
+ * A drawing operator that paints the current source
+ * using the alpha channel of @surface as a mask. (Opaque
+ * areas of @surface are painted with the source, transparent
+ * areas are not painted.)
+ */
+void
+cairo_mask_surface (cairo_t *cr,
+ cairo_surface_t *surface,
+ double surface_x,
+ double surface_y)
+{
+ cairo_pattern_t *pattern;
+ cairo_matrix_t matrix;
+
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ pattern = cairo_pattern_create_for_surface (surface);
+
+ cairo_matrix_init_translate (&matrix, - surface_x, - surface_y);
+ cairo_pattern_set_matrix (pattern, &matrix);
- cr->status = _cairo_gstate_fill (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ cairo_mask (cr, pattern);
+
+ cairo_pattern_destroy (pattern);
}
+/**
+ * cairo_stroke:
+ * @cr: a cairo context
+ *
+ * A drawing operator that strokes the current path according to the
+ * current line width, line join, line cap, and dash settings. After
+ * cairo_stroke, the current path will be cleared from the cairo
+ * context. See cairo_set_line_width(), cairo_set_line_join(),
+ * cairo_set_line_cap(), cairo_set_dash(), and
+ * cairo_stroke_preserve().
+ **/
void
-cairo_copy_page (cairo_t *cr)
+cairo_stroke (cairo_t *cr)
+{
+ cairo_stroke_preserve (cr);
+
+ cairo_new_path (cr);
+}
+
+/**
+ * cairo_stroke_preserve:
+ * @cr: a cairo context
+ *
+ * A drawing operator that strokes the current path according to the
+ * current line width, line join, line cap, and dash settings. Unlike
+ * cairo_stroke(), cairo_stroke_preserve preserves the path within the
+ * cairo context.
+ *
+ * See cairo_set_line_width(), cairo_set_line_join(),
+ * cairo_set_line_cap(), cairo_set_dash(), and
+ * cairo_stroke_preserve().
+ **/
+void
+cairo_stroke_preserve (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ cr->status = _cairo_gstate_stroke (cr->gstate, &cr->path);
if (cr->status)
+ _cairo_error (cr, cr->status);
+}
+slim_hidden_def(cairo_stroke_preserve);
+
+/**
+ * cairo_fill:
+ * @cr: a cairo context
+ *
+ * A drawing operator that fills the current path according to the
+ * current fill rule. After cairo_fill, the current path will be
+ * cleared from the cairo context. See cairo_set_fill_rule() and
+ * cairo_fill_preserve().
+ **/
+void
+cairo_fill (cairo_t *cr)
+{
+ cairo_fill_preserve (cr);
+
+ cairo_new_path (cr);
+}
+
+/**
+ * cairo_fill_preserve:
+ * @cr: a cairo context
+ *
+ * A drawing operator that fills the current path according to the
+ * current fill rule. Unlike cairo_fill(), cairo_fill_preserve
+ * preserves the path within the cairo context.
+ *
+ * See cairo_set_fill_rule() and cairo_fill().
+ **/
+void
+cairo_fill_preserve (cairo_t *cr)
+{
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ cr->status = _cairo_gstate_fill (cr->gstate, &cr->path);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
+}
+slim_hidden_def(cairo_fill_preserve);
+
+void
+cairo_copy_page (cairo_t *cr)
+{
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
cr->status = _cairo_gstate_copy_page (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_show_page (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_show_page (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
cairo_bool_t
@@ -928,16 +1452,18 @@ cairo_in_stroke (cairo_t *cr, double x, double y)
{
int inside;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return 0;
+ }
- cr->status = _cairo_gstate_in_stroke (cr->gstate, x, y, &inside);
-
- CAIRO_CHECK_SANITY (cr);
-
- if (cr->status)
+ cr->status = _cairo_gstate_in_stroke (cr->gstate,
+ &cr->path,
+ x, y, &inside);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return 0;
+ }
return inside;
}
@@ -947,16 +1473,18 @@ cairo_in_fill (cairo_t *cr, double x, double y)
{
int inside;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return 0;
+ }
- cr->status = _cairo_gstate_in_fill (cr->gstate, x, y, &inside);
-
- CAIRO_CHECK_SANITY (cr);
-
- if (cr->status)
+ cr->status = _cairo_gstate_in_fill (cr->gstate,
+ &cr->path,
+ x, y, &inside);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return 0;
+ }
return inside;
}
@@ -965,163 +1493,336 @@ void
cairo_stroke_extents (cairo_t *cr,
double *x1, double *y1, double *x2, double *y2)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_stroke_extents (cr->gstate, x1, y1, x2, y2);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_stroke_extents (cr->gstate,
+ &cr->path,
+ x1, y1, x2, y2);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_fill_extents (cairo_t *cr,
double *x1, double *y1, double *x2, double *y2)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_fill_extents (cr->gstate, x1, y1, x2, y2);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_fill_extents (cr->gstate,
+ &cr->path,
+ x1, y1, x2, y2);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_clip:
+ * @cr: a cairo context
+ *
+ * Establishes a new clip region by intersecting the current clip
+ * region with the current path as it would be filled by cairo_fill()
+ * and according to the current fill rule (see cairo_set_fill_rule()).
+ *
+ * After cairo_clip, the current path will be cleared from the cairo
+ * context.
+ *
+ * The current clip region affects all drawing operations by
+ * effectively masking out any changes to the surface that are outside
+ * the current clip region.
+ *
+ * Calling cairo_clip() can only make the clip region smaller, never
+ * larger. But the current clip is part of the graphics state, so a
+ * tempoarary restriction of the clip region can be achieved by
+ * calling cairo_clip() within a cairo_save()/cairo_restore()
+ * pair. The only other means of increasing the size of the clip
+ * region is cairo_reset_clip().
+ **/
void
-cairo_init_clip (cairo_t *cr)
+cairo_clip (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
- return;
+ cairo_clip_preserve (cr);
- cr->status = _cairo_gstate_init_clip (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ cairo_new_path (cr);
}
+/**
+ * cairo_clip_preserve:
+ * @cr: a cairo context
+ *
+ * Establishes a new clip region by intersecting the current clip
+ * region with the current path as it would be filled by cairo_fill()
+ * and according to the current fill rule (see cairo_set_fill_rule()).
+ *
+ * Unlike cairo_clip(), cairo_clip_preserve preserves the path within
+ * the cairo context.
+ *
+ * The current clip region affects all drawing operations by
+ * effectively masking out any changes to the surface that are outside
+ * the current clip region.
+ *
+ * Calling cairo_clip() can only make the clip region smaller, never
+ * larger. But the current clip is part of the graphics state, so a
+ * tempoarary restriction of the clip region can be achieved by
+ * calling cairo_clip() within a cairo_save()/cairo_restore()
+ * pair. The only other means of increasing the size of the clip
+ * region is cairo_reset_clip().
+ **/
void
-cairo_clip (cairo_t *cr)
+cairo_clip_preserve (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_clip (cr->gstate);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_clip (cr->gstate, &cr->path);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+slim_hidden_def(cairo_clip_preserve);
+/**
+ * cairo_reset_clip:
+ * @cr: a cairo context
+ *
+ * Reset the current clip region to its original, unrestricted
+ * state. That is, set the clip region to an infinitely large shape
+ * containing the target surface. Equivalently, if infinity is too
+ * hard to grasp, one can imagine the clip region being reset to the
+ * exact bounds of the target surface.
+ *
+ * Note that code meant to be reusable should not call
+ * cairo_reset_clip() as it will cause results unexpected by
+ * higher-level code which calls cairo_clip(). Consider using
+ * cairo_save() and cairo_restore() around cairo_clip() as a more
+ * robust means of temporarily restricting the clip region.
+ **/
void
-cairo_select_font (cairo_t *cr,
- const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight)
+cairo_reset_clip (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ cr->status = _cairo_gstate_reset_clip (cr->gstate);
if (cr->status)
+ _cairo_error (cr, cr->status);
+}
+
+/**
+ * cairo_select_font_face:
+ * @cr: a #cairo_t
+ * @family: a font family name, encoded in UTF-8
+ * @slant: the slant for the font
+ * @weight: the weight for the font
+ *
+ * Selects a family and style of font from a simplified description as
+ * a family name, slant and weight. This function is meant to be used
+ * only for applications with simple font needs: Cairo doesn't provide
+ * for operations such as listing all available fonts on the system,
+ * and it is expected that most applications will need to use a more
+ * comprehensive font handling and text layout library in addition to
+ * Cairo.
+ **/
+void
+cairo_select_font_face (cairo_t *cr,
+ const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight)
+{
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_select_font (cr->gstate, family, slant, weight);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_select_font_face (cr->gstate, family, slant, weight);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
/**
- * cairo_current_font:
+ * cairo_get_font_face:
* @cr: a #cairo_t
*
- * Gets the current font object for a #cairo_t. If there is no current
- * font object, because the font parameters, transform, or target
- * surface has been changed since a font was last used, a font object
- * will be created and stored in in the #cairo_t.
+ * Gets the current font face for a #cairo_t.
*
* Return value: the current font object. Can return %NULL
* on out-of-memory or if the context is already in
- * an error state. This object is owned by Cairo. To keep
- * a reference to it, you must call cairo_font_reference().
+ * an error state. This object is owned by cairo. To keep
+ * a reference to it, you must call cairo_font_face_reference().
**/
-cairo_font_t *
-cairo_current_font (cairo_t *cr)
+cairo_font_face_t *
+cairo_get_font_face (cairo_t *cr)
{
- cairo_font_t *ret;
+ cairo_font_face_t *font_face;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return NULL;
+ }
- cr->status = _cairo_gstate_current_font (cr->gstate, &ret);
- CAIRO_CHECK_SANITY (cr);
- return ret;
+ cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ /* XXX: When available:
+ return _cairo_font_face_create_in_error (cr->status);
+ */
+ return NULL;
+ }
+
+ return font_face;
}
+/**
+ * cairo_font_extents:
+ * @cr: a #cairo_t
+ * @extents: a #cairo_font_extents_t object into which the results
+ * will be stored.
+ *
+ * Gets the font extents for the currently selected font.
+ **/
void
-cairo_current_font_extents (cairo_t *cr,
- cairo_font_extents_t *extents)
+cairo_font_extents (cairo_t *cr,
+ cairo_font_extents_t *extents)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_current_font_extents (cr->gstate, extents);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
-
/**
- * cairo_set_font:
+ * cairo_set_font_face:
* @cr: a #cairo_t
- * @font: a #cairo_font_t, or %NULL to unset any previously set font.
- *
- * Replaces the current #cairo_font_t object in the #cairo_t with
- * @font. The replaced font in the #cairo_t will be destroyed if there
- * are no other references to it. Since a #cairo_font_t is specific to
- * a particular output device and size, changing the transformation,
- * font transformation, or target surfaces of a #cairo_t will clear
- * any previously set font. Setting the font using cairo_set_font() is
- * exclusive with the simple font selection API provided by
- * cairo_select_font(). The size and transformation set by
- * cairo_scale_font() and cairo_transform_font() are ignored unless
- * they were taken into account when creating @font.
+ * @font_face: a #cairo_font_face_t, or %NULL to restore to the default font
+ *
+ * Replaces the current #cairo_font_face_t object in the #cairo_t with
+ * @font_face. The replaced font face in the #cairo_t will be
+ * destroyed if there are no other references to it.
**/
void
-cairo_set_font (cairo_t *cr, cairo_font_t *font)
+cairo_set_font_face (cairo_t *cr,
+ cairo_font_face_t *font_face)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_set_font (cr->gstate, font);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_set_font_face (cr->gstate, font_face);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_set_font_size:
+ * @cr: a #cairo_t
+ * @size: the new font size, in user space units
+ *
+ * Sets the current font matrix to a scale by a factor of @size, replacing
+ * any font matrix previously set with cairo_set_font_size() or
+ * cairo_set_font_matrix(). This results in a font size of @size user space
+ * units. (More precisely, this matrix will result in the font's
+ * em-square being a @size by @size square in user space.)
+ **/
void
-cairo_scale_font (cairo_t *cr, double scale)
+cairo_set_font_size (cairo_t *cr, double size)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_scale_font (cr->gstate, scale);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_set_font_size (cr->gstate, size);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_set_font_matrix
+ * @cr: a #cairo_t
+ * @matrix: a #cairo_matrix_t describing a transform to be applied to
+ * the current font.
+ *
+ * Sets the current font matrix to @matrix. The font matrix gives a
+ * transformation from the design space of the font (in this space,
+ * the em-square is 1 unit by 1 unit) to user space. Normally, a
+ * simple scale is used (see cairo_set_font_size()), but a more
+ * complex font matrix can be used to shear the font
+ * or stretch it unequally along the two axes
+ **/
void
-cairo_transform_font (cairo_t *cr, cairo_matrix_t *matrix)
+cairo_set_font_matrix (cairo_t *cr,
+ const cairo_matrix_t *matrix)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_transform_font (cr->gstate, matrix);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_set_font_matrix (cr->gstate, matrix);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_get_font_matrix
+ * @cr: a #cairo_t
+ * @matrix: return value for the matrix
+ *
+ * Stores the current font matrix into @matrix. See
+ * cairo_set_font_matrix().
+ **/
void
-cairo_text_extents (cairo_t *cr,
- const unsigned char *utf8,
- cairo_text_extents_t *extents)
+cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix)
+{
+ _cairo_gstate_get_font_matrix (cr->gstate, matrix);
+}
+
+/**
+ * cairo_text_extents:
+ * @cr: a #cairo_t
+ * @utf8: a string of text, encoded in utf-8
+ * @extents: a #cairo_text_extents_t object into which the results
+ * will be stored.
+ *
+ * Gets the extents for a string of text. The extents describe a
+ * user-space rectangle that encloses the "inked" portion of the text,
+ * (as it would be drawn by cairo_show_text). Additionally, the
+ * x_advance and y_advance values indicate the amount by which the
+ * current point would be advanced by cairo_show_text.
+ *
+ * Note that whitespace characters do not directly contribute to the
+ * size of the rectangle (extents.width and extents.height). They do
+ * contribute indirectly by changing the position of non-whitespace
+ * characters. In particular, trailing whitespace characters are
+ * likely to not affect the size of the rectangle, though they will
+ * affect the x_advance and y_advance values.
+ **/
+void
+cairo_text_extents (cairo_t *cr,
+ const char *utf8,
+ cairo_text_extents_t *extents)
{
cairo_glyph_t *glyphs = NULL;
- int nglyphs;
+ int num_glyphs;
+ double x, y;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
if (utf8 == NULL) {
extents->x_bearing = 0.0;
@@ -1133,281 +1834,463 @@ cairo_text_extents (cairo_t *cr,
return;
}
- cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
- CAIRO_CHECK_SANITY (cr);
+ cairo_get_current_point (cr, &x, &y);
+
+ cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
+ x, y,
+ &glyphs, &num_glyphs);
if (cr->status) {
if (glyphs)
free (glyphs);
+ _cairo_error (cr, cr->status);
return;
}
- cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, nglyphs, extents);
- CAIRO_CHECK_SANITY (cr);
-
+ cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs, extents);
if (glyphs)
free (glyphs);
+
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_glyph_extents:
+ * @cr: a #cairo_t
+ * @glyphs: an array of #cairo_glyph_t objects
+ * @num_glyphs: the number of elements in @glyphs
+ * @extents: a #cairo_text_extents_t object into which the results
+ * will be stored
+ *
+ * Gets the extents for an array of glyphs. The extents describe a
+ * user-space rectangle that encloses the "inked" portion of the
+ * glyphs, (as they would be drawn by cairo_show_glyphs).
+ * Additionally, the x_advance and y_advance values indicate the
+ * amount by which the current point would be advanced by
+ * cairo_show_glyphs.
+ *
+ * Note that whitespace glyphs do not contribute to the size of the
+ * rectangle (extents.width and extents.height).
+ **/
void
cairo_glyph_extents (cairo_t *cr,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_text_extents_t *extents)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs,
extents);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
-cairo_show_text (cairo_t *cr, const unsigned char *utf8)
+cairo_show_text (cairo_t *cr, const char *utf8)
{
cairo_glyph_t *glyphs = NULL;
- int nglyphs;
+ int num_glyphs;
+ double x, y;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
if (utf8 == NULL)
return;
- cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
- CAIRO_CHECK_SANITY (cr);
+ cairo_get_current_point (cr, &x, &y);
+
+ cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
+ x, y,
+ &glyphs, &num_glyphs);
if (cr->status) {
if (glyphs)
free (glyphs);
+ _cairo_error (cr, cr->status);
return;
}
- cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, nglyphs);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
if (glyphs)
free (glyphs);
+
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
- CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
-cairo_text_path (cairo_t *cr, const unsigned char *utf8)
+cairo_text_path (cairo_t *cr, const char *utf8)
{
cairo_glyph_t *glyphs = NULL;
- int nglyphs;
+ int num_glyphs;
+ double x, y;
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
+
+ cairo_get_current_point (cr, &x, &y);
- cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8, &glyphs, &nglyphs);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
+ x, y,
+ &glyphs, &num_glyphs);
if (cr->status) {
if (glyphs)
free (glyphs);
+ _cairo_error (cr, cr->status);
return;
}
- cr->status = _cairo_gstate_glyph_path (cr->gstate, glyphs, nglyphs);
- CAIRO_CHECK_SANITY (cr);
-
+ cr->status = _cairo_gstate_glyph_path (cr->gstate,
+ glyphs, num_glyphs,
+ &cr->path);
if (glyphs)
free (glyphs);
-}
-void
-cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
-{
- CAIRO_CHECK_SANITY (cr);
if (cr->status)
- return;
+ _cairo_error (cr, cr->status);
- cr->status = _cairo_gstate_glyph_path (cr->gstate, glyphs, num_glyphs);
- CAIRO_CHECK_SANITY (cr);
}
void
-cairo_show_surface (cairo_t *cr,
- cairo_surface_t *surface,
- int width,
- int height)
+cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
return;
+ }
- cr->status = _cairo_gstate_show_surface (cr->gstate,
- surface, width, height);
- CAIRO_CHECK_SANITY (cr);
+ cr->status = _cairo_gstate_glyph_path (cr->gstate,
+ glyphs, num_glyphs,
+ &cr->path);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
+/**
+ * cairo_get_operator:
+ * @cr: a cairo context
+ *
+ * Gets the current compositing operator for a cairo context.
+ *
+ * Return value: the current compositing operator.
+ **/
cairo_operator_t
-cairo_current_operator (cairo_t *cr)
-{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_operator (cr->gstate);
-}
-DEPRECATE (cairo_get_operator, cairo_current_operator);
-
-void
-cairo_current_rgb_color (cairo_t *cr, double *red, double *green, double *blue)
-{
- CAIRO_CHECK_SANITY (cr);
- _cairo_gstate_current_rgb_color (cr->gstate, red, green, blue);
- CAIRO_CHECK_SANITY (cr);
-}
-DEPRECATE (cairo_get_rgb_color, cairo_current_rgb_color);
-
-double
-cairo_current_alpha (cairo_t *cr)
+cairo_get_operator (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_alpha (cr->gstate);
+ return _cairo_gstate_get_operator (cr->gstate);
}
-DEPRECATE (cairo_get_alpha, cairo_current_alpha);
+/**
+ * cairo_get_tolerance:
+ * @cr: a cairo context
+ *
+ * Gets the current tolerance value, as set by cairo_set_tolerance().
+ *
+ * Return value: the current tolerance value.
+ **/
double
-cairo_current_tolerance (cairo_t *cr)
+cairo_get_tolerance (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_tolerance (cr->gstate);
+ return _cairo_gstate_get_tolerance (cr->gstate);
}
-DEPRECATE (cairo_get_tolerance, cairo_current_tolerance);
+/**
+ * cairo_get_current_point:
+ * @cr: a cairo context
+ * @x: return value for X coordinate of the current point
+ * @y: return value for Y coordinate of the current point
+ *
+ * Gets the current point of the current path, which is
+ * conceptually the final point reached by the path so far.
+ *
+ * The current point is returned in the user-space coordinate
+ * system. If there is no defined current point then @x and @y will
+ * both be set to 0.0.
+ *
+ * Most path construction functions alter the current point. See the
+ * following for details on how they affect the current point:
+ *
+ * cairo_new_path(), cairo_move_to(), cairo_line_to(),
+ * cairo_curve_to(), cairo_arc(), cairo_rel_move_to(),
+ * cairo_rel_line_to(), cairo_rel_curve_to(), cairo_arc(),
+ * cairo_text_path(), cairo_stroke_to_path()
+ **/
void
-cairo_current_point (cairo_t *cr, double *x, double *y)
+cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret)
{
- CAIRO_CHECK_SANITY (cr);
- _cairo_gstate_current_point (cr->gstate, x, y);
- CAIRO_CHECK_SANITY (cr);
+ cairo_status_t status;
+ cairo_fixed_t x_fixed, y_fixed;
+ double x, y;
+
+ status = _cairo_path_fixed_get_current_point (&cr->path, &x_fixed, &y_fixed);
+ if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
+ x = 0.0;
+ y = 0.0;
+ } else {
+ x = _cairo_fixed_to_double (x_fixed);
+ y = _cairo_fixed_to_double (y_fixed);
+ _cairo_gstate_backend_to_user (cr->gstate, &x, &y);
+ }
+
+ if (x_ret)
+ *x_ret = x;
+ if (y_ret)
+ *y_ret = y;
}
-DEPRECATE (cairo_get_current_point, cairo_current_point);
+slim_hidden_def(cairo_get_current_point);
+/**
+ * cairo_get_fill_rule:
+ * @cr: a cairo context
+ *
+ * Gets the current fill rule, as set by cairo_set_fill_rule().
+ *
+ * Return value: the current fill rule.
+ **/
cairo_fill_rule_t
-cairo_current_fill_rule (cairo_t *cr)
+cairo_get_fill_rule (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_fill_rule (cr->gstate);
+ return _cairo_gstate_get_fill_rule (cr->gstate);
}
-DEPRECATE (cairo_get_fill_rule, cairo_current_fill_rule);
+/**
+ * cairo_get_line_width:
+ * @cr: a cairo context
+ *
+ * Gets the current line width, as set by cairo_set_line_width().
+ *
+ * Return value: the current line width, in user-space units.
+ **/
double
-cairo_current_line_width (cairo_t *cr)
+cairo_get_line_width (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_line_width (cr->gstate);
+ return _cairo_gstate_get_line_width (cr->gstate);
}
-DEPRECATE (cairo_get_line_width, cairo_current_line_width);
+/**
+ * cairo_get_line_cap:
+ * @cr: a cairo context
+ *
+ * Gets the current line cap style, as set by cairo_set_line_cap().
+ *
+ * Return value: the current line cap style.
+ **/
cairo_line_cap_t
-cairo_current_line_cap (cairo_t *cr)
+cairo_get_line_cap (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_line_cap (cr->gstate);
+ return _cairo_gstate_get_line_cap (cr->gstate);
}
-DEPRECATE (cairo_get_line_cap, cairo_current_line_cap);
+/**
+ * cairo_get_line_join:
+ * @cr: a cairo context
+ *
+ * Gets the current line join style, as set by cairo_set_line_join().
+ *
+ * Return value: the current line join style.
+ **/
cairo_line_join_t
-cairo_current_line_join (cairo_t *cr)
+cairo_get_line_join (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_line_join (cr->gstate);
+ return _cairo_gstate_get_line_join (cr->gstate);
}
-DEPRECATE (cairo_get_line_join, cairo_current_line_join);
+/**
+ * cairo_get_miter_limit:
+ * @cr: a cairo context
+ *
+ * Gets the current miter limit, as set by cairo_set_miter_limit().
+ *
+ * Return value: the current miter limit.
+ **/
double
-cairo_current_miter_limit (cairo_t *cr)
+cairo_get_miter_limit (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_miter_limit (cr->gstate);
+ return _cairo_gstate_get_miter_limit (cr->gstate);
}
-DEPRECATE (cairo_get_miter_limit, cairo_current_miter_limit);
+/**
+ * cairo_get_matrix:
+ * @cr: a cairo context
+ * @matrix: return value for the matrix
+ *
+ * Stores the current transformation matrix (CTM) into @matrix.
+ **/
void
-cairo_current_matrix (cairo_t *cr, cairo_matrix_t *matrix)
+cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix)
{
- CAIRO_CHECK_SANITY (cr);
- _cairo_gstate_current_matrix (cr->gstate, matrix);
- CAIRO_CHECK_SANITY (cr);
+ _cairo_gstate_get_matrix (cr->gstate, matrix);
}
-DEPRECATE (cairo_get_matrix, cairo_current_matrix);
+/**
+ * cairo_get_target:
+ * @cr: a cairo context
+ *
+ * Gets the target surface for the cairo context as passed to
+ * cairo_create().
+ *
+ * Return value: the target surface, (or NULL if @cr is in an error
+ * state). This object is owned by cairo. To keep a reference to it,
+ * you must call cairo_surface_reference().
+ **/
cairo_surface_t *
-cairo_current_target_surface (cairo_t *cr)
+cairo_get_target (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
- return _cairo_gstate_current_target_surface (cr->gstate);
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ /* XXX: Should be as follows when available:
+ return _cairo_surface_create_in_error ();
+ */
+ return NULL;
+ }
+
+ return _cairo_gstate_get_target (cr->gstate);
}
-DEPRECATE (cairo_get_target_surface, cairo_current_target_surface);
-void
-cairo_current_path (cairo_t *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_curve_to_func_t *curve_to,
- cairo_close_path_func_t *close_path,
- void *closure)
+/**
+ * cairo_copy_path:
+ * @cr: a cairo context
+ *
+ * Creates a copy of the current path and returns it to the user as a
+ * #cairo_path_t. See #cairo_path_data_t for hints on how to iterate
+ * over the returned data structure.
+ *
+ * Return value: the copy of the current path. The caller owns the
+ * returned object and should call cairo_path_destroy() when finished
+ * with it.
+ *
+ * This function will always return a valid pointer, but the result
+ * will have no data, (data==NULL and num_data==0), if either of the
+ * following conditions hold:
+ *
+ * 1) If there is insufficient memory to copy the path. In this case
+ * path->status will be set to CAIRO_STATUS_NO_MEMORY.
+ *
+ * 2) If @cr is already in an error state. In this case path->status
+ * will contain the same status that would be returned by
+ * cairo_status(cr).
+ **/
+cairo_path_t *
+cairo_copy_path (cairo_t *cr)
+{
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return _cairo_path_data_create_in_error (cr->status);
+ }
+
+ return _cairo_path_data_create (&cr->path, cr->gstate);
+}
+
+/**
+ * cairo_copy_path_flat:
+ * @cr: a cairo context
+ *
+ * Gets a flattened copy of the current path and returns it to the
+ * user as a #cairo_path_t. See #cairo_path_data_t for hints on
+ * how to iterate over the returned data structure.
+ *
+ * This function is like cairo_copy_path() except that any curves
+ * in the path will be approximated with piecewise-linear
+ * approximations, (accurate to within the current tolerance
+ * value). That is, the result is guaranteed to not have any elements
+ * of type CAIRO_PATH_CURVE_TO which will instead be replaced by a
+ * series of CAIRO_PATH_LINE_TO elements.
+ *
+ * Return value: the copy of the current path. The caller owns the
+ * returned object and should call cairo_path_destroy() when finished
+ * with it.
+ *
+ * This function will always return a valid pointer, but the result
+ * will have no data, (data==NULL and num_data==0), if either of the
+ * following conditions hold:
+ *
+ * 1) If there is insufficient memory to copy the path. In this case
+ * path->status will be set to CAIRO_STATUS_NO_MEMORY.
+ *
+ * 2) If @cr is already in an error state. In this case path->status
+ * will contain the same status that would be returned by
+ * cairo_status(cr).
+ **/
+cairo_path_t *
+cairo_copy_path_flat (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
if (cr->status)
- return;
-
- cr->status = _cairo_gstate_interpret_path (cr->gstate,
- move_to,
- line_to,
- curve_to,
- close_path,
- closure);
- CAIRO_CHECK_SANITY (cr);
+ return _cairo_path_data_create_in_error (cr->status);
+ else
+ return _cairo_path_data_create_flat (&cr->path, cr->gstate);
}
+/**
+ * cairo_append_path:
+ * @cr: a cairo context
+ * @path: path to be appended
+ *
+ * Append the @path onto the current path. The @path may be either the
+ * return value from one of cairo_copy_path() or
+ * cairo_copy_path_flat() or it may be constructed manually. See
+ * #cairo_path_t for details on how the path data structure should be
+ * initialized, and note that path->status must be initialized to
+ * CAIRO_STATUS_SUCCESS.
+ **/
void
-cairo_current_path_flat (cairo_t *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_close_path_func_t *close_path,
- void *closure)
+cairo_append_path (cairo_t *cr,
+ cairo_path_t *path)
{
- CAIRO_CHECK_SANITY (cr);
- if (cr->status)
+ if (cr->status) {
+ _cairo_error (cr, cr->status);
+ return;
+ }
+
+ if (path == NULL || path->data == NULL) {
+ _cairo_error (cr, CAIRO_STATUS_NULL_POINTER);
return;
+ }
- cr->status = _cairo_gstate_interpret_path (cr->gstate,
- move_to,
- line_to,
- NULL,
- close_path,
- closure);
- CAIRO_CHECK_SANITY (cr);
+ if (path->status) {
+ _cairo_error (cr, path->status);
+ return;
+ }
+
+ cr->status = _cairo_path_data_append_to_context (path, cr);
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
cairo_status_t
cairo_status (cairo_t *cr)
{
- CAIRO_CHECK_SANITY (cr);
return cr->status;
}
-DEPRECATE (cairo_get_status, cairo_status);
const char *
-cairo_status_string (cairo_t *cr)
+cairo_status_to_string (cairo_status_t status)
{
- switch (cr->status) {
+ switch (status) {
case CAIRO_STATUS_SUCCESS:
return "success";
case CAIRO_STATUS_NO_MEMORY:
@@ -1426,11 +2309,22 @@ cairo_status_string (cairo_t *cr)
return "NULL pointer";
case CAIRO_STATUS_INVALID_STRING:
return "input string not valid UTF-8";
+ case CAIRO_STATUS_INVALID_PATH_DATA:
+ return "input path data not valid";
+ case CAIRO_STATUS_READ_ERROR:
+ return "error while reading from input stream";
+ case CAIRO_STATUS_WRITE_ERROR:
+ return "error while writing to output stream";
+ case CAIRO_STATUS_SURFACE_FINISHED:
+ return "the target surface has been finished";
+ case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
+ return "the surface type is not appropriate for the operation";
+ case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
+ return "the pattern type is not appropriate for the operation";
}
return "<unknown error status>";
}
-DEPRECATE (cairo_get_status_string, cairo_status_string);
void
_cairo_restrict_value (double *value, double min, double max)
diff --git a/src/cairo.h b/src/cairo.h
index 03e0632..0fcd856 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1,6 +1,7 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -46,7 +47,6 @@
#endif
#include <cairo-features.h>
-#include <pixman.h>
CAIRO_BEGIN_DECLS
@@ -55,7 +55,7 @@ CAIRO_BEGIN_DECLS
*
* #cairo_bool_t is used for boolean values. Returns of type
* #cairo_bool_t will always be either 0 or 1, but testing against
- * these values explicitely is not encouraged; just use the
+ * these values explicitly is not encouraged; just use the
* value as a boolean condition.
*
* <informalexample><programlisting>
@@ -94,9 +94,58 @@ typedef struct _cairo_surface cairo_surface_t;
* A #cairo_matrix_t holds an affine transformation, such as a scale,
* rotation, or shear, or a combination of those.
**/
-typedef struct _cairo_matrix cairo_matrix_t;
+typedef struct _cairo_matrix {
+ double xx; double yx;
+ double xy; double yy;
+ double x0; double y0;
+} cairo_matrix_t;
+
typedef struct _cairo_pattern cairo_pattern_t;
+/**
+ * cairo_destroy_func_t
+ *
+ * #cairo_destroy_func_t the type of function which is called when a
+ * data element is destroyed. It is passed the pointer to the data
+ * element and should free any memory and resources allocated for it.
+ */
+typedef void (*cairo_destroy_func_t) (void *data);
+
+/**
+ * cairo_user_data_key_t
+ *
+ * #cairo_user_data_key_t is used for attaching user data to cairo
+ * data structures. The actual contents of the struct is never used,
+ * and there is no need to initialize the object; only the unique
+ * address of a #cairo_data_key_t object is used. Typically, you
+ * would just use the address of a static #cairo_data_key_t object.
+ */
+typedef struct _cairo_user_data_key {
+ int unused;
+} cairo_user_data_key_t;
+
+/**
+ * cairo_status_t
+ * @CAIRO_STATUS_SUCCESS: no error has occurred
+ * @CAIRO_STATUS_NO_MEMORY:
+ * @CAIRO_STATUS_INVALID_RESTORE:
+ * @CAIRO_STATUS_INVALID_POP_GROUP:
+ * @CAIRO_STATUS_NO_CURRENT_POINT:
+ * @CAIRO_STATUS_INVALID_MATRIX:
+ * @CAIRO_STATUS_NO_TARGET_SURFACE:
+ * @CAIRO_STATUS_NULL_POINTER:
+ * @CAIRO_STATUS_INVALID_STRING:
+ * @CAIRO_STATUS_INVALID_PATH_DATA:
+ * @CAIRO_STATUS_READ_ERROR:
+ * @CAIRO_STATUS_WRITE_ERROR:
+ * @CAIRO_STATUS_SURFACE_FINISHED:
+ * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
+ *
+ * #cairo_status_t is used to indicate errors that can occur when
+ * using Cairo. In some cases it is returned directly by functions.
+ * but when using #cairo_t, the last error, if any, is stored in
+ * the context and can be retrieved with cairo_status().
+ **/
typedef enum cairo_status {
CAIRO_STATUS_SUCCESS = 0,
CAIRO_STATUS_NO_MEMORY,
@@ -106,12 +155,48 @@ typedef enum cairo_status {
CAIRO_STATUS_INVALID_MATRIX,
CAIRO_STATUS_NO_TARGET_SURFACE,
CAIRO_STATUS_NULL_POINTER,
- CAIRO_STATUS_INVALID_STRING
+ CAIRO_STATUS_INVALID_STRING,
+ CAIRO_STATUS_INVALID_PATH_DATA,
+ CAIRO_STATUS_READ_ERROR,
+ CAIRO_STATUS_WRITE_ERROR,
+ CAIRO_STATUS_SURFACE_FINISHED,
+ CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
+ CAIRO_STATUS_PATTERN_TYPE_MISMATCH
} cairo_status_t;
+/**
+ * cairo_write_func_t
+ *
+ * #cairo_write_func_t is the type of function which is called when a
+ * backend needs to write data to an output stream. It is passed the
+ * closure which was specified by the user at the time the write
+ * function was registered, the data to write and the length of the
+ * data in bytes. The write function should return
+ * CAIRO_STATUS_SUCCESS if all the data was successfully written,
+ * CAIRO_STATUS_WRITE_ERROR otherwise.
+ */
+typedef cairo_status_t (*cairo_write_func_t) (void *closure,
+ const unsigned char *data,
+ unsigned int length);
+
+/**
+ * cairo_read_func_t
+ *
+ * #cairo_read_func_t is the type of function which is called when a
+ * backend needs to read data from an intput stream. It is passed the
+ * closure which was specified by the user at the time the read
+ * function was registered, the buffer to read the data into and the
+ * length of the data in bytes. The read function should return
+ * CAIRO_STATUS_SUCCESS if all the data was successfully written,
+ * CAIRO_STATUS_READ_ERROR otherwise.
+ */
+typedef cairo_status_t (*cairo_read_func_t) (void *closure,
+ unsigned char *data,
+ unsigned int length);
+
/* Functions for manipulating state objects */
cairo_t *
-cairo_create (void);
+cairo_create (cairo_surface_t *target);
void
cairo_reference (cairo_t *cr);
@@ -125,10 +210,6 @@ cairo_save (cairo_t *cr);
void
cairo_restore (cairo_t *cr);
-/* XXX: Replace with cairo_current_gstate/cairo_set_gstate */
-void
-cairo_copy (cairo_t *dest, cairo_t *src);
-
/* XXX: I want to rethink this API
void
cairo_push_group (cairo_t *cr);
@@ -138,59 +219,22 @@ cairo_pop_group (cairo_t *cr);
*/
/* Modify state */
-void
-cairo_set_target_surface (cairo_t *cr, cairo_surface_t *surface);
-
-/**
- * cairo_format_t
- * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
- * alpha in the upper 8 bits, then red, then green, then blue.
- * The 32-bit quanties are stored native-endian. Pre-multiplied
- * alpha is used. (That is, 50% transparent red is 0x80800000,
- * not 0x80ff0000.)
- * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with
- * the upper 8 bits unused. Red, Green, and Blue are stored
- * in the remaining 24 bits in that order.
- * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding
- * an alpha value.
- * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding
- * an alpha value. Pixels are packed together into 32-bit
- * quantities. The ordering of the bits matches the
- * endianess of the platform. On a big-endian machine, the
- * first pixel is in the uppermost bit, on a little-endian
- * machine the first pixel is in the least-significant bit.
- *
- * #cairo_format_t is used to identify the memory format of
- * image data.
- */
-typedef enum cairo_format {
- CAIRO_FORMAT_ARGB32,
- CAIRO_FORMAT_RGB24,
- CAIRO_FORMAT_A8,
- CAIRO_FORMAT_A1
-} cairo_format_t;
-/* XXX: Need to add cairo_set_target_image_data */
-void
-cairo_set_target_image (cairo_t *cr,
- char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride);
-
-typedef enum cairo_operator {
+typedef enum cairo_operator {
CAIRO_OPERATOR_CLEAR,
- CAIRO_OPERATOR_SRC,
- CAIRO_OPERATOR_DST,
+
+ CAIRO_OPERATOR_SOURCE,
CAIRO_OPERATOR_OVER,
- CAIRO_OPERATOR_OVER_REVERSE,
CAIRO_OPERATOR_IN,
- CAIRO_OPERATOR_IN_REVERSE,
CAIRO_OPERATOR_OUT,
- CAIRO_OPERATOR_OUT_REVERSE,
CAIRO_OPERATOR_ATOP,
- CAIRO_OPERATOR_ATOP_REVERSE,
+
+ CAIRO_OPERATOR_DEST,
+ CAIRO_OPERATOR_DEST_OVER,
+ CAIRO_OPERATOR_DEST_IN,
+ CAIRO_OPERATOR_DEST_OUT,
+ CAIRO_OPERATOR_DEST_ATOP,
+
CAIRO_OPERATOR_XOR,
CAIRO_OPERATOR_ADD,
CAIRO_OPERATOR_SATURATE
@@ -199,36 +243,23 @@ typedef enum cairo_operator {
void
cairo_set_operator (cairo_t *cr, cairo_operator_t op);
-/* XXX: Probably want to bite the bullet and expose a cairo_color_t object */
-
-/* XXX: I've been trying to come up with a sane way to specify:
-
- cairo_set_color (cairo_t *cr, cairo_color_t *color);
-
- Keith wants to be able to support super-luminescent colors,
- (premultiplied colors with R/G/B greater than alpha). The current
- API does not allow that. Adding a premulitplied RGBA cairo_color_t
- would do the trick.
-
- One problem though is that alpha is currently orthogonal to
- color. For example, show_surface uses gstate->alpha but ignores the
- color. So, it doesn't seem be right to have cairo_set_color modify
- the behavior of cairo_show_surface.
-*/
+void
+cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
void
-cairo_set_rgb_color (cairo_t *cr, double red, double green, double blue);
+cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
void
-cairo_set_pattern (cairo_t *cr, cairo_pattern_t *pattern);
+cairo_set_source_rgba (cairo_t *cr,
+ double red, double green, double blue,
+ double alpha);
void
-cairo_set_alpha (cairo_t *cr, double alpha);
+cairo_set_source_surface (cairo_t *cr,
+ cairo_surface_t *surface,
+ double x,
+ double y);
-/* XXX: Currently, the tolerance value is specified by the user in
- terms of device-space units. If I'm not mistaken, this is the only
- value in this API that is not expressed in user-space units. I
- should think whether this value should be user-space instead. */
void
cairo_set_tolerance (cairo_t *cr, double tolerance);
@@ -307,32 +338,27 @@ void
cairo_rotate (cairo_t *cr, double angle);
void
-cairo_concat_matrix (cairo_t *cr,
- cairo_matrix_t *matrix);
+cairo_transform (cairo_t *cr,
+ const cairo_matrix_t *matrix);
void
-cairo_set_matrix (cairo_t *cr,
- cairo_matrix_t *matrix);
-
-void
-cairo_default_matrix (cairo_t *cr);
-
-/* XXX: There's been a proposal to add cairo_default_matrix_exact */
+cairo_set_matrix (cairo_t *cr,
+ const cairo_matrix_t *matrix);
void
cairo_identity_matrix (cairo_t *cr);
void
-cairo_transform_point (cairo_t *cr, double *x, double *y);
+cairo_user_to_device (cairo_t *cr, double *x, double *y);
void
-cairo_transform_distance (cairo_t *cr, double *dx, double *dy);
+cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
void
-cairo_inverse_transform_point (cairo_t *cr, double *x, double *y);
+cairo_device_to_user (cairo_t *cr, double *x, double *y);
void
-cairo_inverse_transform_distance (cairo_t *cr, double *dx, double *dy);
+cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
/* Path creation functions */
void
@@ -387,16 +413,9 @@ cairo_rectangle (cairo_t *cr,
double x, double y,
double width, double height);
-/* XXX: This is the same name that PostScript uses, but to me the name
- suggests an actual drawing operation ala cairo_stroke --- especially
- since I want to add a cairo_path_t and with that it would be
- natural to have "cairo_stroke_path (cairo_t *, cairo_path_t *)"
-
- Maybe we could use something like "cairo_outline_path (cairo_t *)"?
-*/
/* XXX: NYI
void
-cairo_stroke_path (cairo_t *cr);
+cairo_stroke_to_path (cairo_t *cr);
*/
void
@@ -404,12 +423,35 @@ cairo_close_path (cairo_t *cr);
/* Painting functions */
void
+cairo_paint (cairo_t *cr);
+
+void
+cairo_paint_with_alpha (cairo_t *cr,
+ double alpha);
+
+void
+cairo_mask (cairo_t *cr,
+ cairo_pattern_t *pattern);
+
+void
+cairo_mask_surface (cairo_t *cr,
+ cairo_surface_t *surface,
+ double surface_x,
+ double surface_y);
+
+void
cairo_stroke (cairo_t *cr);
void
+cairo_stroke_preserve (cairo_t *cr);
+
+void
cairo_fill (cairo_t *cr);
void
+cairo_fill_preserve (cairo_t *cr);
+
+void
cairo_copy_page (cairo_t *cr);
void
@@ -435,25 +477,37 @@ cairo_fill_extents (cairo_t *cr,
/* Clipping */
void
-cairo_init_clip (cairo_t *cr);
+cairo_reset_clip (cairo_t *cr);
-/* Note: cairo_clip does not consume the current path */
void
cairo_clip (cairo_t *cr);
+void
+cairo_clip_preserve (cairo_t *cr);
+
/* Font/Text functions */
/**
- * cairo_font_t:
- *
- * A #cairo_font_t is a font scaled to a particular size and device
- * resolution. A font can be set on a #cairo_t by using
- * cairo_set_font() assuming that the current transformation and
- * target surface of the #cairo_t match that for which the
- * #cairo_font_t was created. The effect of using a mismatched
- * #cairo_font_t will be incorrect font metrics.
+ * cairo_scaled_font_t:
+ *
+ * A #cairo_scaled_font_t is a font scaled to a particular size and device
+ * resolution. A cairo_scaled_font_t is most useful for low-level font
+ * usage where a library or application wants to cache a reference
+ * to a scaled font to speed up the computation of metrics.
*/
-typedef struct _cairo_font cairo_font_t;
+typedef struct _cairo_scaled_font cairo_scaled_font_t;
+
+/**
+ * cairo_font_face_t:
+ *
+ * A #cairo_font_face_t specifies all aspects of a font other
+ * than the size or font matrix (a font matrix is used to distort
+ * a font by sheering it or scaling it unequally in the two
+ * directions) . A font face can be set on a #cairo_t by using
+ * cairo_set_font_face(); the size and font matrix are set with
+ * cairo_set_font_size() and cairo_set_font_matrix().
+ */
+typedef struct _cairo_font_face cairo_font_face_t;
/**
* cairo_glyph_t:
@@ -502,10 +556,10 @@ typedef struct {
* after drawing these glyphs. Will typically be zero except
* for vertical text layout as found in East-Asian languages.
*
- * The #cairo_text_extents_t< structure stores the extents of a single
+ * The #cairo_text_extents_t structure stores the extents of a single
* glyph or a string of glyphs in user-space coordinates. Because text
- * extents are in user-space coordinates, they don't scale along with
- * the current transformation matrix. If you call
+ * extents are in user-space coordinates, they are mostly, but not
+ * entirely, independent of the current transformation matrix. If you call
* <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
* be drawn twice as big, but the reported text extents will not be
* doubled. They will change slightly due to hinting (so you can't
@@ -521,6 +575,47 @@ typedef struct {
double y_advance;
} cairo_text_extents_t;
+/**
+ * cairo_font_extents_t:
+ * @ascent: the distance that the font extends above the baseline.
+ * Note that this is not always exactly equal to the maximum
+ * of the extents of all the glyphs in the font, but rather
+ * is picked to express the font designer's intent as to
+ * how the font should align with elements above it.
+ * @descent: the distance that the font extends below the baseline.
+ * This value is positive for typical fonts that include
+ * portions below the baseline. Note that this is not always
+ * exactly equal to the maximum of the extents of all the
+ * glyphs in the font, but rather is picked to express the
+ * font designer's intent as to how the the font should
+ * align with elements below it.
+ * @height: the recommended vertical distance between baselines when
+ * setting consecutive lines of text with the font. This
+ * is greater than @ascent+@descent by a
+ * quantity known as the <firstterm>line spacing</firstterm>
+ * or <firstterm>external leading</firstterm>. When space
+ * is at a premium, most fonts can be set with only
+ * a distance of @ascent+@descent between lines.
+ * @max_x_advance: the maximum distance in the X direction that
+ * the the origin is advanced for any glyph in the font.
+ * @max_y_advance: the maximum distance in the Y direction that
+ * the the origin is advanced for any glyph in the font.
+ * this will be zero for normal fonts used for horizontal
+ * writing. (The scripts of East Asia are sometimes written
+ * vertically.)
+ *
+ * The #cairo_text_extents_t structure stores metric information for
+ * a font. Values are given in the current user-space coordinate
+ * system.
+ *
+ * Because font metrics are in user-space coordinates, they are
+ * mostly, but not entirely, independent of the current transformation
+ * matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
+ * text will be drawn twice as big, but the reported text extents will
+ * not be doubled. They will change slightly due to hinting (so you
+ * can't assume that metrics are independent of the transformation
+ * matrix), but otherwise will remain unchanged.
+ */
typedef struct {
double ascent;
double descent;
@@ -544,37 +639,42 @@ typedef enum cairo_font_weight {
font object inside the the cairo_t. */
void
-cairo_select_font (cairo_t *cr,
- const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight);
+cairo_select_font_face (cairo_t *cr,
+ const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight);
+
+void
+cairo_set_font_size (cairo_t *cr, double size);
void
-cairo_scale_font (cairo_t *cr, double scale);
+cairo_set_font_matrix (cairo_t *cr,
+ const cairo_matrix_t *matrix);
void
-cairo_transform_font (cairo_t *cr, cairo_matrix_t *matrix);
+cairo_get_font_matrix (cairo_t *cr,
+ cairo_matrix_t *matrix);
void
-cairo_show_text (cairo_t *cr, const unsigned char *utf8);
+cairo_show_text (cairo_t *cr, const char *utf8);
void
cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
-cairo_font_t *
-cairo_current_font (cairo_t *cr);
+cairo_font_face_t *
+cairo_get_font_face (cairo_t *cr);
void
-cairo_current_font_extents (cairo_t *cr,
- cairo_font_extents_t *extents);
+cairo_font_extents (cairo_t *cr,
+ cairo_font_extents_t *extents);
void
-cairo_set_font (cairo_t *cr, cairo_font_t *font);
+cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
void
-cairo_text_extents (cairo_t *cr,
- const unsigned char *utf8,
- cairo_text_extents_t *extents);
+cairo_text_extents (cairo_t *cr,
+ const char *utf8,
+ cairo_text_extents_t *extents);
void
cairo_glyph_extents (cairo_t *cr,
@@ -583,119 +683,198 @@ cairo_glyph_extents (cairo_t *cr,
cairo_text_extents_t *extents);
void
-cairo_text_path (cairo_t *cr, const unsigned char *utf8);
+cairo_text_path (cairo_t *cr, const char *utf8);
void
cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs);
-/* Portable interface to general font features. */
-
+/* Generic identifier for a font style */
+
void
-cairo_font_reference (cairo_font_t *font);
+cairo_font_face_reference (cairo_font_face_t *font_face);
void
-cairo_font_destroy (cairo_font_t *font);
+cairo_font_face_destroy (cairo_font_face_t *font_face);
+
+void *
+cairo_font_face_get_user_data (cairo_font_face_t *font_face,
+ const cairo_user_data_key_t *key);
cairo_status_t
-cairo_font_extents (cairo_font_t *font,
- cairo_matrix_t *font_matrix,
- cairo_font_extents_t *extents);
+cairo_font_face_set_user_data (cairo_font_face_t *font_face,
+ const cairo_user_data_key_t *key,
+ void *user_data,
+ cairo_destroy_func_t destroy);
+
+/* Portable interface to general font features. */
+
+cairo_scaled_font_t *
+cairo_scaled_font_create (cairo_font_face_t *font_face,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm);
void
-cairo_font_glyph_extents (cairo_font_t *font,
- cairo_matrix_t *font_matrix,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents);
+cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
-/* Image functions */
+void
+cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
+
+cairo_status_t
+cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font,
+ cairo_font_extents_t *extents);
-/* XXX: Eliminate width/height here */
void
-cairo_show_surface (cairo_t *cr,
- cairo_surface_t *surface,
- int width,
- int height);
+cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents);
/* Query functions */
-/* XXX: It would be nice if I could find a simpler way to make the
- definitions for the deprecated functions. Ideally, I would just
- have to put DEPRECATE (cairo_get_operator, cairo_current_operator)
- into one file and be done with it. For now, I've got a little more
- typing than that. */
-
cairo_operator_t
-cairo_current_operator (cairo_t *cr);
+cairo_get_operator (cairo_t *cr);
-void
-cairo_current_rgb_color (cairo_t *cr, double *red, double *green, double *blue);
cairo_pattern_t *
-cairo_current_pattern (cairo_t *cr);
-
-double
-cairo_current_alpha (cairo_t *cr);
-
-/* XXX: Do we want cairo_current_pattern as well? */
+cairo_get_source (cairo_t *cr);
double
-cairo_current_tolerance (cairo_t *cr);
+cairo_get_tolerance (cairo_t *cr);
void
-cairo_current_point (cairo_t *cr, double *x, double *y);
+cairo_get_current_point (cairo_t *cr, double *x, double *y);
cairo_fill_rule_t
-cairo_current_fill_rule (cairo_t *cr);
+cairo_get_fill_rule (cairo_t *cr);
double
-cairo_current_line_width (cairo_t *cr);
+cairo_get_line_width (cairo_t *cr);
cairo_line_cap_t
-cairo_current_line_cap (cairo_t *cr);
+cairo_get_line_cap (cairo_t *cr);
cairo_line_join_t
-cairo_current_line_join (cairo_t *cr);
+cairo_get_line_join (cairo_t *cr);
double
-cairo_current_miter_limit (cairo_t *cr);
+cairo_get_miter_limit (cairo_t *cr);
-/* XXX: How to do cairo_current_dash??? Do we want to switch to a cairo_dash object? */
+/* XXX: How to do cairo_get_dash??? Do we want to switch to a cairo_dash object? */
void
-cairo_current_matrix (cairo_t *cr, cairo_matrix_t *matrix);
+cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
-/* XXX: Need to decide the memory mangement semantics of this
- function. Should it reference the surface again? */
cairo_surface_t *
-cairo_current_target_surface (cairo_t *cr);
+cairo_get_target (cairo_t *cr);
-typedef void (cairo_move_to_func_t) (void *closure,
- double x, double y);
+/**
+ * cairo_path_data_t:
+ *
+ * A data structure for holding path data---appears within
+ * #cairo_path_t.
+ *
+ * The data structure is designed to try to balance the demands of
+ * efficiency and ease-of-use. A path is represented as an array of
+ * cairo_path_data_t which is a union of headers and points.
+ *
+ * Each portion of the path is represented by one or more elements in
+ * the array, (one header followed by 0 or more points). The length
+ * value of the header is the number of array elements for the current
+ * portion including the header, (ie. length == 1 + # of points), and
+ * where the number of points for each element type must be as
+ * follows:
+ *
+ * CAIRO_PATH_MOVE_TO: 1 point
+ * CAIRO_PATH_LINE_TO: 1 point
+ * CAIRO_PATH_CURVE_TO: 3 points
+ * CAIRO_PATH_CLOSE_PATH: 0 points
+ *
+ * The semantics and ordering of the coordinate values are consistent
+ * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
+ * cairo_close_path().
+ *
+ * Here is sample code for iterating through a #cairo_path_t:
+ *
+ * <informalexample><programlisting>
+ * int i;
+ * cairo_path_t *path;
+ * cairo_path_data_t *data;
+ *
+ * path = cairo_copy_path (cr);
+ *
+ * for (i=0; i < path->num_data; i += path->data[i].header.length) {
+ * data = &path->data[i];
+ * switch (data->header.type) {
+ * case CAIRO_PATH_MOVE_TO:
+ * do_move_to_things (data[1].point.x, data[1].point.y);
+ * break;
+ * case CAIRO_PATH_LINE_TO:
+ * do_line_to_things (data[1].point.x, data[1].point.y);
+ * break;
+ * case CAIRO_PATH_CURVE_TO:
+ * do_curve_to_things (data[1].point.x, data[1].point.y,
+ * data[2].point.x, data[2].point.y,
+ * data[3].point.x, data[3].point.y);
+ * break;
+ * case CAIRO_PATH_CLOSE_PATH:
+ * do_close_path_things ();
+ * break;
+ * }
+ * }
+ *
+ * cairo_path_destroy (path);
+ * </programlisting></informalexample>
+ */
+typedef enum cairo_path_data_type {
+ CAIRO_PATH_MOVE_TO,
+ CAIRO_PATH_LINE_TO,
+ CAIRO_PATH_CURVE_TO,
+ CAIRO_PATH_CLOSE_PATH
+} cairo_path_data_type_t;
+
+typedef union {
+ struct {
+ cairo_path_data_type_t type;
+ int length;
+ } header;
+ struct {
+ double x, y;
+ } point;
+} cairo_path_data_t;
-typedef void (cairo_line_to_func_t) (void *closure,
- double x, double y);
+/**
+ * cairo_path_t:
+ *
+ * A data structure for holding a path. This data structure serves as
+ * the return value for cairo_copy_path_data() and
+ * cairo_copy_path_data_flat() as well the input value for
+ * cairo_append_path().
+ *
+ * See #cairo_path_data_t for hints on how to iterate over the
+ * actual data within the path.
+ *
+ * The num_data member gives the number of elements in the data
+ * array. This number is larger than the number of independent path
+ * portions (MOVE_TO, LINE_TO, CURVE_TO, CLOSE_PATH), since the data
+ * includes both headers and coordinates for each portion.
+ **/
+typedef struct cairo_path {
+ cairo_status_t status;
+ cairo_path_data_t *data;
+ int num_data;
+} cairo_path_t;
-typedef void (cairo_curve_to_func_t) (void *closure,
- double x1, double y1,
- double x2, double y2,
- double x3, double y3);
+cairo_path_t *
+cairo_copy_path (cairo_t *cr);
-typedef void (cairo_close_path_func_t) (void *closure);
+cairo_path_t *
+cairo_copy_path_flat (cairo_t *cr);
-extern void
-cairo_current_path (cairo_t *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_curve_to_func_t *curve_to,
- cairo_close_path_func_t *close_path,
- void *closure);
+void
+cairo_append_path (cairo_t *cr,
+ cairo_path_t *path);
-extern void
-cairo_current_path_flat (cairo_t *cr,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_close_path_func_t *close_path,
- void *closure);
+void
+cairo_path_destroy (cairo_path_t *path);
/* Error status queries */
@@ -703,20 +882,41 @@ cairo_status_t
cairo_status (cairo_t *cr);
const char *
-cairo_status_string (cairo_t *cr);
+cairo_status_to_string (cairo_status_t status);
/* Surface manipulation */
-/* XXX: We may want to rename this function in light of the new
- virtualized surface backends... */
-cairo_surface_t *
-cairo_surface_create_for_image (char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride);
+
+/**
+ * cairo_format_t
+ * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
+ * alpha in the upper 8 bits, then red, then green, then blue.
+ * The 32-bit quantities are stored native-endian. Pre-multiplied
+ * alpha is used. (That is, 50% transparent red is 0x80800000,
+ * not 0x80ff0000.)
+ * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with
+ * the upper 8 bits unused. Red, Green, and Blue are stored
+ * in the remaining 24 bits in that order.
+ * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding
+ * an alpha value.
+ * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding
+ * an alpha value. Pixels are packed together into 32-bit
+ * quantities. The ordering of the bits matches the
+ * endianess of the platform. On a big-endian machine, the
+ * first pixel is in the uppermost bit, on a little-endian
+ * machine the first pixel is in the least-significant bit.
+ *
+ * #cairo_format_t is used to identify the memory format of
+ * image data.
+ */
+typedef enum cairo_format {
+ CAIRO_FORMAT_ARGB32,
+ CAIRO_FORMAT_RGB24,
+ CAIRO_FORMAT_A8,
+ CAIRO_FORMAT_A1
+} cairo_format_t;
/* XXX: I want to remove this function, (replace with
- cairo_set_target_scratch or similar). */
+ cairo_begin_group and friends). */
cairo_surface_t *
cairo_surface_create_similar (cairo_surface_t *other,
cairo_format_t format,
@@ -729,35 +929,36 @@ cairo_surface_reference (cairo_surface_t *surface);
void
cairo_surface_destroy (cairo_surface_t *surface);
-/* XXX: Note: The current Render/Ic implementations don't do the right
- thing with repeat when the surface has a non-identity matrix. */
-/* XXX: Rework this as a cairo function with an enum: cairo_set_pattern_extend */
cairo_status_t
-cairo_surface_set_repeat (cairo_surface_t *surface, int repeat);
+cairo_surface_finish (cairo_surface_t *surface);
+
+#if CAIRO_HAS_PNG_FUNCTIONS
-/* XXX: Rework this as a cairo function: cairo_set_pattern_transform */
cairo_status_t
-cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix);
+cairo_surface_write_to_png (cairo_surface_t *surface,
+ const char *filename);
-/* XXX: Rework this as a cairo function: cairo_current_pattern_transform */
cairo_status_t
-cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix);
+cairo_surface_write_to_png_stream (cairo_surface_t *surface,
+ cairo_write_func_t write_func,
+ void *closure);
+
+#endif
+
+void *
+cairo_surface_get_user_data (cairo_surface_t *surface,
+ const cairo_user_data_key_t *key);
-typedef enum {
- CAIRO_FILTER_FAST,
- CAIRO_FILTER_GOOD,
- CAIRO_FILTER_BEST,
- CAIRO_FILTER_NEAREST,
- CAIRO_FILTER_BILINEAR,
- CAIRO_FILTER_GAUSSIAN
-} cairo_filter_t;
-
-/* XXX: Rework this as a cairo function: cairo_set_pattern_filter */
cairo_status_t
-cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter);
+cairo_surface_set_user_data (cairo_surface_t *surface,
+ const cairo_user_data_key_t *key,
+ void *user_data,
+ cairo_destroy_func_t destroy);
-cairo_filter_t
-cairo_surface_get_filter (cairo_surface_t *surface);
+void
+cairo_surface_set_device_offset (cairo_surface_t *surface,
+ double x_offset,
+ double y_offset);
/* Image-surface functions */
@@ -767,12 +968,29 @@ cairo_image_surface_create (cairo_format_t format,
int height);
cairo_surface_t *
-cairo_image_surface_create_for_data (char *data,
+cairo_image_surface_create_for_data (unsigned char *data,
cairo_format_t format,
int width,
int height,
int stride);
+int
+cairo_image_surface_get_width (cairo_surface_t *surface);
+
+int
+cairo_image_surface_get_height (cairo_surface_t *surface);
+
+#if CAIRO_HAS_PNG_FUNCTIONS
+
+cairo_surface_t *
+cairo_image_surface_create_from_png (const char *filename);
+
+cairo_surface_t *
+cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
+ void *closure);
+
+#endif
+
/* Pattern creation functions */
cairo_pattern_t *
cairo_pattern_create_for_surface (cairo_surface_t *surface);
@@ -792,16 +1010,26 @@ void
cairo_pattern_destroy (cairo_pattern_t *pattern);
cairo_status_t
-cairo_pattern_add_color_stop (cairo_pattern_t *pattern,
- double offset,
- double red, double green, double blue,
- double alpha);
-
-cairo_status_t
-cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
+cairo_pattern_status (cairo_pattern_t *pattern);
-cairo_status_t
-cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix);
+void
+cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
+ double offset,
+ double red, double green, double blue);
+
+void
+cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
+ double offset,
+ double red, double green, double blue,
+ double alpha);
+
+void
+cairo_pattern_set_matrix (cairo_pattern_t *pattern,
+ const cairo_matrix_t *matrix);
+
+void
+cairo_pattern_get_matrix (cairo_pattern_t *pattern,
+ cairo_matrix_t *matrix);
typedef enum {
CAIRO_EXTEND_NONE,
@@ -809,13 +1037,22 @@ typedef enum {
CAIRO_EXTEND_REFLECT
} cairo_extend_t;
-cairo_status_t
+void
cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
cairo_extend_t
cairo_pattern_get_extend (cairo_pattern_t *pattern);
-cairo_status_t
+typedef enum {
+ CAIRO_FILTER_FAST,
+ CAIRO_FILTER_GOOD,
+ CAIRO_FILTER_BEST,
+ CAIRO_FILTER_NEAREST,
+ CAIRO_FILTER_BILINEAR,
+ CAIRO_FILTER_GAUSSIAN
+} cairo_filter_t;
+
+void
cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
cairo_filter_t
@@ -823,72 +1060,136 @@ cairo_pattern_get_filter (cairo_pattern_t *pattern);
/* Matrix functions */
-/* XXX: Rename all of these to cairo_transform_t */
-
-cairo_matrix_t *
-cairo_matrix_create (void);
-
void
-cairo_matrix_destroy (cairo_matrix_t *matrix);
+cairo_matrix_init (cairo_matrix_t *matrix,
+ double xx, double yx,
+ double xy, double yy,
+ double x0, double y0);
-cairo_status_t
-cairo_matrix_copy (cairo_matrix_t *matrix, const cairo_matrix_t *other);
+void
+cairo_matrix_init_identity (cairo_matrix_t *matrix);
-cairo_status_t
-cairo_matrix_set_identity (cairo_matrix_t *matrix);
+void
+cairo_matrix_init_translate (cairo_matrix_t *matrix,
+ double tx, double ty);
-cairo_status_t
-cairo_matrix_set_affine (cairo_matrix_t *matrix,
- double a, double b,
- double c, double d,
- double tx, double ty);
+void
+cairo_matrix_init_scale (cairo_matrix_t *matrix,
+ double sx, double sy);
-cairo_status_t
-cairo_matrix_get_affine (cairo_matrix_t *matrix,
- double *a, double *b,
- double *c, double *d,
- double *tx, double *ty);
+void
+cairo_matrix_init_rotate (cairo_matrix_t *matrix,
+ double radians);
-cairo_status_t
+void
cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
-cairo_status_t
+void
cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
-cairo_status_t
+void
cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
cairo_status_t
cairo_matrix_invert (cairo_matrix_t *matrix);
-cairo_status_t
-cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b);
+void
+cairo_matrix_multiply (cairo_matrix_t *result,
+ const cairo_matrix_t *a,
+ const cairo_matrix_t *b);
-cairo_status_t
-cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy);
+/* XXX: Need a new name here perhaps. */
+void
+cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
+ double *dx, double *dy);
-cairo_status_t
-cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y);
+/* XXX: Need a new name here perhaps. */
+void
+cairo_matrix_transform_point (const cairo_matrix_t *matrix,
+ double *x, double *y);
-/* Deprecated functions. We've made some effort to allow the
- deprecated functions to continue to work for now, (with useful
- warnings). But the deprecated functions will not appear in the next
- release. */
#ifndef _CAIROINT_H_
-#define cairo_get_operator cairo_get_operator_DEPRECATED_BY_cairo_current_operator
-#define cairo_get_rgb_color cairo_get_rgb_color_DEPRECATED_BY_cairo_current_rgb_color
-#define cairo_get_alpha cairo_get_alpha_DEPRECATED_BY_cairo_current_alpha
-#define cairo_get_tolerance cairo_get_tolerance_DEPRECATED_BY_cairo_current_tolerance
-#define cairo_get_current_point cairo_get_current_point_DEPRECATED_BY_cairo_current_point
-#define cairo_get_fill_rule cairo_get_fill_rule_DEPRECATED_BY_cairo_current_fill_rule
-#define cairo_get_line_width cairo_get_line_width_DEPRECATED_BY_cairo_current_line_width
-#define cairo_get_line_cap cairo_get_line_cap_DEPRECATED_BY_cairo_current_line_cap
-#define cairo_get_line_join cairo_get_line_join_DEPRECATED_BY_cairo_current_line_join
-#define cairo_get_miter_limit cairo_get_miter_limit_DEPRECATED_BY_cairo_current_miter_limit
-#define cairo_get_matrix cairo_get_matrix_DEPRECATED_BY_cairo_current_matrix
-#define cairo_get_target_surface cairo_get_target_surface_DEPRECATED_BY_cairo_current_target_surface
-#define cairo_get_status cairo_get_status_DEPRECATED_BY_cairo_status
-#define cairo_get_status_string cairo_get_status_string_DEPRECATED_BY_cairo_status_string
+
+/* Obsolete functions. These definitions exist to coerce the compiler
+ * into providing a little bit of guidance with its error
+ * messages. The idea is to help users port their old code without
+ * having to dig through lots of documentation.
+ *
+ * The first set of REPLACED_BY functions is for functions whose names
+ * have just been changed. So fixing these up is mechanical, (and
+ * automated by means of the cairo/util/cairo-api-update script.
+ *
+ * The second set of DEPRECATED_BY functions is for functions where
+ * the replacement is used in a different way, (ie. different
+ * arguments, multiple functions instead of one, etc). Fixing these up
+ * will require a bit more work on the user's part, (and hopefully we
+ * can get cairo-api-update to find these and print some guiding
+ * information).
+ */
+#define cairo_current_font_extents cairo_current_font_extents_REPLACED_BY_cairo_font_extents
+#define cairo_get_font_extents cairo_get_font_extents_REPLACED_BY_cairo_font_extents
+#define cairo_current_operator cairo_current_operator_REPLACED_BY_cairo_get_operator
+#define cairo_current_tolerance cairo_current_tolerance_REPLACED_BY_cairo_get_tolerance
+#define cairo_current_point cairo_current_point_REPLACED_BY_cairo_get_current_point
+#define cairo_current_fill_rule cairo_current_fill_rule_REPLACED_BY_cairo_get_fill_rule
+#define cairo_current_line_width cairo_current_line_width_REPLACED_BY_cairo_get_line_width
+#define cairo_current_line_cap cairo_current_line_cap_REPLACED_BY_cairo_get_line_cap
+#define cairo_current_line_join cairo_current_line_join_REPLACED_BY_cairo_get_line_join
+#define cairo_current_miter_limit cairo_current_miter_limit_REPLACED_BY_cairo_get_miter_limit
+#define cairo_current_matrix cairo_current_matrix_REPLACED_BY_cairo_get_matrix
+#define cairo_current_target_surface cairo_current_target_surface_REPLACED_BY_cairo_get_target
+#define cairo_get_status cairo_get_status_REPLACED_BY_cairo_status
+#define cairo_concat_matrix cairo_concat_matrix_REPLACED_BY_cairo_transform
+#define cairo_scale_font cairo_scale_font_REPLACED_BY_cairo_set_font_size
+#define cairo_select_font cairo_select_font_REPLACED_BY_cairo_select_font_face
+#define cairo_transform_font cairo_transform_font_REPLACED_BY_cairo_set_font_matrix
+#define cairo_transform_point cairo_transform_point_REPLACED_BY_cairo_user_to_device
+#define cairo_transform_distance cairo_transform_distance_REPLACED_BY_cairo_user_to_device_distance
+#define cairo_inverse_transform_point cairo_inverse_transform_point_REPLACED_BY_cairo_device_to_user
+#define cairo_inverse_transform_distance cairo_inverse_transform_distance_REPLACED_BY_cairo_device_to_user_distance
+#define cairo_init_clip cairo_init_clip_REPLACED_BY_cairo_reset_clip
+#define cairo_surface_create_for_image cairo_surface_create_for_image_REPLACED_BY_cairo_image_surface_create_for_data
+#define cairo_default_matrix cairo_default_matrix_REPLACED_BY_cairo_identity_matrix
+#define cairo_matrix_set_affine cairo_matrix_set_affine_REPLACED_BY_cairo_matrix_init
+#define cairo_matrix_set_identity cairo_matrix_set_identity_REPLACED_BY_cairo_matrix_init_identity
+#define cairo_pattern_add_color_stop cairo_pattern_add_color_stop_REPLACED_BY_cairo_pattern_add_color_stop_rgba
+#define cairo_set_rgb_color cairo_set_rgb_color_REPLACED_BY_cairo_set_source_rgb
+#define cairo_set_pattern cairo_set_pattern_REPLACED_BY_cairo_set_source
+#define cairo_xlib_surface_create_for_pixmap_with_visual cairo_xlib_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xlib_surface_create
+#define cairo_xlib_surface_create_for_window_with_visual cairo_xlib_surface_create_for_window_with_visual_REPLACED_BY_cairo_xlib_surface_create
+#define cairo_xcb_surface_create_for_pixmap_with_visual cairo_xcb_surface_create_for_pixmap_with_visual_REPLACED_BY_cairo_xcb_surface_create
+#define cairo_xcb_surface_create_for_window_with_visual cairo_xcb_surface_create_for_window_with_visual_REPLACED_BY_cairo_xcb_surface_create
+
+
+#define cairo_current_path cairo_current_path_DEPRECATED_BY_cairo_copy_path
+#define cairo_current_path_flat cairo_current_path_flat_DEPRECATED_BY_cairo_copy_path_flat
+#define cairo_get_path cairo_get_path_DEPRECATED_BY_cairo_copy_path
+#define cairo_get_path_flat cairo_get_path_flat_DEPRECATED_BY_cairo_get_path_flat
+#define cairo_set_alpha cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba_OR_cairo_paint_with_alpha
+#define cairo_show_surface cairo_show_surface_DEPRECATED_BY_cairo_set_source_surface_AND_cairo_paint
+#define cairo_copy cairo_copy_DEPRECATED_BY_cairo_create_AND_MANY_INDIVIDUAL_FUNCTIONS
+#define cairo_surface_set_repeat cairo_surface_set_repeat_DEPRECATED_BY_cairo_pattern_set_extend
+#define cairo_surface_set_matrix cairo_surface_set_matrix_DEPRECATED_BY_cairo_pattern_set_matrix
+#define cairo_surface_get_matrix cairo_surface_get_matrix_DEPRECATED_BY_cairo_pattern_get_matrix
+#define cairo_surface_set_filter cairo_surface_set_filter_DEPRECATED_BY_cairo_pattern_set_filter
+#define cairo_surface_get_filter cairo_surface_get_filter_DEPRECATED_BY_cairo_pattern_get_filter
+#define cairo_matrix_create cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t
+#define cairo_matrix_destroy cairo_matrix_destroy_DEPRECATED_BY_cairo_matrix_t
+#define cairo_matrix_copy cairo_matrix_copy_DEPRECATED_BY_cairo_matrix_t
+#define cairo_matrix_get_affine cairo_matrix_get_affine_DEPRECATED_BY_cairo_matrix_t
+#define cairo_set_target_surface cairo_set_target_surface_DEPRECATED_BY_cairo_create
+#define cairo_set_target_glitz cairo_set_target_glitz_DEPRECATED_BY_cairo_glitz_surface_create
+#define cairo_set_target_image cairo_set_target_image_DEPRECATED_BY_cairo_image_surface_create_for_data
+#define cairo_set_target_pdf cairo_set_target_pdf_DEPRECATED_BY_cairo_pdf_surface_create
+#define cairo_set_target_png cairo_set_target_png_DEPRECATED_BY_cairo_surface_write_to_png
+#define cairo_set_target_ps cairo_set_target_ps_DEPRECATED_BY_cairo_ps_surface_create
+#define cairo_set_target_quartz cairo_set_target_quartz_DEPRECATED_BY_cairo_quartz_surface_create
+#define cairo_set_target_win32 cairo_set_target_win32_DEPRECATED_BY_cairo_win32_surface_create
+#define cairo_set_target_xcb cairo_set_target_xcb_DEPRECATED_BY_cairo_xcb_surface_create
+#define cairo_set_target_drawable cairo_set_target_drawable_DEPRECATED_BY_cairo_xlib_surface_create
+#define cairo_get_status_string cairo_get_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
+#define cairo_status_string cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string
+
#endif
CAIRO_END_DECLS
diff --git a/src/cairo_array.c b/src/cairo_array.c
deleted file mode 100644
index 2b1cf9d..0000000
--- a/src/cairo_array.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2004 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is University of Southern
- * California.
- *
- * Contributor(s):
- * Kristian Høgsberg <krh@redhat.com>
- */
-
-#include "cairoint.h"
-
-void
-_cairo_array_init (cairo_array_t *array, int element_size)
-{
- array->size = 0;
- array->num_elements = 0;
- array->element_size = element_size;
- array->elements = NULL;
-}
-
-void
-_cairo_array_fini (cairo_array_t *array)
-{
- free (array->elements);
-}
-
-cairo_status_t
-_cairo_array_grow_by (cairo_array_t *array, int additional)
-{
- char *new_elements;
- int old_size = array->size;
- int required_size = array->num_elements + additional;
- int new_size;
-
- if (required_size <= old_size)
- return CAIRO_STATUS_SUCCESS;
-
- if (old_size == 0)
- new_size = 1;
- else
- new_size = old_size * 2;
-
- while (new_size < required_size)
- new_size = new_size * 2;
-
- array->size = new_size;
- new_elements = realloc (array->elements,
- array->size * array->element_size);
-
- if (new_elements == NULL) {
- array->size = old_size;
- return CAIRO_STATUS_NO_MEMORY;
- }
-
- array->elements = new_elements;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-void
-_cairo_array_truncate (cairo_array_t *array, int num_elements)
-{
- if (num_elements < array->num_elements)
- array->num_elements = num_elements;
-}
-
-void *
-_cairo_array_index (cairo_array_t *array, int index)
-{
- assert (0 <= index && index < array->num_elements);
-
- return (void *) &array->elements[index * array->element_size];
-}
-
-void
-_cairo_array_copy_element (cairo_array_t *array, int index, void *dst)
-{
- memcpy (dst, _cairo_array_index (array, index), array->element_size);
-}
-
-void *
-_cairo_array_append (cairo_array_t *array,
- const void *elements, int num_elements)
-{
- cairo_status_t status;
- void *dest;
-
- status = _cairo_array_grow_by (array, num_elements);
- if (status != CAIRO_STATUS_SUCCESS)
- return NULL;
-
- assert (array->num_elements + num_elements <= array->size);
-
- dest = &array->elements[array->num_elements * array->element_size];
- array->num_elements += num_elements;
-
- if (elements != NULL)
- memcpy (dest, elements, num_elements * array->element_size);
-
- return dest;
-}
-
-int
-_cairo_array_num_elements (cairo_array_t *array)
-{
- return array->num_elements;
-}
diff --git a/src/cairo_atsui_font.c b/src/cairo_atsui_font.c
deleted file mode 100644
index cb4b1c5..0000000
--- a/src/cairo_atsui_font.c
+++ /dev/null
@@ -1,807 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2004 Calum Robinson
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Calum Robinson
- *
- * Contributor(s):
- * Calum Robinson <calumr@mac.com>
- */
-
-#include <stdlib.h>
-#include <math.h>
-
-#include "cairo-atsui.h"
-#include "cairoint.h"
-
-
-
-
-
-#pragma mark Types
-
-
-
-
-
-typedef struct {
- cairo_unscaled_font_t base;
-
- ATSUStyle style;
- ATSUFontID fontID;
-} cairo_atsui_font_t;
-
-
-typedef struct cairo_ATSUI_glyph_path_callback_info_t {
- cairo_path_t *path;
- cairo_matrix_t scale;
-} cairo_ATSUI_glyph_path_callback_info_t;
-
-
-
-
-
-#pragma mark Private Functions
-
-
-
-
-
-static CGAffineTransform CGAffineTransformMakeWithCairoFontScale(cairo_font_scale_t scale)
-{
- return CGAffineTransformMake( scale.matrix[0][0], scale.matrix[0][1],
- scale.matrix[1][0], scale.matrix[1][1],
- 0, 0);
-}
-
-
-static ATSUStyle CreateSizedCopyOfStyle(ATSUStyle inStyle, cairo_font_scale_t *scale)
-{
- ATSUStyle style;
- OSStatus err;
-
-
- // Set the style's size
- CGAffineTransform theTransform = CGAffineTransformMakeWithCairoFontScale(*scale);
- Fixed theSize = FloatToFixed(CGSizeApplyAffineTransform(CGSizeMake(1.0, 1.0), theTransform).height);
- const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag };
- const ByteCount theFontStyleSizes[] = { sizeof(Fixed) };
- ATSUAttributeValuePtr theFontStyleValues[] = { &theSize };
-
- err = ATSUCreateAndCopyStyle(inStyle, &style);
-
- err = ATSUSetAttributes( style,
- sizeof(theFontStyleTags) / sizeof(ATSUAttributeTag),
- theFontStyleTags, theFontStyleSizes, theFontStyleValues);
-
-
- return style;
-}
-
-
-
-
-
-#pragma mark Public Functions
-
-
-
-
-
-static cairo_unscaled_font_t *
-_cairo_atsui_font_create( const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight)
-{
- cairo_atsui_font_t *font = NULL;
- ATSUStyle style;
- ATSUFontID fontID;
- OSStatus err;
- Boolean isItalic, isBold;
-
-
- err = ATSUCreateStyle(&style);
-
-
- switch (weight)
- {
- case CAIRO_FONT_WEIGHT_BOLD:
- isBold = true;
- break;
- case CAIRO_FONT_WEIGHT_NORMAL:
- default:
- isBold = false;
- break;
- }
-
- switch (slant)
- {
- case CAIRO_FONT_SLANT_ITALIC:
- isItalic = true;
- break;
- case CAIRO_FONT_SLANT_OBLIQUE:
- isItalic = false;
- break;
- case CAIRO_FONT_SLANT_NORMAL:
- default:
- isItalic = false;
- break;
- }
-
- err = ATSUFindFontFromName( family, strlen(family),
- kFontFamilyName,
- kFontNoPlatformCode,
- kFontRomanScript,
- kFontNoLanguageCode,
- &fontID);
-
-
- ATSUAttributeTag styleTags[] = {kATSUQDItalicTag, kATSUQDBoldfaceTag, kATSUFontTag};
- ATSUAttributeValuePtr styleValues[] = {&isItalic, &isBold, &fontID};
- ByteCount styleSizes[] = {sizeof(Boolean), sizeof(Boolean), sizeof(ATSUFontID)};
-
-
- err = ATSUSetAttributes( style,
- sizeof(styleTags) / sizeof(styleTags[0]),
- styleTags,
- styleSizes,
- styleValues);
-
-
-
- font = malloc(sizeof(cairo_atsui_font_t));
-
- if (_cairo_unscaled_font_init(&font->base, &cairo_atsui_font_backend) == CAIRO_STATUS_SUCCESS)
- {
- font->style = style;
- font->fontID = fontID;
-
-
- return &font->base;
- }
-
-
- free(font);
-
- return NULL;
-}
-
-
-static void
-_cairo_atsui_font_destroy(void *abstract_font)
-{
- cairo_atsui_font_t *font = abstract_font;
-
-
- if (font == NULL)
- return;
-
- if (font->style)
- ATSUDisposeStyle(font->style);
-
- free(font);
-}
-
-
-static cairo_status_t
-_cairo_atsui_font_text_to_glyphs( void *abstract_font,
- cairo_font_scale_t *sc,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *nglyphs)
-{
- cairo_atsui_font_t *font = abstract_font;
- size_t i;
- OSStatus err;
- ATSUTextLayout textLayout;
- ATSLayoutRecord *layoutRecords;
- ItemCount glyphCount, charCount;
- UniChar *theText;
- ATSUStyle style;
-
-
- charCount = strlen(utf8);
-
-
- err = ATSUCreateTextLayout(&textLayout);
-
-
- // Set the text in the text layout object, so we can measure it
- theText = (UniChar *)malloc(charCount * sizeof(UniChar));
-
- for (i = 0; i < charCount; i++)
- {
- theText[i] = utf8[i];
- }
-
- err = ATSUSetTextPointerLocation( textLayout,
- theText,
- 0,
- charCount,
- charCount);
-
-
- style = CreateSizedCopyOfStyle(font->style, sc);
-
-
- // Set the style for all of the text
- err = ATSUSetRunStyle( textLayout,
- style,
- kATSUFromTextBeginning,
- kATSUToTextEnd);
-
-
-
- // Get the glyphs from the text layout object
- err = ATSUDirectGetLayoutDataArrayPtrFromTextLayout( textLayout,
- 0,
- kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
- (void *)&layoutRecords,
- &glyphCount);
-
- *nglyphs = glyphCount;
-
-
- *glyphs = (cairo_glyph_t *)malloc(glyphCount * (sizeof(cairo_glyph_t)));
- if (*glyphs == NULL)
- {
- return CAIRO_STATUS_NO_MEMORY;
- }
-
- for (i = 0; i < glyphCount; i++)
- {
- (*glyphs)[i].index = layoutRecords[i].glyphID;
- (*glyphs)[i].x = FixedToFloat(layoutRecords[i].realPos);
- (*glyphs)[i].y = 0;
- }
-
-
- free(theText);
-
- ATSUDirectReleaseLayoutDataArrayPtr( NULL,
- kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
- (void *)&layoutRecords);
-
- ATSUDisposeTextLayout(textLayout);
-
- ATSUDisposeStyle(style);
-
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-static cairo_status_t
-_cairo_atsui_font_font_extents( void *abstract_font,
- cairo_font_scale_t *sc,
- cairo_font_extents_t *extents)
-{
- cairo_atsui_font_t *font = abstract_font;
- ATSFontRef atsFont;
- ATSFontMetrics metrics;
- OSStatus err;
-
-
- // TODO - test this
-
- atsFont = FMGetATSFontRefFromFont(font->fontID);
-
- if (atsFont)
- {
- err = ATSFontGetHorizontalMetrics(atsFont, kATSOptionFlagsDefault, &metrics);
-
- if (err == noErr)
- {
- extents->ascent = metrics.ascent;
- extents->descent = metrics.descent;
- extents->height = metrics.capHeight;
- extents->max_x_advance = metrics.maxAdvanceWidth;
-
- // The FT backend doesn't handle max_y_advance either, so we'll ignore it for now.
- extents->max_y_advance = 0.0;
-
-
- return CAIRO_STATUS_SUCCESS;
- }
- }
-
-
- return CAIRO_STATUS_NULL_POINTER;
-}
-
-
-static cairo_status_t
-_cairo_atsui_font_glyph_extents( void *abstract_font,
- cairo_font_scale_t *sc,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents)
-{
- cairo_atsui_font_t *font = abstract_font;
- cairo_point_double_t origin;
- cairo_point_double_t glyph_min, glyph_max;
- cairo_point_double_t total_min, total_max;
- OSStatus err;
- ATSUStyle style;
- int i;
-
-
- if (num_glyphs == 0)
- {
- extents->x_bearing = 0.0;
- extents->y_bearing = 0.0;
- extents->width = 0.0;
- extents->height = 0.0;
- extents->x_advance = 0.0;
- extents->y_advance = 0.0;
-
- return CAIRO_STATUS_SUCCESS;
- }
-
- origin.x = glyphs[0].x;
- origin.y = glyphs[0].y;
-
-
- style = CreateSizedCopyOfStyle(font->style, sc);
-
-
- for (i = 0; i < num_glyphs; i++)
- {
- GlyphID theGlyph = glyphs[i].index;
- double minX, maxX, ascent, descent;
- ATSGlyphIdealMetrics metricsH, metricsV;
-
-
- err = ATSUGlyphGetIdealMetrics( style,
- 1,
- &theGlyph,
- 0,
- &metricsH);
-
-
- ATSUVerticalCharacterType verticalType = kATSUStronglyVertical;
- ATSUAttributeTag theTag = kATSUVerticalCharacterTag;
- ByteCount theSize = sizeof(ATSUVerticalCharacterType);
-
- err = ATSUSetAttributes(style, 1, &theTag, &theSize, (ATSUAttributeValuePtr)&verticalType);
-
- err = ATSUGlyphGetIdealMetrics( style,
- 1,
- &theGlyph,
- 0,
- &metricsV);
-
- minX = metricsH.otherSideBearing.x;
- maxX = metricsH.advance.x;
-
- ascent = metricsV.advance.x;
- descent = metricsV.otherSideBearing.x;
-
- glyph_min.x = glyphs[i].x + minX;
- glyph_min.y = glyphs[i].y + descent;
- glyph_max.x = glyphs[i].x + maxX;
- glyph_max.y = glyphs[i].y + ascent;
-
- if (i==0)
- {
- total_min = glyph_min;
- total_max = glyph_max;
- }
- else
- {
- if (glyph_min.x < total_min.x)
- total_min.x = glyph_min.x;
- if (glyph_min.y < total_min.y)
- total_min.y = glyph_min.y;
-
- if (glyph_max.x > total_max.x)
- total_max.x = glyph_max.x;
- if (glyph_max.y > total_max.y)
- total_max.y = glyph_max.y;
- }
- }
-
-
- extents->x_bearing = total_min.x - origin.x;
- extents->y_bearing = total_min.y - origin.y;
- extents->width = total_max.x - total_min.x;
- extents->height = total_max.y - total_min.y;
- extents->x_advance = glyphs[i-1].x - origin.x;
- extents->y_advance = glyphs[i-1].y - origin.y;
-
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-static cairo_status_t
-_cairo_atsui_font_glyph_bbox( void *abstract_font,
- cairo_font_scale_t *sc,
- const cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_box_t *bbox)
-{
- cairo_atsui_font_t *font = abstract_font;
- cairo_fixed_t x1, y1, x2, y2;
- int i;
- OSStatus err;
- ATSUStyle style;
-
-
- bbox->p1.x = bbox->p1.y = CAIRO_MAXSHORT << 16;
- bbox->p2.x = bbox->p2.y = CAIRO_MINSHORT << 16;
-
-
- style = CreateSizedCopyOfStyle(font->style, sc);
-
-
- for (i = 0; i < num_glyphs; i++)
- {
- GlyphID theGlyph = glyphs[i].index;
- ATSGlyphIdealMetrics metrics;
-
-
- err = ATSUGlyphGetIdealMetrics( style,
- 1,
- &theGlyph,
- 0,
- &metrics);
-
- x1 = _cairo_fixed_from_double(glyphs[i].x);
- y1 = _cairo_fixed_from_double(glyphs[i].y);
- x2 = x1 + _cairo_fixed_from_double(metrics.advance.x);
- y2 = y1 + _cairo_fixed_from_double(metrics.advance.y);
-
- if (x1 < bbox->p1.x)
- bbox->p1.x = x1;
-
- if (y1 < bbox->p1.y)
- bbox->p1.y = y1;
-
- if (x2 > bbox->p2.x)
- bbox->p2.x = x2;
-
- if (y2 > bbox->p2.y)
- bbox->p2.y = y2;
- }
-
-
- ATSUDisposeStyle(style);
-
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-static cairo_status_t
-_cairo_atsui_font_show_glyphs( void *abstract_font,
- cairo_font_scale_t *sc,
- cairo_operator_t operator,
- cairo_surface_t *source,
- cairo_surface_t *surface,
- int source_x,
- int source_y,
- const cairo_glyph_t *glyphs,
- int num_glyphs)
-{
- cairo_atsui_font_t *font = abstract_font;
- CGContextRef myBitmapContext;
- CGColorSpaceRef colorSpace;
- cairo_image_surface_t *destImageSurface;
- int i;
-
-
- destImageSurface = _cairo_surface_get_image(surface);
-
-
- // Create a CGBitmapContext for the dest surface for drawing into
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- myBitmapContext = CGBitmapContextCreate( destImageSurface->data,
- destImageSurface->width,
- destImageSurface->height,
- destImageSurface->depth / 4,
- destImageSurface->stride,
- colorSpace,
- kCGImageAlphaPremultipliedFirst);
-
-
- ATSFontRef atsFont = FMGetATSFontRefFromFont(font->fontID);
- CGFontRef cgFont = CGFontCreateWithPlatformFont(&atsFont);
-
- CGContextSetFont(myBitmapContext, cgFont);
-
-
- CGAffineTransform textTransform = CGAffineTransformMakeWithCairoFontScale(*sc);
- CGSize textSize = CGSizeMake(1.0, 1.0);
-
- textSize = CGSizeApplyAffineTransform(textSize, textTransform);
-
- CGContextSetFontSize(myBitmapContext, textSize.width);
-
-
- // TODO - bold and italic text
- //
- // We could draw the text using ATSUI and get bold, italics
- // etc. for free, but ATSUI does a lot of text layout work
- // that we don't really need...
-
-
- for (i = 0; i < num_glyphs; i++)
- {
- CGGlyph theGlyph = glyphs[i].index;
-
- CGContextShowGlyphsAtPoint(myBitmapContext, source_x + glyphs[i].x, destImageSurface->height - (source_y + glyphs[i].y), &theGlyph, 1);
- }
-
-
- CGColorSpaceRelease(colorSpace);
- CGContextRelease(myBitmapContext);
-
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-#pragma mark -
-
-
-static OSStatus MyATSCubicMoveToCallback(const Float32Point *pt, void *callBackDataPtr)
-{
- cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
- double scaledPt[2];
- cairo_point_t point;
-
-
- scaledPt[0] = pt->x;
- scaledPt[1] = pt->y;
-
- cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
-
- point.x = _cairo_fixed_from_double(scaledPt[0]);
- point.y = _cairo_fixed_from_double(scaledPt[1]);
-
- _cairo_path_move_to(info->path, &point);
-
-
- return noErr;
-}
-
-
-static OSStatus MyATSCubicLineToCallback(const Float32Point *pt, void *callBackDataPtr)
-{
- cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
- cairo_point_t point;
- double scaledPt[2];
-
-
- scaledPt[0] = pt->x;
- scaledPt[1] = pt->y;
-
- cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
-
- point.x = _cairo_fixed_from_double(scaledPt[0]);
- point.y = _cairo_fixed_from_double(scaledPt[1]);
-
- _cairo_path_line_to(info->path, &point);
-
-
- return noErr;
-}
-
-
-static OSStatus MyATSCubicCurveToCallback( const Float32Point *pt1,
- const Float32Point *pt2,
- const Float32Point *pt3,
- void *callBackDataPtr)
-{
- cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
- cairo_point_t p0, p1, p2;
- double scaledPt[2];
-
-
- scaledPt[0] = pt1->x;
- scaledPt[1] = pt1->y;
-
- cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
-
- p0.x = _cairo_fixed_from_double(scaledPt[0]);
- p0.y = _cairo_fixed_from_double(scaledPt[1]);
-
-
- scaledPt[0] = pt2->x;
- scaledPt[1] = pt2->y;
-
- cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
-
- p1.x = _cairo_fixed_from_double(scaledPt[0]);
- p1.y = _cairo_fixed_from_double(scaledPt[1]);
-
-
- scaledPt[0] = pt3->x;
- scaledPt[1] = pt3->y;
-
- cairo_matrix_transform_point(&info->scale, &scaledPt[0], &scaledPt[1]);
-
- p2.x = _cairo_fixed_from_double(scaledPt[0]);
- p2.y = _cairo_fixed_from_double(scaledPt[1]);
-
-
- _cairo_path_curve_to(info->path, &p0, &p1, &p2);
-
-
- return noErr;
-}
-
-
-static OSStatus MyCubicClosePathProc(void * callBackDataPtr)
-{
- cairo_ATSUI_glyph_path_callback_info_t *info = callBackDataPtr;
-
-
- _cairo_path_close_path(info->path);
-
-
- return noErr;
-}
-
-
-static cairo_status_t
-_cairo_atsui_font_glyph_path( void *abstract_font,
- cairo_font_scale_t *sc,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_t *path)
-{
- int i;
- cairo_atsui_font_t *font = abstract_font;
- OSStatus err;
- cairo_ATSUI_glyph_path_callback_info_t info;
- ATSUStyle style;
-
-
- static ATSCubicMoveToUPP moveProc = NULL;
- static ATSCubicLineToUPP lineProc = NULL;
- static ATSCubicCurveToUPP curveProc = NULL;
- static ATSCubicClosePathUPP closePathProc = NULL;
-
-
- if (moveProc == NULL)
- {
- moveProc = NewATSCubicMoveToUPP(MyATSCubicMoveToCallback);
- lineProc = NewATSCubicLineToUPP(MyATSCubicLineToCallback);
- curveProc = NewATSCubicCurveToUPP(MyATSCubicCurveToCallback);
- closePathProc = NewATSCubicClosePathUPP(MyCubicClosePathProc);
- }
-
-
- info.path = path;
-
-
- style = CreateSizedCopyOfStyle(font->style, sc);
-
-
- for (i = 0; i < num_glyphs; i++)
- {
- GlyphID theGlyph = glyphs[i].index;
-
-
- cairo_matrix_set_affine( &info.scale,
- 1.0, 0.0,
- 0.0, 1.0,
- glyphs[i].x, glyphs[i].y);
-
-
- err = ATSUGlyphGetCubicPaths( style,
- theGlyph,
- moveProc,
- lineProc,
- curveProc,
- closePathProc,
- (void *)&info,
- &err);
- }
-
-
- err = ATSUDisposeStyle(style);
-
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-#pragma mark -
-
-
-static cairo_status_t
-_cairo_atsui_font_create_glyph(cairo_image_glyph_cache_entry_t *val)
-{
- // TODO
- printf("_cairo_atsui_font_create_glyph is unimplemented\n");
-
- // I'm not sure if we need this, given that the ATSUI backend does no caching(?)
-
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-cairo_font_t *
-cairo_atsui_font_create(ATSUStyle style)
-{
- cairo_font_scale_t scale;
- cairo_font_t *scaled;
- cairo_atsui_font_t *f = NULL;
-
-
- scaled = malloc(sizeof(cairo_font_t));
- if (scaled == NULL)
- return NULL;
-
-
- f = malloc(sizeof(cairo_atsui_font_t));
- if (f)
- {
- if (_cairo_unscaled_font_init(&f->base, &cairo_atsui_font_backend) == CAIRO_STATUS_SUCCESS)
- {
- f->style = style;
-
- _cairo_font_init(scaled, &scale, &f->base);
-
- return scaled;
- }
- }
-
-
- free(scaled);
-
-
- return NULL;
-}
-
-
-
-
-
-#pragma mark Backend
-
-
-
-
-
-const cairo_font_backend_t cairo_atsui_font_backend = {
- _cairo_atsui_font_create,
- _cairo_atsui_font_destroy,
- _cairo_atsui_font_font_extents,
- _cairo_atsui_font_text_to_glyphs,
- _cairo_atsui_font_glyph_extents,
- _cairo_atsui_font_glyph_bbox,
- _cairo_atsui_font_show_glyphs,
- _cairo_atsui_font_glyph_path,
- _cairo_atsui_font_create_glyph
-};
diff --git a/src/cairo_font.c b/src/cairo_font.c
deleted file mode 100644
index 529c1c7..0000000
--- a/src/cairo_font.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2002 University of Southern California
- * Copyright © 2005 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is University of Southern
- * California.
- *
- * Contributor(s):
- * Carl D. Worth <cworth@cworth.org>
- * Graydon Hoare <graydon@redhat.com>
- * Owen Taylor <otaylor@redhat.com>
- */
-
-#include "cairoint.h"
-
-/* Now the internal "unscaled + scale" font API */
-
-cairo_private cairo_status_t
-_cairo_font_create (const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight,
- cairo_font_scale_t *sc,
- cairo_font_t **font)
-{
- const cairo_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT;
-
- return backend->create (family, slant, weight, sc, font);
-}
-
-void
-_cairo_font_init (cairo_font_t *font,
- cairo_font_scale_t *scale,
- const cairo_font_backend_t *backend)
-{
- font->scale = *scale;
- font->refcount = 1;
- font->backend = backend;
-}
-
-void
-_cairo_unscaled_font_init (cairo_unscaled_font_t *font,
- const cairo_font_backend_t *backend)
-{
- font->refcount = 1;
- font->backend = backend;
-}
-
-cairo_status_t
-_cairo_font_text_to_glyphs (cairo_font_t *font,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs)
-{
- return font->backend->text_to_glyphs (font, utf8, glyphs, num_glyphs);
-}
-
-cairo_status_t
-_cairo_font_glyph_extents (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents)
-{
- return font->backend->glyph_extents(font, glyphs, num_glyphs, extents);
-}
-
-
-cairo_status_t
-_cairo_font_glyph_bbox (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_box_t *bbox)
-{
- return font->backend->glyph_bbox (font, glyphs, num_glyphs, bbox);
-}
-
-cairo_status_t
-_cairo_font_show_glyphs (cairo_font_t *font,
- cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height,
- cairo_glyph_t *glyphs,
- int num_glyphs)
-{
- cairo_status_t status;
- if (surface->backend->show_glyphs != NULL) {
- status = surface->backend->show_glyphs (font, operator, pattern,
- surface,
- source_x, source_y,
- dest_x, dest_y,
- width, height,
- glyphs, num_glyphs);
- if (status == CAIRO_STATUS_SUCCESS)
- return status;
- }
-
- /* Surface display routine either does not exist or failed. */
- return font->backend->show_glyphs (font, operator, pattern,
- surface,
- source_x, source_y,
- dest_x, dest_y,
- width, height,
- glyphs, num_glyphs);
-}
-
-cairo_status_t
-_cairo_font_glyph_path (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_t *path)
-{
- return font->backend->glyph_path (font, glyphs, num_glyphs, path);
-}
-
-void
-_cairo_font_get_glyph_cache_key (cairo_font_t *font,
- cairo_glyph_cache_key_t *key)
-{
- font->backend->get_glyph_cache_key (font, key);
-}
-
-cairo_status_t
-_cairo_font_font_extents (cairo_font_t *font,
- cairo_font_extents_t *extents)
-{
- return font->backend->font_extents (font, extents);
-}
-
-void
-_cairo_unscaled_font_reference (cairo_unscaled_font_t *font)
-{
- font->refcount++;
-}
-
-void
-_cairo_unscaled_font_destroy (cairo_unscaled_font_t *font)
-{
- if (--(font->refcount) > 0)
- return;
-
- font->backend->destroy_unscaled_font (font);
-}
-
-
-
-/* Public font API follows. */
-
-void
-cairo_font_reference (cairo_font_t *font)
-{
- font->refcount++;
-}
-
-void
-cairo_font_destroy (cairo_font_t *font)
-{
- if (--(font->refcount) > 0)
- return;
-
- font->backend->destroy_font (font);
-}
-
-/**
- * cairo_font_extents:
- * @font: a #cairo_font_t
- * @font_matrix: the font transformation for which this font was
- * created. (See cairo_transform_font()). This is needed
- * properly convert the metrics from the font into user space.
- * @extents: a #cairo_font_extents_t which to store the retrieved extents.
- *
- * Gets the metrics for a #cairo_font_t.
- *
- * Return value: %CAIRO_STATUS_SUCCESS on success. Otherwise, an
- * error such as %CAIRO_STATUS_NO_MEMORY.
- **/
-cairo_status_t
-cairo_font_extents (cairo_font_t *font,
- cairo_matrix_t *font_matrix,
- cairo_font_extents_t *extents)
-{
- cairo_int_status_t status;
- double font_scale_x, font_scale_y;
-
- status = _cairo_font_font_extents (font, extents);
-
- if (!CAIRO_OK (status))
- return status;
-
- _cairo_matrix_compute_scale_factors (font_matrix,
- &font_scale_x, &font_scale_y,
- /* XXX */ 1);
-
- /*
- * The font responded in unscaled units, scale by the font
- * matrix scale factors to get to user space
- */
-
- extents->ascent *= font_scale_y;
- extents->descent *= font_scale_y;
- extents->height *= font_scale_y;
- extents->max_x_advance *= font_scale_x;
- extents->max_y_advance *= font_scale_y;
-
- return status;
-}
-
-/**
- * cairo_font_glyph_extents:
- * @font: a #cairo_font_t
- * @font_matrix: the font transformation for which this font was
- * created. (See cairo_transform_font()). This is needed
- * properly convert the metrics from the font into user space.
- * @glyphs: an array of glyph IDs with X and Y offsets.
- * @num_glyphs: the number of glyphs in the @glyphs array
- * @extents: a #cairo_text_extents_t which to store the retrieved extents.
- *
- * cairo_font_glyph_extents() gets the overall metrics for a string of
- * glyphs. The X and Y offsets in @glyphs are taken from an origin of 0,0.
- **/
-void
-cairo_font_glyph_extents (cairo_font_t *font,
- cairo_matrix_t *font_matrix,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents)
-{
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
- cairo_glyph_t origin_glyph;
- cairo_text_extents_t origin_extents;
- int i;
- double min_x = 0.0, min_y = 0.0, max_x = 0.0, max_y = 0.0;
- double x_pos = 0.0, y_pos = 0.0;
- int set = 0;
-
- if (!num_glyphs)
- {
- extents->x_bearing = 0.0;
- extents->y_bearing = 0.0;
- extents->width = 0.0;
- extents->height = 0.0;
- extents->x_advance = 0.0;
- extents->y_advance = 0.0;
-
- return;
- }
-
- for (i = 0; i < num_glyphs; i++)
- {
- double x, y;
- double wm, hm;
-
- origin_glyph = glyphs[i];
- origin_glyph.x = 0.0;
- origin_glyph.y = 0.0;
- status = _cairo_font_glyph_extents (font,
- &origin_glyph, 1,
- &origin_extents);
-
- /*
- * Transform font space metrics into user space metrics
- * by running the corners through the font matrix and
- * expanding the bounding box as necessary
- */
- x = origin_extents.x_bearing;
- y = origin_extents.y_bearing;
- cairo_matrix_transform_point (font_matrix,
- &x, &y);
-
- for (hm = 0.0; hm <= 1.0; hm += 1.0)
- for (wm = 0.0; wm <= 1.0; wm += 1.0)
- {
- x = origin_extents.x_bearing + origin_extents.width * wm;
- y = origin_extents.y_bearing + origin_extents.height * hm;
- cairo_matrix_transform_point (font_matrix,
- &x, &y);
- x += glyphs[i].x;
- y += glyphs[i].y;
- if (!set)
- {
- min_x = max_x = x;
- min_y = max_y = y;
- set = 1;
- }
- else
- {
- if (x < min_x) min_x = x;
- if (x > max_x) max_x = x;
- if (y < min_y) min_y = y;
- if (y > max_y) max_y = y;
- }
- }
-
- x = origin_extents.x_advance;
- y = origin_extents.y_advance;
- cairo_matrix_transform_point (font_matrix,
- &x, &y);
- x_pos = glyphs[i].x + x;
- y_pos = glyphs[i].y + y;
- }
-
- extents->x_bearing = min_x - glyphs[0].x;
- extents->y_bearing = min_y - glyphs[0].y;
- extents->width = max_x - min_x;
- extents->height = max_y - min_y;
- extents->x_advance = x_pos - glyphs[0].x;
- extents->y_advance = y_pos - glyphs[0].y;
-}
-
-/* Now we implement functions to access a default global image & metrics
- * cache.
- */
-
-unsigned long
-_cairo_glyph_cache_hash (void *cache, void *key)
-{
- cairo_glyph_cache_key_t *in;
- in = (cairo_glyph_cache_key_t *) key;
- return
- ((unsigned long) in->unscaled)
- ^ ((unsigned long) in->scale.matrix[0][0])
- ^ ((unsigned long) in->scale.matrix[0][1])
- ^ ((unsigned long) in->scale.matrix[1][0])
- ^ ((unsigned long) in->scale.matrix[1][1])
- ^ (in->flags * 1451) /* 1451 is just an abitrary prime */
- ^ in->index;
-}
-
-int
-_cairo_glyph_cache_keys_equal (void *cache,
- void *k1,
- void *k2)
-{
- cairo_glyph_cache_key_t *a, *b;
- a = (cairo_glyph_cache_key_t *) k1;
- b = (cairo_glyph_cache_key_t *) k2;
- return (a->index == b->index)
- && (a->unscaled == b->unscaled)
- && (a->flags == b->flags)
- && (a->scale.matrix[0][0] == b->scale.matrix[0][0])
- && (a->scale.matrix[0][1] == b->scale.matrix[0][1])
- && (a->scale.matrix[1][0] == b->scale.matrix[1][0])
- && (a->scale.matrix[1][1] == b->scale.matrix[1][1]);
-}
-
-
-static cairo_status_t
-_image_glyph_cache_create_entry (void *cache,
- void *key,
- void **return_value)
-{
- cairo_glyph_cache_key_t *k = (cairo_glyph_cache_key_t *) key;
- cairo_image_glyph_cache_entry_t *im;
- cairo_status_t status;
-
- im = calloc (1, sizeof (cairo_image_glyph_cache_entry_t));
- if (im == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- im->key = *k;
- status = im->key.unscaled->backend->create_glyph (im);
-
- if (status != CAIRO_STATUS_SUCCESS) {
- free (im);
- return status;
- }
-
- _cairo_unscaled_font_reference (im->key.unscaled);
-
- im->key.base.memory =
- sizeof (cairo_image_glyph_cache_entry_t)
- + (im->image ?
- sizeof (cairo_image_surface_t)
- + 28 * sizeof (int) /* rough guess at size of pixman image structure */
- + (im->image->height * im->image->stride) : 0);
-
- *return_value = im;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-
-static void
-_image_glyph_cache_destroy_entry (void *cache,
- void *value)
-{
- cairo_image_glyph_cache_entry_t *im;
-
- im = (cairo_image_glyph_cache_entry_t *) value;
- _cairo_unscaled_font_destroy (im->key.unscaled);
- cairo_surface_destroy (&(im->image->base));
- free (im);
-}
-
-static void
-_image_glyph_cache_destroy_cache (void *cache)
-{
- free (cache);
-}
-
-static const cairo_cache_backend_t cairo_image_cache_backend = {
- _cairo_glyph_cache_hash,
- _cairo_glyph_cache_keys_equal,
- _image_glyph_cache_create_entry,
- _image_glyph_cache_destroy_entry,
- _image_glyph_cache_destroy_cache
-};
-
-void
-_cairo_lock_global_image_glyph_cache()
-{
- /* FIXME: implement locking. */
-}
-
-void
-_cairo_unlock_global_image_glyph_cache()
-{
- /* FIXME: implement locking. */
-}
-
-static cairo_cache_t *
-_global_image_glyph_cache = NULL;
-
-cairo_cache_t *
-_cairo_get_global_image_glyph_cache ()
-{
- if (_global_image_glyph_cache == NULL) {
- _global_image_glyph_cache = malloc (sizeof (cairo_cache_t));
-
- if (_global_image_glyph_cache == NULL)
- goto FAIL;
-
- if (_cairo_cache_init (_global_image_glyph_cache,
- &cairo_image_cache_backend,
- CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT))
- goto FAIL;
- }
-
- return _global_image_glyph_cache;
-
- FAIL:
- if (_global_image_glyph_cache)
- free (_global_image_glyph_cache);
- _global_image_glyph_cache = NULL;
- return NULL;
-}
diff --git a/src/cairo_gstate.c b/src/cairo_gstate.c
deleted file mode 100644
index d6db560..0000000
--- a/src/cairo_gstate.c
+++ /dev/null
@@ -1,2566 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2002 University of Southern California
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is University of Southern
- * California.
- *
- * Contributor(s):
- * Carl D. Worth <cworth@cworth.org>
- */
-
-#include <stdlib.h>
-#include <math.h>
-
-#include "cairoint.h"
-
-static cairo_status_t
-_cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate,
- cairo_pattern_t *src,
- cairo_operator_t operator,
- cairo_surface_t *dst,
- cairo_traps_t *traps);
-
-static cairo_status_t
-_cairo_gstate_ensure_font (cairo_gstate_t *gstate);
-
-static void
-_cairo_gstate_unset_font (cairo_gstate_t *gstate);
-
-cairo_gstate_t *
-_cairo_gstate_create ()
-{
- cairo_status_t status;
- cairo_gstate_t *gstate;
-
- gstate = malloc (sizeof (cairo_gstate_t));
-
- if (gstate)
- {
- status = _cairo_gstate_init (gstate);
- if (status) {
- free (gstate);
- return NULL;
- }
- }
-
- return gstate;
-}
-
-cairo_status_t
-_cairo_gstate_init (cairo_gstate_t *gstate)
-{
- gstate->operator = CAIRO_GSTATE_OPERATOR_DEFAULT;
-
- gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
-
- gstate->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
- gstate->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
- gstate->line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
- gstate->miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
-
- gstate->fill_rule = CAIRO_GSTATE_FILL_RULE_DEFAULT;
-
- gstate->dash = NULL;
- gstate->num_dashes = 0;
- gstate->dash_offset = 0.0;
-
- gstate->font_family = NULL;
- gstate->font_slant = CAIRO_FONT_SLANT_DEFAULT;
- gstate->font_weight = CAIRO_FONT_WEIGHT_DEFAULT;
-
- gstate->font = NULL;
-
- gstate->surface = NULL;
-
- gstate->clip.region = NULL;
- gstate->clip.surface = NULL;
-
- gstate->pattern = _cairo_pattern_create_solid (0.0, 0.0, 0.0);
- if (!gstate->pattern)
- return CAIRO_STATUS_NO_MEMORY;
-
- gstate->alpha = 1.0;
-
- gstate->pixels_per_inch = CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT;
- _cairo_gstate_default_matrix (gstate);
-
- _cairo_path_init (&gstate->path);
-
- _cairo_pen_init_empty (&gstate->pen_regular);
-
- gstate->next = NULL;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
-{
- cairo_status_t status;
- cairo_gstate_t *next;
-
- /* Copy all members, but don't smash the next pointer */
- next = gstate->next;
- *gstate = *other;
- gstate->next = next;
-
- /* Now fix up pointer data that needs to be cloned/referenced */
- if (other->dash) {
- gstate->dash = malloc (other->num_dashes * sizeof (double));
- if (gstate->dash == NULL)
- return CAIRO_STATUS_NO_MEMORY;
- memcpy (gstate->dash, other->dash, other->num_dashes * sizeof (double));
- }
-
- if (other->font_family) {
- gstate->font_family = strdup (other->font_family);
- if (!gstate->font_family)
- goto CLEANUP_DASH;
- }
-
- if (other->font) {
- gstate->font = other->font;
- cairo_font_reference (gstate->font);
- }
-
- if (other->clip.region)
- {
- gstate->clip.region = pixman_region_create ();
- pixman_region_copy (gstate->clip.region, other->clip.region);
- }
-
- cairo_surface_reference (gstate->surface);
- cairo_surface_reference (gstate->clip.surface);
-
- cairo_pattern_reference (gstate->pattern);
-
- status = _cairo_path_init_copy (&gstate->path, &other->path);
- if (status)
- goto CLEANUP_FONT;
-
- status = _cairo_pen_init_copy (&gstate->pen_regular, &other->pen_regular);
- if (status)
- goto CLEANUP_PATH;
-
- return status;
-
- CLEANUP_PATH:
- _cairo_path_fini (&gstate->path);
-
- CLEANUP_FONT:
- cairo_font_destroy (gstate->font);
- gstate->font = NULL;
-
- if (gstate->font_family) {
- free (gstate->font_family);
- gstate->font_family = NULL;
- }
-
- CLEANUP_DASH:
- free (gstate->dash);
- gstate->dash = NULL;
-
- return CAIRO_STATUS_NO_MEMORY;
-}
-
-void
-_cairo_gstate_fini (cairo_gstate_t *gstate)
-{
- if (gstate->font_family)
- free (gstate->font_family);
-
- if (gstate->font)
- cairo_font_destroy (gstate->font);
-
- if (gstate->surface)
- cairo_surface_destroy (gstate->surface);
- gstate->surface = NULL;
-
- if (gstate->clip.surface)
- cairo_surface_destroy (gstate->clip.surface);
- gstate->clip.surface = NULL;
-
- if (gstate->clip.region)
- pixman_region_destroy (gstate->clip.region);
- gstate->clip.region = NULL;
-
- cairo_pattern_destroy (gstate->pattern);
-
- _cairo_matrix_fini (&gstate->font_matrix);
-
- _cairo_matrix_fini (&gstate->ctm);
- _cairo_matrix_fini (&gstate->ctm_inverse);
-
- _cairo_path_fini (&gstate->path);
-
- _cairo_pen_fini (&gstate->pen_regular);
-
- if (gstate->dash) {
- free (gstate->dash);
- gstate->dash = NULL;
- }
-}
-
-void
-_cairo_gstate_destroy (cairo_gstate_t *gstate)
-{
- _cairo_gstate_fini (gstate);
- free (gstate);
-}
-
-cairo_gstate_t*
-_cairo_gstate_clone (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
- cairo_gstate_t *clone;
-
- clone = malloc (sizeof (cairo_gstate_t));
- if (clone) {
- status = _cairo_gstate_init_copy (clone, gstate);
- if (status) {
- free (clone);
- return NULL;
- }
- }
- clone->next = NULL;
-
- return clone;
-}
-
-cairo_status_t
-_cairo_gstate_copy (cairo_gstate_t *dest, cairo_gstate_t *src)
-{
- cairo_status_t status;
- cairo_gstate_t *next;
-
- /* Preserve next pointer over fini/init */
- next = dest->next;
- _cairo_gstate_fini (dest);
- status = _cairo_gstate_init_copy (dest, src);
- dest->next = next;
-
- return status;
-}
-
-/* Push rendering off to an off-screen group. */
-/* XXX: Rethinking this API
-cairo_status_t
-_cairo_gstate_begin_group (cairo_gstate_t *gstate)
-{
- Pixmap pix;
- cairo_color_t clear;
- unsigned int width, height;
-
- gstate->parent_surface = gstate->surface;
-
- width = _cairo_surface_get_width (gstate->surface);
- height = _cairo_surface_get_height (gstate->surface);
-
- pix = XCreatePixmap (gstate->dpy,
- _cairo_surface_get_drawable (gstate->surface),
- width, height,
- _cairo_surface_get_depth (gstate->surface));
- if (pix == 0)
- return CAIRO_STATUS_NO_MEMORY;
-
- gstate->surface = cairo_surface_create (gstate->dpy);
- if (gstate->surface == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- _cairo_surface_set_drawableWH (gstate->surface, pix, width, height);
-
- _cairo_color_init (&clear);
- _cairo_color_set_alpha (&clear, 0);
-
- status = _cairo_surface_fill_rectangle (gstate->surface,
- CAIRO_OPERATOR_SRC,
- &clear,
- 0, 0,
- _cairo_surface_get_width (gstate->surface),
- _cairo_surface_get_height (gstate->surface));
- if (status)
- return status;
-
- return CAIRO_STATUS_SUCCESS;
-}
-*/
-
-/* Complete the current offscreen group, composing its contents onto the parent surface. */
-/* XXX: Rethinking this API
-cairo_status_t
-_cairo_gstate_end_group (cairo_gstate_t *gstate)
-{
- Pixmap pix;
- cairo_color_t mask_color;
- cairo_surface_t mask;
-
- if (gstate->parent_surface == NULL)
- return CAIRO_STATUS_INVALID_POP_GROUP;
-
- _cairo_surface_init (&mask, gstate->dpy);
- _cairo_color_init (&mask_color);
- _cairo_color_set_alpha (&mask_color, gstate->alpha);
-
- _cairo_surface_set_solid_color (&mask, &mask_color);
-
- * XXX: This could be made much more efficient by using
- _cairo_surface_get_damaged_width/Height if cairo_surface_t actually kept
- track of such informaton. *
- _cairo_surface_composite (gstate->operator,
- gstate->surface,
- mask,
- gstate->parent_surface,
- 0, 0,
- 0, 0,
- 0, 0,
- _cairo_surface_get_width (gstate->surface),
- _cairo_surface_get_height (gstate->surface));
-
- _cairo_surface_fini (&mask);
-
- pix = _cairo_surface_get_drawable (gstate->surface);
- XFreePixmap (gstate->dpy, pix);
-
- cairo_surface_destroy (gstate->surface);
- gstate->surface = gstate->parent_surface;
- gstate->parent_surface = NULL;
-
- return CAIRO_STATUS_SUCCESS;
-}
-*/
-
-cairo_status_t
-_cairo_gstate_set_target_surface (cairo_gstate_t *gstate, cairo_surface_t *surface)
-{
- double scale;
-
- _cairo_gstate_unset_font (gstate);
-
- if (gstate->surface)
- cairo_surface_destroy (gstate->surface);
-
- gstate->surface = surface;
-
- /* Sometimes the user wants to return to having no target surface,
- * (just like after cairo_create). This can be useful for forcing
- * the old surface to be destroyed. */
- if (surface == NULL)
- return CAIRO_STATUS_SUCCESS;
-
- cairo_surface_reference (gstate->surface);
-
- scale = _cairo_surface_pixels_per_inch (surface) / gstate->pixels_per_inch;
- _cairo_gstate_scale (gstate, scale, scale);
- gstate->pixels_per_inch = _cairo_surface_pixels_per_inch (surface);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-/* XXX: Need to decide the memory mangement semantics of this
- function. Should it reference the surface again? */
-cairo_surface_t *
-_cairo_gstate_current_target_surface (cairo_gstate_t *gstate)
-{
- if (gstate == NULL)
- return NULL;
-
-/* XXX: Do we want this?
- if (gstate->surface)
- _cairo_surface_reference (gstate->surface);
-*/
-
- return gstate->surface;
-}
-
-cairo_status_t
-_cairo_gstate_set_pattern (cairo_gstate_t *gstate, cairo_pattern_t *pattern)
-{
- if (pattern == NULL)
- return CAIRO_STATUS_NULL_POINTER;
-
- cairo_pattern_reference (pattern);
- cairo_pattern_destroy (gstate->pattern);
- gstate->pattern = pattern;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_pattern_t *
-_cairo_gstate_current_pattern (cairo_gstate_t *gstate)
-{
- if (gstate == NULL)
- return NULL;
-
-/* XXX: Do we want this?
- cairo_pattern_reference (gstate->pattern);
-*/
-
- return gstate->pattern;
-}
-
-cairo_status_t
-_cairo_gstate_set_operator (cairo_gstate_t *gstate, cairo_operator_t operator)
-{
- gstate->operator = operator;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_operator_t
-_cairo_gstate_current_operator (cairo_gstate_t *gstate)
-{
- return gstate->operator;
-}
-
-cairo_status_t
-_cairo_gstate_set_rgb_color (cairo_gstate_t *gstate, double red, double green, double blue)
-{
- cairo_pattern_destroy (gstate->pattern);
-
- gstate->pattern = _cairo_pattern_create_solid (red, green, blue);
- if (!gstate->pattern)
- return CAIRO_STATUS_NO_MEMORY;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_current_rgb_color (cairo_gstate_t *gstate, double *red, double *green, double *blue)
-{
- return _cairo_pattern_get_rgb (gstate->pattern, red, green, blue);
-}
-
-cairo_status_t
-_cairo_gstate_set_tolerance (cairo_gstate_t *gstate, double tolerance)
-{
- gstate->tolerance = tolerance;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-double
-_cairo_gstate_current_tolerance (cairo_gstate_t *gstate)
-{
- return gstate->tolerance;
-}
-
-cairo_status_t
-_cairo_gstate_set_alpha (cairo_gstate_t *gstate, double alpha)
-{
- gstate->alpha = alpha;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-double
-_cairo_gstate_current_alpha (cairo_gstate_t *gstate)
-{
- return gstate->alpha;
-}
-
-cairo_status_t
-_cairo_gstate_set_fill_rule (cairo_gstate_t *gstate, cairo_fill_rule_t fill_rule)
-{
- gstate->fill_rule = fill_rule;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_fill_rule_t
-_cairo_gstate_current_fill_rule (cairo_gstate_t *gstate)
-{
- return gstate->fill_rule;
-}
-
-cairo_status_t
-_cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width)
-{
- gstate->line_width = width;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-double
-_cairo_gstate_current_line_width (cairo_gstate_t *gstate)
-{
- return gstate->line_width;
-}
-
-cairo_status_t
-_cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap)
-{
- gstate->line_cap = line_cap;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_line_cap_t
-_cairo_gstate_current_line_cap (cairo_gstate_t *gstate)
-{
- return gstate->line_cap;
-}
-
-cairo_status_t
-_cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join)
-{
- gstate->line_join = line_join;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_line_join_t
-_cairo_gstate_current_line_join (cairo_gstate_t *gstate)
-{
- return gstate->line_join;
-}
-
-cairo_status_t
-_cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, double offset)
-{
- if (gstate->dash) {
- free (gstate->dash);
- gstate->dash = NULL;
- }
-
- gstate->num_dashes = num_dashes;
- if (gstate->num_dashes) {
- gstate->dash = malloc (gstate->num_dashes * sizeof (double));
- if (gstate->dash == NULL) {
- gstate->num_dashes = 0;
- return CAIRO_STATUS_NO_MEMORY;
- }
- }
-
- memcpy (gstate->dash, dash, gstate->num_dashes * sizeof (double));
- gstate->dash_offset = offset;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit)
-{
- gstate->miter_limit = limit;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-double
-_cairo_gstate_current_miter_limit (cairo_gstate_t *gstate)
-{
- return gstate->miter_limit;
-}
-
-void
-_cairo_gstate_current_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
-{
- cairo_matrix_copy (matrix, &gstate->ctm);
-}
-
-cairo_status_t
-_cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty)
-{
- cairo_matrix_t tmp;
-
- _cairo_gstate_unset_font (gstate);
-
- _cairo_matrix_set_translate (&tmp, tx, ty);
- cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
-
- _cairo_matrix_set_translate (&tmp, -tx, -ty);
- cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy)
-{
- cairo_matrix_t tmp;
-
- if (sx == 0 || sy == 0)
- return CAIRO_STATUS_INVALID_MATRIX;
-
- _cairo_gstate_unset_font (gstate);
-
- _cairo_matrix_set_scale (&tmp, sx, sy);
- cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
-
- _cairo_matrix_set_scale (&tmp, 1/sx, 1/sy);
- cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_rotate (cairo_gstate_t *gstate, double angle)
-{
- cairo_matrix_t tmp;
-
- _cairo_gstate_unset_font (gstate);
-
- _cairo_matrix_set_rotate (&tmp, angle);
- cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
-
- _cairo_matrix_set_rotate (&tmp, -angle);
- cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_concat_matrix (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix)
-{
- cairo_matrix_t tmp;
-
- _cairo_gstate_unset_font (gstate);
-
- cairo_matrix_copy (&tmp, matrix);
- cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
-
- cairo_matrix_invert (&tmp);
- cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_set_matrix (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix)
-{
- cairo_status_t status;
-
- _cairo_gstate_unset_font (gstate);
-
- cairo_matrix_copy (&gstate->ctm, matrix);
-
- cairo_matrix_copy (&gstate->ctm_inverse, matrix);
- status = cairo_matrix_invert (&gstate->ctm_inverse);
- if (status)
- return status;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_default_matrix (cairo_gstate_t *gstate)
-{
- int scale = gstate->pixels_per_inch / CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT + 0.5;
- if (scale == 0)
- scale = 1;
-
- _cairo_gstate_unset_font (gstate);
-
- cairo_matrix_set_identity (&gstate->font_matrix);
-
- cairo_matrix_set_identity (&gstate->ctm);
- cairo_matrix_scale (&gstate->ctm, scale, scale);
- cairo_matrix_copy (&gstate->ctm_inverse, &gstate->ctm);
- cairo_matrix_invert (&gstate->ctm_inverse);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_identity_matrix (cairo_gstate_t *gstate)
-{
- _cairo_gstate_unset_font (gstate);
-
- cairo_matrix_set_identity (&gstate->ctm);
- cairo_matrix_set_identity (&gstate->ctm_inverse);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_transform_point (cairo_gstate_t *gstate, double *x, double *y)
-{
- cairo_matrix_transform_point (&gstate->ctm, x, y);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy)
-{
- cairo_matrix_transform_distance (&gstate->ctm, dx, dy);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_inverse_transform_point (cairo_gstate_t *gstate, double *x, double *y)
-{
- cairo_matrix_transform_point (&gstate->ctm_inverse, x, y);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_inverse_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy)
-{
- cairo_matrix_transform_distance (&gstate->ctm_inverse, dx, dy);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_new_path (cairo_gstate_t *gstate)
-{
- _cairo_path_fini (&gstate->path);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_move_to (cairo_gstate_t *gstate, double x, double y)
-{
- cairo_point_t point;
-
- cairo_matrix_transform_point (&gstate->ctm, &x, &y);
-
- point.x = _cairo_fixed_from_double (x);
- point.y = _cairo_fixed_from_double (y);
-
- return _cairo_path_move_to (&gstate->path, &point);
-}
-
-cairo_status_t
-_cairo_gstate_line_to (cairo_gstate_t *gstate, double x, double y)
-{
- cairo_point_t point;
-
- cairo_matrix_transform_point (&gstate->ctm, &x, &y);
-
- point.x = _cairo_fixed_from_double (x);
- point.y = _cairo_fixed_from_double (y);
-
- return _cairo_path_line_to (&gstate->path, &point);
-}
-
-cairo_status_t
-_cairo_gstate_curve_to (cairo_gstate_t *gstate,
- double x0, double y0,
- double x1, double y1,
- double x2, double y2)
-{
- cairo_point_t p0, p1, p2;
-
- cairo_matrix_transform_point (&gstate->ctm, &x0, &y0);
- cairo_matrix_transform_point (&gstate->ctm, &x1, &y1);
- cairo_matrix_transform_point (&gstate->ctm, &x2, &y2);
-
- p0.x = _cairo_fixed_from_double (x0);
- p0.y = _cairo_fixed_from_double (y0);
-
- p1.x = _cairo_fixed_from_double (x1);
- p1.y = _cairo_fixed_from_double (y1);
-
- p2.x = _cairo_fixed_from_double (x2);
- p2.y = _cairo_fixed_from_double (y2);
-
- return _cairo_path_curve_to (&gstate->path, &p0, &p1, &p2);
-}
-
-/* Spline deviation from the circle in radius would be given by:
-
- error = sqrt (x**2 + y**2) - 1
-
- A simpler error function to work with is:
-
- e = x**2 + y**2 - 1
-
- From "Good approximation of circles by curvature-continuous Bezier
- curves", Tor Dokken and Morten Daehlen, Computer Aided Geometric
- Design 8 (1990) 22-41, we learn:
-
- abs (max(e)) = 4/27 * sin**6(angle/4) / cos**2(angle/4)
-
- and
- abs (error) =~ 1/2 * e
-
- Of course, this error value applies only for the particular spline
- approximation that is used in _cairo_gstate_arc_segment.
-*/
-static double
-_arc_error_normalized (double angle)
-{
- return 2.0/27.0 * pow (sin (angle / 4), 6) / pow (cos (angle / 4), 2);
-}
-
-static double
-_arc_max_angle_for_tolerance_normalized (double tolerance)
-{
- double angle, error;
- int i;
-
- /* Use table lookup to reduce search time in most cases. */
- struct {
- double angle;
- double error;
- } table[] = {
- { M_PI / 1.0, 0.0185185185185185036127 },
- { M_PI / 2.0, 0.000272567143730179811158 },
- { M_PI / 3.0, 2.38647043651461047433e-05 },
- { M_PI / 4.0, 4.2455377443222443279e-06 },
- { M_PI / 5.0, 1.11281001494389081528e-06 },
- { M_PI / 6.0, 3.72662000942734705475e-07 },
- { M_PI / 7.0, 1.47783685574284411325e-07 },
- { M_PI / 8.0, 6.63240432022601149057e-08 },
- { M_PI / 9.0, 3.2715520137536980553e-08 },
- { M_PI / 10.0, 1.73863223499021216974e-08 },
- { M_PI / 11.0, 9.81410988043554039085e-09 },
- };
- int table_size = (sizeof (table) / sizeof (table[0]));
-
- for (i = 0; i < table_size; i++)
- if (table[i].error < tolerance)
- return table[i].angle;
-
- ++i;
- do {
- angle = M_PI / i++;
- error = _arc_error_normalized (angle);
- } while (error > tolerance);
-
- return angle;
-}
-
-static int
-_cairo_gstate_arc_segments_needed (cairo_gstate_t *gstate,
- double angle,
- double radius)
-{
- double l1, l2, lmax;
- double max_angle;
-
- _cairo_matrix_compute_eigen_values (&gstate->ctm, &l1, &l2);
-
- l1 = fabs (l1);
- l2 = fabs (l2);
- if (l1 > l2)
- lmax = l1;
- else
- lmax = l2;
-
- max_angle = _arc_max_angle_for_tolerance_normalized (gstate->tolerance / (radius * lmax));
-
- return (int) ceil (angle / max_angle);
-}
-
-/* We want to draw a single spline approximating a circular arc radius
- R from angle A to angle B. Since we want a symmetric spline that
- matches the endpoints of the arc in position and slope, we know
- that the spline control points must be:
-
- (R * cos(A), R * sin(A))
- (R * cos(A) - h * sin(A), R * sin(A) + h * cos (A))
- (R * cos(B) + h * sin(B), R * sin(B) - h * cos (B))
- (R * cos(B), R * sin(B))
-
- for some value of h.
-
- "Approximation of circular arcs by cubic poynomials", Michael
- Goldapp, Computer Aided Geometric Design 8 (1991) 227-238, provides
- various values of h along with error analysis for each.
-
- From that paper, a very practical value of h is:
-
- h = 4/3 * tan(angle/4)
-
- This value does not give the spline with minimal error, but it does
- provide a very good approximation, (6th-order convergence), and the
- error expression is quite simple, (see the comment for
- _arc_error_normalized).
-*/
-static cairo_status_t
-_cairo_gstate_arc_segment (cairo_gstate_t *gstate,
- double xc, double yc,
- double radius,
- double angle_A, double angle_B)
-{
- cairo_status_t status;
- double r_sin_A, r_cos_A;
- double r_sin_B, r_cos_B;
- double h;
-
- r_sin_A = radius * sin (angle_A);
- r_cos_A = radius * cos (angle_A);
- r_sin_B = radius * sin (angle_B);
- r_cos_B = radius * cos (angle_B);
-
- h = 4.0/3.0 * tan ((angle_B - angle_A) / 4.0);
-
- status = _cairo_gstate_curve_to (gstate,
- xc + r_cos_A - h * r_sin_A, yc + r_sin_A + h * r_cos_A,
- xc + r_cos_B + h * r_sin_B, yc + r_sin_B - h * r_cos_B,
- xc + r_cos_B, yc + r_sin_B);
- if (status)
- return status;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_cairo_gstate_arc_dir (cairo_gstate_t *gstate,
- double xc, double yc,
- double radius,
- double angle_min,
- double angle_max,
- cairo_direction_t dir)
-{
- cairo_status_t status;
-
- while (angle_max - angle_min > 4 * M_PI)
- angle_max -= 2 * M_PI;
-
- /* Recurse if drawing arc larger than pi */
- if (angle_max - angle_min > M_PI) {
- double angle_mid = angle_min + (angle_max - angle_min) / 2.0;
- /* XXX: Something tells me this block could be condensed. */
- if (dir == CAIRO_DIRECTION_FORWARD) {
- status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
- angle_min, angle_mid, dir);
- if (status)
- return status;
-
- status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
- angle_mid, angle_max, dir);
- if (status)
- return status;
- } else {
- status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
- angle_mid, angle_max, dir);
- if (status)
- return status;
-
- status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
- angle_min, angle_mid, dir);
- if (status)
- return status;
- }
- } else {
- int i, segments;
- double angle, angle_step;
-
- segments = _cairo_gstate_arc_segments_needed (gstate,
- angle_max - angle_min,
- radius);
- angle_step = (angle_max - angle_min) / (double) segments;
-
- if (dir == CAIRO_DIRECTION_FORWARD) {
- angle = angle_min;
- } else {
- angle = angle_max;
- angle_step = - angle_step;
- }
-
- for (i = 0; i < segments; i++, angle += angle_step) {
- _cairo_gstate_arc_segment (gstate,
- xc, yc,
- radius,
- angle,
- angle + angle_step);
- }
-
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_arc (cairo_gstate_t *gstate,
- double xc, double yc,
- double radius,
- double angle1, double angle2)
-{
- cairo_status_t status;
-
- if (radius <= 0.0)
- return CAIRO_STATUS_SUCCESS;
-
- while (angle2 < angle1)
- angle2 += 2 * M_PI;
-
- status = _cairo_gstate_line_to (gstate,
- xc + radius * cos (angle1),
- yc + radius * sin (angle1));
- if (status)
- return status;
-
- status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
- angle1, angle2, CAIRO_DIRECTION_FORWARD);
- if (status)
- return status;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_arc_negative (cairo_gstate_t *gstate,
- double xc, double yc,
- double radius,
- double angle1, double angle2)
-{
- cairo_status_t status;
-
- if (radius <= 0.0)
- return CAIRO_STATUS_SUCCESS;
-
- while (angle2 > angle1)
- angle2 -= 2 * M_PI;
-
- status = _cairo_gstate_line_to (gstate,
- xc + radius * cos (angle1),
- yc + radius * sin (angle1));
- if (status)
- return status;
-
- status = _cairo_gstate_arc_dir (gstate, xc, yc, radius,
- angle2, angle1, CAIRO_DIRECTION_REVERSE);
- if (status)
- return status;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-/* XXX: NYI
-cairo_status_t
-_cairo_gstate_arc_to (cairo_gstate_t *gstate,
- double x1, double y1,
- double x2, double y2,
- double radius)
-{
-
-}
-*/
-
-cairo_status_t
-_cairo_gstate_rel_move_to (cairo_gstate_t *gstate, double dx, double dy)
-{
- cairo_distance_t distance;
-
- cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
-
- distance.dx = _cairo_fixed_from_double (dx);
- distance.dy = _cairo_fixed_from_double (dy);
-
- return _cairo_path_rel_move_to (&gstate->path, &distance);
-}
-
-cairo_status_t
-_cairo_gstate_rel_line_to (cairo_gstate_t *gstate, double dx, double dy)
-{
- cairo_distance_t distance;
-
- cairo_matrix_transform_distance (&gstate->ctm, &dx, &dy);
-
- distance.dx = _cairo_fixed_from_double (dx);
- distance.dy = _cairo_fixed_from_double (dy);
-
- return _cairo_path_rel_line_to (&gstate->path, &distance);
-}
-
-cairo_status_t
-_cairo_gstate_rel_curve_to (cairo_gstate_t *gstate,
- double dx0, double dy0,
- double dx1, double dy1,
- double dx2, double dy2)
-{
- cairo_distance_t distance[3];
-
- cairo_matrix_transform_distance (&gstate->ctm, &dx0, &dy0);
- cairo_matrix_transform_distance (&gstate->ctm, &dx1, &dy1);
- cairo_matrix_transform_distance (&gstate->ctm, &dx2, &dy2);
-
- distance[0].dx = _cairo_fixed_from_double (dx0);
- distance[0].dy = _cairo_fixed_from_double (dy0);
-
- distance[1].dx = _cairo_fixed_from_double (dx1);
- distance[1].dy = _cairo_fixed_from_double (dy1);
-
- distance[2].dx = _cairo_fixed_from_double (dx2);
- distance[2].dy = _cairo_fixed_from_double (dy2);
-
- return _cairo_path_rel_curve_to (&gstate->path,
- &distance[0],
- &distance[1],
- &distance[2]);
-}
-
-/* XXX: NYI
-cairo_status_t
-_cairo_gstate_stroke_path (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
-
- _cairo_pen_init (&gstate);
- return CAIRO_STATUS_SUCCESS;
-}
-*/
-
-cairo_status_t
-_cairo_gstate_close_path (cairo_gstate_t *gstate)
-{
- return _cairo_path_close_path (&gstate->path);
-}
-
-cairo_status_t
-_cairo_gstate_current_point (cairo_gstate_t *gstate, double *x_ret, double *y_ret)
-{
- cairo_status_t status;
- cairo_point_t point;
- double x, y;
-
- status = _cairo_path_current_point (&gstate->path, &point);
- if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
- x = 0.0;
- y = 0.0;
- } else {
- x = _cairo_fixed_to_double (point.x);
- y = _cairo_fixed_to_double (point.y);
- cairo_matrix_transform_point (&gstate->ctm_inverse, &x, &y);
- }
-
- if (x_ret)
- *x_ret = x;
- if (y_ret)
- *y_ret = y;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-typedef struct gstate_path_interpreter {
- cairo_matrix_t ctm_inverse;
- double tolerance;
- cairo_point_t current_point;
-
- cairo_move_to_func_t *move_to;
- cairo_line_to_func_t *line_to;
- cairo_curve_to_func_t *curve_to;
- cairo_close_path_func_t *close_path;
-
- void *closure;
-} gpi_t;
-
-static cairo_status_t
-_gpi_move_to (void *closure, cairo_point_t *point)
-{
- gpi_t *gpi = closure;
- double x, y;
-
- x = _cairo_fixed_to_double (point->x);
- y = _cairo_fixed_to_double (point->y);
-
- cairo_matrix_transform_point (&gpi->ctm_inverse, &x, &y);
-
- gpi->move_to (gpi->closure, x, y);
- gpi->current_point = *point;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_gpi_line_to (void *closure, cairo_point_t *point)
-{
- gpi_t *gpi = closure;
- double x, y;
-
- x = _cairo_fixed_to_double (point->x);
- y = _cairo_fixed_to_double (point->y);
-
- cairo_matrix_transform_point (&gpi->ctm_inverse, &x, &y);
-
- gpi->line_to (gpi->closure, x, y);
- gpi->current_point = *point;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_gpi_curve_to (void *closure,
- cairo_point_t *p1,
- cairo_point_t *p2,
- cairo_point_t *p3)
-{
- gpi_t *gpi = closure;
- cairo_status_t status;
- cairo_spline_t spline;
- double x1, y1, x2, y2, x3, y3;
-
- if (gpi->curve_to) {
- x1 = _cairo_fixed_to_double (p1->x);
- y1 = _cairo_fixed_to_double (p1->y);
- cairo_matrix_transform_point (&gpi->ctm_inverse, &x1, &y1);
-
- x2 = _cairo_fixed_to_double (p2->x);
- y2 = _cairo_fixed_to_double (p2->y);
- cairo_matrix_transform_point (&gpi->ctm_inverse, &x2, &y2);
-
- x3 = _cairo_fixed_to_double (p3->x);
- y3 = _cairo_fixed_to_double (p3->y);
- cairo_matrix_transform_point (&gpi->ctm_inverse, &x3, &y3);
-
- gpi->curve_to (gpi->closure, x1, y1, x2, y2, x3, y3);
- } else {
- cairo_point_t *p0 = &gpi->current_point;
- int i;
- double x, y;
-
- status = _cairo_spline_init (&spline, p0, p1, p2, p3);
- if (status == CAIRO_INT_STATUS_DEGENERATE)
- return CAIRO_STATUS_SUCCESS;
-
- status = _cairo_spline_decompose (&spline, gpi->tolerance);
- if (status)
- return status;
-
- for (i=1; i < spline.num_points; i++) {
- x = _cairo_fixed_to_double (spline.points[i].x);
- y = _cairo_fixed_to_double (spline.points[i].y);
-
- cairo_matrix_transform_point (&gpi->ctm_inverse, &x, &y);
-
- gpi->line_to (gpi->closure, x, y);
- }
- }
-
- gpi->current_point = *p3;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_gpi_close_path (void *closure)
-{
- gpi_t *gpi = closure;
-
- gpi->close_path (gpi->closure);
-
- gpi->current_point.x = 0;
- gpi->current_point.y = 0;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-/* It's OK for curve_path to be NULL. In that case, all curves in the
- path will be decomposed into one or more calls to the line_to
- function, (according to the current tolerance). */
-cairo_status_t
-_cairo_gstate_interpret_path (cairo_gstate_t *gstate,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_curve_to_func_t *curve_to,
- cairo_close_path_func_t *close_path,
- void *closure)
-{
- cairo_path_t path;
- gpi_t gpi;
-
- /* Anything we want from gstate must be copied. We must not retain
- pointers into gstate. */
- _cairo_path_init_copy (&path, &gstate->path);
-
- cairo_matrix_copy (&gpi.ctm_inverse, &gstate->ctm_inverse);
- gpi.tolerance = gstate->tolerance;
-
- gpi.move_to = move_to;
- gpi.line_to = line_to;
- gpi.curve_to = curve_to;
- gpi.close_path = close_path;
- gpi.closure = closure;
-
- gpi.current_point.x = 0;
- gpi.current_point.y = 0;
-
- return _cairo_path_interpret (&path,
- CAIRO_DIRECTION_FORWARD,
- _gpi_move_to,
- _gpi_line_to,
- _gpi_curve_to,
- _gpi_close_path,
- &gpi);
-}
-
-/* XXX: gstate->alpha will be going away before too long, and when it
- * does, it may make sense for this function to just disappear.
- */
-static void
-_cairo_gstate_pattern_init_copy (cairo_gstate_t *gstate,
- cairo_pattern_union_t *pattern,
- cairo_pattern_t *src)
-{
- _cairo_pattern_init_copy (&pattern->base, src);
- _cairo_pattern_transform (&pattern->base, &gstate->ctm_inverse);
- _cairo_pattern_set_alpha (&pattern->base, gstate->alpha);
-}
-
-cairo_status_t
-_cairo_gstate_stroke (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
- cairo_traps_t traps;
-
- if (gstate->line_width <= 0.0)
- return CAIRO_STATUS_SUCCESS;
-
- _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);
-
- _cairo_traps_init (&traps);
-
- status = _cairo_path_stroke_to_traps (&gstate->path, gstate, &traps);
- if (status) {
- _cairo_traps_fini (&traps);
- return status;
- }
-
- _cairo_gstate_clip_and_composite_trapezoids (gstate,
- gstate->pattern,
- gstate->operator,
- gstate->surface,
- &traps);
-
- _cairo_traps_fini (&traps);
-
- _cairo_gstate_new_path (gstate);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_in_stroke (cairo_gstate_t *gstate,
- double x,
- double y,
- cairo_bool_t *inside_ret)
-{
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
- cairo_traps_t traps;
-
- cairo_matrix_transform_point (&gstate->ctm, &x, &y);
-
- _cairo_pen_init (&gstate->pen_regular, gstate->line_width / 2.0, gstate);
-
- _cairo_traps_init (&traps);
-
- status = _cairo_path_stroke_to_traps (&gstate->path, gstate, &traps);
- if (status)
- goto BAIL;
-
- *inside_ret = _cairo_traps_contain (&traps, x, y);
-
-BAIL:
- _cairo_traps_fini (&traps);
-
- return status;
-}
-
-/* XXX We currently have a confusing mix of boxes and rectangles as
- * exemplified by this function. A cairo_box_t is a rectangular area
- * represented by the coordinates of the upper left and lower right
- * corners, expressed in fixed point numbers. A cairo_rectangle_t is
- * also a rectangular area, but represented by the upper left corner
- * and the width and the height, as integer numbers.
- *
- * This function converts a cairo_box_t to a cairo_rectangle_t by
- * increasing the area to the nearest integer coordinates. We should
- * standardize on cairo_rectangle_t and cairo_rectangle_fixed_t, and
- * this function could be renamed to the more reasonable
- * _cairo_rectangle_fixed_round.
- */
-
-static void
-_cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_t *rectangle)
-{
- rectangle->x = _cairo_fixed_integer_floor (box->p1.x);
- rectangle->y = _cairo_fixed_integer_floor (box->p1.y);
- rectangle->width = _cairo_fixed_integer_ceil (box->p2.x) - rectangle->x;
- rectangle->height = _cairo_fixed_integer_ceil (box->p2.y) - rectangle->y;
-}
-
-static void
-_cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src)
-{
- int x1, y1, x2, y2;
-
- x1 = MAX (dest->x, src->x);
- y1 = MAX (dest->y, src->y);
- x2 = MIN (dest->x + dest->width, src->x + src->width);
- y2 = MIN (dest->y + dest->height, src->y + src->height);
-
- if (x1 >= x2 || y1 >= y2) {
- dest->x = 0;
- dest->y = 0;
- dest->width = 0;
- dest->height = 0;
- } else {
- dest->x = x1;
- dest->y = y1;
- dest->width = x2 - x1;
- dest->height = y2 - y1;
- }
-}
-
-static int
-_cairo_rectangle_empty (cairo_rectangle_t *rect)
-{
- return rect->width == 0 || rect->height == 0;
-}
-
-static void
-translate_traps (cairo_traps_t *traps, int x, int y)
-{
- cairo_fixed_t xoff, yoff;
- cairo_trapezoid_t *t;
- int i;
-
- /* Ugh. The cairo_composite/(Render) interface doesn't allow
- an offset for the trapezoids. Need to manually shift all
- the coordinates to align with the offset origin of the
- intermediate surface. */
-
- xoff = _cairo_fixed_from_int (x);
- yoff = _cairo_fixed_from_int (y);
-
- for (i = 0, t = traps->traps; i < traps->num_traps; i++, t++) {
- t->top += yoff;
- t->bottom += yoff;
- t->left.p1.x += xoff;
- t->left.p1.y += yoff;
- t->left.p2.x += xoff;
- t->left.p2.y += yoff;
- t->right.p1.x += xoff;
- t->right.p1.y += yoff;
- t->right.p2.x += xoff;
- t->right.p2.y += yoff;
- }
-}
-
-
-/* Warning: This call modifies the coordinates of traps */
-static cairo_status_t
-_cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate,
- cairo_pattern_t *src,
- cairo_operator_t operator,
- cairo_surface_t *dst,
- cairo_traps_t *traps)
-{
- cairo_status_t status;
- cairo_pattern_union_t pattern;
- cairo_rectangle_t extents;
- cairo_box_t trap_extents;
-
- if (traps->num_traps == 0)
- return CAIRO_STATUS_SUCCESS;
-
- if (gstate->surface == NULL)
- return CAIRO_STATUS_NO_TARGET_SURFACE;
-
- _cairo_traps_extents (traps, &trap_extents);
- _cairo_box_round_to_rectangle (&trap_extents, &extents);
-
- if (gstate->clip.surface) {
- cairo_surface_t *intermediate;
- cairo_surface_pattern_t intermediate_pattern;
- cairo_color_t empty_color;
-
- _cairo_rectangle_intersect (&extents, &gstate->clip.rect);
-
- if (_cairo_rectangle_empty (&extents)) {
- status = CAIRO_STATUS_SUCCESS;
- goto BAIL1;
- }
-
- translate_traps (traps, -extents.x, -extents.y);
-
- _cairo_color_init (&empty_color);
- _cairo_color_set_alpha (&empty_color, 0.);
- intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface,
- CAIRO_FORMAT_A8,
- extents.width,
- extents.height,
- &empty_color);
- if (intermediate == NULL) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto BAIL1;
- }
-
- _cairo_pattern_init_solid (&pattern.solid, 1.0, 1.0, 1.0);
-
- status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_ADD,
- &pattern.base,
- intermediate,
- extents.x, extents.y,
- 0, 0,
- extents.width,
- extents.height,
- traps->traps,
- traps->num_traps);
- _cairo_pattern_fini (&pattern.base);
-
- if (status)
- goto BAIL2;
-
-
- _cairo_pattern_init_for_surface (&pattern.surface,
- gstate->clip.surface);
-
- status = _cairo_surface_composite (CAIRO_OPERATOR_IN,
- &pattern.base,
- NULL,
- intermediate,
- extents.x - gstate->clip.rect.x,
- extents.y - gstate->clip.rect.y,
- 0, 0,
- 0, 0,
- extents.width, extents.height);
- _cairo_pattern_fini (&pattern.base);
-
- if (status)
- goto BAIL2;
-
- _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
- _cairo_gstate_pattern_init_copy (gstate, &pattern, src);
-
- status = _cairo_surface_composite (operator,
- &pattern.base,
- &intermediate_pattern.base,
- dst,
- extents.x, extents.y,
- 0, 0,
- extents.x, extents.y,
- extents.width, extents.height);
-
- _cairo_pattern_fini (&pattern.base);
- _cairo_pattern_fini (&intermediate_pattern.base);
-
- BAIL2:
- cairo_surface_destroy (intermediate);
- BAIL1:
-
- if (status)
- return status;
-
- } else {
- if (gstate->clip.region) {
- pixman_box16_t box;
- pixman_box16_t *intersection_extents;
- pixman_region16_t *rect, *intersection;
-
- box.x1 = _cairo_fixed_integer_floor (trap_extents.p1.x);
- box.y1 = _cairo_fixed_integer_floor (trap_extents.p1.y);
- box.x2 = _cairo_fixed_integer_ceil (trap_extents.p2.x);
- box.y2 = _cairo_fixed_integer_ceil (trap_extents.p2.y);
-
- rect = pixman_region_create_simple (&box);
- if (rect == NULL)
- goto bail1;
- intersection = pixman_region_create();
- if (intersection == NULL)
- goto bail2;
-
- if (pixman_region_intersect (intersection, gstate->clip.region,
- rect) != PIXMAN_REGION_STATUS_SUCCESS)
- goto bail3;
- intersection_extents = pixman_region_extents (intersection);
-
- extents.x = intersection_extents->x1;
- extents.y = intersection_extents->y1;
- extents.width = intersection_extents->x2 - intersection_extents->x1;
- extents.height = intersection_extents->y2 - intersection_extents->y1;
- bail3:
- pixman_region_destroy (intersection);
- bail2:
- pixman_region_destroy (rect);
- bail1:
- ;
- }
-
- _cairo_gstate_pattern_init_copy (gstate, &pattern, src);
-
- status = _cairo_surface_composite_trapezoids (gstate->operator,
- &pattern.base, dst,
- extents.x, extents.y,
- extents.x, extents.y,
- extents.width,
- extents.height,
- traps->traps,
- traps->num_traps);
-
- _cairo_pattern_fini (&pattern.base);
-
- if (status)
- return status;
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_fill (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
- cairo_traps_t traps;
-
- _cairo_traps_init (&traps);
-
- status = _cairo_path_fill_to_traps (&gstate->path, gstate, &traps);
- if (status) {
- _cairo_traps_fini (&traps);
- return status;
- }
-
- _cairo_gstate_clip_and_composite_trapezoids (gstate,
- gstate->pattern,
- gstate->operator,
- gstate->surface,
- &traps);
-
- _cairo_traps_fini (&traps);
-
- _cairo_gstate_new_path (gstate);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_in_fill (cairo_gstate_t *gstate,
- double x,
- double y,
- cairo_bool_t *inside_ret)
-{
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
- cairo_traps_t traps;
-
- cairo_matrix_transform_point (&gstate->ctm, &x, &y);
-
- _cairo_traps_init (&traps);
-
- status = _cairo_path_fill_to_traps (&gstate->path, gstate, &traps);
- if (status)
- goto BAIL;
-
- *inside_ret = _cairo_traps_contain (&traps, x, y);
-
-BAIL:
- _cairo_traps_fini (&traps);
-
- return status;
-}
-
-cairo_status_t
-_cairo_gstate_copy_page (cairo_gstate_t *gstate)
-{
- if (gstate->surface == NULL)
- return CAIRO_STATUS_NO_TARGET_SURFACE;
-
- return _cairo_surface_copy_page (gstate->surface);
-}
-
-cairo_status_t
-_cairo_gstate_show_page (cairo_gstate_t *gstate)
-{
- if (gstate->surface == NULL)
- return CAIRO_STATUS_NO_TARGET_SURFACE;
-
- return _cairo_surface_show_page (gstate->surface);
-}
-
-cairo_status_t
-_cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
- double *x1, double *y1,
- double *x2, double *y2)
-{
- cairo_status_t status;
- cairo_traps_t traps;
- cairo_box_t extents;
-
- _cairo_traps_init (&traps);
-
- status = _cairo_path_stroke_to_traps (&gstate->path, gstate, &traps);
- if (status)
- goto BAIL;
-
- _cairo_traps_extents (&traps, &extents);
-
- *x1 = _cairo_fixed_to_double (extents.p1.x);
- *y1 = _cairo_fixed_to_double (extents.p1.y);
- *x2 = _cairo_fixed_to_double (extents.p2.x);
- *y2 = _cairo_fixed_to_double (extents.p2.y);
-
- cairo_matrix_transform_point (&gstate->ctm_inverse, x1, y1);
- cairo_matrix_transform_point (&gstate->ctm_inverse, x2, y2);
-
-BAIL:
- _cairo_traps_fini (&traps);
-
- return status;
-}
-
-cairo_status_t
-_cairo_gstate_fill_extents (cairo_gstate_t *gstate,
- double *x1, double *y1,
- double *x2, double *y2)
-{
- cairo_status_t status;
- cairo_traps_t traps;
- cairo_box_t extents;
-
- _cairo_traps_init (&traps);
-
- status = _cairo_path_fill_to_traps (&gstate->path, gstate, &traps);
- if (status)
- goto BAIL;
-
- _cairo_traps_extents (&traps, &extents);
-
- *x1 = _cairo_fixed_to_double (extents.p1.x);
- *y1 = _cairo_fixed_to_double (extents.p1.y);
- *x2 = _cairo_fixed_to_double (extents.p2.x);
- *y2 = _cairo_fixed_to_double (extents.p2.y);
-
- cairo_matrix_transform_point (&gstate->ctm_inverse, x1, y1);
- cairo_matrix_transform_point (&gstate->ctm_inverse, x2, y2);
-
-BAIL:
- _cairo_traps_fini (&traps);
-
- return status;
-}
-
-cairo_status_t
-_cairo_gstate_init_clip (cairo_gstate_t *gstate)
-{
- /* destroy any existing clip-region artifacts */
- if (gstate->clip.surface)
- cairo_surface_destroy (gstate->clip.surface);
- gstate->clip.surface = NULL;
-
- if (gstate->clip.region)
- pixman_region_destroy (gstate->clip.region);
- gstate->clip.region = NULL;
-
- /* reset the surface's clip to the whole surface */
- if (gstate->surface)
- _cairo_surface_set_clip_region (gstate->surface,
- gstate->clip.region);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static int
-extract_transformed_rectangle(cairo_matrix_t *mat,
- cairo_traps_t *tr,
- pixman_box16_t *box)
-{
- double a, b, c, d, tx, ty;
- cairo_status_t st;
-
- st = cairo_matrix_get_affine (mat, &a, &b, &c, &d, &tx, &ty);
- if (!(st == CAIRO_STATUS_SUCCESS && b == 0. && c == 0.))
- return 0;
-
- if (tr->num_traps == 1
- && tr->traps[0].left.p1.x == tr->traps[0].left.p2.x
- && tr->traps[0].right.p1.x == tr->traps[0].right.p2.x
- && tr->traps[0].left.p1.y == tr->traps[0].right.p1.y
- && tr->traps[0].left.p2.y == tr->traps[0].right.p2.y
- && _cairo_fixed_is_integer(tr->traps[0].left.p1.x)
- && _cairo_fixed_is_integer(tr->traps[0].left.p1.y)
- && _cairo_fixed_is_integer(tr->traps[0].left.p2.x)
- && _cairo_fixed_is_integer(tr->traps[0].left.p2.y)
- && _cairo_fixed_is_integer(tr->traps[0].right.p1.x)
- && _cairo_fixed_is_integer(tr->traps[0].right.p1.y)
- && _cairo_fixed_is_integer(tr->traps[0].right.p2.x)
- && _cairo_fixed_is_integer(tr->traps[0].right.p2.y)) {
-
- box->x1 = (short) _cairo_fixed_integer_part(tr->traps[0].left.p1.x);
- box->x2 = (short) _cairo_fixed_integer_part(tr->traps[0].right.p1.x);
- box->y1 = (short) _cairo_fixed_integer_part(tr->traps[0].left.p1.y);
- box->y2 = (short) _cairo_fixed_integer_part(tr->traps[0].left.p2.y);
- return 1;
- }
- return 0;
-}
-
-/* Reset surface clip region to the one in the gstate */
-cairo_status_t
-_cairo_gstate_restore_external_state (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
-
- status = CAIRO_STATUS_SUCCESS;
-
- if (gstate->surface)
- status = _cairo_surface_set_clip_region (gstate->surface,
- gstate->clip.region);
-
- /* If not supported we're already using surface clipping */
- if (status == CAIRO_INT_STATUS_UNSUPPORTED)
- status = CAIRO_STATUS_SUCCESS;
-
- return status;
-}
-
-cairo_status_t
-_cairo_gstate_clip (cairo_gstate_t *gstate)
-{
- cairo_status_t status;
- cairo_pattern_union_t pattern;
- cairo_traps_t traps;
- cairo_color_t white_color;
- cairo_box_t extents;
- pixman_box16_t box;
-
- /* Fill the clip region as traps. */
-
- _cairo_traps_init (&traps);
- status = _cairo_path_fill_to_traps (&gstate->path, gstate, &traps);
- if (status) {
- _cairo_traps_fini (&traps);
- return status;
- }
-
- /* Check to see if we can represent these traps as a PixRegion. */
-
- if (extract_transformed_rectangle (&gstate->ctm, &traps, &box)) {
-
- pixman_region16_t *rect = NULL;
- pixman_region16_t *intersection = NULL;
-
- status = CAIRO_STATUS_SUCCESS;
- rect = pixman_region_create_simple (&box);
-
- if (rect == NULL) {
- status = CAIRO_STATUS_NO_MEMORY;
-
- } else {
-
- if (gstate->clip.region == NULL) {
- gstate->clip.region = rect;
- } else {
- intersection = pixman_region_create();
- if (pixman_region_intersect (intersection,
- gstate->clip.region, rect)
- == PIXMAN_REGION_STATUS_SUCCESS) {
- pixman_region_destroy (gstate->clip.region);
- gstate->clip.region = intersection;
- } else {
- status = CAIRO_STATUS_NO_MEMORY;
- }
- pixman_region_destroy (rect);
- }
-
- if (!status)
- status = _cairo_surface_set_clip_region (gstate->surface,
- gstate->clip.region);
- }
-
- if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
- _cairo_traps_fini (&traps);
- return status;
- }
-
- /* Fall through as status == CAIRO_INT_STATUS_UNSUPPORTED
- means that backend doesn't support clipping regions and
- mask surface clipping should be used instead. */
- }
-
- /* Otherwise represent the clip as a mask surface. */
-
- _cairo_color_init (&white_color);
-
- if (gstate->clip.surface == NULL) {
- _cairo_traps_extents (&traps, &extents);
- _cairo_box_round_to_rectangle (&extents, &gstate->clip.rect);
- gstate->clip.surface =
- _cairo_surface_create_similar_solid (gstate->surface,
- CAIRO_FORMAT_A8,
- gstate->clip.rect.width,
- gstate->clip.rect.height,
- &white_color);
- if (gstate->clip.surface == NULL)
- return CAIRO_STATUS_NO_MEMORY;
- }
-
- translate_traps (&traps, -gstate->clip.rect.x, -gstate->clip.rect.y);
- _cairo_pattern_init_solid (&pattern.solid, 1.0, 1.0, 1.0);
-
- status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN,
- &pattern.base,
- gstate->clip.surface,
- 0, 0,
- 0, 0,
- gstate->clip.rect.width,
- gstate->clip.rect.height,
- traps.traps,
- traps.num_traps);
-
- _cairo_pattern_fini (&pattern.base);
-
- _cairo_traps_fini (&traps);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_show_surface (cairo_gstate_t *gstate,
- cairo_surface_t *surface,
- int width,
- int height)
-{
-
- /* We are dealing with 6 coordinate spaces in this function. this makes
- * it ugly.
- *
- * - "Image" space is the space of the surface we're reading pixels from.
- * it is the surface argument to this function. The surface has a
- * matrix attached to it which maps "user" space (see below) into
- * image space.
- *
- * - "Device" space is the space of the surface we're ultimately writing
- * pixels to. It is the current surface of the gstate argument to
- * this function.
- *
- * - "User" space is an arbitrary space defined by the user, defined
- * implicitly by the gstate's CTM. The CTM maps from user space to
- * device space. The CTM inverse (which is also kept at all times)
- * maps from device space to user space.
- *
- * - "Clip" space is the space of the surface being used to clip pixels
- * during compositing. Space-wise, it is a bounding box (offset+size)
- * within device space. This surface is usually smaller than the device
- * surface (and possibly the image surface too) and logically occupies
- * a bounding box around the "clip path", situated somewhere in device
- * space. The clip path is already painted on the clip surface.
- *
- * - "Intermediate" space is the subset of the Clip space that the
- * drawing will affect, and we allocate an intermediate surface
- * of this size so that we can paint in it.
- *
- * - "Pattern" space is another arbitrary space defined in the pattern
- * element of gstate. As pixels are read from image space, they are
- * combined with pixels being read from pattern space and pixels
- * already existing in device space. User coordinates are converted
- * to pattern space, similarly, using a matrix attached to the pattern.
- * (in fact, there is a 7th space in here, which is the space of the
- * surface acting as a source for the pattern)
- *
- * To composite these spaces, we temporarily change the image surface
- * so that it can be read and written in device coordinates; in a sense
- * this makes it "spatially compatible" with the clip and device spaces.
- *
- *
- * There is also some confusion about the interaction between a clip and
- * a pattern; it is assumed that in this "show surface" operation a pattern
- * is to be used as an auxiliary alpha mask. this might be wrong, but it's
- * what we're doing now.
- *
- * so, to follow the operations below, remember that in the compositing
- * model, each operation is always of the form ((src IN mask) OP dst).
- * that's the basic operation.
- *
- * so the compositing we are trying to do here, in general, involves 2
- * steps, going via a temporary surface:
- *
- * - combining clip and pattern pixels together into a mask channel.
- * this will be ((pattern IN clip) SRC temporary). it ignores the
- * pixels already in the temporary, overwriting it with the
- * pattern, clipped to the clip mask.
- *
- * - combining temporary and "image" pixels with "device" pixels,
- * with a user-provided porter/duff operator. this will be
- * ((image IN temporary) OP device).
- *
- * if there is no clip, the degenerate case is just the second step
- * with pattern standing in for temporary.
- *
- */
-
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
- cairo_matrix_t image_to_user, image_to_device;
- double device_x, device_y;
- double device_width, device_height;
- cairo_surface_pattern_t pattern;
- cairo_box_t pattern_extents;
- cairo_rectangle_t extents;
-
- cairo_surface_get_matrix (surface, &image_to_user);
- cairo_matrix_invert (&image_to_user);
- cairo_matrix_multiply (&image_to_device, &image_to_user, &gstate->ctm);
-
- _cairo_gstate_current_point (gstate, &device_x, &device_y);
- device_width = width;
- device_height = height;
- _cairo_matrix_transform_bounding_box (&image_to_device,
- &device_x, &device_y,
- &device_width, &device_height);
-
- _cairo_pattern_init_for_surface (&pattern, surface);
-
- /* inherit surface attributes while surface attribute functions still
- exist */
- pattern.base.matrix = surface->matrix;
- pattern.base.filter = surface->filter;
- if (surface->repeat)
- pattern.base.extend = CAIRO_EXTEND_REPEAT;
- else
- pattern.base.extend = CAIRO_EXTEND_NONE;
-
- _cairo_pattern_transform (&pattern.base, &gstate->ctm_inverse);
- _cairo_pattern_set_alpha (&pattern.base, gstate->alpha);
-
- pattern_extents.p1.x = _cairo_fixed_from_double (device_x);
- pattern_extents.p1.y = _cairo_fixed_from_double (device_y);
- pattern_extents.p2.x = _cairo_fixed_from_double (device_x + device_width);
- pattern_extents.p2.y = _cairo_fixed_from_double (device_y + device_height);
- _cairo_box_round_to_rectangle (&pattern_extents, &extents);
-
- if (gstate->clip.surface)
- {
- _cairo_rectangle_intersect (&extents, &gstate->clip.rect);
-
- /* We only need to composite if the rectangle is not empty. */
- if (!_cairo_rectangle_empty (&extents)) {
- cairo_surface_pattern_t clip_pattern;
-
- _cairo_pattern_init_for_surface (&clip_pattern,
- gstate->clip.surface);
-
- status = _cairo_surface_composite (gstate->operator,
- &pattern.base,
- &clip_pattern.base,
- gstate->surface,
- extents.x, extents.y,
- 0, 0,
- extents.x, extents.y,
- extents.width, extents.height);
-
- _cairo_pattern_fini (&clip_pattern.base);
- }
- }
- else
- {
- /* XXX: The rendered size is sometimes 1 or 2 pixels short
- * from what I expect. Need to fix this.
- * KRH: I'm guessing this was due to rounding error when
- * passing double coordinates for integer arguments. Using
- * the extents rectangle should fix this, since it's properly
- * rounded. Is this still the case?
- */
- status = _cairo_surface_composite (gstate->operator,
- &pattern.base,
- NULL,
- gstate->surface,
- extents.x, extents.y,
- 0, 0,
- extents.x, extents.y,
- extents.width, extents.height);
-
- }
-
- _cairo_pattern_fini (&pattern.base);
-
- return status;
-}
-
-static void
-_cairo_gstate_unset_font (cairo_gstate_t *gstate)
-{
- if (gstate->font) {
- cairo_font_destroy (gstate->font);
- gstate->font = NULL;
- }
-}
-
-cairo_status_t
-_cairo_gstate_select_font (cairo_gstate_t *gstate,
- const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight)
-{
- char *new_family;
-
- new_family = strdup (family);
- if (!new_family)
- return CAIRO_STATUS_NO_MEMORY;
-
- _cairo_gstate_unset_font (gstate);
-
- gstate->font_family = new_family;
- gstate->font_slant = slant;
- gstate->font_weight = weight;
-
- cairo_matrix_set_identity (&gstate->font_matrix);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_scale_font (cairo_gstate_t *gstate,
- double scale)
-{
- _cairo_gstate_unset_font (gstate);
-
- return cairo_matrix_scale (&gstate->font_matrix, scale, scale);
-}
-
-cairo_status_t
-_cairo_gstate_transform_font (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix)
-{
- cairo_matrix_t tmp;
- double a, b, c, d, tx, ty;
-
- _cairo_gstate_unset_font (gstate);
-
- cairo_matrix_get_affine (matrix, &a, &b, &c, &d, &tx, &ty);
- cairo_matrix_set_affine (&tmp, a, b, c, d, 0, 0);
- return cairo_matrix_multiply (&gstate->font_matrix, &gstate->font_matrix, &tmp);
-}
-
-
-cairo_status_t
-_cairo_gstate_current_font (cairo_gstate_t *gstate,
- cairo_font_t **font)
-{
- cairo_status_t status;
-
- status = _cairo_gstate_ensure_font (gstate);
- if (status)
- return status;
-
- *font = gstate->font;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-void
-_cairo_gstate_set_font_transform (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix)
-{
- _cairo_gstate_unset_font (gstate);
-
- cairo_matrix_copy (&gstate->font_matrix, matrix);
-}
-
-void
-_cairo_gstate_current_font_transform (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix)
-{
- cairo_matrix_copy (matrix, &gstate->font_matrix);
-}
-
-/*
- * Like everything else in this file, fonts involve Too Many Coordinate Spaces;
- * it is easy to get confused about what's going on.
- *
- * The user's view
- * ---------------
- *
- * Users ask for things in user space. When cairo starts, a user space unit
- * is about 1/96 inch, which is similar to (but importantly different from)
- * the normal "point" units most users think in terms of. When a user
- * selects a font, its scale is set to "one user unit". The user can then
- * independently scale the user coordinate system *or* the font matrix, in
- * order to adjust the rendered size of the font.
- *
- * The only font type exposed to the user is cairo_font_t which is a
- * a font specialized to a particular scale matrix, CTM, and target
- * surface. The user is responsible for not using a cairo_font_t
- * after changing the parameters; doing so will produce garbled metrics.
- *
- *
- * The font's view
- * ---------------
- *
- * Fonts are designed and stored (in say .ttf files) in "font space", which
- * describes an "EM Square" (a design tile) and has some abstract number
- * such as 1000, 1024, or 2048 units per "EM". This is basically an
- * uninteresting space for us, but we need to remember that it exists.
- *
- * Font resources (from libraries or operating systems) render themselves
- * to a particular device. Since they do not want to make most programmers
- * worry about the font design space, the scaling API is simplified to
- * involve just telling the font the required pixel size of the EM square
- * (that is, in device space).
- *
- *
- * Cairo's gstate view
- * -------------------
- *
- * In addition to the CTM and CTM inverse, we keep a matrix in the gstate
- * called the "font matrix" which describes the user's most recent
- * font-scaling or font-transforming request. This is kept in terms of an
- * abstract scale factor, composed with the CTM and used to set the font's
- * pixel size. So if the user asks to "scale the font by 12", the matrix
- * is:
- *
- * [ 12.0, 0.0, 0.0, 12.0, 0.0, 0.0 ]
- *
- * It is an affine matrix, like all cairo matrices, but its tx and ty
- * components are always set to zero; we don't permit "nudging" fonts
- * around.
- *
- * In order to perform any action on a font, we must build an object
- * called a cairo_font_scale_t; this contains the central 2x2 matrix
- * resulting from "font matrix * CTM".
- *
- * We pass this to the font when making requests of it, which causes it to
- * reply for a particular [user request, device] combination, under the CTM
- * (to accomodate the "zoom in" == "bigger fonts" issue above).
- *
- * The other terms in our communication with the font are therefore in
- * device space. When we ask it to perform text->glyph conversion, it will
- * produce a glyph string in device space. Glyph vectors we pass to it for
- * measuring or rendering should be in device space. The metrics which we
- * get back from the font will be in device space. The contents of the
- * global glyph image cache will be in device space.
- *
- *
- * Cairo's public view
- * -------------------
- *
- * Since the values entering and leaving via public API calls are in user
- * space, the gstate functions typically need to multiply argumens by the
- * CTM (for user-input glyph vectors), and return values by the CTM inverse
- * (for font responses such as metrics or glyph vectors).
- *
- */
-
-void
-_cairo_gstate_current_font_scale (cairo_gstate_t *gstate,
- cairo_font_scale_t *sc)
-{
- cairo_matrix_t tmp;
- double dummy;
- cairo_matrix_multiply (&tmp, &gstate->font_matrix, &gstate->ctm);
- cairo_matrix_get_affine (&tmp,
- &sc->matrix[0][0],
- &sc->matrix[0][1],
- &sc->matrix[1][0],
- &sc->matrix[1][1],
- &dummy, &dummy);
-}
-
-static cairo_status_t
-_cairo_gstate_ensure_font (cairo_gstate_t *gstate)
-{
- cairo_font_scale_t sc;
- cairo_status_t status;
- const char *family;
-
- if (gstate->font)
- return CAIRO_STATUS_SUCCESS;
-
- _cairo_gstate_current_font_scale (gstate, &sc);
-
- if (gstate->font_family)
- family = gstate->font_family;
- else
- family = CAIRO_FONT_FAMILY_DEFAULT;
-
- status = _cairo_font_create (family,
- gstate->font_slant,
- gstate->font_weight,
- &sc,
- &gstate->font);
-
- if (status)
- return status;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_current_font_extents (cairo_gstate_t *gstate,
- cairo_font_extents_t *extents)
-{
- cairo_status_t status = _cairo_gstate_ensure_font (gstate);
- if (status)
- return status;
-
- return cairo_font_extents (gstate->font,
- &gstate->font_matrix,
- extents);
-}
-
-cairo_status_t
-_cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *nglyphs)
-{
- cairo_status_t status;
-
- cairo_point_t point;
- double origin_x, origin_y;
- int i;
-
- status = _cairo_gstate_ensure_font (gstate);
- if (status)
- return status;
-
- status = _cairo_path_current_point (&gstate->path, &point);
- if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
- origin_x = 0.0;
- origin_y = 0.0;
- } else {
- origin_x = _cairo_fixed_to_double (point.x);
- origin_y = _cairo_fixed_to_double (point.y);
- cairo_matrix_transform_point (&gstate->ctm_inverse,
- &origin_x, &origin_y);
- }
-
- status = _cairo_font_text_to_glyphs (gstate->font,
- utf8, glyphs, nglyphs);
-
- if (status || !glyphs || !nglyphs || !(*glyphs) || !(nglyphs))
- return status;
-
- /* The font responded in glyph space, starting from (0,0). Convert to
- user space by applying the font transform, then add any current point
- offset. */
-
- for (i = 0; i < *nglyphs; ++i) {
- cairo_matrix_transform_point (&gstate->font_matrix,
- &((*glyphs)[i].x),
- &((*glyphs)[i].y));
- (*glyphs)[i].x += origin_x;
- (*glyphs)[i].y += origin_y;
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_set_font (cairo_gstate_t *gstate,
- cairo_font_t *font)
-{
- if (font != gstate->font) {
- if (gstate->font)
- cairo_font_destroy (gstate->font);
- gstate->font = font;
- if (gstate->font)
- cairo_font_reference (gstate->font);
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents)
-{
- cairo_status_t status;
-
- status = _cairo_gstate_ensure_font (gstate);
- if (status)
- return status;
-
- cairo_font_glyph_extents (gstate->font,
- &gstate->font_matrix,
- glyphs, num_glyphs,
- extents);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
- cairo_glyph_t *glyphs,
- int num_glyphs)
-{
- cairo_status_t status;
- int i;
- cairo_glyph_t *transformed_glyphs = NULL;
- cairo_pattern_union_t pattern;
- cairo_box_t bbox;
- cairo_rectangle_t extents;
-
- status = _cairo_gstate_ensure_font (gstate);
- if (status)
- return status;
-
- transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
- if (transformed_glyphs == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_glyphs; ++i)
- {
- transformed_glyphs[i] = glyphs[i];
- cairo_matrix_transform_point (&gstate->ctm,
- &transformed_glyphs[i].x,
- &transformed_glyphs[i].y);
- }
-
- status = _cairo_font_glyph_bbox (gstate->font,
- transformed_glyphs, num_glyphs,
- &bbox);
- _cairo_box_round_to_rectangle (&bbox, &extents);
-
- if (status)
- goto CLEANUP_GLYPHS;
-
- if (gstate->clip.surface)
- {
- cairo_surface_t *intermediate;
- cairo_surface_pattern_t intermediate_pattern;
- cairo_color_t empty_color;
-
- _cairo_rectangle_intersect (&extents, &gstate->clip.rect);
-
- /* Shortcut if empty */
- if (_cairo_rectangle_empty (&extents)) {
- status = CAIRO_STATUS_SUCCESS;
- goto BAIL1;
- }
-
- _cairo_color_init (&empty_color);
- _cairo_color_set_alpha (&empty_color, .0);
- intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface,
- CAIRO_FORMAT_A8,
- extents.width,
- extents.height,
- &empty_color);
- if (intermediate == NULL) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto BAIL1;
- }
-
- /* move the glyphs again, from dev space to intermediate space */
- for (i = 0; i < num_glyphs; ++i)
- {
- transformed_glyphs[i].x -= extents.x;
- transformed_glyphs[i].y -= extents.y;
- }
-
- _cairo_pattern_init_solid (&pattern.solid, 1.0, 1.0, 1.0);
-
- status = _cairo_font_show_glyphs (gstate->font,
- CAIRO_OPERATOR_ADD,
- &pattern.base, intermediate,
- extents.x, extents.y,
- 0, 0,
- extents.width, extents.height,
- transformed_glyphs, num_glyphs);
-
- _cairo_pattern_fini (&pattern.base);
-
- if (status)
- goto BAIL2;
-
- _cairo_pattern_init_for_surface (&pattern.surface,
- gstate->clip.surface);
-
- status = _cairo_surface_composite (CAIRO_OPERATOR_IN,
- &pattern.base,
- NULL,
- intermediate,
- extents.x - gstate->clip.rect.x,
- extents.y - gstate->clip.rect.y,
- 0, 0,
- 0, 0,
- extents.width, extents.height);
-
- _cairo_pattern_fini (&pattern.base);
-
- if (status)
- goto BAIL2;
-
- _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
- _cairo_gstate_pattern_init_copy (gstate, &pattern, gstate->pattern);
-
- status = _cairo_surface_composite (gstate->operator,
- &pattern.base,
- &intermediate_pattern.base,
- gstate->surface,
- extents.x, extents.y,
- 0, 0,
- extents.x, extents.y,
- extents.width, extents.height);
- _cairo_pattern_fini (&pattern.base);
- _cairo_pattern_fini (&intermediate_pattern.base);
-
- BAIL2:
- cairo_surface_destroy (intermediate);
- BAIL1:
- ;
- }
- else
- {
- _cairo_gstate_pattern_init_copy (gstate, &pattern, gstate->pattern);
-
- status = _cairo_font_show_glyphs (gstate->font,
- gstate->operator, &pattern.base,
- gstate->surface,
- extents.x, extents.y,
- extents.x, extents.y,
- extents.width, extents.height,
- transformed_glyphs, num_glyphs);
-
- _cairo_pattern_fini (&pattern.base);
- }
-
- CLEANUP_GLYPHS:
- free (transformed_glyphs);
-
- return status;
-}
-
-cairo_status_t
-_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
- cairo_glyph_t *glyphs,
- int num_glyphs)
-{
- cairo_status_t status;
- int i;
- cairo_glyph_t *transformed_glyphs = NULL;
-
- transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
- if (transformed_glyphs == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- for (i = 0; i < num_glyphs; ++i)
- {
- transformed_glyphs[i] = glyphs[i];
- cairo_matrix_transform_point (&gstate->ctm,
- &(transformed_glyphs[i].x),
- &(transformed_glyphs[i].y));
- }
-
- status = _cairo_font_glyph_path (gstate->font,
- transformed_glyphs, num_glyphs,
- &gstate->path);
-
- free (transformed_glyphs);
- return status;
-}
diff --git a/src/cairo_path.c b/src/cairo_path.c
deleted file mode 100644
index 8314f60..0000000
--- a/src/cairo_path.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2002 University of Southern California
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is University of Southern
- * California.
- *
- * Contributor(s):
- * Carl D. Worth <cworth@cworth.org>
- */
-
-#include <stdlib.h>
-#include "cairoint.h"
-
-/* private functions */
-static cairo_status_t
-_cairo_path_add (cairo_path_t *path, cairo_path_op_t op, cairo_point_t *points, int num_pts);
-
-static void
-_cairo_path_add_op_buf (cairo_path_t *path, cairo_path_op_buf_t *op);
-
-static cairo_status_t
-_cairo_path_new_op_buf (cairo_path_t *path);
-
-static void
-_cairo_path_add_arg_buf (cairo_path_t *path, cairo_path_arg_buf_t *arg);
-
-static cairo_status_t
-_cairo_path_new_arg_buf (cairo_path_t *path);
-
-static cairo_path_op_buf_t *
-_cairo_path_op_buf_create (void);
-
-static void
-_cairo_path_op_buf_destroy (cairo_path_op_buf_t *buf);
-
-static void
-_cairo_path_op_buf_add (cairo_path_op_buf_t *op_buf, cairo_path_op_t op);
-
-static cairo_path_arg_buf_t *
-_cairo_path_arg_buf_create (void);
-
-static void
-_cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *buf);
-
-static void
-_cairo_path_arg_buf_add (cairo_path_arg_buf_t *arg, cairo_point_t *points, int num_points);
-
-void
-_cairo_path_init (cairo_path_t *path)
-{
- path->op_head = NULL;
- path->op_tail = NULL;
-
- path->arg_head = NULL;
- path->arg_tail = NULL;
-
- path->current_point.x = 0;
- path->current_point.y = 0;
- path->has_current_point = 0;
- path->last_move_point = path->current_point;
-}
-
-cairo_status_t
-_cairo_path_init_copy (cairo_path_t *path, cairo_path_t *other)
-{
- cairo_path_op_buf_t *op, *other_op;
- cairo_path_arg_buf_t *arg, *other_arg;
-
- _cairo_path_init (path);
- path->current_point = other->current_point;
- path->has_current_point = other->has_current_point;
- path->last_move_point = other->last_move_point;
-
- for (other_op = other->op_head; other_op; other_op = other_op->next) {
- op = _cairo_path_op_buf_create ();
- if (op == NULL) {
- _cairo_path_fini(path);
- return CAIRO_STATUS_NO_MEMORY;
- }
- *op = *other_op;
- _cairo_path_add_op_buf (path, op);
- }
-
- for (other_arg = other->arg_head; other_arg; other_arg = other_arg->next) {
- arg = _cairo_path_arg_buf_create ();
- if (arg == NULL) {
- _cairo_path_fini(path);
- return CAIRO_STATUS_NO_MEMORY;
- }
- *arg = *other_arg;
- _cairo_path_add_arg_buf (path, arg);
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-void
-_cairo_path_fini (cairo_path_t *path)
-{
- cairo_path_op_buf_t *op;
- cairo_path_arg_buf_t *arg;
-
- while (path->op_head) {
- op = path->op_head;
- path->op_head = op->next;
- _cairo_path_op_buf_destroy (op);
- }
- path->op_tail = NULL;
-
- while (path->arg_head) {
- arg = path->arg_head;
- path->arg_head = arg->next;
- _cairo_path_arg_buf_destroy (arg);
- }
- path->arg_tail = NULL;
-
- path->has_current_point = 0;
-}
-
-cairo_status_t
-_cairo_path_move_to (cairo_path_t *path, cairo_point_t *point)
-{
- cairo_status_t status;
-
- status = _cairo_path_add (path, CAIRO_PATH_OP_MOVE_TO, point, 1);
- if (status)
- return status;
-
- path->current_point = *point;
- path->has_current_point = 1;
- path->last_move_point = path->current_point;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_path_rel_move_to (cairo_path_t *path, cairo_distance_t *distance)
-{
- cairo_point_t point;
-
- point.x = path->current_point.x + distance->dx;
- point.y = path->current_point.y + distance->dy;
-
- return _cairo_path_move_to (path, &point);
-}
-
-cairo_status_t
-_cairo_path_line_to (cairo_path_t *path, cairo_point_t *point)
-{
- cairo_status_t status;
-
- status = _cairo_path_add (path, CAIRO_PATH_OP_LINE_TO, point, 1);
- if (status)
- return status;
-
- path->current_point = *point;
- path->has_current_point = 1;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_path_rel_line_to (cairo_path_t *path, cairo_distance_t *distance)
-{
- cairo_point_t point;
-
- point.x = path->current_point.x + distance->dx;
- point.y = path->current_point.y + distance->dy;
-
- return _cairo_path_line_to (path, &point);
-}
-
-cairo_status_t
-_cairo_path_curve_to (cairo_path_t *path,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2)
-{
- cairo_status_t status;
- cairo_point_t point[3];
-
- point[0] = *p0;
- point[1] = *p1;
- point[2] = *p2;
-
- status = _cairo_path_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
- if (status)
- return status;
-
- path->current_point = *p2;
- path->has_current_point = 1;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_path_rel_curve_to (cairo_path_t *path,
- cairo_distance_t *d0,
- cairo_distance_t *d1,
- cairo_distance_t *d2)
-{
- cairo_point_t p0, p1, p2;
-
- p0.x = path->current_point.x + d0->dx;
- p0.y = path->current_point.y + d0->dy;
-
- p1.x = path->current_point.x + d1->dx;
- p1.y = path->current_point.y + d1->dy;
-
- p2.x = path->current_point.x + d2->dx;
- p2.y = path->current_point.y + d2->dy;
-
- return _cairo_path_curve_to (path, &p0, &p1, &p2);
-}
-
-cairo_status_t
-_cairo_path_close_path (cairo_path_t *path)
-{
- cairo_status_t status;
-
- status = _cairo_path_add (path, CAIRO_PATH_OP_CLOSE_PATH, NULL, 0);
- if (status)
- return status;
-
- path->current_point.x = path->last_move_point.x;
- path->current_point.y = path->last_move_point.y;
- path->has_current_point = 1;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
-_cairo_path_current_point (cairo_path_t *path, cairo_point_t *point)
-{
- if (! path->has_current_point)
- return CAIRO_STATUS_NO_CURRENT_POINT;
-
- *point = path->current_point;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_cairo_path_add (cairo_path_t *path, cairo_path_op_t op, cairo_point_t *points, int num_points)
-{
- cairo_status_t status;
-
- if (path->op_tail == NULL || path->op_tail->num_ops + 1 > CAIRO_PATH_BUF_SZ) {
- status = _cairo_path_new_op_buf (path);
- if (status)
- return status;
- }
- _cairo_path_op_buf_add (path->op_tail, op);
-
- if (path->arg_tail == NULL || path->arg_tail->num_points + num_points > CAIRO_PATH_BUF_SZ) {
- status = _cairo_path_new_arg_buf (path);
- if (status)
- return status;
- }
- _cairo_path_arg_buf_add (path->arg_tail, points, num_points);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_path_add_op_buf (cairo_path_t *path, cairo_path_op_buf_t *op)
-{
- op->next = NULL;
- op->prev = path->op_tail;
-
- if (path->op_tail) {
- path->op_tail->next = op;
- } else {
- path->op_head = op;
- }
-
- path->op_tail = op;
-}
-
-static cairo_status_t
-_cairo_path_new_op_buf (cairo_path_t *path)
-{
- cairo_path_op_buf_t *op;
-
- op = _cairo_path_op_buf_create ();
- if (op == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- _cairo_path_add_op_buf (path, op);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_path_add_arg_buf (cairo_path_t *path, cairo_path_arg_buf_t *arg)
-{
- arg->next = NULL;
- arg->prev = path->arg_tail;
-
- if (path->arg_tail) {
- path->arg_tail->next = arg;
- } else {
- path->arg_head = arg;
- }
-
- path->arg_tail = arg;
-}
-
-static cairo_status_t
-_cairo_path_new_arg_buf (cairo_path_t *path)
-{
- cairo_path_arg_buf_t *arg;
-
- arg = _cairo_path_arg_buf_create ();
-
- if (arg == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- _cairo_path_add_arg_buf (path, arg);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_path_op_buf_t *
-_cairo_path_op_buf_create (void)
-{
- cairo_path_op_buf_t *op;
-
- op = malloc (sizeof (cairo_path_op_buf_t));
-
- if (op) {
- op->num_ops = 0;
- op->next = NULL;
- }
-
- return op;
-}
-
-static void
-_cairo_path_op_buf_destroy (cairo_path_op_buf_t *op)
-{
- free (op);
-}
-
-static void
-_cairo_path_op_buf_add (cairo_path_op_buf_t *op_buf, cairo_path_op_t op)
-{
- op_buf->op[op_buf->num_ops++] = op;
-}
-
-static cairo_path_arg_buf_t *
-_cairo_path_arg_buf_create (void)
-{
- cairo_path_arg_buf_t *arg;
-
- arg = malloc (sizeof (cairo_path_arg_buf_t));
-
- if (arg) {
- arg->num_points = 0;
- arg->next = NULL;
- }
-
- return arg;
-}
-
-static void
-_cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *arg)
-{
- free (arg);
-}
-
-static void
-_cairo_path_arg_buf_add (cairo_path_arg_buf_t *arg, cairo_point_t *points, int num_points)
-{
- int i;
-
- for (i=0; i < num_points; i++) {
- arg->points[arg->num_points++] = points[i];
- }
-}
-
-#define CAIRO_PATH_OP_MAX_ARGS 3
-
-static int const num_args[] =
-{
- 1, /* cairo_path_move_to */
- 1, /* cairo_path_op_line_to */
- 3, /* cairo_path_op_curve_to */
- 0, /* cairo_path_op_close_path */
-};
-
-cairo_status_t
-_cairo_path_interpret (cairo_path_t *path,
- cairo_direction_t dir,
- cairo_path_move_to_func_t *move_to,
- cairo_path_line_to_func_t *line_to,
- cairo_path_curve_to_func_t *curve_to,
- cairo_path_close_path_func_t *close_path,
- void *closure)
-{
- cairo_status_t status;
- int i, arg;
- cairo_path_op_buf_t *op_buf;
- cairo_path_op_t op;
- cairo_path_arg_buf_t *arg_buf = path->arg_head;
- int buf_i = 0;
- cairo_point_t point[CAIRO_PATH_OP_MAX_ARGS];
- int step = (dir == CAIRO_DIRECTION_FORWARD) ? 1 : -1;
-
- for (op_buf = (dir == CAIRO_DIRECTION_FORWARD) ? path->op_head : path->op_tail;
- op_buf;
- op_buf = (dir == CAIRO_DIRECTION_FORWARD) ? op_buf->next : op_buf->prev)
- {
- int start, stop;
- if (dir == CAIRO_DIRECTION_FORWARD) {
- start = 0;
- stop = op_buf->num_ops;
- } else {
- start = op_buf->num_ops - 1;
- stop = -1;
- }
-
- for (i=start; i != stop; i += step) {
- op = op_buf->op[i];
-
- if (dir == CAIRO_DIRECTION_REVERSE) {
- if (buf_i == 0) {
- arg_buf = arg_buf->prev;
- buf_i = arg_buf->num_points;
- }
- buf_i -= num_args[op];
- }
-
- for (arg = 0; arg < num_args[op]; arg++) {
- point[arg] = arg_buf->points[buf_i];
- buf_i++;
- if (buf_i >= arg_buf->num_points) {
- arg_buf = arg_buf->next;
- buf_i = 0;
- }
- }
-
- if (dir == CAIRO_DIRECTION_REVERSE) {
- buf_i -= num_args[op];
- }
-
- switch (op) {
- case CAIRO_PATH_OP_MOVE_TO:
- status = (*move_to) (closure, &point[0]);
- break;
- case CAIRO_PATH_OP_LINE_TO:
- status = (*line_to) (closure, &point[0]);
- break;
- case CAIRO_PATH_OP_CURVE_TO:
- status = (*curve_to) (closure, &point[0], &point[1], &point[2]);
- break;
- case CAIRO_PATH_OP_CLOSE_PATH:
- default:
- status = (*close_path) (closure);
- break;
- }
- if (status)
- return status;
- }
- }
-
- return CAIRO_STATUS_SUCCESS;
-}
-
diff --git a/src/cairo_png_surface.c b/src/cairo_png_surface.c
deleted file mode 100644
index 1ae745c..0000000
--- a/src/cairo_png_surface.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2004 University of Southern California
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is University of Southern
- * California.
- *
- * Contributor(s):
- * Olivier Andrieu <oliv__a@users.sourceforge.net>
- * Carl D. Worth <cworth@cworth.org>
- */
-
-#include <png.h>
-
-#include "cairoint.h"
-#include "cairo-png.h"
-
-static const cairo_surface_backend_t cairo_png_surface_backend;
-
-static cairo_int_status_t
-_cairo_png_surface_copy_page (void *abstract_surface);
-
-void
-cairo_set_target_png (cairo_t *cr,
- FILE *file,
- cairo_format_t format,
- int width,
- int height)
-{
- cairo_surface_t *surface;
-
- surface = cairo_png_surface_create (file, format,
- width, height);
-
- if (surface == NULL) {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface (cr, surface);
-
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy (surface);
-}
-
-typedef struct cairo_png_surface {
- cairo_surface_t base;
-
- /* PNG-specific fields */
- cairo_image_surface_t *image;
- FILE *file;
- int copied;
-
- cairo_format_t format;
-
-} cairo_png_surface_t;
-
-
-static void
-_cairo_png_surface_erase (cairo_png_surface_t *surface);
-
-cairo_surface_t *
-cairo_png_surface_create (FILE *file,
- cairo_format_t format,
- int width,
- int height)
-{
- cairo_png_surface_t *surface;
-
- surface = malloc (sizeof (cairo_png_surface_t));
- if (surface == NULL)
- return NULL;
-
- _cairo_surface_init (&surface->base, &cairo_png_surface_backend);
-
- surface->image = (cairo_image_surface_t *)
- cairo_image_surface_create (format, width, height);
-
- if (surface->image == NULL) {
- free (surface);
- return NULL;
- }
-
- _cairo_png_surface_erase (surface);
-
- surface->file = file;
- surface->copied = 0;
-
- surface->format = format;
-
- return &surface->base;
-}
-
-
-static cairo_surface_t *
-_cairo_png_surface_create_similar (void *abstract_src,
- cairo_format_t format,
- int drawable,
- int width,
- int height)
-{
- return NULL;
-}
-
-static void
-unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
-{
- int i;
-
- for (i = 0; i < row_info->rowbytes; i += 4) {
- unsigned char *b = &data[i];
- unsigned int pixel;
- unsigned char alpha;
-
- memcpy (&pixel, b, sizeof (unsigned int));
- alpha = (pixel & 0xff000000) >> 24;
- if (alpha == 0) {
- b[0] = b[1] = b[2] = b[3] = 0;
- } else {
- b[0] = (((pixel & 0x0000ff) >> 0) * 255) / alpha;
- b[1] = (((pixel & 0x00ff00) >> 8) * 255) / alpha;
- b[2] = (((pixel & 0xff0000) >> 16) * 255) / alpha;
- b[3] = alpha;
- }
- }
-}
-
-static void
-_cairo_png_surface_destroy (void *abstract_surface)
-{
- cairo_png_surface_t *surface = abstract_surface;
-
- if (! surface->copied)
- _cairo_png_surface_copy_page (surface);
-
- cairo_surface_destroy (&surface->image->base);
-
- free (surface);
-}
-
-static void
-_cairo_png_surface_erase (cairo_png_surface_t *surface)
-{
- cairo_color_t transparent;
-
- _cairo_color_init (&transparent);
- _cairo_color_set_rgb (&transparent, 0., 0., 0.);
- _cairo_color_set_alpha (&transparent, 0.);
- _cairo_surface_fill_rectangle (&surface->image->base,
- CAIRO_OPERATOR_SRC,
- &transparent,
- 0, 0,
- surface->image->width,
- surface->image->height);
-}
-
-static double
-_cairo_png_surface_pixels_per_inch (void *abstract_surface)
-{
- return 96.0;
-}
-
-static cairo_status_t
-_cairo_png_surface_acquire_source_image (void *abstract_surface,
- cairo_image_surface_t **image_out,
- void **image_extra)
-{
- cairo_png_surface_t *surface = abstract_surface;
-
- *image_out = surface->image;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_png_surface_release_source_image (void *abstract_surface,
- cairo_image_surface_t *image,
- void *image_extra)
-{
-}
-
-static cairo_status_t
-_cairo_png_surface_acquire_dest_image (void *abstract_surface,
- cairo_rectangle_t *interest_rect,
- cairo_image_surface_t **image_out,
- cairo_rectangle_t *image_rect,
- void **image_extra)
-{
- cairo_png_surface_t *surface = abstract_surface;
-
- image_rect->x = 0;
- image_rect->y = 0;
- image_rect->width = surface->image->width;
- image_rect->height = surface->image->height;
-
- *image_out = surface->image;
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_png_surface_release_dest_image (void *abstract_surface,
- cairo_rectangle_t *interest_rect,
- cairo_image_surface_t *image,
- cairo_rectangle_t *image_rect,
- void *image_extra)
-{
-}
-
-static cairo_status_t
-_cairo_png_surface_clone_similar (void *abstract_surface,
- cairo_surface_t *src,
- cairo_surface_t **clone_out)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_png_surface_composite (cairo_operator_t operator,
- cairo_pattern_t *src,
- cairo_pattern_t *mask,
- void *abstract_dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_png_surface_fill_rectangles (void *abstract_surface,
- cairo_operator_t operator,
- const cairo_color_t *color,
- cairo_rectangle_t *rects,
- int num_rects)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_png_surface_composite_trapezoids (cairo_operator_t operator,
- cairo_pattern_t *pattern,
- void *abstract_dst,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height,
- cairo_trapezoid_t *traps,
- int num_traps)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-static cairo_int_status_t
-_cairo_png_surface_copy_page (void *abstract_surface)
-{
- int i;
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
- cairo_png_surface_t *surface = abstract_surface;
- png_struct *png;
- png_info *info;
- png_byte **rows;
- png_color_16 white;
- int png_color_type;
- int depth;
-
- rows = malloc (surface->image->height * sizeof(png_byte*));
- if (rows == NULL)
- return CAIRO_STATUS_NO_MEMORY;
-
- for (i = 0; i < surface->image->height; i++)
- rows[i] = surface->image->data + i * surface->image->stride;
-
- png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (png == NULL) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto BAIL1;
- }
-
- info = png_create_info_struct (png);
- if (info == NULL) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto BAIL2;
- }
-
- if (setjmp (png_jmpbuf (png))) {
- status = CAIRO_STATUS_NO_MEMORY;
- goto BAIL2;
- }
-
- png_init_io (png, surface->file);
-
- switch (surface->format) {
- case CAIRO_FORMAT_ARGB32:
- depth = 8;
- png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
- break;
- case CAIRO_FORMAT_RGB24:
- depth = 8;
- png_color_type = PNG_COLOR_TYPE_RGB;
- break;
- case CAIRO_FORMAT_A8:
- depth = 8;
- png_color_type = PNG_COLOR_TYPE_GRAY;
- break;
- case CAIRO_FORMAT_A1:
- depth = 1;
- png_color_type = PNG_COLOR_TYPE_GRAY;
- break;
- default:
- status = CAIRO_STATUS_NULL_POINTER;
- goto BAIL2;
- }
-
- png_set_IHDR (png, info,
- surface->image->width,
- surface->image->height, depth,
- png_color_type,
- PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_DEFAULT,
- PNG_FILTER_TYPE_DEFAULT);
-
- white.red = 0xff;
- white.blue = 0xff;
- white.green = 0xff;
- png_set_bKGD (png, info, &white);
-
-/* XXX: Setting the time is interfereing with the image comparison
- png_convert_from_time_t (&png_time, time (NULL));
- png_set_tIME (png, info, &png_time);
-*/
-
- png_set_write_user_transform_fn (png, unpremultiply_data);
- if (surface->format == CAIRO_FORMAT_ARGB32 || surface->format == CAIRO_FORMAT_RGB24)
- png_set_bgr (png);
- if (surface->format == CAIRO_FORMAT_RGB24)
- png_set_filler (png, 0, PNG_FILLER_AFTER);
-
- png_write_info (png, info);
- png_write_image (png, rows);
- png_write_end (png, info);
-
- surface->copied = 1;
-
-BAIL2:
- png_destroy_write_struct (&png, &info);
-BAIL1:
- free (rows);
-
- return status;
-}
-
-static cairo_int_status_t
-_cairo_png_surface_show_page (void *abstract_surface)
-{
- cairo_int_status_t status;
- cairo_png_surface_t *surface = abstract_surface;
-
- status = _cairo_png_surface_copy_page (surface);
- if (status)
- return status;
-
- _cairo_png_surface_erase (surface);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_int_status_t
-_cairo_png_surface_set_clip_region (void *abstract_surface,
- pixman_region16_t *region)
-{
- cairo_png_surface_t *surface = abstract_surface;
-
- return _cairo_image_surface_set_clip_region (surface->image, region);
-}
-
-static const cairo_surface_backend_t cairo_png_surface_backend = {
- _cairo_png_surface_create_similar,
- _cairo_png_surface_destroy,
- _cairo_png_surface_pixels_per_inch,
- _cairo_png_surface_acquire_source_image,
- _cairo_png_surface_release_source_image,
- _cairo_png_surface_acquire_dest_image,
- _cairo_png_surface_release_dest_image,
- _cairo_png_surface_clone_similar,
- _cairo_png_surface_composite,
- _cairo_png_surface_fill_rectangles,
- _cairo_png_surface_composite_trapezoids,
- _cairo_png_surface_copy_page,
- _cairo_png_surface_show_page,
- _cairo_png_surface_set_clip_region,
- NULL /* show_glyphs */
-};
diff --git a/src/cairo_quartz_surface.c b/src/cairo_quartz_surface.c
deleted file mode 100644
index 01b345c..0000000
--- a/src/cairo_quartz_surface.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2004 Calum Robinson
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Calum Robinson
- *
- * Contributor(s):
- * Calum Robinson <calumr@mac.com>
- */
-
-#include "cairoint.h"
-#include "cairo-quartz.h"
-
-#pragma mark Types
-
-typedef struct cairo_quartz_surface {
- cairo_surface_t base;
-
- CGContextRef context;
-
- int width;
- int height;
-
- cairo_image_surface_t *image;
-
- CGImageRef cgImage;
-} cairo_quartz_surface_t;
-
-
-
-
-
-#pragma mark Private functions
-
-
-
-
-void ImageDataReleaseFunc(void *info, const void *data, size_t size)
-{
- if (data != NULL)
- {
- free((void *)data);
- }
-}
-
-
-
-
-#pragma mark Public functions
-
-
-
-
-
-void
-cairo_set_target_quartz_context( cairo_t *cr,
- CGContextRef context,
- int width,
- int height)
-{
- cairo_surface_t *surface;
-
-
- if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
- return;
-
- surface = cairo_quartz_surface_create(context, width, height);
- if (surface == NULL)
- {
- cr->status = CAIRO_STATUS_NO_MEMORY;
- return;
- }
-
- cairo_set_target_surface(cr, surface);
-
- /* cairo_set_target_surface takes a reference, so we must destroy ours */
- cairo_surface_destroy(surface);
-}
-
-
-static cairo_surface_t *
-_cairo_quartz_surface_create_similar( void *abstract_src,
- cairo_format_t format,
- int drawable,
- int width,
- int height)
-{
- return NULL;
-}
-
-
-static void
-_cairo_quartz_surface_destroy(void *abstract_surface)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
-
-
- if (surface->cgImage)
- {
- CGImageRelease(surface->cgImage);
- }
-
-
- free(surface);
-}
-
-
-static double
-_cairo_quartz_surface_pixels_per_inch(void *abstract_surface)
-{
-
-
- // TODO - get this from CGDirectDisplay somehow?
- return 96.0;
-}
-
-
-static cairo_image_surface_t *
-_cairo_quartz_surface_get_image(void *abstract_surface)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
- CGColorSpaceRef colorSpace;
- void *imageData;
- UInt32 imageDataSize, rowBytes;
- CGDataProviderRef dataProvider;
-
-
- // We keep a cached (cairo_image_surface_t *) in the cairo_quartz_surface_t
- // struct. If the window is ever drawn to without going through Cairo, then
- // we would need to refetch the pixel data from the window into the cached
- // image surface.
- if (surface->image)
- {
- cairo_surface_reference(&surface->image->base);
-
- return surface->image;
- }
-
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
-
- rowBytes = surface->width * 4;
- imageDataSize = rowBytes * surface->height;
- imageData = malloc(imageDataSize);
-
- dataProvider = CGDataProviderCreateWithData(NULL, imageData, imageDataSize, ImageDataReleaseFunc);
-
- surface->cgImage = CGImageCreate( surface->width,
- surface->height,
- 8,
- 32,
- rowBytes,
- colorSpace,
- kCGImageAlphaPremultipliedFirst,
- dataProvider,
- NULL,
- false,
- kCGRenderingIntentDefault);
-
-
- CGColorSpaceRelease(colorSpace);
- CGDataProviderRelease(dataProvider);
-
-
- surface->image = (cairo_image_surface_t *)
- cairo_image_surface_create_for_data( imageData,
- CAIRO_FORMAT_ARGB32,
- surface->width,
- surface->height,
- rowBytes);
-
-
- // Set the image surface Cairo state to match our own.
- _cairo_image_surface_set_repeat(surface->image, surface->base.repeat);
- _cairo_image_surface_set_matrix(surface->image, &(surface->base.matrix));
-
-
- return surface->image;
-}
-
-
-static cairo_status_t
-_cairo_quartz_surface_set_image( void *abstract_surface,
- cairo_image_surface_t *image)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
- cairo_status_t status;
-
-
- if (surface->image == image)
- {
- CGRect rect;
-
-
- rect = CGRectMake(0, 0, surface->width, surface->height);
-
- CGContextDrawImage(surface->context, rect, surface->cgImage);
-
-
- status = CAIRO_STATUS_SUCCESS;
- }
- else
- {
- // TODO - set_image from something other than what we returned from get_image
- status = CAIRO_STATUS_NO_TARGET_SURFACE;
- }
-
-
- return status;
-}
-
-
-static cairo_status_t
-_cairo_quartz_surface_set_matrix(void *abstract_surface, cairo_matrix_t *matrix)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
-
- return _cairo_image_surface_set_matrix(surface->image, matrix);
-}
-
-
-static cairo_status_t
-_cairo_quartz_surface_set_filter(void *abstract_surface, cairo_filter_t filter)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
-
- return _cairo_image_surface_set_filter(surface->image, filter);
-}
-
-
-static cairo_status_t
-_cairo_quartz_surface_set_repeat(void *abstract_surface, int repeat)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
-
- return _cairo_image_surface_set_repeat(surface->image, repeat);
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_composite( cairo_operator_t operator,
- cairo_surface_t *generic_src,
- cairo_surface_t *generic_mask,
- void *abstract_dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_fill_rectangles( void *abstract_surface,
- cairo_operator_t operator,
- const cairo_color_t *color,
- cairo_rectangle_t *rects,
- int num_rects)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_composite_trapezoids( cairo_operator_t operator,
- cairo_surface_t *generic_src,
- void *abstract_dst,
- int xSrc,
- int ySrc,
- cairo_trapezoid_t *traps,
- int num_traps)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_copy_page(void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_show_page(void *abstract_surface)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_set_clip_region( void *abstract_surface,
- pixman_region16_t *region)
-{
- cairo_quartz_surface_t *surface = abstract_surface;
-
- return _cairo_image_surface_set_clip_region(surface->image, region);
-}
-
-
-static cairo_int_status_t
-_cairo_quartz_surface_create_pattern( void *abstract_surface,
- cairo_pattern_t *pattern,
- cairo_box_t *extents)
-{
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-
-
-static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
- _cairo_quartz_surface_create_similar,
- _cairo_quartz_surface_destroy,
- _cairo_quartz_surface_pixels_per_inch,
- _cairo_quartz_surface_get_image,
- _cairo_quartz_surface_set_image,
- _cairo_quartz_surface_set_matrix,
- _cairo_quartz_surface_set_filter,
- _cairo_quartz_surface_set_repeat,
- _cairo_quartz_surface_composite,
- _cairo_quartz_surface_fill_rectangles,
- _cairo_quartz_surface_composite_trapezoids,
- _cairo_quartz_surface_copy_page,
- _cairo_quartz_surface_show_page,
- _cairo_quartz_surface_set_clip_region,
- _cairo_quartz_surface_create_pattern
-};
-
-
-cairo_surface_t *
-cairo_quartz_surface_create( CGContextRef context,
- int width,
- int height)
-{
- cairo_quartz_surface_t *surface;
-
-
- surface = malloc(sizeof(cairo_quartz_surface_t));
- if (surface == NULL)
- return NULL;
-
- _cairo_surface_init(&surface->base, &cairo_quartz_surface_backend);
-
-
- surface->context = context;
-
- surface->width = width;
- surface->height = height;
-
- surface->image = NULL;
-
- surface->cgImage = NULL;
-
-
- // Set up the image surface which Cairo draws into and we blit to & from.
- surface->image = _cairo_quartz_surface_get_image(surface);
-
-
- return (cairo_surface_t *)surface;
-}
-
-
-DEPRECATE (cairo_surface_create_for_drawable, cairo_quartz_surface_create);
diff --git a/src/cairoint.h b/src/cairoint.h
index 50899ec..1b21228 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1,6 +1,7 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2002 University of Southern California
+ * Copyright © 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -52,11 +53,17 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
+
+#ifdef _MSC_VER
+#define _USE_MATH_DEFINES
+#endif
#include <math.h>
#include <limits.h>
-#include <stdint.h>
+#include <stdio.h>
#include "cairo.h"
+#include <pixman.h>
#if __GNUC__ >= 3 && defined(__ELF__)
# define slim_hidden_proto(name) slim_hidden_proto1(name, INT_##name)
@@ -85,7 +92,7 @@
#define cairo_private
#endif
-/* These macros allow us to deprecate a function by providing an alias
+/* This macro allow us to deprecate a function by providing an alias
for the old function name to the new function name. With this
macro, binary compatibility is preserved. The macro only works on
some platforms --- tough.
@@ -94,14 +101,15 @@
source code so that it will no longer link against the old
symbols. Instead it will give a descriptive error message
indicating that the old function has been deprecated by the new
- function. */
+ function.
+*/
#if __GNUC__ >= 2 && defined(__ELF__)
-# define DEPRECATE(old, new) \
+# define CAIRO_FUNCTION_ALIAS(old, new) \
extern __typeof (new) old \
__asm__ ("" #old) \
__attribute__((__alias__("" #new)))
#else
-# define DEPRECATE(old, new)
+# define CAIRO_FUNCTION_ALIAS(old, new)
#endif
#ifndef __GNUC__
@@ -119,6 +127,12 @@
#define TRUE 1
#endif
+#define ASSERT_NOT_REACHED \
+do { \
+ static const int NOT_REACHED = 0; \
+ assert (NOT_REACHED); \
+} while (0)
+
#include "cairo-wideint.h"
typedef int32_t cairo_fixed_16_16_t;
@@ -133,6 +147,8 @@ typedef cairo_fixed_16_16_t cairo_fixed_t;
#define CAIRO_MAXSHORT SHRT_MAX
#define CAIRO_MINSHORT SHRT_MIN
+#define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff))
+
typedef struct _cairo_point {
cairo_fixed_t x;
cairo_fixed_t y;
@@ -164,7 +180,7 @@ typedef struct _cairo_trapezoid {
cairo_line_t left, right;
} cairo_trapezoid_t;
-typedef struct _cairo_rectangle_int {
+typedef struct _cairo_rectangle {
short x, y;
unsigned short width, height;
} cairo_rectangle_t, cairo_glyph_size_t;
@@ -177,47 +193,12 @@ typedef enum cairo_int_status {
CAIRO_INT_STATUS_UNSUPPORTED
} cairo_int_status_t;
-#define CAIRO_OK(status) ((status) == CAIRO_STATUS_SUCCESS)
-
-typedef enum cairo_path_op {
- CAIRO_PATH_OP_MOVE_TO = 0,
- CAIRO_PATH_OP_LINE_TO = 1,
- CAIRO_PATH_OP_CURVE_TO = 2,
- CAIRO_PATH_OP_CLOSE_PATH = 3
-} __attribute__ ((packed)) cairo_path_op_t; /* Don't want 32 bits if we can avoid it. */
-
typedef enum cairo_direction {
CAIRO_DIRECTION_FORWARD,
CAIRO_DIRECTION_REVERSE
} cairo_direction_t;
-#define CAIRO_PATH_BUF_SZ 64
-
-typedef struct _cairo_path_op_buf {
- int num_ops;
- cairo_path_op_t op[CAIRO_PATH_BUF_SZ];
-
- struct _cairo_path_op_buf *next, *prev;
-} cairo_path_op_buf_t;
-
-typedef struct _cairo_path_arg_buf {
- int num_points;
- cairo_point_t points[CAIRO_PATH_BUF_SZ];
-
- struct _cairo_path_arg_buf *next, *prev;
-} cairo_path_arg_buf_t;
-
-typedef struct _cairo_path {
- cairo_path_op_buf_t *op_head;
- cairo_path_op_buf_t *op_tail;
-
- cairo_path_arg_buf_t *arg_head;
- cairo_path_arg_buf_t *arg_tail;
-
- cairo_point_t last_move_point;
- cairo_point_t current_point;
- int has_current_point;
-} cairo_path_t;
+typedef struct _cairo_path_fixed cairo_path_fixed_t;
typedef struct _cairo_edge {
cairo_line_t edge;
@@ -302,6 +283,24 @@ _cairo_array_copy_element (cairo_array_t *array, int index, void *dst);
cairo_private int
_cairo_array_num_elements (cairo_array_t *array);
+typedef cairo_array_t cairo_user_data_array_t;
+
+cairo_private void
+_cairo_user_data_array_init (cairo_user_data_array_t *array);
+
+cairo_private void
+_cairo_user_data_array_fini (cairo_user_data_array_t *array);
+
+cairo_private void *
+_cairo_user_data_array_get_data (cairo_user_data_array_t *array,
+ const cairo_user_data_key_t *key);
+
+cairo_private cairo_status_t
+_cairo_user_data_array_set_data (cairo_user_data_array_t *array,
+ const cairo_user_data_key_t *key,
+ void *user_data,
+ cairo_destroy_func_t destroy);
+
/* cairo_cache.c structures and functions */
typedef struct _cairo_cache_backend {
@@ -357,7 +356,6 @@ typedef struct {
#undef CAIRO_MEASURE_CACHE_PERFORMANCE
typedef struct {
- unsigned long refcount;
const cairo_cache_backend_t *backend;
const cairo_cache_arrangement_t *arrangement;
cairo_cache_entry_base_t **entries;
@@ -404,25 +402,34 @@ _cairo_hash_string (const char *c);
#define CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT 0x100000
#define CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT 0x100000
-typedef struct {
- double matrix[2][2];
-} cairo_font_scale_t;
+typedef struct _cairo_unscaled_font cairo_unscaled_font_t;
-struct _cairo_font_backend;
+typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t;
+typedef struct _cairo_scaled_font_backend cairo_scaled_font_backend_t;
+typedef struct _cairo_font_face_backend cairo_font_face_backend_t;
/*
* A cairo_unscaled_font_t is just an opaque handle we use in the
* glyph cache.
*/
-typedef struct {
+struct _cairo_unscaled_font {
int refcount;
- const struct _cairo_font_backend *backend;
-} cairo_unscaled_font_t;
+ const cairo_unscaled_font_backend_t *backend;
+};
-struct _cairo_font {
+struct _cairo_scaled_font {
int refcount;
- cairo_font_scale_t scale; /* font space => device space */
- const struct _cairo_font_backend *backend;
+ cairo_matrix_t font_matrix; /* font space => user space */
+ cairo_matrix_t ctm; /* user space => device space */
+ cairo_matrix_t scale; /* font space => device space */
+ cairo_font_face_t *font_face; /* may be NULL */
+ const cairo_scaled_font_backend_t *backend;
+};
+
+struct _cairo_font_face {
+ int refcount;
+ cairo_user_data_array_t user_data;
+ const cairo_font_face_backend_t *backend;
};
/* cairo_font.c is responsible for a global glyph cache:
@@ -438,7 +445,7 @@ struct _cairo_font {
typedef struct {
cairo_cache_entry_base_t base;
cairo_unscaled_font_t *unscaled;
- cairo_font_scale_t scale;
+ cairo_matrix_t scale; /* translation is ignored */
int flags;
unsigned long index;
} cairo_glyph_cache_key_t;
@@ -471,98 +478,108 @@ _cairo_glyph_cache_keys_equal (void *cache,
/* the font backend interface */
-typedef struct _cairo_font_backend {
- cairo_status_t (*create) (const char *family,
+struct _cairo_unscaled_font_backend {
+ void (*destroy) (void *unscaled_font);
+ cairo_status_t (*create_glyph) (void *unscaled_font,
+ cairo_image_glyph_cache_entry_t *entry);
+};
+
+struct _cairo_scaled_font_backend {
+ cairo_status_t (*create) (const char *family,
cairo_font_slant_t slant,
cairo_font_weight_t weight,
- cairo_font_scale_t *scale,
- cairo_font_t **font);
-
- void (*destroy_font) (void *font);
- void (*destroy_unscaled_font) (void *font);
-
- cairo_status_t (*font_extents) (void *font,
- cairo_font_extents_t *extents);
-
- cairo_status_t (*text_to_glyphs) (void *font,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs);
-
- cairo_status_t (*glyph_extents) (void *font,
- cairo_glyph_t *glyphs,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **font);
+
+ void (*destroy) (void *font);
+
+ cairo_status_t (*font_extents) (void *font,
+ cairo_font_extents_t *extents);
+
+ cairo_status_t (*text_to_glyphs) (void *font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs);
+
+ cairo_status_t (*glyph_extents) (void *font,
+ cairo_glyph_t *glyphs,
int num_glyphs,
- cairo_text_extents_t *extents);
+ cairo_text_extents_t *extents);
- cairo_status_t (*glyph_bbox) (void *font,
- const cairo_glyph_t *glyphs,
+ cairo_status_t (*glyph_bbox) (void *font,
+ const cairo_glyph_t *glyphs,
int num_glyphs,
- cairo_box_t *bbox);
+ cairo_box_t *bbox);
- cairo_status_t (*show_glyphs) (void *font,
+ cairo_status_t (*show_glyphs) (void *font,
cairo_operator_t operator,
- cairo_pattern_t *pattern,
- cairo_surface_t *surface,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *surface,
int source_x,
int source_y,
int dest_x,
int dest_y,
unsigned int width,
unsigned int height,
- const cairo_glyph_t *glyphs,
+ const cairo_glyph_t *glyphs,
int num_glyphs);
- cairo_status_t (*glyph_path) (void *font,
- cairo_glyph_t *glyphs,
+ cairo_status_t (*glyph_path) (void *font,
+ cairo_glyph_t *glyphs,
int num_glyphs,
- cairo_path_t *path);
- void (*get_glyph_cache_key) (void *font,
- cairo_glyph_cache_key_t *key);
-
- cairo_status_t (*create_glyph) (cairo_image_glyph_cache_entry_t *entry);
+ cairo_path_fixed_t *path);
+ void (*get_glyph_cache_key) (void *font,
+ cairo_glyph_cache_key_t *key);
+};
-} cairo_font_backend_t;
+struct _cairo_font_face_backend {
+ /* The destroy() function is allowed to resurrect the font face
+ * by re-referencing. This is needed for the FreeType backend.
+ */
+ void (*destroy) (void *font_face);
+ cairo_status_t (*create_font) (void *font_face,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ cairo_scaled_font_t **scaled_font);
+};
/* concrete font backends */
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
-extern const cairo_private struct _cairo_font_backend cairo_ft_font_backend;
+extern const cairo_private struct _cairo_scaled_font_backend cairo_ft_scaled_font_backend;
#endif
-#ifdef CAIRO_HAS_WIN32_FONT
+#if CAIRO_HAS_WIN32_FONT
-extern const cairo_private struct _cairo_font_backend cairo_win32_font_backend;
+extern const cairo_private struct _cairo_scaled_font_backend cairo_win32_scaled_font_backend;
#endif
-#ifdef CAIRO_HAS_ATSUI_FONT
+#if CAIRO_HAS_ATSUI_FONT
-extern const cairo_private struct _cairo_font_backend cairo_atsui_font_backend;
+extern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_font_backend;
#endif
typedef struct _cairo_surface_backend {
cairo_surface_t *
(*create_similar) (void *surface,
- cairo_format_t format,
- int drawable,
- int width,
- int height);
-
- void
- (*destroy) (void *surface);
+ cairo_format_t format,
+ int width,
+ int height);
- double
- (*pixels_per_inch) (void *surface);
+ cairo_status_t
+ (*finish) (void *surface);
cairo_status_t
- (* acquire_source_image) (void *abstract_surface,
+ (*acquire_source_image) (void *abstract_surface,
cairo_image_surface_t **image_out,
void **image_extra);
void
- (* release_source_image) (void *abstract_surface,
+ (*release_source_image) (void *abstract_surface,
cairo_image_surface_t *image,
void *image_extra);
@@ -587,39 +604,39 @@ typedef struct _cairo_surface_backend {
/* XXX: dst should be the first argument for consistency */
cairo_int_status_t
- (*composite) (cairo_operator_t operator,
+ (*composite) (cairo_operator_t operator,
cairo_pattern_t *src,
cairo_pattern_t *mask,
void *dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height);
+ int src_x,
+ int src_y,
+ int mask_x,
+ int mask_y,
+ int dst_x,
+ int dst_y,
+ unsigned int width,
+ unsigned int height);
cairo_int_status_t
(*fill_rectangles) (void *surface,
- cairo_operator_t operator,
+ cairo_operator_t operator,
const cairo_color_t *color,
cairo_rectangle_t *rects,
- int num_rects);
+ int num_rects);
/* XXX: dst should be the first argument for consistency */
cairo_int_status_t
- (*composite_trapezoids) (cairo_operator_t operator,
+ (*composite_trapezoids) (cairo_operator_t operator,
cairo_pattern_t *pattern,
void *dst,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height,
+ int src_x,
+ int src_y,
+ int dst_x,
+ int dst_y,
+ unsigned int width,
+ unsigned int height,
cairo_trapezoid_t *traps,
- int num_traps);
+ int num_traps);
cairo_int_status_t
(*copy_page) (void *surface);
@@ -627,32 +644,85 @@ typedef struct _cairo_surface_backend {
cairo_int_status_t
(*show_page) (void *surface);
+ /* Set given region as the clip region for the surface, replacing
+ * any previously set clip region. Passing in a NULL region will
+ * clear the surface clip region.
+ *
+ * The surface is expected to store the clip region and clip all
+ * following drawing operations against it until the clip region
+ * is cleared of replaced by another clip region.
+ *
+ * Cairo will call this function whenever a clip path can be
+ * represented as a device pixel aligned set of rectangles. When
+ * this is not possible, cairo will use mask surfaces for
+ * clipping.
+ */
cairo_int_status_t
(*set_clip_region) (void *surface,
pixman_region16_t *region);
+
+ /* Intersect the given path against the clip path currently set in
+ * the surface, using the given fill_rule and tolerance, and set
+ * the result as the new clipping path for the surface. Passing
+ * in a NULL path will clear the surface clipping path.
+ *
+ * The surface is expected to store the resulting clip path and
+ * clip all following drawing operations against it until the clip
+ * path cleared or intersected with a new path.
+ *
+ * If a surface implements this function, set_clip_region() will
+ * never be called and should not be implemented. If this
+ * function is not implemented cairo will use set_clip_region()
+ * (if available) and mask surfaces for clipping.
+ */
+ cairo_int_status_t
+ (*intersect_clip_path) (void *dst,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance);
+
+ /* Get the extents of the current surface. For many surface types
+ * this will be as simple as { x=0, y=0, width=surface->width,
+ * height=surface->height}.
+ *
+ * This function need not take account of any clipping from
+ * set_clip_region since the generic version of set_clip_region
+ * saves those, and the generic get_clip_extents will only call
+ * into the specific surface->get_extents if there is no current
+ * clip.
+ */
+ cairo_int_status_t
+ (*get_extents) (void *surface,
+ cairo_rectangle_t *rectangle);
+
/*
* This is an optional entry to let the surface manage its own glyph
* resources. If null, the font will be asked to render against this
* surface, using image surfaces as glyphs.
*/
- cairo_status_t
- (*show_glyphs) (cairo_font_t *font,
- cairo_operator_t operator,
+ cairo_int_status_t
+ (*show_glyphs) (cairo_scaled_font_t *font,
+ cairo_operator_t operator,
cairo_pattern_t *pattern,
void *surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int width,
- unsigned int height,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
const cairo_glyph_t *glyphs,
- int num_glyphs);
-} cairo_surface_backend_t;
+ int num_glyphs);
-struct _cairo_matrix {
- double m[3][2];
-};
+ cairo_int_status_t
+ (*fill_path) (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ void *dst,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance);
+
+} cairo_surface_backend_t;
typedef struct _cairo_format_masks {
int bpp;
@@ -662,14 +732,37 @@ typedef struct _cairo_format_masks {
unsigned long blue_mask;
} cairo_format_masks_t;
+typedef enum _cairo_clip_mode {
+ CAIRO_CLIP_MODE_PATH,
+ CAIRO_CLIP_MODE_REGION,
+ CAIRO_CLIP_MODE_MASK
+} cairo_clip_mode_t;
+
struct _cairo_surface {
const cairo_surface_backend_t *backend;
unsigned int ref_count;
-
- cairo_matrix_t matrix;
- cairo_filter_t filter;
- int repeat;
+ cairo_bool_t finished;
+ cairo_user_data_array_t user_data;
+
+ double device_x_offset;
+ double device_y_offset;
+
+ /*
+ * Each time a clip region is modified, it gets the next value in this
+ * sequence. This means that clip regions for this surface are uniquely
+ * identified andupdates to the clip can be readily identified
+ */
+ unsigned int next_clip_serial;
+ /*
+ * The serial number of the current clip. This is set when
+ * the surface clipping is set. The gstate can then cheaply
+ * check whether the surface clipping is already correct before
+ * performing a rendering operation.
+ *
+ * The special value '0' is reserved for the unclipped case.
+ */
+ unsigned int current_clip_serial;
};
struct _cairo_image_surface {
@@ -677,7 +770,7 @@ struct _cairo_image_surface {
/* libic-specific fields */
cairo_format_t format;
- char *data;
+ unsigned char *data;
int owns_data;
int width;
@@ -706,6 +799,12 @@ struct _cairo_color {
unsigned short alpha_short;
};
+typedef enum {
+ CAIRO_STOCK_WHITE,
+ CAIRO_STOCK_BLACK,
+ CAIRO_STOCK_TRANSPARENT
+} cairo_stock_t;
+
#define CAIRO_EXTEND_DEFAULT CAIRO_EXTEND_NONE
#define CAIRO_FILTER_DEFAULT CAIRO_FILTER_BEST
@@ -724,16 +823,15 @@ typedef struct _cairo_color_stop {
struct _cairo_pattern {
cairo_pattern_type_t type;
unsigned int ref_count;
+ cairo_status_t status;
cairo_matrix_t matrix;
cairo_filter_t filter;
cairo_extend_t extend;
- double alpha;
};
typedef struct _cairo_solid_pattern {
cairo_pattern_t base;
-
- double red, green, blue;
+ cairo_color_t color;
} cairo_solid_pattern_t;
typedef struct _cairo_surface_pattern {
@@ -800,20 +898,24 @@ typedef struct _cairo_traps {
#define CAIRO_FONT_SLANT_DEFAULT CAIRO_FONT_SLANT_NORMAL
#define CAIRO_FONT_WEIGHT_DEFAULT CAIRO_FONT_WEIGHT_NORMAL
-#if defined (CAIRO_HAS_WIN32_FONT)
+#define CAIRO_WIN32_FONT_FAMILY_DEFAULT "Arial"
+#define CAIRO_ATSUI_FONT_FAMILY_DEFAULT "Monaco"
+#define CAIRO_FT_FONT_FAMILY_DEFAULT ""
-#define CAIRO_FONT_FAMILY_DEFAULT "Arial"
-#define CAIRO_FONT_BACKEND_DEFAULT &cairo_win32_font_backend
+#if CAIRO_HAS_WIN32_FONT
-#elif defined (CAIRO_HAS_ATSUI_FONT)
+#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_WIN32_FONT_FAMILY_DEFAULT
+#define CAIRO_FONT_BACKEND_DEFAULT &cairo_win32_scaled_font_backend
-#define CAIRO_FONT_FAMILY_DEFAULT "Monaco"
-#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_font_backend
+#elif CAIRO_HAS_ATSUI_FONT
-#elif defined (CAIRO_HAS_FT_FONT)
+#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_ATSUI_FONT_FAMILY_DEFAULT
+#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_scaled_font_backend
-#define CAIRO_FONT_FAMILY_DEFAULT "serif"
-#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_font_backend
+#elif CAIRO_HAS_FT_FONT
+
+#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
+#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_scaled_font_backend
#endif
@@ -824,64 +926,9 @@ typedef struct _cairo_traps {
#define CAIRO_GSTATE_LINE_CAP_DEFAULT CAIRO_LINE_CAP_BUTT
#define CAIRO_GSTATE_LINE_JOIN_DEFAULT CAIRO_LINE_JOIN_MITER
#define CAIRO_GSTATE_MITER_LIMIT_DEFAULT 10.0
-#define CAIRO_GSTATE_PIXELS_PER_INCH_DEFAULT 96.0
-
-/* Need a name distinct from the cairo_clip function */
-typedef struct _cairo_clip_rec {
- cairo_rectangle_t rect;
- pixman_region16_t *region;
- cairo_surface_t *surface;
-} cairo_clip_rec_t;
-
-typedef struct _cairo_gstate {
- cairo_operator_t operator;
-
- double tolerance;
-
- /* stroke style */
- double line_width;
- cairo_line_cap_t line_cap;
- cairo_line_join_t line_join;
- double miter_limit;
-
- cairo_fill_rule_t fill_rule;
-
- double *dash;
- int num_dashes;
- double dash_offset;
-
- char *font_family; /* NULL means CAIRO_FONT_FAMILY_DEFAULT; */
- cairo_font_slant_t font_slant;
- cairo_font_weight_t font_weight;
-
- cairo_font_t *font; /* Specific to the current CTM */
-
- cairo_surface_t *surface;
-
- cairo_pattern_t *pattern;
- double alpha;
-
- cairo_clip_rec_t clip;
-
- double pixels_per_inch;
-
- cairo_matrix_t font_matrix;
-
- cairo_matrix_t ctm;
- cairo_matrix_t ctm_inverse;
-
- cairo_path_t path;
+#define CAIRO_GSTATE_DEFAULT_FONT_SIZE 10.0
- cairo_pen_t pen_regular;
-
- struct _cairo_gstate *next;
-} cairo_gstate_t;
-
-struct _cairo {
- unsigned int ref_count;
- cairo_gstate_t *gstate;
- cairo_status_t status;
-};
+typedef struct _cairo_gstate cairo_gstate_t;
typedef struct _cairo_stroke_face {
cairo_point_t ccw;
@@ -920,19 +967,9 @@ _cairo_fixed_integer_floor (cairo_fixed_t f);
cairo_private int
_cairo_fixed_integer_ceil (cairo_fixed_t f);
-
/* cairo_gstate.c */
cairo_private cairo_gstate_t *
-_cairo_gstate_create (void);
-
-cairo_private cairo_status_t
-_cairo_gstate_init (cairo_gstate_t *gstate);
-
-cairo_private cairo_status_t
-_cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other);
-
-cairo_private void
-_cairo_gstate_fini (cairo_gstate_t *gstate);
+_cairo_gstate_create (cairo_surface_t *target);
cairo_private void
_cairo_gstate_destroy (cairo_gstate_t *gstate);
@@ -941,76 +978,55 @@ cairo_private cairo_gstate_t *
_cairo_gstate_clone (cairo_gstate_t *gstate);
cairo_private cairo_status_t
-_cairo_gstate_copy (cairo_gstate_t *dest, cairo_gstate_t *src);
-
-cairo_private cairo_status_t
_cairo_gstate_begin_group (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_end_group (cairo_gstate_t *gstate);
-cairo_private cairo_status_t
-_cairo_gstate_set_target_surface (cairo_gstate_t *gstate, cairo_surface_t *surface);
-
cairo_private cairo_surface_t *
-_cairo_gstate_current_target_surface (cairo_gstate_t *gstate);
+_cairo_gstate_get_target (cairo_gstate_t *gstate);
cairo_private cairo_status_t
-_cairo_gstate_set_pattern (cairo_gstate_t *gstate, cairo_pattern_t *pattern);
+_cairo_gstate_set_source (cairo_gstate_t *gstate, cairo_pattern_t *source);
cairo_private cairo_pattern_t *
-_cairo_gstate_current_pattern (cairo_gstate_t *gstate);
+_cairo_gstate_get_source (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_operator (cairo_gstate_t *gstate, cairo_operator_t operator);
cairo_private cairo_operator_t
-_cairo_gstate_current_operator (cairo_gstate_t *gstate);
-
-cairo_private cairo_status_t
-_cairo_gstate_set_rgb_color (cairo_gstate_t *gstate, double red, double green, double blue);
-
-cairo_private cairo_status_t
-_cairo_gstate_current_rgb_color (cairo_gstate_t *gstate,
- double *red,
- double *green,
- double *blue);
+_cairo_gstate_get_operator (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_tolerance (cairo_gstate_t *gstate, double tolerance);
cairo_private double
-_cairo_gstate_current_tolerance (cairo_gstate_t *gstate);
-
-cairo_private cairo_status_t
-_cairo_gstate_set_alpha (cairo_gstate_t *gstate, double alpha);
-
-cairo_private double
-_cairo_gstate_current_alpha (cairo_gstate_t *gstate);
+_cairo_gstate_get_tolerance (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_fill_rule (cairo_gstate_t *gstate, cairo_fill_rule_t fill_rule);
cairo_private cairo_fill_rule_t
-_cairo_gstate_current_fill_rule (cairo_gstate_t *gstate);
+_cairo_gstate_get_fill_rule (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_line_width (cairo_gstate_t *gstate, double width);
cairo_private double
-_cairo_gstate_current_line_width (cairo_gstate_t *gstate);
+_cairo_gstate_get_line_width (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_line_cap (cairo_gstate_t *gstate, cairo_line_cap_t line_cap);
cairo_private cairo_line_cap_t
-_cairo_gstate_current_line_cap (cairo_gstate_t *gstate);
+_cairo_gstate_get_line_cap (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_line_join (cairo_gstate_t *gstate, cairo_line_join_t line_join);
cairo_private cairo_line_join_t
-_cairo_gstate_current_line_join (cairo_gstate_t *gstate);
+_cairo_gstate_get_line_join (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, double offset);
@@ -1019,10 +1035,10 @@ cairo_private cairo_status_t
_cairo_gstate_set_miter_limit (cairo_gstate_t *gstate, double limit);
cairo_private double
-_cairo_gstate_current_miter_limit (cairo_gstate_t *gstate);
+_cairo_gstate_get_miter_limit (cairo_gstate_t *gstate);
cairo_private void
-_cairo_gstate_current_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix);
+_cairo_gstate_get_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix);
cairo_private cairo_status_t
_cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty);
@@ -1034,94 +1050,46 @@ cairo_private cairo_status_t
_cairo_gstate_rotate (cairo_gstate_t *gstate, double angle);
cairo_private cairo_status_t
-_cairo_gstate_concat_matrix (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix);
+_cairo_gstate_transform (cairo_gstate_t *gstate,
+ const cairo_matrix_t *matrix);
cairo_private cairo_status_t
-_cairo_gstate_set_matrix (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix);
-
-cairo_private cairo_status_t
-_cairo_gstate_default_matrix (cairo_gstate_t *gstate);
+_cairo_gstate_set_matrix (cairo_gstate_t *gstate,
+ const cairo_matrix_t *matrix);
cairo_private cairo_status_t
_cairo_gstate_identity_matrix (cairo_gstate_t *gstate);
cairo_private cairo_status_t
-_cairo_gstate_transform_point (cairo_gstate_t *gstate, double *x, double *y);
+_cairo_gstate_user_to_device (cairo_gstate_t *gstate, double *x, double *y);
cairo_private cairo_status_t
-_cairo_gstate_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy);
+_cairo_gstate_user_to_device_distance (cairo_gstate_t *gstate, double *dx, double *dy);
cairo_private cairo_status_t
-_cairo_gstate_inverse_transform_point (cairo_gstate_t *gstate, double *x, double *y);
+_cairo_gstate_device_to_user (cairo_gstate_t *gstate, double *x, double *y);
cairo_private cairo_status_t
-_cairo_gstate_inverse_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy);
+_cairo_gstate_device_to_user_distance (cairo_gstate_t *gstate, double *dx, double *dy);
-cairo_private cairo_status_t
-_cairo_gstate_new_path (cairo_gstate_t *gstate);
-
-cairo_private cairo_status_t
-_cairo_gstate_move_to (cairo_gstate_t *gstate, double x, double y);
-
-cairo_private cairo_status_t
-_cairo_gstate_line_to (cairo_gstate_t *gstate, double x, double y);
-
-cairo_private cairo_status_t
-_cairo_gstate_curve_to (cairo_gstate_t *gstate,
- double x1, double y1,
- double x2, double y2,
- double x3, double y3);
-
-cairo_private cairo_status_t
-_cairo_gstate_arc (cairo_gstate_t *gstate,
- double xc, double yc,
- double radius,
- double angle1, double angle2);
-
-cairo_private cairo_status_t
-_cairo_gstate_arc_negative (cairo_gstate_t *gstate,
- double xc, double yc,
- double radius,
- double angle1, double angle2);
-
-cairo_private cairo_status_t
-_cairo_gstate_rel_move_to (cairo_gstate_t *gstate, double dx, double dy);
-
-cairo_private cairo_status_t
-_cairo_gstate_rel_line_to (cairo_gstate_t *gstate, double dx, double dy);
-
-cairo_private cairo_status_t
-_cairo_gstate_rel_curve_to (cairo_gstate_t *gstate,
- double dx1, double dy1,
- double dx2, double dy2,
- double dx3, double dy3);
-
-/* XXX: NYI
-cairo_private cairo_status_t
-_cairo_gstate_stroke_path (cairo_gstate_t *gstate);
-*/
+cairo_private void
+_cairo_gstate_user_to_backend (cairo_gstate_t *gstate, double *x, double *y);
-cairo_private cairo_status_t
-_cairo_gstate_close_path (cairo_gstate_t *gstate);
+cairo_private void
+_cairo_gstate_backend_to_user (cairo_gstate_t *gstate, double *x, double *y);
cairo_private cairo_status_t
-_cairo_gstate_current_point (cairo_gstate_t *gstate, double *x, double *y);
+_cairo_gstate_paint (cairo_gstate_t *gstate);
cairo_private cairo_status_t
-_cairo_gstate_interpret_path (cairo_gstate_t *gstate,
- cairo_move_to_func_t *move_to,
- cairo_line_to_func_t *line_to,
- cairo_curve_to_func_t *curve_to,
- cairo_close_path_func_t *close_path,
- void *closure);
+_cairo_gstate_mask (cairo_gstate_t *gstate,
+ cairo_pattern_t *mask);
cairo_private cairo_status_t
-_cairo_gstate_stroke (cairo_gstate_t *gstate);
+_cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path);
cairo_private cairo_status_t
-_cairo_gstate_fill (cairo_gstate_t *gstate);
+_cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path);
cairo_private cairo_status_t
_cairo_gstate_copy_page (cairo_gstate_t *gstate);
@@ -1130,85 +1098,82 @@ cairo_private cairo_status_t
_cairo_gstate_show_page (cairo_gstate_t *gstate);
cairo_private cairo_status_t
-_cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
+_cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
double *x1, double *y1,
double *x2, double *y2);
cairo_private cairo_status_t
-_cairo_gstate_fill_extents (cairo_gstate_t *gstate,
+_cairo_gstate_fill_extents (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
double *x1, double *y1,
double *x2, double *y2);
cairo_private cairo_status_t
-_cairo_gstate_in_stroke (cairo_gstate_t *gstate,
- double x,
- double y,
- cairo_bool_t *inside_ret);
-
-cairo_private cairo_status_t
-_cairo_gstate_in_fill (cairo_gstate_t *gstate,
- double x,
- double y,
- cairo_bool_t *inside_ret);
+_cairo_gstate_in_stroke (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
+ double x,
+ double y,
+ cairo_bool_t *inside_ret);
cairo_private cairo_status_t
-_cairo_gstate_init_clip (cairo_gstate_t *gstate);
+_cairo_gstate_in_fill (cairo_gstate_t *gstate,
+ cairo_path_fixed_t *path,
+ double x,
+ double y,
+ cairo_bool_t *inside_ret);
cairo_private cairo_status_t
-_cairo_gstate_clip (cairo_gstate_t *gstate);
+_cairo_gstate_clip (cairo_gstate_t *gstate, cairo_path_fixed_t *path);
cairo_private cairo_status_t
-_cairo_gstate_restore_external_state (cairo_gstate_t *gstate);
+_cairo_gstate_reset_clip (cairo_gstate_t *gstate);
cairo_private cairo_status_t
_cairo_gstate_show_surface (cairo_gstate_t *gstate,
cairo_surface_t *surface,
- int width,
- int height);
+ double x,
+ double y,
+ double width,
+ double height);
cairo_private cairo_status_t
-_cairo_gstate_select_font (cairo_gstate_t *gstate,
- const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight);
+_cairo_gstate_select_font_face (cairo_gstate_t *gstate,
+ const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight);
cairo_private cairo_status_t
-_cairo_gstate_scale_font (cairo_gstate_t *gstate,
- double scale);
+_cairo_gstate_set_font_size (cairo_gstate_t *gstate,
+ double size);
-cairo_private void
-_cairo_gstate_current_font_scale (cairo_gstate_t *gstate,
- cairo_font_scale_t *sc);
-
+void
+_cairo_gstate_get_font_matrix (cairo_gstate_t *gstate,
+ cairo_matrix_t *matrix);
+
cairo_private cairo_status_t
-_cairo_gstate_transform_font (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix);
+_cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
+ const cairo_matrix_t *matrix);
cairo_private cairo_status_t
-_cairo_gstate_current_font (cairo_gstate_t *gstate,
- cairo_font_t **font);
-
-cairo_private void
-_cairo_gstate_set_font_transform (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix);
-
-cairo_private void
-_cairo_gstate_current_font_transform (cairo_gstate_t *gstate,
- cairo_matrix_t *matrix);
+_cairo_gstate_get_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t **font_face);
cairo_private cairo_status_t
-_cairo_gstate_current_font_extents (cairo_gstate_t *gstate,
- cairo_font_extents_t *extents);
+_cairo_gstate_get_font_extents (cairo_gstate_t *gstate,
+ cairo_font_extents_t *extents);
cairo_private cairo_status_t
-_cairo_gstate_set_font (cairo_gstate_t *gstate,
- cairo_font_t *font);
+_cairo_gstate_set_font_face (cairo_gstate_t *gstate,
+ cairo_font_face_t *font_face);
cairo_private cairo_status_t
_cairo_gstate_text_to_glyphs (cairo_gstate_t *font,
- const unsigned char *utf8,
+ const char *utf8,
+ double x,
+ double y,
cairo_glyph_t **glyphs,
- int *num_glyphs);
+ int *num_glyphs);
cairo_private cairo_status_t
_cairo_gstate_glyph_extents (cairo_gstate_t *gstate,
@@ -1222,45 +1187,70 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
int num_glyphs);
cairo_private cairo_status_t
-_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
- cairo_glyph_t *glyphs,
- int num_glyphs);
+_cairo_gstate_glyph_path (cairo_gstate_t *gstate,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path);
/* cairo_color.c */
+cairo_private const cairo_color_t *
+_cairo_stock_color (cairo_stock_t stock);
+
+#define CAIRO_COLOR_WHITE _cairo_stock_color (CAIRO_STOCK_WHITE)
+#define CAIRO_COLOR_BLACK _cairo_stock_color (CAIRO_STOCK_BLACK)
+#define CAIRO_COLOR_TRANSPARENT _cairo_stock_color (CAIRO_STOCK_TRANSPARENT)
+
cairo_private void
_cairo_color_init (cairo_color_t *color);
cairo_private void
-_cairo_color_fini (cairo_color_t *color);
+_cairo_color_init_rgb (cairo_color_t *color,
+ double red, double green, double blue);
cairo_private void
-_cairo_color_set_rgb (cairo_color_t *color, double red, double green, double blue);
+_cairo_color_init_rgba (cairo_color_t *color,
+ double red, double green, double blue,
+ double alpha);
cairo_private void
-_cairo_color_get_rgb (const cairo_color_t *color,
- double *red, double *green, double *blue);
+_cairo_color_multiply_alpha (cairo_color_t *color,
+ double alpha);
cairo_private void
-_cairo_color_set_alpha (cairo_color_t *color, double alpha);
+_cairo_color_get_rgba (cairo_color_t *color,
+ double *red,
+ double *green,
+ double *blue,
+ double *alpha);
-/* cairo_font.c */
+cairo_private void
+_cairo_color_get_rgba_premultiplied (cairo_color_t *color,
+ double *red,
+ double *green,
+ double *blue,
+ double *alpha);
-cairo_private cairo_status_t
-_cairo_font_create (const char *family,
- cairo_font_slant_t slant,
- cairo_font_weight_t weight,
- cairo_font_scale_t *sc,
- cairo_font_t **font);
+/* cairo-font.c */
cairo_private void
-_cairo_font_init (cairo_font_t *font,
- cairo_font_scale_t *scale,
- const cairo_font_backend_t *backend);
+_cairo_font_face_init (cairo_font_face_t *font_face,
+ const cairo_font_face_backend_t *backend);
+
+cairo_private cairo_font_face_t *
+_cairo_simple_font_face_create (const char *family,
+ cairo_font_slant_t slant,
+ cairo_font_weight_t weight);
+
+cairo_private void
+_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
+ const cairo_matrix_t *font_matrix,
+ const cairo_matrix_t *ctm,
+ const cairo_scaled_font_backend_t *backend);
cairo_private void
-_cairo_unscaled_font_init (cairo_unscaled_font_t *font,
- const struct _cairo_font_backend *backend);
+_cairo_unscaled_font_init (cairo_unscaled_font_t *font,
+ const cairo_unscaled_font_backend_t *backend);
cairo_private void
_cairo_unscaled_font_reference (cairo_unscaled_font_t *font);
@@ -1269,56 +1259,50 @@ cairo_private void
_cairo_unscaled_font_destroy (cairo_unscaled_font_t *font);
cairo_private cairo_status_t
-_cairo_font_font_extents (cairo_font_t *font,
- cairo_font_extents_t *extents);
+_cairo_scaled_font_font_extents (cairo_scaled_font_t *scaled_font,
+ cairo_font_extents_t *extents);
cairo_private cairo_status_t
-_cairo_font_text_to_glyphs (cairo_font_t *font,
- const unsigned char *utf8,
- cairo_glyph_t **glyphs,
- int *num_glyphs);
+_cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
+ const char *utf8,
+ cairo_glyph_t **glyphs,
+ int *num_glyphs);
cairo_private cairo_status_t
-_cairo_font_glyph_extents (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_text_extents_t *extents);
+_cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_text_extents_t *extents);
cairo_private cairo_status_t
-_cairo_font_glyph_bbox (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_box_t *bbox);
+_cairo_scaled_font_glyph_bbox (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_box_t *bbox);
cairo_private cairo_status_t
-_cairo_font_show_glyphs (cairo_font_t *font,
- cairo_operator_t operator,
- cairo_pattern_t *source,
- cairo_surface_t *surface,
- int source_x,
- int source_y,
- int dest_x,
- int dest_y,
- unsigned int widht,
- unsigned int height,
- cairo_glyph_t *glyphs,
- int num_glyphs);
+_cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *source,
+ cairo_surface_t *surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ cairo_glyph_t *glyphs,
+ int num_glyphs);
cairo_private cairo_status_t
-_cairo_font_glyph_path (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_t *path);
-
-cairo_private cairo_status_t
-_cairo_font_glyph_path (cairo_font_t *font,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- cairo_path_t *path);
+_cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ cairo_path_fixed_t *path);
cairo_private void
-_cairo_font_get_glyph_cache_key (cairo_font_t *font,
- cairo_glyph_cache_key_t *key);
+_cairo_scaled_font_get_glyph_cache_key (cairo_scaled_font_t *scaled_font,
+ cairo_glyph_cache_key_t *key);
/* cairo_hull.c */
cairo_private cairo_status_t
@@ -1326,104 +1310,127 @@ _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
/* cairo_path.c */
cairo_private void
-_cairo_path_init (cairo_path_t *path);
+_cairo_path_fixed_init (cairo_path_fixed_t *path);
cairo_private cairo_status_t
-_cairo_path_init_copy (cairo_path_t *path, cairo_path_t *other);
+_cairo_path_fixed_init_copy (cairo_path_fixed_t *path,
+ cairo_path_fixed_t *other);
cairo_private void
-_cairo_path_fini (cairo_path_t *path);
+_cairo_path_fixed_fini (cairo_path_fixed_t *path);
-cairo_private cairo_status_t
-_cairo_path_move_to (cairo_path_t *path, cairo_point_t *point);
+cairo_status_t
+_cairo_path_fixed_move_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x,
+ cairo_fixed_t y);
-cairo_private cairo_status_t
-_cairo_path_rel_move_to (cairo_path_t *path, cairo_slope_t *slope);
+cairo_status_t
+_cairo_path_fixed_rel_move_to (cairo_path_fixed_t *path,
+ cairo_fixed_t dx,
+ cairo_fixed_t dy);
-cairo_private cairo_status_t
-_cairo_path_line_to (cairo_path_t *path, cairo_point_t *point);
+cairo_status_t
+_cairo_path_fixed_line_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x,
+ cairo_fixed_t y);
-cairo_private cairo_status_t
-_cairo_path_rel_line_to (cairo_path_t *path, cairo_slope_t *slope);
+cairo_status_t
+_cairo_path_fixed_rel_line_to (cairo_path_fixed_t *path,
+ cairo_fixed_t dx,
+ cairo_fixed_t dy);
-cairo_private cairo_status_t
-_cairo_path_curve_to (cairo_path_t *path,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2);
+cairo_status_t
+_cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x0, cairo_fixed_t y0,
+ cairo_fixed_t x1, cairo_fixed_t y1,
+ cairo_fixed_t x2, cairo_fixed_t y2);
-cairo_private cairo_status_t
-_cairo_path_rel_curve_to (cairo_path_t *path,
- cairo_slope_t *s0,
- cairo_slope_t *s1,
- cairo_slope_t *s2);
+cairo_status_t
+_cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
+ cairo_fixed_t dx0, cairo_fixed_t dy0,
+ cairo_fixed_t dx1, cairo_fixed_t dy1,
+ cairo_fixed_t dx2, cairo_fixed_t dy2);
cairo_private cairo_status_t
-_cairo_path_close_path (cairo_path_t *path);
+_cairo_path_fixed_close_path (cairo_path_fixed_t *path);
-cairo_private cairo_status_t
-_cairo_path_current_point (cairo_path_t *path, cairo_point_t *point);
+cairo_status_t
+_cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
+ cairo_fixed_t *x,
+ cairo_fixed_t *y);
-typedef cairo_status_t (cairo_path_move_to_func_t) (void *closure,
- cairo_point_t *point);
+typedef cairo_status_t
+(cairo_path_fixed_move_to_func_t) (void *closure,
+ cairo_point_t *point);
-typedef cairo_status_t (cairo_path_line_to_func_t) (void *closure,
- cairo_point_t *point);
+typedef cairo_status_t
+(cairo_path_fixed_line_to_func_t) (void *closure,
+ cairo_point_t *point);
-typedef cairo_status_t (cairo_path_curve_to_func_t) (void *closure,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2);
+typedef cairo_status_t
+(cairo_path_fixed_curve_to_func_t) (void *closure,
+ cairo_point_t *p0,
+ cairo_point_t *p1,
+ cairo_point_t *p2);
-typedef cairo_status_t (cairo_path_close_path_func_t) (void *closure);
+typedef cairo_status_t
+(cairo_path_fixed_close_path_func_t) (void *closure);
cairo_private cairo_status_t
-_cairo_path_interpret (cairo_path_t *path,
- cairo_direction_t dir,
- cairo_path_move_to_func_t *move_to,
- cairo_path_line_to_func_t *line_to,
- cairo_path_curve_to_func_t *curve_to,
- cairo_path_close_path_func_t *close_path,
- void *closure);
+_cairo_path_fixed_interpret (cairo_path_fixed_t *path,
+ cairo_direction_t dir,
+ cairo_path_fixed_move_to_func_t *move_to,
+ cairo_path_fixed_line_to_func_t *line_to,
+ cairo_path_fixed_curve_to_func_t *curve_to,
+ cairo_path_fixed_close_path_func_t *close_path,
+ void *closure);
cairo_private cairo_status_t
-_cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, double *y2);
+_cairo_path_fixed_bounds (cairo_path_fixed_t *path,
+ double *x1, double *y1,
+ double *x2, double *y2);
/* cairo_path_fill.c */
cairo_private cairo_status_t
-_cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps);
+_cairo_path_fixed_fill_to_traps (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate,
+ cairo_traps_t *traps);
/* cairo_path_stroke.c */
cairo_private cairo_status_t
-_cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps);
+_cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path,
+ cairo_gstate_t *gstate,
+ cairo_traps_t *traps);
-/* cairo_surface.c */
+/* cairo-surface.c */
cairo_private cairo_surface_t *
_cairo_surface_create_similar_scratch (cairo_surface_t *other,
cairo_format_t format,
- int drawable,
int width,
int height);
cairo_private cairo_surface_t *
-_cairo_surface_create_similar_solid (cairo_surface_t *other,
- cairo_format_t format,
- int width,
- int height,
- cairo_color_t *color);
+_cairo_surface_create_similar_solid (cairo_surface_t *other,
+ cairo_format_t format,
+ int width,
+ int height,
+ const cairo_color_t *color);
cairo_private void
_cairo_surface_init (cairo_surface_t *surface,
const cairo_surface_backend_t *backend);
+cairo_private cairo_clip_mode_t
+_cairo_surface_get_clip_mode (cairo_surface_t *surface);
+
cairo_private cairo_status_t
-_cairo_surface_fill_rectangle (cairo_surface_t *surface,
- cairo_operator_t operator,
- cairo_color_t *color,
- int x,
- int y,
- int width,
- int height);
+_cairo_surface_fill_rectangle (cairo_surface_t *surface,
+ cairo_operator_t operator,
+ const cairo_color_t *color,
+ int x,
+ int y,
+ int width,
+ int height);
cairo_private cairo_status_t
_cairo_surface_composite (cairo_operator_t operator,
@@ -1446,6 +1453,14 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface,
cairo_rectangle_t *rects,
int num_rects);
+cairo_private cairo_int_status_t
+_cairo_surface_fill_path (cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *dst,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance);
+
cairo_private cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
cairo_pattern_t *pattern,
@@ -1465,9 +1480,6 @@ _cairo_surface_copy_page (cairo_surface_t *surface);
cairo_private cairo_status_t
_cairo_surface_show_page (cairo_surface_t *surface);
-cairo_private double
-_cairo_surface_pixels_per_inch (cairo_surface_t *surface);
-
cairo_private cairo_status_t
_cairo_surface_acquire_source_image (cairo_surface_t *surface,
cairo_image_surface_t **image_out,
@@ -1497,14 +1509,50 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
cairo_surface_t *src,
cairo_surface_t **clone_out);
+cairo_private unsigned int
+_cairo_surface_get_current_clip_serial (cairo_surface_t *surface);
+
+cairo_private unsigned int
+_cairo_surface_allocate_clip_serial (cairo_surface_t *surface);
+
+cairo_private cairo_status_t
+_cairo_surface_reset_clip (cairo_surface_t *surface);
+
cairo_private cairo_status_t
-_cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region);
+_cairo_surface_set_clip_region (cairo_surface_t *surface,
+ pixman_region16_t *region,
+ unsigned int serial);
+
+typedef struct _cairo_clip_path cairo_clip_path_t;
+
+cairo_private cairo_status_t
+_cairo_surface_set_clip_path (cairo_surface_t *surface,
+ cairo_clip_path_t *clip_path,
+ unsigned int serial);
+
+cairo_private cairo_status_t
+_cairo_surface_get_extents (cairo_surface_t *surface,
+ cairo_rectangle_t *rectangle);
+
+cairo_private cairo_status_t
+_cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
+ cairo_operator_t operator,
+ cairo_pattern_t *pattern,
+ cairo_surface_t *surface,
+ int source_x,
+ int source_y,
+ int dest_x,
+ int dest_y,
+ unsigned int width,
+ unsigned int height,
+ const cairo_glyph_t *glyphs,
+ int num_glyphs);
/* cairo_image_surface.c */
cairo_private cairo_image_surface_t *
-_cairo_image_surface_create_with_masks (char *data,
- cairo_format_masks_t *format,
+_cairo_image_surface_create_with_masks (unsigned char *data,
+ cairo_format_masks_t *format,
int width,
int height,
int stride);
@@ -1512,18 +1560,6 @@ _cairo_image_surface_create_with_masks (char *data,
cairo_private void
_cairo_image_surface_assume_ownership_of_data (cairo_image_surface_t *surface);
-cairo_private cairo_status_t
-_cairo_image_surface_set_matrix (cairo_image_surface_t *surface,
- cairo_matrix_t *matrix);
-
-cairo_private cairo_status_t
-_cairo_image_surface_set_filter (cairo_image_surface_t *surface,
- cairo_filter_t filter);
-
-cairo_private cairo_status_t
-_cairo_image_surface_set_repeat (cairo_image_surface_t *surface,
- int repeat);
-
cairo_private cairo_int_status_t
_cairo_image_surface_set_clip_region (cairo_image_surface_t *surface,
pixman_region16_t *region);
@@ -1605,44 +1641,39 @@ _cairo_spline_fini (cairo_spline_t *spline);
/* cairo_matrix.c */
cairo_private void
-_cairo_matrix_init (cairo_matrix_t *matrix);
+_cairo_matrix_get_affine (const cairo_matrix_t *matrix,
+ double *xx, double *yx,
+ double *xy, double *yy,
+ double *x0, double *y0);
cairo_private void
-_cairo_matrix_fini (cairo_matrix_t *matrix);
-
-cairo_private cairo_status_t
-_cairo_matrix_set_translate (cairo_matrix_t *matrix,
- double tx, double ty);
-
-cairo_private cairo_status_t
-_cairo_matrix_set_scale (cairo_matrix_t *matrix,
- double sx, double sy);
-
-cairo_private cairo_status_t
-_cairo_matrix_set_rotate (cairo_matrix_t *matrix,
- double angle);
-
-cairo_private cairo_status_t
-_cairo_matrix_transform_bounding_box (cairo_matrix_t *matrix,
+_cairo_matrix_transform_bounding_box (const cairo_matrix_t *matrix,
double *x, double *y,
double *width, double *height);
-cairo_private cairo_status_t
-_cairo_matrix_compute_determinant (cairo_matrix_t *matrix, double *det);
+cairo_private void
+_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix, double *det);
-cairo_private cairo_status_t
-_cairo_matrix_compute_eigen_values (cairo_matrix_t *matrix, double *lambda1, double *lambda2);
+cairo_private void
+_cairo_matrix_compute_eigen_values (const cairo_matrix_t *matrix,
+ double *lambda1, double *lambda2);
cairo_private cairo_status_t
-_cairo_matrix_compute_scale_factors (cairo_matrix_t *matrix, double *sx, double *sy, int x_major);
+_cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
+ double *sx, double *sy, int x_major);
cairo_private cairo_bool_t
-_cairo_matrix_is_integer_translation(cairo_matrix_t *matrix, int *itx, int *ity);
+_cairo_matrix_is_integer_translation(const cairo_matrix_t *matrix,
+ int *itx, int *ity);
/* cairo_traps.c */
cairo_private void
_cairo_traps_init (cairo_traps_t *traps);
+cairo_private cairo_status_t
+_cairo_traps_init_box (cairo_traps_t *traps,
+ cairo_box_t *box);
+
cairo_private void
_cairo_traps_fini (cairo_traps_t *traps);
@@ -1663,6 +1694,10 @@ _cairo_traps_contain (cairo_traps_t *traps, double x, double y);
cairo_private void
_cairo_traps_extents (cairo_traps_t *traps, cairo_box_t *extents);
+cairo_private cairo_status_t
+_cairo_traps_extract_region (cairo_traps_t *tr,
+ pixman_region16_t **region);
+
/* cairo_slope.c */
cairo_private void
_cairo_slope_init (cairo_slope_t *slope, cairo_point_t *a, cairo_point_t *b);
@@ -1678,12 +1713,13 @@ _cairo_slope_counter_clockwise (cairo_slope_t *a, cairo_slope_t *b);
/* cairo_pattern.c */
-cairo_private cairo_status_t
-_cairo_pattern_init_copy (cairo_pattern_t *pattern, cairo_pattern_t *other);
+cairo_private void
+_cairo_pattern_init_copy (cairo_pattern_t *pattern,
+ const cairo_pattern_t *other);
cairo_private void
_cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
- double red, double green, double blue);
+ const cairo_color_t *color);
cairo_private void
_cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern,
@@ -1702,21 +1738,17 @@ cairo_private void
_cairo_pattern_fini (cairo_pattern_t *pattern);
cairo_private cairo_pattern_t *
-_cairo_pattern_create_solid (double red, double green, double blue);
-
-cairo_private cairo_status_t
-_cairo_pattern_get_rgb (cairo_pattern_t *pattern,
- double *red, double *green, double *blue);
+_cairo_pattern_create_solid (const cairo_color_t *color);
-cairo_private void
-_cairo_pattern_set_alpha (cairo_pattern_t *pattern, double alpha);
+cairo_pattern_t *
+_cairo_pattern_create_in_error (cairo_status_t status);
cairo_private void
-_cairo_pattern_transform (cairo_pattern_t *pattern,
- cairo_matrix_t *ctm_inverse);
+_cairo_pattern_transform (cairo_pattern_t *pattern,
+ const cairo_matrix_t *ctm_inverse);
cairo_private cairo_bool_t
-_cairo_pattern_is_opaque (cairo_pattern_t *pattern);
+_cairo_pattern_is_opaque_solid (cairo_pattern_t *pattern);
cairo_private cairo_int_status_t
_cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
@@ -1752,37 +1784,71 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src,
/* cairo_unicode.c */
cairo_private cairo_status_t
-_cairo_utf8_to_ucs4 (const char *str,
- int len,
- uint32_t **result,
- int *items_written);
+_cairo_utf8_to_ucs4 (const unsigned char *str,
+ int len,
+ uint32_t **result,
+ int *items_written);
+
+cairo_private cairo_status_t
+_cairo_utf8_to_utf16 (const unsigned char *str,
+ int len,
+ uint16_t **result,
+ int *items_written);
+
+/* cairo_output_stream.c */
+
+typedef struct _cairo_output_stream cairo_output_stream_t;
+
+cairo_private cairo_output_stream_t *
+_cairo_output_stream_create (cairo_write_func_t write_func,
+ void *closure);
+
+cairo_private void
+_cairo_output_stream_destroy (cairo_output_stream_t *stream);
+
+cairo_private cairo_status_t
+_cairo_output_stream_write (cairo_output_stream_t *stream,
+ const void *data, size_t length);
cairo_private cairo_status_t
-_cairo_utf8_to_utf16 (const char *str,
- int len,
- uint16_t **result,
- int *items_written);
+_cairo_output_stream_vprintf (cairo_output_stream_t *stream,
+ const char *fmt, va_list ap);
+
+cairo_private cairo_status_t
+_cairo_output_stream_printf (cairo_output_stream_t *stream,
+ const char *fmt, ...);
+
+cairo_private long
+_cairo_output_stream_get_position (cairo_output_stream_t *status);
+
+cairo_private cairo_status_t
+_cairo_output_stream_get_status (cairo_output_stream_t *stream);
+
+cairo_output_stream_t *
+_cairo_output_stream_create_for_file (const char *filename);
/* Avoid unnecessary PLT entries. */
+slim_hidden_proto(cairo_get_current_point)
+slim_hidden_proto(cairo_fill_preserve)
+slim_hidden_proto(cairo_clip_preserve)
slim_hidden_proto(cairo_close_path)
-slim_hidden_proto(cairo_matrix_copy)
slim_hidden_proto(cairo_matrix_invert)
slim_hidden_proto(cairo_matrix_multiply)
slim_hidden_proto(cairo_matrix_scale)
-slim_hidden_proto(cairo_matrix_set_affine)
-slim_hidden_proto(cairo_matrix_set_identity)
+slim_hidden_proto(cairo_matrix_init)
+slim_hidden_proto(cairo_matrix_init_identity)
+slim_hidden_proto(cairo_matrix_init_translate)
+slim_hidden_proto(cairo_matrix_init_scale)
+slim_hidden_proto(cairo_matrix_init_rotate)
slim_hidden_proto(cairo_matrix_transform_distance)
slim_hidden_proto(cairo_matrix_transform_point)
slim_hidden_proto(cairo_move_to)
+slim_hidden_proto(cairo_new_path)
slim_hidden_proto(cairo_rel_line_to)
slim_hidden_proto(cairo_restore)
slim_hidden_proto(cairo_save)
-slim_hidden_proto(cairo_set_target_surface)
-slim_hidden_proto(cairo_surface_create_for_image)
+slim_hidden_proto(cairo_stroke_preserve)
slim_hidden_proto(cairo_surface_destroy)
-slim_hidden_proto(cairo_surface_get_matrix)
-slim_hidden_proto(cairo_surface_set_matrix)
-slim_hidden_proto(cairo_surface_set_repeat)
#endif
diff --git a/test/Makefile.am b/test/Makefile.am
index 04d42e2..4820419 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,45 +1,103 @@
-# All new test cases go here
-TESTS = \
-fill_rule \
-leaky_polygon \
-line_width \
-linear_gradient \
-move_to_show_surface \
-text_cache_crash \
-text_rotate \
-coverage \
-clip_twice \
-pixman_rotate
+# All test cases go here
+TESTS = \
+clip-nesting \
+clip-twice \
+create-for-png \
+fill-and-stroke \
+fill-rule \
+filter-nearest-offset \
+get-and-set \
+gradient-alpha \
+leaky-polygon \
+line-width \
+linear-gradient \
+mask \
+move-to-show-surface \
+paint \
+paint-with-alpha \
+path-data \
+pixman-rotate \
+scale-source-surface-paint \
+select-font-no-show-text \
+self-copy \
+self-intersecting \
+set-source \
+source-clip \
+source-surface-scale-paint \
+surface-finish-twice \
+surface-pattern \
+text-cache-crash \
+text-rotate \
+transforms \
+translate-show-surface \
+trap-clip \
+user-data \
+rel-path
-# And all new tests go here too. I really don't like having to repeat
-# this list. Anyone know a good way to avoid it? Can I use a wildcard
-# here?
-EXTRA_DIST = \
-fill_rule-ref.png \
-leaky_polygon-ref.png \
-line_width-ref.png \
-linear_gradient-ref.png \
-move_to_show_surface-ref.png \
-coverage-ref.png \
-clip_twice-ref.png \
-pixman_rotate-ref.png \
-romedalen.png
+if CAIRO_HAS_PDF_SURFACE
+TESTS += pdf-surface pdf-clip
+endif
-# Once we can draw the text_rotate.c test case correctly, we should
-# create and add text_rotate-ref.png to the list of reference PNGs.
+if CAIRO_HAS_PS_SURFACE
+TESTS += ps-surface
+endif
-# This list is only for known bugs (not regressions). We do need to
-# fix these before the next release, but they are expected to fail for
-# now, so they don't need to hold up any new code commit.
+if CAIRO_HAS_XLIB_SURFACE
+TESTS += xlib-surface
+endif
+
+# All tests which have a reference image go here.
+# I really don't like having to repeat this list. Anyone know a good
+# way to avoid it? Can I use a wildcard here?
+EXTRA_DIST = \
+clip-nesting-ref.png \
+clip-twice-ref.png \
+create-for-png-ref.png \
+fill-and-stroke-ref.png \
+fill-rule-ref.png \
+filter-nearest-offset-ref.png \
+gradient-alpha-ref.png \
+leaky-polygon-ref.png \
+line-width-ref.png \
+linear-gradient-ref.png \
+mask-ref.png \
+move-to-show-surface-ref.png \
+paint-ref.png \
+paint-with-alpha-ref.png \
+path-data-ref.png \
+pixman-rotate-ref.png \
+romedalen.png \
+self-copy-ref.png \
+self-intersecting-ref.png \
+scale-source-surface-paint-ref.png \
+set-source-ref.png \
+source-clip-ref.png \
+source-surface-scale-paint-ref.png \
+surface-pattern-ref.png \
+transforms-ref.png \
+translate-show-surface-ref.png \
+trap-clip-ref.png \
+rel-path-ref.png
+
+# Any test for which the code committed to CVS is expected to fail
+# should be listed here.
+#
+# This way, we can avoid being bothered by reports of bugs we are
+# aware of, but users can still report when tests start behaving in
+# unexpected ways on their system.
#
-# When new bugs are found in committed code they can be listed
-# here. New failures due to local, uncommitted code changes are
-# regression bugs that should not be listed here. Instead they should
-# be fixed before the code is committed.
-XFAIL_TESTS = \
-move_to_show_surface \
-pixman_rotate \
-text_rotate
+# Of course, before any "release" of cairo we should eliminate
+# everything from this list by fixing the bugs. (We don't necessarily
+# have to be that strict for "snapshots" though.)
+#
+# Also, any test listed here should call cairo_test_expect_failure and
+# provide an explanation for the expected failure.
+XFAIL_TESTS = \
+filter-nearest-offset \
+pixman-rotate \
+self-intersecting \
+source-surface-scale-paint \
+text-rotate
check_PROGRAMS = $(TESTS)
@@ -47,37 +105,77 @@ check_PROGRAMS = $(TESTS)
# not be the most portable approach, but it is pragmatic and I'm
# willing to do something cleaner as soon as it causes someone a
# problem.
-INCLUDES = -D_GNU_SOURCE -I$(srcdir) $(CAIRO_CFLAGS) -I$(srcdir)/../src
+INCLUDES = \
+ -D_GNU_SOURCE \
+ $(CAIRO_CFLAGS) \
+ -I$(srcdir) \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src
-AM_LDFLAGS = $(CAIRO_LIBS) ../src/libcairo.la
+noinst_LTLIBRARIES = libcairotest.la
-cairo_test_lib =\
-buffer_diff.c \
-buffer_diff.h \
-cairo_test.c \
-cairo_test.h \
-read_png.c \
-read_png.h \
-write_png.c \
-write_png.h \
+libcairotest_la_SOURCES =\
+buffer-diff.c \
+buffer-diff.h \
+cairo-test.c \
+cairo-test.h \
+read-png.c \
+read-png.h \
+write-png.c \
+write-png.h \
xmalloc.c \
xmalloc.h
+LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
+
# ARGH! I have to repeat the list of tests a third time. Maybe it's
# time to break down and auto-generate the Makefile.am or something
# from autogen.sh. My, but this is painful...
-fill_rule_SOURCES = fill_rule.c $(cairo_test_lib)
-leaky_polygon_SOURCES = leaky_polygon.c $(cairo_test_lib)
-line_width_SOURCES = line_width.c $(cairo_test_lib)
-linear_gradient_SOURCES = linear_gradient.c $(cairo_test_lib)
-move_to_show_surface_SOURCES = move_to_show_surface.c $(cairo_test_lib)
-text_cache_crash_SOURCES = text_cache_crash.c $(cairo_test_lib)
-text_rotate_SOURCES = text_rotate.c $(cairo_test_lib)
-coverage_SOURCES = coverage.c $(cairo_test_lib)
-clip_twice_SOURCES = clip_twice.c $(cairo_test_lib)
-pixman_rotate_SOURCES = pixman_rotate.c $(cairo_test_lib)
+clip_nesting_LDADD = $(LDADDS)
+clip_twice_LDADD = $(LDADDS)
+create_for_png_LDADD = $(LDADDS)
+fill_and_stroke_LDADD = $(LDADDS)
+fill_rule_LDADD = $(LDADDS)
+filter_nearest_offset_LDADD = $(LDADDS)
+get_and_set_LDADD = $(LDADDS)
+gradient_alpha_LDADD = $(LDADDS)
+leaky_polygon_LDADD = $(LDADDS)
+line_width_LDADD = $(LDADDS)
+linear_gradient_LDADD = $(LDADDS)
+mask_LDADD = $(LDADDS)
+move_to_show_surface_LDADD = $(LDADDS)
+paint_LDADD = $(LDADDS)
+paint_with_alpha_LDADD = $(LDADDS)
+path_data_LDADD = $(LDADDS)
+pdf_surface_LDADD = $(LDADDS)
+pdf_clip_LDADD = $(LDADDS)
+ps_surface_LDADD = $(LDADDS)
+pixman_rotate_LDADD = $(LDADDS)
+scale_source_surface_paint_LDADD = $(LDADDS)
+select_font_no_show_text_LDADD = $(LDADDS)
+self_copy_LDADD = $(LDADDS)
+self_intersecting_LDADD = $(LDADDS)
+set_source_LDADD = $(LDADDS)
+source_clip_LDADD = $(LDADDS)
+source_surface_scale_paint_LDADD = $(LDADDS)
+surface_finish_twice_LDADD = $(LDADDS)
+surface_pattern_LDADD = $(LDADDS)
+text_cache_crash_LDADD = $(LDADDS)
+text_rotate_LDADD = $(LDADDS)
+transforms_LDADD = $(LDADDS)
+translate_show_surface_LDADD = $(LDADDS)
+trap_clip_LDADD = $(LDADDS)
+user_data_LDADD = $(LDADDS)
+rel_path_LDADD = $(LDADDS)
+xlib_surface_LDADD = $(LDADDS)
noinst_PROGRAMS = imagediff
-imagediff_SOURCES = imagediff.c $(cairo_test_lib)
+imagediff_LDADD = $(LDADDS)
-CLEANFILES = *-out.png *-diff.png *.log
+CLEANFILES = \
+ *-out.png \
+ *-diff.png \
+ *.log \
+ ps-surface.ps \
+ pdf-surface.pdf \
+ pdf-clip.pdf
diff --git a/test/Makefile.in b/test/Makefile.in
index f2bbb66..1fb5658 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -14,7 +14,8 @@
@SET_MAKE@
-SOURCES = $(clip_twice_SOURCES) $(coverage_SOURCES) $(fill_rule_SOURCES) $(imagediff_SOURCES) $(leaky_polygon_SOURCES) $(line_width_SOURCES) $(linear_gradient_SOURCES) $(move_to_show_surface_SOURCES) $(pixman_rotate_SOURCES) $(text_cache_crash_SOURCES) $(text_rotate_SOURCES)
+
+SOURCES = $(libcairotest_la_SOURCES) clip-nesting.c clip-twice.c create-for-png.c fill-and-stroke.c fill-rule.c filter-nearest-offset.c get-and-set.c gradient-alpha.c imagediff.c leaky-polygon.c line-width.c linear-gradient.c mask.c move-to-show-surface.c paint.c paint-with-alpha.c path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c ps-surface.c rel-path.c scale-source-surface-paint.c select-font-no-show-text.c self-copy.c self-intersecting.c set-source.c source-clip.c source-surface-scale-paint.c surface-finish-twice.c surface-pattern.c text-cache-crash.c text-rotate.c transforms.c translate-show-surface.c trap-clip.c user-data.c xlib-surface.c
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@@ -38,7 +39,10 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = $(am__EXEEXT_1)
+@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_1 = pdf-surface pdf-clip
+@CAIRO_HAS_PS_SURFACE_TRUE@am__append_2 = ps-surface
+@CAIRO_HAS_XLIB_SURFACE_TRUE@am__append_3 = xlib-surface
+check_PROGRAMS = $(am__EXEEXT_4)
noinst_PROGRAMS = imagediff$(EXEEXT)
subdir = test
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -50,50 +54,150 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-am__EXEEXT_1 = fill_rule$(EXEEXT) leaky_polygon$(EXEEXT) \
- line_width$(EXEEXT) linear_gradient$(EXEEXT) \
- move_to_show_surface$(EXEEXT) text_cache_crash$(EXEEXT) \
- text_rotate$(EXEEXT) coverage$(EXEEXT) clip_twice$(EXEEXT) \
- pixman_rotate$(EXEEXT)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libcairotest_la_LIBADD =
+am_libcairotest_la_OBJECTS = buffer-diff.lo cairo-test.lo read-png.lo \
+ write-png.lo xmalloc.lo
+libcairotest_la_OBJECTS = $(am_libcairotest_la_OBJECTS)
+@CAIRO_HAS_PDF_SURFACE_TRUE@am__EXEEXT_1 = pdf-surface$(EXEEXT) \
+@CAIRO_HAS_PDF_SURFACE_TRUE@ pdf-clip$(EXEEXT)
+@CAIRO_HAS_PS_SURFACE_TRUE@am__EXEEXT_2 = ps-surface$(EXEEXT)
+@CAIRO_HAS_XLIB_SURFACE_TRUE@am__EXEEXT_3 = xlib-surface$(EXEEXT)
+am__EXEEXT_4 = clip-nesting$(EXEEXT) clip-twice$(EXEEXT) \
+ create-for-png$(EXEEXT) fill-and-stroke$(EXEEXT) \
+ fill-rule$(EXEEXT) filter-nearest-offset$(EXEEXT) \
+ get-and-set$(EXEEXT) gradient-alpha$(EXEEXT) \
+ leaky-polygon$(EXEEXT) line-width$(EXEEXT) \
+ linear-gradient$(EXEEXT) mask$(EXEEXT) \
+ move-to-show-surface$(EXEEXT) paint$(EXEEXT) \
+ paint-with-alpha$(EXEEXT) path-data$(EXEEXT) \
+ pixman-rotate$(EXEEXT) scale-source-surface-paint$(EXEEXT) \
+ select-font-no-show-text$(EXEEXT) self-copy$(EXEEXT) \
+ self-intersecting$(EXEEXT) set-source$(EXEEXT) \
+ source-clip$(EXEEXT) source-surface-scale-paint$(EXEEXT) \
+ surface-finish-twice$(EXEEXT) surface-pattern$(EXEEXT) \
+ text-cache-crash$(EXEEXT) text-rotate$(EXEEXT) \
+ transforms$(EXEEXT) translate-show-surface$(EXEEXT) \
+ trap-clip$(EXEEXT) user-data$(EXEEXT) rel-path$(EXEEXT) \
+ $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3)
PROGRAMS = $(noinst_PROGRAMS)
-am__objects_1 = buffer_diff.$(OBJEXT) cairo_test.$(OBJEXT) \
- read_png.$(OBJEXT) write_png.$(OBJEXT) xmalloc.$(OBJEXT)
-am_clip_twice_OBJECTS = clip_twice.$(OBJEXT) $(am__objects_1)
-clip_twice_OBJECTS = $(am_clip_twice_OBJECTS)
-clip_twice_LDADD = $(LDADD)
-am_coverage_OBJECTS = coverage.$(OBJEXT) $(am__objects_1)
-coverage_OBJECTS = $(am_coverage_OBJECTS)
-coverage_LDADD = $(LDADD)
-am_fill_rule_OBJECTS = fill_rule.$(OBJEXT) $(am__objects_1)
-fill_rule_OBJECTS = $(am_fill_rule_OBJECTS)
-fill_rule_LDADD = $(LDADD)
-am_imagediff_OBJECTS = imagediff.$(OBJEXT) $(am__objects_1)
-imagediff_OBJECTS = $(am_imagediff_OBJECTS)
-imagediff_LDADD = $(LDADD)
-am_leaky_polygon_OBJECTS = leaky_polygon.$(OBJEXT) $(am__objects_1)
-leaky_polygon_OBJECTS = $(am_leaky_polygon_OBJECTS)
-leaky_polygon_LDADD = $(LDADD)
-am_line_width_OBJECTS = line_width.$(OBJEXT) $(am__objects_1)
-line_width_OBJECTS = $(am_line_width_OBJECTS)
-line_width_LDADD = $(LDADD)
-am_linear_gradient_OBJECTS = linear_gradient.$(OBJEXT) \
- $(am__objects_1)
-linear_gradient_OBJECTS = $(am_linear_gradient_OBJECTS)
-linear_gradient_LDADD = $(LDADD)
-am_move_to_show_surface_OBJECTS = move_to_show_surface.$(OBJEXT) \
- $(am__objects_1)
-move_to_show_surface_OBJECTS = $(am_move_to_show_surface_OBJECTS)
-move_to_show_surface_LDADD = $(LDADD)
-am_pixman_rotate_OBJECTS = pixman_rotate.$(OBJEXT) $(am__objects_1)
-pixman_rotate_OBJECTS = $(am_pixman_rotate_OBJECTS)
-pixman_rotate_LDADD = $(LDADD)
-am_text_cache_crash_OBJECTS = text_cache_crash.$(OBJEXT) \
- $(am__objects_1)
-text_cache_crash_OBJECTS = $(am_text_cache_crash_OBJECTS)
-text_cache_crash_LDADD = $(LDADD)
-am_text_rotate_OBJECTS = text_rotate.$(OBJEXT) $(am__objects_1)
-text_rotate_OBJECTS = $(am_text_rotate_OBJECTS)
-text_rotate_LDADD = $(LDADD)
+clip_nesting_SOURCES = clip-nesting.c
+clip_nesting_OBJECTS = clip-nesting.$(OBJEXT)
+am__DEPENDENCIES_1 = libcairotest.la $(top_builddir)/src/libcairo.la
+clip_nesting_DEPENDENCIES = $(am__DEPENDENCIES_1)
+clip_twice_SOURCES = clip-twice.c
+clip_twice_OBJECTS = clip-twice.$(OBJEXT)
+clip_twice_DEPENDENCIES = $(am__DEPENDENCIES_1)
+create_for_png_SOURCES = create-for-png.c
+create_for_png_OBJECTS = create-for-png.$(OBJEXT)
+create_for_png_DEPENDENCIES = $(am__DEPENDENCIES_1)
+fill_and_stroke_SOURCES = fill-and-stroke.c
+fill_and_stroke_OBJECTS = fill-and-stroke.$(OBJEXT)
+fill_and_stroke_DEPENDENCIES = $(am__DEPENDENCIES_1)
+fill_rule_SOURCES = fill-rule.c
+fill_rule_OBJECTS = fill-rule.$(OBJEXT)
+fill_rule_DEPENDENCIES = $(am__DEPENDENCIES_1)
+filter_nearest_offset_SOURCES = filter-nearest-offset.c
+filter_nearest_offset_OBJECTS = filter-nearest-offset.$(OBJEXT)
+filter_nearest_offset_DEPENDENCIES = $(am__DEPENDENCIES_1)
+get_and_set_SOURCES = get-and-set.c
+get_and_set_OBJECTS = get-and-set.$(OBJEXT)
+get_and_set_DEPENDENCIES = $(am__DEPENDENCIES_1)
+gradient_alpha_SOURCES = gradient-alpha.c
+gradient_alpha_OBJECTS = gradient-alpha.$(OBJEXT)
+gradient_alpha_DEPENDENCIES = $(am__DEPENDENCIES_1)
+imagediff_SOURCES = imagediff.c
+imagediff_OBJECTS = imagediff.$(OBJEXT)
+imagediff_DEPENDENCIES = $(am__DEPENDENCIES_1)
+leaky_polygon_SOURCES = leaky-polygon.c
+leaky_polygon_OBJECTS = leaky-polygon.$(OBJEXT)
+leaky_polygon_DEPENDENCIES = $(am__DEPENDENCIES_1)
+line_width_SOURCES = line-width.c
+line_width_OBJECTS = line-width.$(OBJEXT)
+line_width_DEPENDENCIES = $(am__DEPENDENCIES_1)
+linear_gradient_SOURCES = linear-gradient.c
+linear_gradient_OBJECTS = linear-gradient.$(OBJEXT)
+linear_gradient_DEPENDENCIES = $(am__DEPENDENCIES_1)
+mask_SOURCES = mask.c
+mask_OBJECTS = mask.$(OBJEXT)
+mask_DEPENDENCIES = $(am__DEPENDENCIES_1)
+move_to_show_surface_SOURCES = move-to-show-surface.c
+move_to_show_surface_OBJECTS = move-to-show-surface.$(OBJEXT)
+move_to_show_surface_DEPENDENCIES = $(am__DEPENDENCIES_1)
+paint_SOURCES = paint.c
+paint_OBJECTS = paint.$(OBJEXT)
+paint_DEPENDENCIES = $(am__DEPENDENCIES_1)
+paint_with_alpha_SOURCES = paint-with-alpha.c
+paint_with_alpha_OBJECTS = paint-with-alpha.$(OBJEXT)
+paint_with_alpha_DEPENDENCIES = $(am__DEPENDENCIES_1)
+path_data_SOURCES = path-data.c
+path_data_OBJECTS = path-data.$(OBJEXT)
+path_data_DEPENDENCIES = $(am__DEPENDENCIES_1)
+pdf_clip_SOURCES = pdf-clip.c
+pdf_clip_OBJECTS = pdf-clip.$(OBJEXT)
+pdf_clip_DEPENDENCIES = $(am__DEPENDENCIES_1)
+pdf_surface_SOURCES = pdf-surface.c
+pdf_surface_OBJECTS = pdf-surface.$(OBJEXT)
+pdf_surface_DEPENDENCIES = $(am__DEPENDENCIES_1)
+pixman_rotate_SOURCES = pixman-rotate.c
+pixman_rotate_OBJECTS = pixman-rotate.$(OBJEXT)
+pixman_rotate_DEPENDENCIES = $(am__DEPENDENCIES_1)
+ps_surface_SOURCES = ps-surface.c
+ps_surface_OBJECTS = ps-surface.$(OBJEXT)
+ps_surface_DEPENDENCIES = $(am__DEPENDENCIES_1)
+rel_path_SOURCES = rel-path.c
+rel_path_OBJECTS = rel-path.$(OBJEXT)
+rel_path_DEPENDENCIES = $(am__DEPENDENCIES_1)
+scale_source_surface_paint_SOURCES = scale-source-surface-paint.c
+scale_source_surface_paint_OBJECTS = \
+ scale-source-surface-paint.$(OBJEXT)
+scale_source_surface_paint_DEPENDENCIES = $(am__DEPENDENCIES_1)
+select_font_no_show_text_SOURCES = select-font-no-show-text.c
+select_font_no_show_text_OBJECTS = select-font-no-show-text.$(OBJEXT)
+select_font_no_show_text_DEPENDENCIES = $(am__DEPENDENCIES_1)
+self_copy_SOURCES = self-copy.c
+self_copy_OBJECTS = self-copy.$(OBJEXT)
+self_copy_DEPENDENCIES = $(am__DEPENDENCIES_1)
+self_intersecting_SOURCES = self-intersecting.c
+self_intersecting_OBJECTS = self-intersecting.$(OBJEXT)
+self_intersecting_DEPENDENCIES = $(am__DEPENDENCIES_1)
+set_source_SOURCES = set-source.c
+set_source_OBJECTS = set-source.$(OBJEXT)
+set_source_DEPENDENCIES = $(am__DEPENDENCIES_1)
+source_clip_SOURCES = source-clip.c
+source_clip_OBJECTS = source-clip.$(OBJEXT)
+source_clip_DEPENDENCIES = $(am__DEPENDENCIES_1)
+source_surface_scale_paint_SOURCES = source-surface-scale-paint.c
+source_surface_scale_paint_OBJECTS = \
+ source-surface-scale-paint.$(OBJEXT)
+source_surface_scale_paint_DEPENDENCIES = $(am__DEPENDENCIES_1)
+surface_finish_twice_SOURCES = surface-finish-twice.c
+surface_finish_twice_OBJECTS = surface-finish-twice.$(OBJEXT)
+surface_finish_twice_DEPENDENCIES = $(am__DEPENDENCIES_1)
+surface_pattern_SOURCES = surface-pattern.c
+surface_pattern_OBJECTS = surface-pattern.$(OBJEXT)
+surface_pattern_DEPENDENCIES = $(am__DEPENDENCIES_1)
+text_cache_crash_SOURCES = text-cache-crash.c
+text_cache_crash_OBJECTS = text-cache-crash.$(OBJEXT)
+text_cache_crash_DEPENDENCIES = $(am__DEPENDENCIES_1)
+text_rotate_SOURCES = text-rotate.c
+text_rotate_OBJECTS = text-rotate.$(OBJEXT)
+text_rotate_DEPENDENCIES = $(am__DEPENDENCIES_1)
+transforms_SOURCES = transforms.c
+transforms_OBJECTS = transforms.$(OBJEXT)
+transforms_DEPENDENCIES = $(am__DEPENDENCIES_1)
+translate_show_surface_SOURCES = translate-show-surface.c
+translate_show_surface_OBJECTS = translate-show-surface.$(OBJEXT)
+translate_show_surface_DEPENDENCIES = $(am__DEPENDENCIES_1)
+trap_clip_SOURCES = trap-clip.c
+trap_clip_OBJECTS = trap-clip.$(OBJEXT)
+trap_clip_DEPENDENCIES = $(am__DEPENDENCIES_1)
+user_data_SOURCES = user-data.c
+user_data_OBJECTS = user-data.$(OBJEXT)
+user_data_DEPENDENCIES = $(am__DEPENDENCIES_1)
+xlib_surface_SOURCES = xlib-surface.c
+xlib_surface_OBJECTS = xlib-surface.$(OBJEXT)
+xlib_surface_DEPENDENCIES = $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -105,18 +209,30 @@ LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(clip_twice_SOURCES) $(coverage_SOURCES) \
- $(fill_rule_SOURCES) $(imagediff_SOURCES) \
- $(leaky_polygon_SOURCES) $(line_width_SOURCES) \
- $(linear_gradient_SOURCES) $(move_to_show_surface_SOURCES) \
- $(pixman_rotate_SOURCES) $(text_cache_crash_SOURCES) \
- $(text_rotate_SOURCES)
-DIST_SOURCES = $(clip_twice_SOURCES) $(coverage_SOURCES) \
- $(fill_rule_SOURCES) $(imagediff_SOURCES) \
- $(leaky_polygon_SOURCES) $(line_width_SOURCES) \
- $(linear_gradient_SOURCES) $(move_to_show_surface_SOURCES) \
- $(pixman_rotate_SOURCES) $(text_cache_crash_SOURCES) \
- $(text_rotate_SOURCES)
+SOURCES = $(libcairotest_la_SOURCES) clip-nesting.c clip-twice.c \
+ create-for-png.c fill-and-stroke.c fill-rule.c \
+ filter-nearest-offset.c get-and-set.c gradient-alpha.c \
+ imagediff.c leaky-polygon.c line-width.c linear-gradient.c \
+ mask.c move-to-show-surface.c paint.c paint-with-alpha.c \
+ path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c \
+ ps-surface.c rel-path.c scale-source-surface-paint.c \
+ select-font-no-show-text.c self-copy.c self-intersecting.c \
+ set-source.c source-clip.c source-surface-scale-paint.c \
+ surface-finish-twice.c surface-pattern.c text-cache-crash.c \
+ text-rotate.c transforms.c translate-show-surface.c \
+ trap-clip.c user-data.c xlib-surface.c
+DIST_SOURCES = $(libcairotest_la_SOURCES) clip-nesting.c clip-twice.c \
+ create-for-png.c fill-and-stroke.c fill-rule.c \
+ filter-nearest-offset.c get-and-set.c gradient-alpha.c \
+ imagediff.c leaky-polygon.c line-width.c linear-gradient.c \
+ mask.c move-to-show-surface.c paint.c paint-with-alpha.c \
+ path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c \
+ ps-surface.c rel-path.c scale-source-surface-paint.c \
+ select-font-no-show-text.c self-copy.c self-intersecting.c \
+ set-source.c source-clip.c source-surface-scale-paint.c \
+ surface-finish-twice.c surface-pattern.c text-cache-crash.c \
+ text-rotate.c transforms.c translate-show-surface.c \
+ trap-clip.c user-data.c xlib-surface.c
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -139,8 +255,8 @@ CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@
CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@
CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@
CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@
-CAIRO_HAS_PNG_SURFACE_FALSE = @CAIRO_HAS_PNG_SURFACE_FALSE@
-CAIRO_HAS_PNG_SURFACE_TRUE = @CAIRO_HAS_PNG_SURFACE_TRUE@
+CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@
+CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@
CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@
CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@
CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@
@@ -218,14 +334,13 @@ PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
+PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@
PNG_LIBS = @PNG_LIBS@
PNG_REQUIRES = @PNG_REQUIRES@
-PNG_SURFACE_FEATURE = @PNG_SURFACE_FEATURE@
PS_LIBS = @PS_LIBS@
PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@
QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@
RANLIB = @RANLIB@
-SANITY_CHECKING_FEATURE = @SANITY_CHECKING_FEATURE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -288,86 +403,149 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-# All new test cases go here
-TESTS = \
-fill_rule \
-leaky_polygon \
-line_width \
-linear_gradient \
-move_to_show_surface \
-text_cache_crash \
-text_rotate \
-coverage \
-clip_twice \
-pixman_rotate
-
-
-# And all new tests go here too. I really don't like having to repeat
-# this list. Anyone know a good way to avoid it? Can I use a wildcard
-# here?
+# All test cases go here
+TESTS = clip-nesting clip-twice create-for-png fill-and-stroke \
+ fill-rule filter-nearest-offset get-and-set gradient-alpha \
+ leaky-polygon line-width linear-gradient mask \
+ move-to-show-surface paint paint-with-alpha path-data \
+ pixman-rotate scale-source-surface-paint \
+ select-font-no-show-text self-copy self-intersecting \
+ set-source source-clip source-surface-scale-paint \
+ surface-finish-twice surface-pattern text-cache-crash \
+ text-rotate transforms translate-show-surface trap-clip \
+ user-data rel-path $(am__append_1) $(am__append_2) \
+ $(am__append_3)
+
+# All tests which have a reference image go here.
+# I really don't like having to repeat this list. Anyone know a good
+# way to avoid it? Can I use a wildcard here?
EXTRA_DIST = \
-fill_rule-ref.png \
-leaky_polygon-ref.png \
-line_width-ref.png \
-linear_gradient-ref.png \
-move_to_show_surface-ref.png \
-coverage-ref.png \
-clip_twice-ref.png \
-pixman_rotate-ref.png \
-romedalen.png
-
-
-# Once we can draw the text_rotate.c test case correctly, we should
-# create and add text_rotate-ref.png to the list of reference PNGs.
-
-# This list is only for known bugs (not regressions). We do need to
-# fix these before the next release, but they are expected to fail for
-# now, so they don't need to hold up any new code commit.
+clip-nesting-ref.png \
+clip-twice-ref.png \
+create-for-png-ref.png \
+fill-and-stroke-ref.png \
+fill-rule-ref.png \
+filter-nearest-offset-ref.png \
+gradient-alpha-ref.png \
+leaky-polygon-ref.png \
+line-width-ref.png \
+linear-gradient-ref.png \
+mask-ref.png \
+move-to-show-surface-ref.png \
+paint-ref.png \
+paint-with-alpha-ref.png \
+path-data-ref.png \
+pixman-rotate-ref.png \
+romedalen.png \
+self-copy-ref.png \
+self-intersecting-ref.png \
+scale-source-surface-paint-ref.png \
+set-source-ref.png \
+source-clip-ref.png \
+source-surface-scale-paint-ref.png \
+surface-pattern-ref.png \
+transforms-ref.png \
+translate-show-surface-ref.png \
+trap-clip-ref.png \
+rel-path-ref.png
+
+
+# Any test for which the code committed to CVS is expected to fail
+# should be listed here.
+#
+# This way, we can avoid being bothered by reports of bugs we are
+# aware of, but users can still report when tests start behaving in
+# unexpected ways on their system.
#
-# When new bugs are found in committed code they can be listed
-# here. New failures due to local, uncommitted code changes are
-# regression bugs that should not be listed here. Instead they should
-# be fixed before the code is committed.
+# Of course, before any "release" of cairo we should eliminate
+# everything from this list by fixing the bugs. (We don't necessarily
+# have to be that strict for "snapshots" though.)
+#
+# Also, any test listed here should call cairo_test_expect_failure and
+# provide an explanation for the expected failure.
XFAIL_TESTS = \
-move_to_show_surface \
-pixman_rotate \
-text_rotate
+filter-nearest-offset \
+pixman-rotate \
+self-intersecting \
+source-surface-scale-paint \
+text-rotate
# We're using _GNU_SOURCE to get the prototype for asprintf. This may
# not be the most portable approach, but it is pragmatic and I'm
# willing to do something cleaner as soon as it causes someone a
# problem.
-INCLUDES = -D_GNU_SOURCE -I$(srcdir) $(CAIRO_CFLAGS) -I$(srcdir)/../src
-AM_LDFLAGS = $(CAIRO_LIBS) ../src/libcairo.la
-cairo_test_lib = \
-buffer_diff.c \
-buffer_diff.h \
-cairo_test.c \
-cairo_test.h \
-read_png.c \
-read_png.h \
-write_png.c \
-write_png.h \
+INCLUDES = \
+ -D_GNU_SOURCE \
+ $(CAIRO_CFLAGS) \
+ -I$(srcdir) \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src
+
+noinst_LTLIBRARIES = libcairotest.la
+libcairotest_la_SOURCES = \
+buffer-diff.c \
+buffer-diff.h \
+cairo-test.c \
+cairo-test.h \
+read-png.c \
+read-png.h \
+write-png.c \
+write-png.h \
xmalloc.c \
xmalloc.h
+LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la
# ARGH! I have to repeat the list of tests a third time. Maybe it's
# time to break down and auto-generate the Makefile.am or something
# from autogen.sh. My, but this is painful...
-fill_rule_SOURCES = fill_rule.c $(cairo_test_lib)
-leaky_polygon_SOURCES = leaky_polygon.c $(cairo_test_lib)
-line_width_SOURCES = line_width.c $(cairo_test_lib)
-linear_gradient_SOURCES = linear_gradient.c $(cairo_test_lib)
-move_to_show_surface_SOURCES = move_to_show_surface.c $(cairo_test_lib)
-text_cache_crash_SOURCES = text_cache_crash.c $(cairo_test_lib)
-text_rotate_SOURCES = text_rotate.c $(cairo_test_lib)
-coverage_SOURCES = coverage.c $(cairo_test_lib)
-clip_twice_SOURCES = clip_twice.c $(cairo_test_lib)
-pixman_rotate_SOURCES = pixman_rotate.c $(cairo_test_lib)
-imagediff_SOURCES = imagediff.c $(cairo_test_lib)
-CLEANFILES = *-out.png *-diff.png *.log
+clip_nesting_LDADD = $(LDADDS)
+clip_twice_LDADD = $(LDADDS)
+create_for_png_LDADD = $(LDADDS)
+fill_and_stroke_LDADD = $(LDADDS)
+fill_rule_LDADD = $(LDADDS)
+filter_nearest_offset_LDADD = $(LDADDS)
+get_and_set_LDADD = $(LDADDS)
+gradient_alpha_LDADD = $(LDADDS)
+leaky_polygon_LDADD = $(LDADDS)
+line_width_LDADD = $(LDADDS)
+linear_gradient_LDADD = $(LDADDS)
+mask_LDADD = $(LDADDS)
+move_to_show_surface_LDADD = $(LDADDS)
+paint_LDADD = $(LDADDS)
+paint_with_alpha_LDADD = $(LDADDS)
+path_data_LDADD = $(LDADDS)
+pdf_surface_LDADD = $(LDADDS)
+pdf_clip_LDADD = $(LDADDS)
+ps_surface_LDADD = $(LDADDS)
+pixman_rotate_LDADD = $(LDADDS)
+scale_source_surface_paint_LDADD = $(LDADDS)
+select_font_no_show_text_LDADD = $(LDADDS)
+self_copy_LDADD = $(LDADDS)
+self_intersecting_LDADD = $(LDADDS)
+set_source_LDADD = $(LDADDS)
+source_clip_LDADD = $(LDADDS)
+source_surface_scale_paint_LDADD = $(LDADDS)
+surface_finish_twice_LDADD = $(LDADDS)
+surface_pattern_LDADD = $(LDADDS)
+text_cache_crash_LDADD = $(LDADDS)
+text_rotate_LDADD = $(LDADDS)
+transforms_LDADD = $(LDADDS)
+translate_show_surface_LDADD = $(LDADDS)
+trap_clip_LDADD = $(LDADDS)
+user_data_LDADD = $(LDADDS)
+rel_path_LDADD = $(LDADDS)
+xlib_surface_LDADD = $(LDADDS)
+imagediff_LDADD = $(LDADDS)
+CLEANFILES = \
+ *-out.png \
+ *-diff.png \
+ *.log \
+ ps-surface.ps \
+ pdf-surface.pdf \
+ pdf-clip.pdf
+
all: all-am
.SUFFIXES:
@@ -402,6 +580,17 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libcairotest.la: $(libcairotest_la_OBJECTS) $(libcairotest_la_DEPENDENCIES)
+ $(LINK) $(libcairotest_la_LDFLAGS) $(libcairotest_la_OBJECTS) $(libcairotest_la_LIBADD) $(LIBS)
+
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
@@ -415,39 +604,120 @@ clean-noinstPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-clip_twice$(EXEEXT): $(clip_twice_OBJECTS) $(clip_twice_DEPENDENCIES)
- @rm -f clip_twice$(EXEEXT)
+clip-nesting$(EXEEXT): $(clip_nesting_OBJECTS) $(clip_nesting_DEPENDENCIES)
+ @rm -f clip-nesting$(EXEEXT)
+ $(LINK) $(clip_nesting_LDFLAGS) $(clip_nesting_OBJECTS) $(clip_nesting_LDADD) $(LIBS)
+clip-twice$(EXEEXT): $(clip_twice_OBJECTS) $(clip_twice_DEPENDENCIES)
+ @rm -f clip-twice$(EXEEXT)
$(LINK) $(clip_twice_LDFLAGS) $(clip_twice_OBJECTS) $(clip_twice_LDADD) $(LIBS)
-coverage$(EXEEXT): $(coverage_OBJECTS) $(coverage_DEPENDENCIES)
- @rm -f coverage$(EXEEXT)
- $(LINK) $(coverage_LDFLAGS) $(coverage_OBJECTS) $(coverage_LDADD) $(LIBS)
-fill_rule$(EXEEXT): $(fill_rule_OBJECTS) $(fill_rule_DEPENDENCIES)
- @rm -f fill_rule$(EXEEXT)
+create-for-png$(EXEEXT): $(create_for_png_OBJECTS) $(create_for_png_DEPENDENCIES)
+ @rm -f create-for-png$(EXEEXT)
+ $(LINK) $(create_for_png_LDFLAGS) $(create_for_png_OBJECTS) $(create_for_png_LDADD) $(LIBS)
+fill-and-stroke$(EXEEXT): $(fill_and_stroke_OBJECTS) $(fill_and_stroke_DEPENDENCIES)
+ @rm -f fill-and-stroke$(EXEEXT)
+ $(LINK) $(fill_and_stroke_LDFLAGS) $(fill_and_stroke_OBJECTS) $(fill_and_stroke_LDADD) $(LIBS)
+fill-rule$(EXEEXT): $(fill_rule_OBJECTS) $(fill_rule_DEPENDENCIES)
+ @rm -f fill-rule$(EXEEXT)
$(LINK) $(fill_rule_LDFLAGS) $(fill_rule_OBJECTS) $(fill_rule_LDADD) $(LIBS)
+filter-nearest-offset$(EXEEXT): $(filter_nearest_offset_OBJECTS) $(filter_nearest_offset_DEPENDENCIES)
+ @rm -f filter-nearest-offset$(EXEEXT)
+ $(LINK) $(filter_nearest_offset_LDFLAGS) $(filter_nearest_offset_OBJECTS) $(filter_nearest_offset_LDADD) $(LIBS)
+get-and-set$(EXEEXT): $(get_and_set_OBJECTS) $(get_and_set_DEPENDENCIES)
+ @rm -f get-and-set$(EXEEXT)
+ $(LINK) $(get_and_set_LDFLAGS) $(get_and_set_OBJECTS) $(get_and_set_LDADD) $(LIBS)
+gradient-alpha$(EXEEXT): $(gradient_alpha_OBJECTS) $(gradient_alpha_DEPENDENCIES)
+ @rm -f gradient-alpha$(EXEEXT)
+ $(LINK) $(gradient_alpha_LDFLAGS) $(gradient_alpha_OBJECTS) $(gradient_alpha_LDADD) $(LIBS)
imagediff$(EXEEXT): $(imagediff_OBJECTS) $(imagediff_DEPENDENCIES)
@rm -f imagediff$(EXEEXT)
$(LINK) $(imagediff_LDFLAGS) $(imagediff_OBJECTS) $(imagediff_LDADD) $(LIBS)
-leaky_polygon$(EXEEXT): $(leaky_polygon_OBJECTS) $(leaky_polygon_DEPENDENCIES)
- @rm -f leaky_polygon$(EXEEXT)
+leaky-polygon$(EXEEXT): $(leaky_polygon_OBJECTS) $(leaky_polygon_DEPENDENCIES)
+ @rm -f leaky-polygon$(EXEEXT)
$(LINK) $(leaky_polygon_LDFLAGS) $(leaky_polygon_OBJECTS) $(leaky_polygon_LDADD) $(LIBS)
-line_width$(EXEEXT): $(line_width_OBJECTS) $(line_width_DEPENDENCIES)
- @rm -f line_width$(EXEEXT)
+line-width$(EXEEXT): $(line_width_OBJECTS) $(line_width_DEPENDENCIES)
+ @rm -f line-width$(EXEEXT)
$(LINK) $(line_width_LDFLAGS) $(line_width_OBJECTS) $(line_width_LDADD) $(LIBS)
-linear_gradient$(EXEEXT): $(linear_gradient_OBJECTS) $(linear_gradient_DEPENDENCIES)
- @rm -f linear_gradient$(EXEEXT)
+linear-gradient$(EXEEXT): $(linear_gradient_OBJECTS) $(linear_gradient_DEPENDENCIES)
+ @rm -f linear-gradient$(EXEEXT)
$(LINK) $(linear_gradient_LDFLAGS) $(linear_gradient_OBJECTS) $(linear_gradient_LDADD) $(LIBS)
-move_to_show_surface$(EXEEXT): $(move_to_show_surface_OBJECTS) $(move_to_show_surface_DEPENDENCIES)
- @rm -f move_to_show_surface$(EXEEXT)
+mask$(EXEEXT): $(mask_OBJECTS) $(mask_DEPENDENCIES)
+ @rm -f mask$(EXEEXT)
+ $(LINK) $(mask_LDFLAGS) $(mask_OBJECTS) $(mask_LDADD) $(LIBS)
+move-to-show-surface$(EXEEXT): $(move_to_show_surface_OBJECTS) $(move_to_show_surface_DEPENDENCIES)
+ @rm -f move-to-show-surface$(EXEEXT)
$(LINK) $(move_to_show_surface_LDFLAGS) $(move_to_show_surface_OBJECTS) $(move_to_show_surface_LDADD) $(LIBS)
-pixman_rotate$(EXEEXT): $(pixman_rotate_OBJECTS) $(pixman_rotate_DEPENDENCIES)
- @rm -f pixman_rotate$(EXEEXT)
+paint$(EXEEXT): $(paint_OBJECTS) $(paint_DEPENDENCIES)
+ @rm -f paint$(EXEEXT)
+ $(LINK) $(paint_LDFLAGS) $(paint_OBJECTS) $(paint_LDADD) $(LIBS)
+paint-with-alpha$(EXEEXT): $(paint_with_alpha_OBJECTS) $(paint_with_alpha_DEPENDENCIES)
+ @rm -f paint-with-alpha$(EXEEXT)
+ $(LINK) $(paint_with_alpha_LDFLAGS) $(paint_with_alpha_OBJECTS) $(paint_with_alpha_LDADD) $(LIBS)
+path-data$(EXEEXT): $(path_data_OBJECTS) $(path_data_DEPENDENCIES)
+ @rm -f path-data$(EXEEXT)
+ $(LINK) $(path_data_LDFLAGS) $(path_data_OBJECTS) $(path_data_LDADD) $(LIBS)
+pdf-clip$(EXEEXT): $(pdf_clip_OBJECTS) $(pdf_clip_DEPENDENCIES)
+ @rm -f pdf-clip$(EXEEXT)
+ $(LINK) $(pdf_clip_LDFLAGS) $(pdf_clip_OBJECTS) $(pdf_clip_LDADD) $(LIBS)
+pdf-surface$(EXEEXT): $(pdf_surface_OBJECTS) $(pdf_surface_DEPENDENCIES)
+ @rm -f pdf-surface$(EXEEXT)
+ $(LINK) $(pdf_surface_LDFLAGS) $(pdf_surface_OBJECTS) $(pdf_surface_LDADD) $(LIBS)
+pixman-rotate$(EXEEXT): $(pixman_rotate_OBJECTS) $(pixman_rotate_DEPENDENCIES)
+ @rm -f pixman-rotate$(EXEEXT)
$(LINK) $(pixman_rotate_LDFLAGS) $(pixman_rotate_OBJECTS) $(pixman_rotate_LDADD) $(LIBS)
-text_cache_crash$(EXEEXT): $(text_cache_crash_OBJECTS) $(text_cache_crash_DEPENDENCIES)
- @rm -f text_cache_crash$(EXEEXT)
+ps-surface$(EXEEXT): $(ps_surface_OBJECTS) $(ps_surface_DEPENDENCIES)
+ @rm -f ps-surface$(EXEEXT)
+ $(LINK) $(ps_surface_LDFLAGS) $(ps_surface_OBJECTS) $(ps_surface_LDADD) $(LIBS)
+rel-path$(EXEEXT): $(rel_path_OBJECTS) $(rel_path_DEPENDENCIES)
+ @rm -f rel-path$(EXEEXT)
+ $(LINK) $(rel_path_LDFLAGS) $(rel_path_OBJECTS) $(rel_path_LDADD) $(LIBS)
+scale-source-surface-paint$(EXEEXT): $(scale_source_surface_paint_OBJECTS) $(scale_source_surface_paint_DEPENDENCIES)
+ @rm -f scale-source-surface-paint$(EXEEXT)
+ $(LINK) $(scale_source_surface_paint_LDFLAGS) $(scale_source_surface_paint_OBJECTS) $(scale_source_surface_paint_LDADD) $(LIBS)
+select-font-no-show-text$(EXEEXT): $(select_font_no_show_text_OBJECTS) $(select_font_no_show_text_DEPENDENCIES)
+ @rm -f select-font-no-show-text$(EXEEXT)
+ $(LINK) $(select_font_no_show_text_LDFLAGS) $(select_font_no_show_text_OBJECTS) $(select_font_no_show_text_LDADD) $(LIBS)
+self-copy$(EXEEXT): $(self_copy_OBJECTS) $(self_copy_DEPENDENCIES)
+ @rm -f self-copy$(EXEEXT)
+ $(LINK) $(self_copy_LDFLAGS) $(self_copy_OBJECTS) $(self_copy_LDADD) $(LIBS)
+self-intersecting$(EXEEXT): $(self_intersecting_OBJECTS) $(self_intersecting_DEPENDENCIES)
+ @rm -f self-intersecting$(EXEEXT)
+ $(LINK) $(self_intersecting_LDFLAGS) $(self_intersecting_OBJECTS) $(self_intersecting_LDADD) $(LIBS)
+set-source$(EXEEXT): $(set_source_OBJECTS) $(set_source_DEPENDENCIES)
+ @rm -f set-source$(EXEEXT)
+ $(LINK) $(set_source_LDFLAGS) $(set_source_OBJECTS) $(set_source_LDADD) $(LIBS)
+source-clip$(EXEEXT): $(source_clip_OBJECTS) $(source_clip_DEPENDENCIES)
+ @rm -f source-clip$(EXEEXT)
+ $(LINK) $(source_clip_LDFLAGS) $(source_clip_OBJECTS) $(source_clip_LDADD) $(LIBS)
+source-surface-scale-paint$(EXEEXT): $(source_surface_scale_paint_OBJECTS) $(source_surface_scale_paint_DEPENDENCIES)
+ @rm -f source-surface-scale-paint$(EXEEXT)
+ $(LINK) $(source_surface_scale_paint_LDFLAGS) $(source_surface_scale_paint_OBJECTS) $(source_surface_scale_paint_LDADD) $(LIBS)
+surface-finish-twice$(EXEEXT): $(surface_finish_twice_OBJECTS) $(surface_finish_twice_DEPENDENCIES)
+ @rm -f surface-finish-twice$(EXEEXT)
+ $(LINK) $(surface_finish_twice_LDFLAGS) $(surface_finish_twice_OBJECTS) $(surface_finish_twice_LDADD) $(LIBS)
+surface-pattern$(EXEEXT): $(surface_pattern_OBJECTS) $(surface_pattern_DEPENDENCIES)
+ @rm -f surface-pattern$(EXEEXT)
+ $(LINK) $(surface_pattern_LDFLAGS) $(surface_pattern_OBJECTS) $(surface_pattern_LDADD) $(LIBS)
+text-cache-crash$(EXEEXT): $(text_cache_crash_OBJECTS) $(text_cache_crash_DEPENDENCIES)
+ @rm -f text-cache-crash$(EXEEXT)
$(LINK) $(text_cache_crash_LDFLAGS) $(text_cache_crash_OBJECTS) $(text_cache_crash_LDADD) $(LIBS)
-text_rotate$(EXEEXT): $(text_rotate_OBJECTS) $(text_rotate_DEPENDENCIES)
- @rm -f text_rotate$(EXEEXT)
+text-rotate$(EXEEXT): $(text_rotate_OBJECTS) $(text_rotate_DEPENDENCIES)
+ @rm -f text-rotate$(EXEEXT)
$(LINK) $(text_rotate_LDFLAGS) $(text_rotate_OBJECTS) $(text_rotate_LDADD) $(LIBS)
+transforms$(EXEEXT): $(transforms_OBJECTS) $(transforms_DEPENDENCIES)
+ @rm -f transforms$(EXEEXT)
+ $(LINK) $(transforms_LDFLAGS) $(transforms_OBJECTS) $(transforms_LDADD) $(LIBS)
+translate-show-surface$(EXEEXT): $(translate_show_surface_OBJECTS) $(translate_show_surface_DEPENDENCIES)
+ @rm -f translate-show-surface$(EXEEXT)
+ $(LINK) $(translate_show_surface_LDFLAGS) $(translate_show_surface_OBJECTS) $(translate_show_surface_LDADD) $(LIBS)
+trap-clip$(EXEEXT): $(trap_clip_OBJECTS) $(trap_clip_DEPENDENCIES)
+ @rm -f trap-clip$(EXEEXT)
+ $(LINK) $(trap_clip_LDFLAGS) $(trap_clip_OBJECTS) $(trap_clip_LDADD) $(LIBS)
+user-data$(EXEEXT): $(user_data_OBJECTS) $(user_data_DEPENDENCIES)
+ @rm -f user-data$(EXEEXT)
+ $(LINK) $(user_data_LDFLAGS) $(user_data_OBJECTS) $(user_data_LDADD) $(LIBS)
+xlib-surface$(EXEEXT): $(xlib_surface_OBJECTS) $(xlib_surface_DEPENDENCIES)
+ @rm -f xlib-surface$(EXEEXT)
+ $(LINK) $(xlib_surface_LDFLAGS) $(xlib_surface_OBJECTS) $(xlib_surface_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -455,22 +725,49 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer_diff.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo_test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip_twice.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coverage.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill_rule.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer-diff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-test.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-nesting.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-twice.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/create-for-png.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill-and-stroke.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fill-rule.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter-nearest-offset.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-and-set.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-alpha.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imagediff.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leaky_polygon.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_width.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linear_gradient.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_to_show_surface.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman_rotate.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_png.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_cache_crash.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_rotate.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write_png.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leaky-polygon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line-width.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linear-gradient.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mask.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move-to-show-surface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paint-with-alpha.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path-data.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdf-clip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdf-surface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixman-rotate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ps-surface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-png.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rel-path.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scale-source-surface-paint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select-font-no-show-text.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/self-copy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/self-intersecting.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set-source.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source-clip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source-surface-scale-paint.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface-finish-twice.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface-pattern.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-cache-crash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text-rotate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transforms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/translate-show-surface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap-clip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user-data.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write-png.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlib-surface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@@ -655,7 +952,7 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-all-am: Makefile $(PROGRAMS)
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
@@ -685,7 +982,7 @@ maintainer-clean-generic:
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
- clean-noinstPROGRAMS mostlyclean-am
+ clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -735,15 +1032,16 @@ uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool \
- clean-noinstPROGRAMS ctags distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-exec install-exec-am \
- install-info install-info-am install-man install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-info-am
+ clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/test/buffer-diff.c b/test/buffer-diff.c
new file mode 100644
index 0000000..e540d2f
--- /dev/null
+++ b/test/buffer-diff.c
@@ -0,0 +1,150 @@
+/* imagediff - Compare two images
+ *
+ * Copyright © 2004 Richard D. Worth
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Richard Worth
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ * Richard Worth makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ * RICHARD WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL RICHARD WORTH BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Richard D. Worth <richard@theworths.org> */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include "cairo-test.h"
+
+#include "buffer-diff.h"
+#include "read-png.h"
+#include "write-png.h"
+#include "xmalloc.h"
+
+static void
+xunlink (const char *pathname)
+{
+ if (unlink (pathname) < 0 && errno != ENOENT) {
+ cairo_test_log (" Error: Cannot remove %s: %s\n",
+ pathname, strerror (errno));
+ exit (1);
+ }
+}
+
+int
+buffer_diff (unsigned char *buf_a,
+ unsigned char *buf_b,
+ unsigned char *buf_diff,
+ int width,
+ int height,
+ int stride)
+{
+ int x, y;
+ unsigned char *row_a, *row_b, *row;
+ int pixels_changed = 0;
+
+ for (y = 0; y < height; y++)
+ {
+ row_a = buf_a + y * stride;
+ row_b = buf_b + y * stride;
+ row = buf_diff + y * stride;
+ for (x = 0; x < width; x++)
+ {
+ int channel;
+ unsigned char value_a, value_b;
+ int pixel_differs = 0;
+ for (channel = 0; channel < 4; channel++)
+ {
+ double diff;
+ value_a = row_a[x * 4 + channel];
+ value_b = row_b[x * 4 + channel];
+ if (value_a != value_b)
+ pixel_differs = 1;
+ diff = value_a - value_b;
+ row[x * 4 + channel] = 128 + diff / 3.0;
+ }
+ if (pixel_differs) {
+ pixels_changed++;
+ } else {
+ row[x*4+0] = 0;
+ row[x*4+1] = 0;
+ row[x*4+2] = 0;
+ }
+ row[x * 4 + 3] = 0xff; /* Set ALPHA to 100% (opaque) */
+ }
+ }
+
+ return pixels_changed;
+}
+
+/* Image comparison code courtesy of Richard Worth <richard@theworths.org>
+ * Returns number of pixels changed, (or -1 on error).
+ * Also saves a "diff" image intended to visually show where the
+ * images differ.
+ */
+int
+image_diff (const char *filename_a,
+ const char *filename_b,
+ const char *filename_diff)
+{
+ int pixels_changed;
+ unsigned int width_a, height_a, stride_a;
+ unsigned int width_b, height_b, stride_b;
+ unsigned char *buf_a, *buf_b, *buf_diff;
+ read_png_status_t status;
+
+ status = read_png_argb32 (filename_a, &buf_a, &width_a, &height_a, &stride_a);
+ if (status)
+ return -1;
+
+ status = read_png_argb32 (filename_b, &buf_b, &width_b, &height_b, &stride_b);
+ if (status)
+ return -1;
+
+ if (width_a != width_b ||
+ height_a != height_b ||
+ stride_a != stride_b)
+ {
+ cairo_test_log ("Error: Image size mismatch: (%dx%d@%d) vs. (%dx%d@%d)\n"
+ " for %s vs. %s\n",
+ width_a, height_a, stride_a,
+ width_b, height_b, stride_b,
+ filename_a, filename_b);
+ free (buf_a);
+ free (buf_b);
+ return -1;
+ }
+
+ buf_diff = xcalloc (stride_a * height_a, 1);
+
+ pixels_changed = buffer_diff (buf_a, buf_b, buf_diff,
+ width_a, height_a, stride_a);
+
+ if (pixels_changed) {
+ FILE *png_file = fopen (filename_diff, "wb");
+ write_png_argb32 (buf_diff, png_file, width_a, height_a, stride_a);
+ fclose (png_file);
+ } else {
+ xunlink (filename_diff);
+ }
+
+ free (buf_a);
+ free (buf_b);
+ free (buf_diff);
+
+ return pixels_changed;
+}
diff --git a/test/buffer_diff.h b/test/buffer-diff.h
index 9ee51c3..a02834f 100644
--- a/test/buffer_diff.h
+++ b/test/buffer-diff.h
@@ -26,13 +26,25 @@
#ifndef BUFFER_DIFF_H
#define BUFFER_DIFF_H
-/* Image comparison code courttesy of Richard Worth.
- * Returns number of pixels changed.
- * Also fills out a "diff" image intended to visually show where the
+/* Returns number of pixels changed, (or -1 on error).
+ * Also fills in a "diff" buffer intended to visually show where the
* images differ.
*/
int
-buffer_diff (char *buf_a, char *buf_b, char *buf_diff,
- int width, int height, int stride);
+buffer_diff (unsigned char *buf_a,
+ unsigned char *buf_b,
+ unsigned char *buf_diff,
+ int width,
+ int height,
+ int stride);
+
+/* Returns number of pixels changed, (or -1 on error).
+ * Also saves a "diff" image intended to visually show where the
+ * images differ.
+ */
+int
+image_diff (const char *filename_a,
+ const char *filename_b,
+ const char *filename_diff);
#endif
diff --git a/test/buffer_diff.c b/test/buffer_diff.c
deleted file mode 100644
index 07abd62..0000000
--- a/test/buffer_diff.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* imagediff - Compare two images
- *
- * Copyright © 2004 Richard D. Worth
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of Richard Worth
- * not be used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.
- * Richard Worth makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express
- * or implied warranty.
- *
- * RICHARD WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL RICHARD WORTH BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Richard D. Worth <richard@theworths.org> */
-
-#include "buffer_diff.h"
-
-/* Image comparison code courttesy of Richard Worth.
- * Returns number of pixels changed.
- * Also fills out a "diff" image intended to visually show where the
- * images differ.
- */
-int
-buffer_diff (char *buf_a, char *buf_b, char *buf_diff,
- int width, int height, int stride)
-{
- int x, y;
- int total_pixels_changed = 0;
- unsigned char *row_a, *row_b, *row;
-
- for (y = 0; y < height; y++)
- {
- row_a = buf_a + y * stride;
- row_b = buf_b + y * stride;
- row = buf_diff + y * stride;
- for (x = 0; x < width; x++)
- {
- int channel;
- unsigned char value_a, value_b;
- int pixel_changed = 0;
- for (channel = 0; channel < 4; channel++)
- {
- double diff;
- value_a = row_a[x * 4 + channel];
- value_b = row_b[x * 4 + channel];
- if (value_a != value_b)
- pixel_changed = 1;
- diff = value_a - value_b;
- row[x * 4 + channel] = 128 + diff / 3.0;
- }
- if (pixel_changed) {
- total_pixels_changed++;
- } else {
- row[x*4+0] = 0;
- row[x*4+1] = 0;
- row[x*4+2] = 0;
- }
- row[x * 4 + 3] = 0xff; /* Set ALPHA to 100% (opaque) */
- }
- }
-
- return total_pixels_changed;
-}
diff --git a/test/cairo-test.c b/test/cairo-test.c
new file mode 100644
index 0000000..a17cd6f
--- /dev/null
+++ b/test/cairo-test.c
@@ -0,0 +1,579 @@
+/*
+ * Copyright  2004 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include "cairo-test.h"
+
+#include "buffer-diff.h"
+#include "read-png.h"
+#include "write-png.h"
+#include "xmalloc.h"
+
+#define CAIRO_TEST_LOG_SUFFIX ".log"
+#define CAIRO_TEST_PNG_SUFFIX "-out.png"
+#define CAIRO_TEST_REF_SUFFIX "-ref.png"
+#define CAIRO_TEST_DIFF_SUFFIX "-diff.png"
+
+/* Static data is messy, but we're coding for tests here, not a
+ * general-purpose library, and it keeps the tests cleaner to avoid a
+ * context object there, (though not a whole lot). */
+FILE *cairo_test_log_file;
+
+void
+cairo_test_log (const char *fmt, ...)
+{
+ va_list va;
+
+ va_start (va, fmt);
+ vfprintf (cairo_test_log_file, fmt, va);
+ va_end (va);
+}
+
+void
+xasprintf (char **strp, const char *fmt, ...)
+{
+#ifdef HAVE_VASPRINTF
+ va_list va;
+ int ret;
+
+ va_start (va, fmt);
+ ret = vasprintf (strp, fmt, va);
+ va_end (va);
+
+ if (ret < 0) {
+ cairo_test_log ("Out of memory\n");
+ exit (1);
+ }
+#else /* !HAVE_VASNPRINTF */
+#define BUF_SIZE 1024
+ va_list va;
+ char buffer[BUF_SIZE];
+ int ret;
+
+ va_start (va, fmt);
+ ret = vsnprintf (buffer, sizeof(buffer), fmt, va);
+ va_end (va);
+
+ if (ret < 0) {
+ cairo_test_log ("Failure in vsnprintf\n");
+ exit (1);
+ }
+
+ if (strlen (buffer) == sizeof(buffer) - 1) {
+ cairo_test_log ("Overflowed fixed buffer\n");
+ exit (1);
+ }
+
+ *strp = strdup (buffer);
+ if (!*strp) {
+ cairo_test_log ("Out of memory\n");
+ exit (1);
+ }
+#endif /* !HAVE_VASNPRINTF */
+}
+
+static void
+xunlink (const char *pathname)
+{
+ if (unlink (pathname) < 0 && errno != ENOENT) {
+ cairo_test_log (" Error: Cannot remove %s: %s\n",
+ pathname, strerror (errno));
+ exit (1);
+ }
+}
+
+typedef cairo_surface_t *
+(*cairo_test_create_target_surface_t) (int width, int height, void **closure);
+
+typedef void
+(*cairo_test_cleanup_target_t) (void *closure);
+
+typedef struct _cairo_test_target
+{
+ const char *name;
+ cairo_test_create_target_surface_t create_target_surface;
+ cairo_test_cleanup_target_t cleanup_target;
+ void *closure;
+} cairo_test_target_t;
+
+static cairo_surface_t *
+create_image_surface (int width, int height, void **closure)
+{
+ int stride = 4 * width;
+ unsigned char *buf;
+
+ *closure = buf = xcalloc (stride * height, 1);
+
+ return cairo_image_surface_create_for_data (buf,
+ CAIRO_FORMAT_ARGB32,
+ width, height, stride);
+}
+
+static void
+cleanup_image (void *closure)
+{
+ unsigned char *buf = closure;
+
+ free (buf);
+}
+
+/* XXX: Someone who knows glitz better than I do should fix this up to
+ * work. */
+#if 0 /* #ifdef CAIRO_HAS_GLITZ_SURFACE */
+static cairo_surface_t *
+create_glitz_surface (int width, int height, void **closure)
+{
+#error Not yet implemented
+}
+
+static void
+cleanup_glitz (cairo_t *cr)
+{
+#error Not yet implemented
+}
+#endif
+
+#if CAIRO_HAS_QUARTZ_SURFACE
+static cairo_surface_t *
+create_quartz_surface (int width, int height, void **closure)
+{
+#error Not yet implemented
+}
+
+static void
+cleanup_quartz (void *closure)
+{
+#error Not yet implemented
+}
+#endif
+
+/* Testing the win32 surface isn't interesting, since for
+ * ARGB images it just chains to the image backend
+ */
+#if 0 && CAIRO_HAS_WIN32_SURFACE
+static cairo_surface_t *
+create_win32_surface (int width, int height, void **closure)
+{
+#error Not yet implemented
+}
+
+static void
+cleanup_win32 (void *closure)
+{
+#error Not yet implemented
+}
+#endif
+
+#if CAIRO_HAS_XCB_SURFACE
+#include "cairo-xcb-xrender.h"
+typedef struct _xcb_target_closure
+{
+ XCBConnection *c;
+ XCBDRAWABLE drawable;
+} xcb_target_closure_t;
+
+/* XXX: This is a nasty hack. Something like this should be in XCB's
+ * bindings for Render, not here in this test. */
+static XCBRenderPICTFORMINFO
+_format_from_cairo(XCBConnection *c, cairo_format_t fmt)
+{
+ XCBRenderPICTFORMINFO ret = {{ 0 }};
+ struct tmpl_t {
+ XCBRenderDIRECTFORMAT direct;
+ CARD8 depth;
+ };
+ static const struct tmpl_t templates[] = {
+ /* CAIRO_FORMAT_ARGB32 */
+ {
+ {
+ 16, 0xff,
+ 8, 0xff,
+ 0, 0xff,
+ 24, 0xff
+ },
+ 32
+ },
+ /* CAIRO_FORMAT_RGB24 */
+ {
+ {
+ 16, 0xff,
+ 8, 0xff,
+ 0, 0xff,
+ 0, 0x00
+ },
+ 24
+ },
+ /* CAIRO_FORMAT_A8 */
+ {
+ {
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0xff
+ },
+ 8
+ },
+ /* CAIRO_FORMAT_A1 */
+ {
+ {
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0x00,
+ 0, 0x01
+ },
+ 1
+ },
+ };
+ const struct tmpl_t *tmpl;
+ XCBRenderQueryPictFormatsRep *r;
+ XCBRenderPICTFORMINFOIter fi;
+
+ if(fmt < 0 || fmt >= (sizeof(templates) / sizeof(*templates)))
+ return ret;
+ tmpl = templates + fmt;
+
+ r = XCBRenderQueryPictFormatsReply(c, XCBRenderQueryPictFormats(c), 0);
+ if(!r)
+ return ret;
+
+ for(fi = XCBRenderQueryPictFormatsFormatsIter(r); fi.rem; XCBRenderPICTFORMINFONext(&fi))
+ {
+ const XCBRenderDIRECTFORMAT *t, *f;
+ if(fi.data->type != XCBRenderPictTypeDirect)
+ continue;
+ if(fi.data->depth != tmpl->depth)
+ continue;
+ t = &tmpl->direct;
+ f = &fi.data->direct;
+ if(t->red_mask && (t->red_mask != f->red_mask || t->red_shift != f->red_shift))
+ continue;
+ if(t->green_mask && (t->green_mask != f->green_mask || t->green_shift != f->green_shift))
+ continue;
+ if(t->blue_mask && (t->blue_mask != f->blue_mask || t->blue_shift != f->blue_shift))
+ continue;
+ if(t->alpha_mask && (t->alpha_mask != f->alpha_mask || t->alpha_shift != f->alpha_shift))
+ continue;
+
+ ret = *fi.data;
+ }
+
+ free(r);
+ return ret;
+}
+
+static cairo_surface_t *
+create_xcb_surface (int width, int height, void **closure)
+{
+ XCBSCREEN *root;
+ xcb_target_closure_t *xtc;
+ cairo_surface_t *surface;
+ XCBConnection *c;
+ XCBRenderPICTFORMINFO render_format;
+
+ *closure = xtc = xmalloc (sizeof (xcb_target_closure_t));
+
+ if (width == 0)
+ width = 1;
+ if (height == 0)
+ height = 1;
+
+ xtc->c = c = XCBConnectBasic();
+ if (c == NULL) {
+ cairo_test_log ("Failed to connect to X server through XCB\n");
+ return NULL;
+ }
+
+ root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c)).data;
+
+ xtc->drawable.pixmap = XCBPIXMAPNew (c);
+ {
+ XCBDRAWABLE root_drawable;
+ root_drawable.window = root->root;
+ XCBCreatePixmap (c, 32, xtc->drawable.pixmap, root_drawable,
+ width, height);
+ }
+
+ render_format = _format_from_cairo (c, CAIRO_FORMAT_ARGB32);
+ if (render_format.id.xid == 0)
+ return NULL;
+ surface = cairo_xcb_surface_create_with_xrender_format (c, xtc->drawable,
+ &render_format,
+ width, height);
+
+ return surface;
+}
+
+static void
+cleanup_xcb (void *closure)
+{
+ xcb_target_closure_t *xtc = closure;
+
+ XCBFreePixmap (xtc->c, xtc->drawable.pixmap);
+ XCBDisconnect (xtc->c);
+}
+#endif
+
+#if CAIRO_HAS_XLIB_SURFACE
+#include "cairo-xlib-xrender.h"
+typedef struct _xlib_target_closure
+{
+ Display *dpy;
+ Pixmap pixmap;
+} xlib_target_closure_t;
+
+static cairo_surface_t *
+create_xlib_surface (int width, int height, void **closure)
+{
+ xlib_target_closure_t *xtc;
+ cairo_surface_t *surface;
+ Display *dpy;
+ XRenderPictFormat *xrender_format;
+
+ *closure = xtc = xmalloc (sizeof (xlib_target_closure_t));
+
+ if (width == 0)
+ width = 1;
+ if (height == 0)
+ height = 1;
+
+ xtc->dpy = dpy = XOpenDisplay (0);
+ if (xtc->dpy == NULL) {
+ cairo_test_log ("Failed to open display: %s\n", XDisplayName(0));
+ return NULL;
+ }
+
+ xrender_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
+
+ xtc->pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
+ width, height, xrender_format->depth);
+
+ surface = cairo_xlib_surface_create_with_xrender_format (dpy, xtc->pixmap,
+ xrender_format,
+ width, height);
+ return surface;
+}
+
+static void
+cleanup_xlib (void *closure)
+{
+ xlib_target_closure_t *xtc = closure;
+
+ XFreePixmap (xtc->dpy, xtc->pixmap);
+ XCloseDisplay (xtc->dpy);
+}
+#endif
+
+static cairo_test_status_t
+cairo_test_for_target (cairo_test_t *test,
+ cairo_test_draw_function_t draw,
+ cairo_test_target_t *target)
+{
+ cairo_test_status_t status;
+ cairo_surface_t *surface;
+ cairo_t *cr;
+ char *png_name, *ref_name, *diff_name;
+ char *srcdir;
+ int pixels_changed;
+ cairo_test_status_t ret;
+
+ /* Get the strings ready that we'll need. */
+ srcdir = getenv ("srcdir");
+ if (!srcdir)
+ srcdir = ".";
+ xasprintf (&png_name, "%s-%s%s", test->name,
+ target->name, CAIRO_TEST_PNG_SUFFIX);
+ xasprintf (&ref_name, "%s/%s%s", srcdir, test->name,
+ CAIRO_TEST_REF_SUFFIX);
+ xasprintf (&diff_name, "%s-%s%s", test->name,
+ target->name, CAIRO_TEST_DIFF_SUFFIX);
+
+ /* Run the actual drawing code. */
+ surface = (target->create_target_surface) (test->width, test->height,
+ &target->closure);
+ if (surface == NULL) {
+ cairo_test_log ("Error: Failed to set %s target\n", target->name);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cr = cairo_create (surface);
+
+ cairo_save (cr);
+ cairo_set_source_rgba (cr, 0, 0, 0, 0);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_paint (cr);
+ cairo_restore (cr);
+
+ status = (draw) (cr, test->width, test->height);
+
+ /* Then, check all the different ways it could fail. */
+ if (status) {
+ cairo_test_log ("Error: Function under test failed\n");
+ return status;
+ }
+
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
+ cairo_test_log ("Error: Function under test left cairo status in an error state: %s\n",
+ cairo_status_to_string (cairo_status (cr)));
+ return CAIRO_TEST_FAILURE;
+ }
+
+ /* Skip image check for tests with no image (width,height == 0,0) */
+ if (test->width == 0 || test->height == 0) {
+ cairo_destroy (cr);
+ return CAIRO_TEST_SUCCESS;
+ }
+
+ cairo_surface_write_to_png (surface, png_name);
+
+ cairo_destroy (cr);
+
+ cairo_surface_destroy (surface);
+
+ target->cleanup_target (target->closure);
+
+ pixels_changed = image_diff (png_name, ref_name, diff_name);
+
+ if (pixels_changed) {
+ ret = CAIRO_TEST_FAILURE;
+ if (pixels_changed > 0)
+ cairo_test_log ("Error: %d pixels differ from reference image %s\n",
+ pixels_changed, ref_name);
+ } else {
+ ret = CAIRO_TEST_SUCCESS;
+ }
+
+ free (png_name);
+ free (ref_name);
+ free (diff_name);
+
+ return ret;
+}
+
+static cairo_test_status_t
+cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw)
+{
+ int i;
+ cairo_test_status_t status, ret;
+ cairo_test_target_t targets[] =
+ {
+ { "image", create_image_surface, cleanup_image},
+#if 0 /* #ifdef CAIRO_HAS_GLITZ_SURFACE */
+ { "glitz", create_glitz_surface, cleanup_glitz},
+#endif
+#if CAIRO_HAS_QUARTZ_SURFACE
+ { "quartz", create_quartz_surface, cleanup_quartz},
+#endif
+#if 0 && CAIRO_HAS_WIN32_SURFACE
+ { "win32", create_win32_surface, cleanup_win32},
+#endif
+#if CAIRO_HAS_XCB_SURFACE
+ { "xcb", create_xcb_surface, cleanup_xcb},
+#endif
+#if CAIRO_HAS_XLIB_SURFACE
+ { "xlib", create_xlib_surface, cleanup_xlib},
+#endif
+ };
+ char *log_name;
+
+ xasprintf (&log_name, "%s%s", test->name, CAIRO_TEST_LOG_SUFFIX);
+ xunlink (log_name);
+
+ cairo_test_log_file = fopen (log_name, "a");
+ if (cairo_test_log_file == NULL) {
+ fprintf (stderr, "Error opening log file: %s\n", log_name);
+ cairo_test_log_file = stderr;
+ }
+
+ ret = CAIRO_TEST_SUCCESS;
+ for (i=0; i < sizeof(targets)/sizeof(targets[0]); i++) {
+ cairo_test_target_t *target = &targets[i];
+ cairo_test_log ("Testing %s with %s target\n", test->name, target->name);
+ printf ("%s-%s:\t", test->name, target->name);
+ status = cairo_test_for_target (test, draw, target);
+ if (status) {
+ printf ("FAIL\n");
+ ret = status;
+ } else {
+ printf ("PASS\n");
+ }
+ }
+
+ fclose (cairo_test_log_file);
+
+ return ret;
+}
+
+cairo_test_status_t
+cairo_test_expect_failure (cairo_test_t *test,
+ cairo_test_draw_function_t draw,
+ const char *because)
+{
+ printf ("\n%s is expected to fail:\n\t%s\n", test->name, because);
+ return cairo_test_real (test, draw);
+}
+
+cairo_test_status_t
+cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
+{
+ printf ("\n");
+ return cairo_test_real (test, draw);
+}
+
+cairo_pattern_t *
+cairo_test_create_png_pattern (cairo_t *cr, const char *filename)
+{
+ cairo_surface_t *image;
+ cairo_pattern_t *pattern;
+ unsigned char *buffer;
+ unsigned int w, h, stride;
+ read_png_status_t status;
+ char *srcdir = getenv ("srcdir");
+
+ status = read_png_argb32 (filename, &buffer, &w,&h, &stride);
+ if (status != READ_PNG_SUCCESS) {
+ if (srcdir) {
+ char *srcdir_filename;
+ xasprintf (&srcdir_filename, "%s/%s", srcdir, filename);
+ status = read_png_argb32 (srcdir_filename, &buffer, &w,&h, &stride);
+ free (srcdir_filename);
+ }
+ }
+ if (status != READ_PNG_SUCCESS)
+ return NULL;
+
+ image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32,
+ w, h, stride);
+
+ pattern = cairo_pattern_create_for_surface (image);
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+
+ return pattern;
+}
diff --git a/test/cairo_test.h b/test/cairo-test.h
index 912ce89..6260dae 100644
--- a/test/cairo_test.h
+++ b/test/cairo-test.h
@@ -41,15 +41,25 @@ typedef struct cairo_test {
int height;
} cairo_test_t;
-typedef void (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
+typedef cairo_test_status_t (*cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
/* cairo_test.c */
cairo_test_status_t
cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw);
+cairo_test_status_t
+cairo_test_expect_failure (cairo_test_t *test,
+ cairo_test_draw_function_t draw,
+ const char *reason);
+
cairo_pattern_t *
cairo_test_create_png_pattern (cairo_t *cr, const char *filename);
+void
+cairo_test_log (const char *fmt, ...);
+
+void
+xasprintf (char **strp, const char *fmt, ...);
#endif
diff --git a/test/cairo_test.c b/test/cairo_test.c
deleted file mode 100644
index 06f7672..0000000
--- a/test/cairo_test.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright © 2004 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Red Hat, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Red Hat, Inc. makes no representations about the
- * suitability of this software for any purpose. It is provided "as
- * is" without express or implied warranty.
- *
- * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Carl D. Worth <cworth@cworth.org>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include "cairo_test.h"
-
-#include "buffer_diff.h"
-#include "read_png.h"
-#include "write_png.h"
-#include "xmalloc.h"
-
-#define CAIRO_TEST_LOG_SUFFIX ".log"
-#define CAIRO_TEST_PNG_SUFFIX "-out.png"
-#define CAIRO_TEST_REF_SUFFIX "-ref.png"
-#define CAIRO_TEST_DIFF_SUFFIX "-diff.png"
-
-static void
-xasprintf (char **strp, const char *fmt, ...)
-{
-#ifdef HAVE_VASPRINTF
- va_list va;
- int ret;
-
- va_start (va, fmt);
- ret = vasprintf (strp, fmt, va);
- va_end (va);
-
- if (ret < 0) {
- fprintf (stderr, "Out of memory\n");
- exit (1);
- }
-#else /* !HAVE_VASNPRINTF */
-#define BUF_SIZE 1024
- va_list va;
- char buffer[BUF_SIZE];
- int ret;
-
- va_start (va, fmt);
- ret = vsnprintf (buffer, sizeof(buffer), fmt, va);
- va_end (va);
-
- if (ret < 0) {
- fprintf (stderr, "Failure in vsnprintf\n");
- exit (1);
- }
-
- if (strlen (buffer) == sizeof(buffer) - 1) {
- fprintf (stderr, "Overflowed fixed buffer\n");
- exit (1);
- }
-
- *strp = strdup (buffer);
- if (!*strp) {
- fprintf (stderr, "Out of memory\n");
- exit (1);
- }
-#endif /* !HAVE_VASNPRINTF */
-}
-
-static void
-xunlink (const char *pathname)
-{
- if (unlink (pathname) < 0 && errno != ENOENT) {
- fprintf (stderr, " Error: Cannot remove %s: %s\n",
- pathname, strerror (errno));
- exit (1);
- }
-}
-
-cairo_test_status_t
-cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw)
-{
- cairo_t *cr;
- int stride;
- unsigned char *png_buf, *ref_buf, *diff_buf;
- char *log_name, *png_name, *ref_name, *diff_name;
- char *srcdir;
- int pixels_changed;
- int ref_width, ref_height, ref_stride;
- read_png_status_t png_status;
- cairo_test_status_t ret;
- FILE *png_file;
- FILE *log_file;
-
- /* The cairo part of the test is the easiest part */
- cr = cairo_create ();
-
- stride = 4 * test->width;
-
- png_buf = xcalloc (stride * test->height, 1);
- diff_buf = xcalloc (stride * test->height, 1);
-
- cairo_set_target_image (cr, png_buf, CAIRO_FORMAT_ARGB32,
- test->width, test->height, stride);
-
- (draw) (cr, test->width, test->height);
-
- cairo_destroy (cr);
-
- /* Skip image check for tests with no image (width,height == 0,0) */
- if (test->width == 0 || test->height == 0) {
- free (png_buf);
- free (diff_buf);
- return CAIRO_TEST_SUCCESS;
- }
-
- /* Then we've got a bunch of string manipulation and file I/O for the check */
- srcdir = getenv ("srcdir");
- if (!srcdir)
- srcdir = ".";
- xasprintf (&log_name, "%s%s", test->name, CAIRO_TEST_LOG_SUFFIX);
- xasprintf (&png_name, "%s%s", test->name, CAIRO_TEST_PNG_SUFFIX);
- xasprintf (&ref_name, "%s/%s%s", srcdir, test->name, CAIRO_TEST_REF_SUFFIX);
- xasprintf (&diff_name, "%s%s", test->name, CAIRO_TEST_DIFF_SUFFIX);
-
- png_file = fopen (png_name, "w");
- write_png_argb32 (png_buf, png_file, test->width, test->height, stride);
- fclose (png_file);
-
- xunlink (log_name);
-
- ref_buf = NULL;
- png_status = (read_png_argb32 (ref_name, &ref_buf, &ref_width, &ref_height, &ref_stride));
- if (png_status) {
- log_file = fopen (log_name, "a");
- switch (png_status)
- {
- case READ_PNG_FILE_NOT_FOUND:
- fprintf (log_file, "Error: No reference image found: %s\n", ref_name);
- break;
- case READ_PNG_FILE_NOT_PNG:
- fprintf (log_file, "Error: %s is not a png image\n", ref_name);
- break;
- default:
- fprintf (log_file, "Error: Failed to read %s\n", ref_name);
- }
- fclose (log_file);
-
- ret = CAIRO_TEST_FAILURE;
- goto BAIL;
- } else {
- }
-
- if (test->width != ref_width || test->height != ref_height) {
- log_file = fopen (log_name, "a");
- fprintf (log_file,
- "Error: Image size mismatch: (%dx%d) vs. (%dx%d)\n"
- " for %s vs %s\n",
- test->width, test->height,
- ref_width, ref_height,
- png_name, ref_name);
- fclose (log_file);
-
- ret = CAIRO_TEST_FAILURE;
- goto BAIL;
- }
-
- pixels_changed = buffer_diff (png_buf, ref_buf, diff_buf,
- test->width, test->height, stride);
- if (pixels_changed) {
- log_file = fopen (log_name, "a");
- fprintf (log_file, "Error: %d pixels differ from reference image %s\n",
- pixels_changed, ref_name);
- png_file = fopen (diff_name, "w");
- write_png_argb32 (diff_buf, png_file, test->width, test->height, stride);
- fclose (png_file);
- fclose (log_file);
-
- ret = CAIRO_TEST_FAILURE;
- goto BAIL;
- } else {
- xunlink (diff_name);
- }
-
- ret = CAIRO_TEST_SUCCESS;
-
-BAIL:
- free (png_buf);
- free (ref_buf);
- free (diff_buf);
- free (log_name);
- free (png_name);
- free (ref_name);
- free (diff_name);
-
- return ret;
-}
-
-cairo_pattern_t *
-cairo_test_create_png_pattern (cairo_t *cr, const char *filename)
-{
- cairo_surface_t *image;
- cairo_pattern_t *pattern;
- unsigned char *buffer;
- int w, h, stride;
- read_png_status_t status;
- char *srcdir = getenv ("srcdir");
-
- status = read_png_argb32 (filename, &buffer, &w,&h, &stride);
- if (status != READ_PNG_SUCCESS) {
- if (srcdir) {
- char *srcdir_filename;
- xasprintf (&srcdir_filename, "%s/%s", srcdir, filename);
- status = read_png_argb32 (srcdir_filename, &buffer, &w,&h, &stride);
- free (srcdir_filename);
- }
- }
- if (status != READ_PNG_SUCCESS)
- return NULL;
-
- image = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_ARGB32,
- w, h, stride);
-
- cairo_surface_set_repeat (image, 1);
-
- pattern = cairo_pattern_create_for_surface (image);
-
- return pattern;
-}
diff --git a/test/clip-nesting-ref.png b/test/clip-nesting-ref.png
new file mode 100644
index 0000000..6b7e1cd
--- /dev/null
+++ b/test/clip-nesting-ref.png
Binary files differ
diff --git a/test/clip-nesting.c b/test/clip-nesting.c
new file mode 100644
index 0000000..8019780
--- /dev/null
+++ b/test/clip-nesting.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Owen Taylor <otaylor@redhat.com>
+ */
+
+#include <math.h>
+#include "cairo-test.h"
+#include <stdio.h>
+
+#define SIZE 100
+#define BORDER 10
+#define LINE_WIDTH 20
+
+cairo_test_t test = {
+ "clip-nesting",
+ "Test clipping with multiple contexts for the same surface",
+ SIZE, SIZE
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *target_surface;
+ cairo_t *cr2, *cr3;
+
+ target_surface = cairo_get_target (cr);
+
+ cr2 = cairo_create (target_surface);
+
+ /* Draw a diagonal line and clip to it */
+
+ cairo_move_to (cr2, BORDER, BORDER);
+ cairo_line_to (cr2, BORDER + LINE_WIDTH, BORDER);
+ cairo_line_to (cr2, SIZE - BORDER, SIZE - BORDER);
+ cairo_line_to (cr2, SIZE - BORDER - LINE_WIDTH, SIZE - BORDER);
+
+ cairo_clip (cr2);
+ cairo_set_source_rgb (cr2, 0, 0, 1); /* Blue */
+ cairo_paint (cr2);
+
+ /* Clipping affects this cairo_t */
+
+ cairo_set_source_rgb (cr2, 1, 1, 1); /* White */
+ cairo_rectangle (cr2,
+ SIZE / 2 - LINE_WIDTH / 2, BORDER,
+ LINE_WIDTH, SIZE - 2 * BORDER);
+ cairo_fill (cr2);
+
+ /* But doesn't affect another cairo_t that we create temporarily for
+ * the same surface
+ */
+ cr3 = cairo_create (target_surface);
+ cairo_set_source_rgb (cr3, 1, 1, 1); /* White */
+ cairo_rectangle (cr3,
+ SIZE - BORDER - LINE_WIDTH, BORDER,
+ LINE_WIDTH, SIZE - 2 * BORDER);
+ cairo_fill (cr3);
+
+ cairo_destroy (cr3);
+ cairo_destroy (cr2);
+
+ /* And doesn't affect anything after this cairo_t is destroyed */
+
+ cairo_set_source_rgb (cr, 1, 1, 1); /* White */
+ cairo_rectangle (cr,
+ BORDER, BORDER,
+ LINE_WIDTH, SIZE - 2 * BORDER);
+ cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
+
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/clip-twice-ref.png b/test/clip-twice-ref.png
new file mode 100644
index 0000000..bd3e3db
--- /dev/null
+++ b/test/clip-twice-ref.png
Binary files differ
diff --git a/test/clip_twice.c b/test/clip-twice.c
index 00215e6..446447c 100644
--- a/test/clip_twice.c
+++ b/test/clip-twice.c
@@ -23,21 +23,20 @@
* Author: Kristian Høgsberg <krh@redhat.com>
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
#define WIDTH 64
#define HEIGHT 64
cairo_test_t test = {
- "clip_twice",
+ "clip-twice",
"Verifies that the clip mask is updated correctly when it constructed by setting the clip path twice.",
WIDTH, HEIGHT
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_set_alpha (cr, 1.0);
cairo_new_path (cr);
cairo_arc (cr, WIDTH / 2, HEIGHT / 2, WIDTH / 3, 0, 2 * M_PI);
cairo_clip (cr);
@@ -52,7 +51,7 @@ draw (cairo_t *cr, int width, int height)
cairo_close_path (cr);
cairo_clip (cr);
- cairo_set_rgb_color (cr, 0, 0, 0.6);
+ cairo_set_source_rgb (cr, 0, 0, 0.6);
cairo_new_path (cr);
cairo_move_to (cr, 0, 0);
@@ -63,6 +62,14 @@ draw (cairo_t *cr, int width, int height)
cairo_line_to (cr, WIDTH / 2, HEIGHT / 4);
cairo_close_path (cr);
cairo_fill (cr);
+
+ cairo_new_path (cr);
+ cairo_arc (cr, WIDTH / 2, HEIGHT / 2, WIDTH / 5, 0, 2 * M_PI);
+ cairo_clip (cr);
+ cairo_set_source_rgb (cr, 1, 1, 0);
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/clip_twice-ref.png b/test/clip_twice-ref.png
deleted file mode 100644
index ab0ae1a..0000000
--- a/test/clip_twice-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/coverage-ref.png b/test/coverage-ref.png
deleted file mode 100644
index 9b71040..0000000
--- a/test/coverage-ref.png
+++ /dev/null
Binary files differ
diff --git a/test/move_to_show_surface-ref.png b/test/create-for-png-ref.png
index 765adc4..765adc4 100644
--- a/test/move_to_show_surface-ref.png
+++ b/test/create-for-png-ref.png
Binary files differ
diff --git a/test/create-for-png.c b/test/create-for-png.c
new file mode 100644
index 0000000..ef3b6f6
--- /dev/null
+++ b/test/create-for-png.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#include <stdlib.h>
+
+#define WIDTH 2
+#define HEIGHT 2
+
+cairo_test_t test = {
+ "create-for-png",
+ "Tests the creation of an image surface from a PNG file",
+ WIDTH, HEIGHT
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ char *srcdir = getenv ("srcdir");
+ char *filename;
+ cairo_surface_t *surface;
+
+ xasprintf (&filename, "%s/%s", srcdir ? srcdir : ".",
+ "create-for-png-ref.png");
+
+ surface = cairo_image_surface_create_from_png (filename);
+ free (filename);
+
+ if (surface == NULL) {
+ cairo_test_log ("Error: failed to open file %s\n", filename);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_paint (cr);
+
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/fill-and-stroke-ref.png b/test/fill-and-stroke-ref.png
new file mode 100644
index 0000000..298f694
--- /dev/null
+++ b/test/fill-and-stroke-ref.png
Binary files differ
diff --git a/test/fill-and-stroke.c b/test/fill-and-stroke.c
new file mode 100644
index 0000000..9893171
--- /dev/null
+++ b/test/fill-and-stroke.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#define PAD 2
+#define SIZE 10
+
+cairo_test_t test = {
+ "fill-and-stroke",
+ "Tests calls to various set_source functions",
+ 2 * SIZE + 4 * PAD, SIZE + 2 * PAD
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_rectangle (cr, PAD, PAD, SIZE, SIZE);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ cairo_fill_preserve (cr);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ cairo_stroke (cr);
+
+ cairo_translate (cr, SIZE + 2 * PAD, 0);
+
+ cairo_arc (cr,
+ PAD + SIZE / 2, PAD + SIZE / 2,
+ SIZE / 2,
+ 0, 2 * M_PI);
+ cairo_fill_preserve (cr);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/fill_rule-ref.png b/test/fill-rule-ref.png
index e2e10d4..e2e10d4 100644
--- a/test/fill_rule-ref.png
+++ b/test/fill-rule-ref.png
Binary files differ
diff --git a/test/fill_rule.c b/test/fill-rule.c
index 037a044..103208c 100644
--- a/test/fill_rule.c
+++ b/test/fill-rule.c
@@ -61,13 +61,13 @@
*
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
#define LITTLE_STAR_SIZE 20
#define BIG_STAR_SIZE 80
cairo_test_t test = {
- "fill_rule",
+ "fill-rule",
"Tests cairo_set_full_rule with some star shapes",
BIG_STAR_SIZE * 2 + 3, BIG_STAR_SIZE + LITTLE_STAR_SIZE + 3
};
@@ -97,10 +97,10 @@ big_star_path (cairo_t *cr)
}
/* Fill the same path twice, once with each fill rule */
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- cairo_set_rgb_color (cr, 1, 0, 0);
+ cairo_set_source_rgb (cr, 1, 0, 0);
cairo_translate (cr, 1, 1);
little_star_path (cr);
@@ -121,6 +121,8 @@ draw (cairo_t *cr, int width, int height)
big_star_path (cr);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/filter-nearest-offset-ref.png b/test/filter-nearest-offset-ref.png
new file mode 100644
index 0000000..46092e3
--- /dev/null
+++ b/test/filter-nearest-offset-ref.png
Binary files differ
diff --git a/test/filter-nearest-offset.c b/test/filter-nearest-offset.c
new file mode 100644
index 0000000..74ad476
--- /dev/null
+++ b/test/filter-nearest-offset.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#define STAMP_WIDTH 4
+#define STAMP_HEIGHT 4
+#define PAD 1
+
+#define STEPS 10
+
+#define IMAGE_WIDTH (PAD + STEPS * (STAMP_WIDTH + PAD) + PAD)
+#define IMAGE_HEIGHT (PAD + STEPS * (STAMP_HEIGHT + PAD) + PAD)
+
+cairo_test_t test = {
+ "filter-nearest-offset",
+ "Test sampling offset of CAIRO_FILTER_NEAREST",
+ IMAGE_WIDTH, IMAGE_HEIGHT
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ unsigned long data[STAMP_WIDTH * STAMP_HEIGHT] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff,
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff
+ };
+ int i, j;
+
+ /* Draw reference lines where the jump should be. */
+ cairo_move_to (cr, PAD + STEPS / 2 * (STAMP_WIDTH + PAD), 0);
+ cairo_rel_line_to (cr, 0, IMAGE_HEIGHT);
+ cairo_move_to (cr, 0, PAD + STEPS / 2 * (STAMP_HEIGHT + PAD));
+ cairo_rel_line_to (cr, IMAGE_WIDTH, 0);
+ cairo_set_line_width (cr, 2.0);
+ cairo_stroke (cr);
+
+ surface = cairo_image_surface_create_for_data ((unsigned char *) data,
+ CAIRO_FORMAT_ARGB32,
+ STAMP_WIDTH,
+ STAMP_HEIGHT,
+ STAMP_WIDTH * 4);
+
+ for (j=0; j < STEPS; j++) {
+ double j_step;
+
+ for (i=0; i < STEPS; i++) {
+ double i_step;
+
+#define GENERATE_REFERENCE_IMAGE 0
+#if GENERATE_REFERENCE_IMAGE
+ i_step = i >= STEPS / 2 ? 1 : 0;
+ j_step = j >= STEPS / 2 ? 1 : 0;
+#else
+ i_step = i * 1.0 / STEPS;
+ j_step = j * 1.0 / STEPS;
+#endif
+
+ cairo_save (cr);
+
+ cairo_set_source_surface (cr, surface,
+ PAD + i * (STAMP_WIDTH + PAD) + i_step,
+ PAD + j * (STAMP_HEIGHT + PAD) + j_step);
+ cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_BEST);
+ cairo_paint (cr);
+
+ cairo_restore (cr);
+ }
+ }
+
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test_expect_failure (&test, draw,
+ "wrong sampling location for nearest-neighbor filter in libpixman and Render");
+}
diff --git a/test/get-and-set.c b/test/get-and-set.c
new file mode 100644
index 0000000..72d6610
--- /dev/null
+++ b/test/get-and-set.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "get-and-set",
+ "Tests calls to the most trivial cairo_get and cairo_set functions",
+ 0, 0
+};
+
+typedef struct {
+ cairo_operator_t operator;
+ double tolerance;
+ cairo_fill_rule_t fill_rule;
+ double line_width;
+ cairo_line_cap_t line_cap;
+ cairo_line_join_t line_join;
+ double miter_limit;
+ cairo_matrix_t matrix;
+} settings_t;
+
+/* Two sets of settings, no defaults */
+settings_t settings[] = {
+ {
+ CAIRO_OPERATOR_IN,
+ 2.0,
+ CAIRO_FILL_RULE_EVEN_ODD,
+ 7.7,
+ CAIRO_LINE_CAP_SQUARE,
+ CAIRO_LINE_JOIN_ROUND,
+ 3.14,
+ {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}
+ },
+ {
+ CAIRO_OPERATOR_ATOP,
+ 5.25,
+ CAIRO_FILL_RULE_WINDING,
+ 2.17,
+ CAIRO_LINE_CAP_ROUND,
+ CAIRO_LINE_JOIN_BEVEL,
+ 1000.0,
+ {.1, .01, .001, .0001, .00001, .000001}
+ }
+};
+
+static void
+settings_set (cairo_t *cr, settings_t *settings)
+{
+ cairo_set_operator (cr, settings->operator);
+ cairo_set_tolerance (cr, settings->tolerance);
+ cairo_set_fill_rule (cr, settings->fill_rule);
+ cairo_set_line_width (cr, settings->line_width);
+ cairo_set_line_cap (cr, settings->line_cap);
+ cairo_set_line_join (cr, settings->line_join);
+ cairo_set_miter_limit (cr, settings->miter_limit);
+ cairo_set_matrix (cr, &settings->matrix);
+}
+
+static void
+settings_get (cairo_t *cr, settings_t *settings)
+{
+ settings->operator = cairo_get_operator (cr);
+ settings->tolerance = cairo_get_tolerance (cr);
+ settings->fill_rule = cairo_get_fill_rule (cr);
+ settings->line_width = cairo_get_line_width (cr);
+ settings->line_cap = cairo_get_line_cap (cr);
+ settings->line_join = cairo_get_line_join (cr);
+ settings->miter_limit = cairo_get_miter_limit (cr);
+ cairo_get_matrix (cr, &settings->matrix);
+}
+
+static int
+settings_equal (settings_t *a, settings_t *b)
+{
+ return (a->operator == b->operator &&
+ a->tolerance == b->tolerance &&
+ a->fill_rule == b->fill_rule &&
+ a->line_width == b->line_width &&
+ a->line_cap == b->line_cap &&
+ a->line_join == b->line_join &&
+ a->miter_limit == b->miter_limit &&
+ a->matrix.xx == b->matrix.xx &&
+ a->matrix.xy == b->matrix.xy &&
+ a->matrix.x0 == b->matrix.x0 &&
+ a->matrix.yx == b->matrix.yx &&
+ a->matrix.yy == b->matrix.yy &&
+ a->matrix.y0 == b->matrix.y0);
+}
+
+static cairo_test_status_t
+get_and_set (cairo_t *cr, int width, int height)
+{
+ settings_t check;
+
+ settings_set (cr, &settings[0]);
+
+ cairo_save (cr);
+ {
+ settings_set (cr, &settings[1]);
+ settings_get (cr, &check);
+
+ if (!settings_equal (&settings[1], &check))
+ return CAIRO_TEST_FAILURE;
+ }
+ cairo_restore (cr);
+
+ settings_get (cr, &check);
+
+ if (!settings_equal (&settings[0], &check))
+ return CAIRO_TEST_FAILURE;
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, get_and_set);
+}
diff --git a/test/gradient-alpha-ref.png b/test/gradient-alpha-ref.png
new file mode 100644
index 0000000..e75f911
--- /dev/null
+++ b/test/gradient-alpha-ref.png
Binary files differ
diff --git a/test/gradient-alpha.c b/test/gradient-alpha.c
new file mode 100644
index 0000000..3015728
--- /dev/null
+++ b/test/gradient-alpha.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "gradient-alpha",
+ "Tests drawing of a gradient with various alpha values in the color stops",
+ 10, 10
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_pattern_t *gradient;
+
+ gradient = cairo_pattern_create_linear (0, -height,
+ 0, height);
+ cairo_pattern_add_color_stop_rgba (gradient, 0.0,
+ 1.0, 0.0, 0.0,
+ 1.0);
+ cairo_pattern_add_color_stop_rgba (gradient, 1.0,
+ 0.0, 0.0, 1.0,
+ 0.5);
+
+ cairo_set_source (cr, gradient);
+
+ cairo_paint (cr);
+
+ cairo_pattern_destroy (gradient);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/imagediff.c b/test/imagediff.c
index 36962f1..8e13a1f 100644
--- a/test/imagediff.c
+++ b/test/imagediff.c
@@ -26,9 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include "buffer_diff.h"
-#include "read_png.h"
-#include "write_png.h"
+#include "buffer-diff.h"
+#include "read-png.h"
+#include "write-png.h"
#include "xmalloc.h"
int
@@ -77,7 +77,7 @@ main (int argc, char *argv[])
free (buffer);
- return 0;
+ return total_pixels_changed;
}
diff --git a/test/leaky_polygon-ref.png b/test/leaky-polygon-ref.png
index 0daabe1..0daabe1 100644
--- a/test/leaky_polygon-ref.png
+++ b/test/leaky-polygon-ref.png
Binary files differ
diff --git a/test/leaky_polygon.c b/test/leaky-polygon.c
index 39daf4c..575311e 100644
--- a/test/leaky_polygon.c
+++ b/test/leaky-polygon.c
@@ -51,18 +51,18 @@
*
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
#define WIDTH 21
#define HEIGHT 21
cairo_test_t test = {
- "leaky_polygon",
+ "leaky-polygon",
"Exercises a corner case in the trapezoid rasterization in which pixels outside the trapezoids received a non-zero alpha",
WIDTH, HEIGHT
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_scale (cr, 1.0/(1<<16), 1.0/(1<<16));
@@ -73,6 +73,8 @@ draw (cairo_t *cr, int width, int height)
cairo_close_path (cr);
cairo_fill (cr);
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/line_width-ref.png b/test/line-width-ref.png
index ddcd929..ddcd929 100644
--- a/test/line_width-ref.png
+++ b/test/line-width-ref.png
Binary files differ
diff --git a/test/line_width.c b/test/line-width.c
index 9c3ed89..ca2d276 100644
--- a/test/line_width.c
+++ b/test/line-width.c
@@ -23,7 +23,7 @@
* Author: Carl D. Worth <cworth@cworth.org>
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
#define LINES 5
#define LINE_LENGTH 10
@@ -31,17 +31,17 @@
#define IMAGE_HEIGHT ((LINES+4)*LINES)/2 + 2
cairo_test_t test = {
- "line_width",
+ "line-width",
"Tests cairo_set_line_width",
IMAGE_WIDTH, IMAGE_HEIGHT
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i;
- cairo_set_rgb_color (cr, 0, 0, 0);
+ cairo_set_source_rgb (cr, 0, 0, 0);
cairo_translate (cr, 2, 2);
for (i=0; i < LINES; i++) {
@@ -54,6 +54,8 @@ draw (cairo_t *cr, int width, int height)
cairo_stroke (cr);
cairo_translate (cr, 0, i+3);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/linear_gradient-ref.png b/test/linear-gradient-ref.png
index 7790414..7790414 100644
--- a/test/linear_gradient-ref.png
+++ b/test/linear-gradient-ref.png
Binary files differ
diff --git a/test/linear_gradient.c b/test/linear-gradient.c
index 189b500..38ba559 100644
--- a/test/linear_gradient.c
+++ b/test/linear-gradient.c
@@ -23,7 +23,7 @@
* Author: Owen Taylor <otaylor@redhat.com>
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
#include "stdio.h"
/* The test matrix is
@@ -55,7 +55,7 @@ static const int n_stops[] = { 2, 3 };
#define HEIGHT N_N_STOPS * N_ROTATE_ANGLES * UNIT_SIZE + (N_N_STOPS * N_ROTATE_ANGLES + 1) * PAD
cairo_test_t test = {
- "linear_gradient",
+ "linear-gradient",
"Tests the drawing of linear gradients",
WIDTH, HEIGHT
};
@@ -72,7 +72,7 @@ draw_unit (cairo_t *cr,
cairo_clip (cr);
cairo_new_path(cr);
- cairo_set_rgb_color (cr, 0.0, 0.0, 0.0);
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, 0, 0, 1, 1);
cairo_fill (cr);
@@ -84,38 +84,32 @@ draw_unit (cairo_t *cr,
0.5 * cos (gradient_angle), 0.5 * sin (gradient_angle));
if (n_stops == 2) {
- cairo_pattern_add_color_stop (pattern, 0.,
- 0.3, 0.3, 0.3,
- 1.0);
- cairo_pattern_add_color_stop (pattern, 1.,
- 1.0, 1.0, 1.0,
- 1.0);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.,
+ 0.3, 0.3, 0.3);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.,
+ 1.0, 1.0, 1.0);
} else {
- cairo_pattern_add_color_stop (pattern, 0.,
- 1.0, 0.0, 0.0,
- 1.0);
- cairo_pattern_add_color_stop (pattern, 0.5,
- 1.0, 1.0, 1.0,
- 1.0);
- cairo_pattern_add_color_stop (pattern, 1.,
- 0.0, 0.0, 1.0,
- 1.0);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.,
+ 1.0, 0.0, 0.0);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.5,
+ 1.0, 1.0, 1.0);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.,
+ 0.0, 0.0, 1.0);
}
- cairo_set_pattern (cr, pattern);
+ cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr, -0.5, -0.5, 1, 1);
cairo_fill (cr);
}
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, j, k;
- cairo_set_rgb_color (cr, 0.5, 0.5, 0.5);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_fill (cr);
+ cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
+ cairo_paint (cr);
for (i = 0; i < N_GRADIENT_ANGLES; i++)
for (j = 0; j < N_ROTATE_ANGLES; j++)
@@ -132,6 +126,8 @@ draw (cairo_t *cr, int width, int height)
n_stops[k]);
cairo_restore (cr);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/mask-ref.png b/test/mask-ref.png
new file mode 100644
index 0000000..4b357c0
--- /dev/null
+++ b/test/mask-ref.png
Binary files differ
diff --git a/test/mask.c b/test/mask.c
new file mode 100644
index 0000000..ec0322d
--- /dev/null
+++ b/test/mask.c
@@ -0,0 +1,246 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Owen Taylor <otaylor@redhat.com>
+ * Kristian Høgsberg <krh@redhat.com>
+ */
+
+#include <math.h>
+#include "cairo-test.h"
+#include <stdio.h>
+
+#define WIDTH 64
+#define HEIGHT 64
+#define PAD 10
+
+const char png_filename[] = "romedalen.png";
+
+static void
+set_solid_pattern (cairo_t *cr, int x, int y)
+{
+ cairo_set_source_rgb (cr, 0, 0, 0.6);
+}
+
+static void
+set_translucent_pattern (cairo_t *cr, int x, int y)
+{
+ cairo_set_source_rgba (cr, 0, 0, 0.6, 0.5);
+}
+
+static void
+set_gradient_pattern (cairo_t *cr, int x, int y)
+{
+ cairo_pattern_t *pattern;
+
+ pattern =
+ cairo_pattern_create_linear (x, y, x + WIDTH, y + HEIGHT);
+ cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, 1);
+ cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0.4, 1);
+ cairo_set_source (cr, pattern);
+}
+
+static void
+set_image_pattern (cairo_t *cr, int x, int y)
+{
+ cairo_pattern_t *pattern;
+
+ pattern = cairo_test_create_png_pattern (cr, png_filename);
+ cairo_set_source (cr, pattern);
+}
+
+static void
+mask_polygon (cairo_t *cr, int x, int y)
+{
+ cairo_surface_t *mask_surface;
+ cairo_t *cr2;
+
+ mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
+ CAIRO_FORMAT_A8,
+ WIDTH, HEIGHT);
+ cr2 = cairo_create (mask_surface);
+
+ cairo_save (cr2);
+ cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */
+ cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE);
+ cairo_paint (cr2);
+ cairo_restore (cr2);
+
+ cairo_set_source_rgb (cr2, 1, 1, 1); /* white */
+
+ cairo_new_path (cr2);
+ cairo_move_to (cr2, 0, 0);
+ cairo_line_to (cr2, 0, HEIGHT);
+ cairo_line_to (cr2, WIDTH / 2, 3 * HEIGHT / 4);
+ cairo_line_to (cr2, WIDTH, HEIGHT);
+ cairo_line_to (cr2, WIDTH, 0);
+ cairo_line_to (cr2, WIDTH / 2, HEIGHT / 4);
+ cairo_close_path (cr2);
+ cairo_fill (cr2);
+
+ cairo_destroy (cr2);
+
+ cairo_mask_surface (cr, mask_surface, x, y);
+
+ cairo_surface_destroy (mask_surface);
+}
+
+static void
+mask_alpha (cairo_t *cr, int x, int y)
+{
+ cairo_paint_with_alpha (cr, 0.75);
+}
+
+static void
+mask_gradient (cairo_t *cr, int x, int y)
+{
+ cairo_pattern_t *pattern;
+
+ pattern = cairo_pattern_create_linear (x, y,
+ x + WIDTH, y + HEIGHT);
+
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 0,
+ 1, 1, 1, 1);
+ cairo_pattern_add_color_stop_rgba (pattern,
+ 1,
+ 1, 1, 1, 0);
+
+ cairo_mask (cr, pattern);
+
+ cairo_pattern_destroy (pattern);
+}
+
+static void
+clip_none (cairo_t *cr, int x, int y)
+{
+}
+
+static void
+clip_rects (cairo_t *cr, int x, int y)
+{
+ int height = HEIGHT / 3;
+
+ cairo_new_path (cr);
+ cairo_rectangle (cr, x, y, WIDTH, height);
+ cairo_rectangle (cr, x, y + 2 * height, WIDTH, height);
+ cairo_clip (cr);
+}
+
+static void
+clip_circle (cairo_t *cr, int x, int y)
+{
+ cairo_new_path (cr);
+ cairo_arc (cr, x + WIDTH / 2, y + HEIGHT / 2,
+ WIDTH / 2, 0, 2 * M_PI);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+}
+
+static void (*pattern_funcs[])(cairo_t *cr, int x, int y) = {
+ set_solid_pattern,
+ set_translucent_pattern,
+ set_gradient_pattern,
+ set_image_pattern,
+};
+
+static void (*mask_funcs[])(cairo_t *cr, int x, int y) = {
+ mask_alpha,
+ mask_gradient,
+ mask_polygon,
+};
+
+static void (*clip_funcs[])(cairo_t *cr, int x, int y) = {
+ clip_none,
+ clip_rects,
+ clip_circle,
+};
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+#define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
+#define IMAGE_HEIGHT (ARRAY_SIZE (mask_funcs) * ARRAY_SIZE (clip_funcs) * (HEIGHT + PAD) + PAD)
+
+static cairo_test_t test = {
+ "mask",
+ "Tests of cairo_mask",
+ IMAGE_WIDTH, IMAGE_HEIGHT
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *tmp_surface;
+ cairo_pattern_t *tmp_pattern;
+ int i, j, k;
+ cairo_t *cr2;
+
+ /* Some of our drawing is unbounded, so we draw each test to
+ * a temporary surface and copy over.
+ */
+ tmp_surface = cairo_surface_create_similar (cairo_get_target (cr),
+ CAIRO_FORMAT_ARGB32,
+ IMAGE_WIDTH, IMAGE_HEIGHT);
+ cr2 = cairo_create (tmp_surface);
+
+ tmp_pattern = cairo_pattern_create_for_surface (tmp_surface);
+ cairo_set_source (cr, tmp_pattern);
+
+ for (k = 0; k < ARRAY_SIZE (clip_funcs); k++) {
+ for (j = 0; j < ARRAY_SIZE (mask_funcs); j++) {
+ for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
+ int x = i * (WIDTH + PAD) + PAD;
+ int y = (ARRAY_SIZE (mask_funcs) * k + j) * (HEIGHT + PAD) + PAD;
+
+ /* Clear area we are going to be drawing onto */
+ cairo_save (cr2);
+ cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */
+ cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE);
+ cairo_rectangle (cr2, x, y, WIDTH, HEIGHT);
+ cairo_fill (cr2);
+ cairo_restore (cr2);
+
+ /* draw */
+ cairo_save (cr2);
+
+ clip_funcs[k] (cr2, x, y);
+ pattern_funcs[i] (cr2, x, y);
+ mask_funcs[j] (cr2, x, y);
+
+ cairo_restore (cr2);
+
+ /* Copy back to the main pixmap */
+ cairo_rectangle (cr, x, y, WIDTH, HEIGHT);
+ cairo_fill (cr);
+ }
+ }
+ }
+
+ cairo_destroy (cr2);
+ cairo_surface_destroy (tmp_surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/move-to-show-surface-ref.png b/test/move-to-show-surface-ref.png
new file mode 100644
index 0000000..765adc4
--- /dev/null
+++ b/test/move-to-show-surface-ref.png
Binary files differ
diff --git a/test/move_to_show_surface.c b/test/move-to-show-surface.c
index 6dcda21..c5cc1ae 100644
--- a/test/move_to_show_surface.c
+++ b/test/move-to-show-surface.c
@@ -32,34 +32,46 @@
* bit of poking around suggests this isn't a regression, (at least
* not since the last pixman snapshot).
*
+ * 2005-04-02 Carl Worth <cworth@cworth.org>
+ *
+ * Status: RESOLVED
+ *
+ * Inside cairo_show_surface the current point was being used as
+ * both source and destination offsets. After fixing that to use 0,0
+ * as the source offset and the current point as the destination
+ * offset, the bug seems to be gone.
+ *
*/
-
-#include "cairo_test.h"
+#include "cairo-test.h"
cairo_test_t test = {
- "move_to_show_surface",
+ "move-to-show-surface",
"Tests calls to cairo_show_surface after cairo_move_to",
2, 2
};
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
- uint32_t colors[4] = {
+ unsigned long colors[4] = {
0xffffffff, 0xffff0000,
0xff00ff00, 0xff0000ff
};
int i;
for (i=0; i < 4; i++) {
- surface = cairo_surface_create_for_image ((char *) &colors[i],
- CAIRO_FORMAT_ARGB32, 1, 1, 4);
- cairo_move_to (cr, i % 2, i / 2);
- cairo_show_surface (cr, surface, 1, 1);
+ surface = cairo_image_surface_create_for_data ((unsigned char *) &colors[i],
+ CAIRO_FORMAT_ARGB32,
+ 1, 1, 4);
+ cairo_set_source_surface (cr, surface,
+ i % 2, i / 2);
+ cairo_paint (cr);
cairo_surface_destroy (surface);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/paint-ref.png b/test/paint-ref.png
new file mode 100644
index 0000000..fff03b3
--- /dev/null
+++ b/test/paint-ref.png
Binary files differ
diff --git a/test/paint-with-alpha-ref.png b/test/paint-with-alpha-ref.png
new file mode 100644
index 0000000..d821b5e
--- /dev/null
+++ b/test/paint-with-alpha-ref.png
Binary files differ
diff --git a/test/paint-with-alpha.c b/test/paint-with-alpha.c
new file mode 100644
index 0000000..f4734af
--- /dev/null
+++ b/test/paint-with-alpha.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "paint-with-alpha",
+ "Simple test of cairo_paint_with_alpha",
+ 12, 12
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ unsigned long data[16] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff,
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff
+ };
+
+ surface = cairo_image_surface_create_for_data ((unsigned char *) data,
+ CAIRO_FORMAT_ARGB32, 4, 4, 16);
+
+ cairo_scale (cr, 2, 2);
+
+ cairo_set_source_surface (cr, surface, 1 , 1);
+ cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
+ cairo_paint_with_alpha (cr, 0.5);
+
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/paint.c b/test/paint.c
new file mode 100644
index 0000000..126becc
--- /dev/null
+++ b/test/paint.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "paint",
+ "Test calls to cairo_paint",
+ 8, 8
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ cairo_paint (cr);
+
+ cairo_translate (cr, 2, 2);
+ cairo_scale (cr, 0.5, 0.5);
+
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/path-data-ref.png b/test/path-data-ref.png
new file mode 100644
index 0000000..f8bc647
--- /dev/null
+++ b/test/path-data-ref.png
Binary files differ
diff --git a/test/path-data.c b/test/path-data.c
new file mode 100644
index 0000000..b2d7edb
--- /dev/null
+++ b/test/path-data.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdlib.h>
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "path-data",
+ "Tests calls to path_data functions: cairo_copy_path_data, cairo_copy_path_data_flat, and cairo_append_path_data",
+ 45, 53
+};
+
+static void
+scale_by_two (double *x, double *y)
+{
+ *x = *x * 2.0;
+ *y = *y * 2.0;
+}
+
+typedef void (*munge_func_t) (double *x, double *y);
+
+static void
+munge_and_set_path (cairo_t *cr,
+ cairo_path_t *path,
+ munge_func_t munge)
+{
+ int i;
+ cairo_path_data_t *p;
+ double x1, y1, x2, y2, x3, y3;
+
+ for (i=0; i < path->num_data; i += path->data[i].header.length) {
+ p = &path->data[i];
+ switch (p->header.type) {
+ case CAIRO_PATH_MOVE_TO:
+ x1 = p[1].point.x; y1 = p[1].point.y;
+ (munge) (&x1, &y1);
+ cairo_move_to (cr, x1, y1);
+ break;
+ case CAIRO_PATH_LINE_TO:
+ x1 = p[1].point.x; y1 = p[1].point.y;
+ (munge) (&x1, &y1);
+ cairo_line_to (cr, x1, y1);
+ break;
+ case CAIRO_PATH_CURVE_TO:
+ x1 = p[1].point.x; y1 = p[1].point.y;
+ x2 = p[2].point.x; y2 = p[2].point.y;
+ x3 = p[3].point.x; y3 = p[3].point.y;
+ (munge) (&x1, &y1);
+ (munge) (&x2, &y2);
+ (munge) (&x3, &y3);
+ cairo_curve_to (cr,
+ x1, y1,
+ x2, y2,
+ x3, y3);
+ break;
+ case CAIRO_PATH_CLOSE_PATH:
+ cairo_close_path (cr);
+ break;
+ }
+ }
+}
+
+static void
+make_path (cairo_t *cr)
+{
+ cairo_rectangle (cr, 0, 0, 5, 5);
+ cairo_move_to (cr, 15, 2.5);
+ cairo_arc (cr, 12.5, 2.5, 2.5, 0, 2 * M_PI);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_path_t *path;
+
+ /* copy path, munge, and fill */
+ cairo_translate (cr, 5, 5);
+ make_path (cr);
+ path = cairo_copy_path (cr);
+
+ cairo_new_path (cr);
+ munge_and_set_path (cr, path, scale_by_two);
+ cairo_path_destroy (path);
+ cairo_fill (cr);
+
+ /* copy flattened path, munge, and fill */
+ cairo_translate (cr, 0, 15);
+ make_path (cr);
+ path = cairo_copy_path_flat (cr);
+
+ cairo_new_path (cr);
+ munge_and_set_path (cr, path, scale_by_two);
+ cairo_path_destroy (path);
+ cairo_fill (cr);
+
+ /* append two copies of path, and fill */
+ cairo_translate (cr, 0, 15);
+ cairo_scale (cr, 2.0, 2.0);
+ make_path (cr);
+ path = cairo_copy_path (cr);
+
+ cairo_new_path (cr);
+ cairo_append_path (cr, path);
+ cairo_translate (cr, 2.5, 2.5);
+ cairo_append_path (cr, path);
+
+ cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
+ cairo_fill (cr);
+
+ cairo_path_destroy (path);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ cairo_t *cr;
+ cairo_path_data_t data;
+ cairo_path_t path;
+ cairo_surface_t *surface;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+
+ /* Test a few error cases for cairo_append_path_data */
+ cr = cairo_create (surface);
+ cairo_append_path (cr, NULL);
+ if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER)
+ return 1;
+ cairo_destroy (cr);
+
+ cr = cairo_create (surface);
+ path.data = NULL;
+ path.num_data = 0;
+ cairo_append_path (cr, &path);
+ if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER)
+ return 1;
+ cairo_destroy (cr);
+
+ cr = cairo_create (surface);
+ /* Intentionally insert bogus header.length value (otherwise would be 2) */
+ data.header.type = CAIRO_PATH_MOVE_TO;
+ data.header.length = 1;
+ path.data = &data;
+ path.num_data = 1;
+ cairo_append_path (cr, &path);
+ if (cairo_status (cr) != CAIRO_STATUS_INVALID_PATH_DATA)
+ return 1;
+ cairo_destroy (cr);
+
+ /* And test the degnerate case */
+ cr = cairo_create (surface);
+ path.num_data = 0;
+ cairo_append_path (cr, &path);
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
+ return 1;
+ cairo_destroy (cr);
+
+ cairo_surface_destroy (surface);
+
+ return cairo_test (&test, draw);
+}
diff --git a/test/pdf-clip.c b/test/pdf-clip.c
new file mode 100644
index 0000000..4d6d75c
--- /dev/null
+++ b/test/pdf-clip.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Kristian Høgsberg <krh@redhat.com>
+ */
+
+#include <stdio.h>
+
+#include <cairo-pdf.h>
+#include "cairo-test.h"
+
+/* Test PDF clipping */
+
+#define WIDTH_IN_POINTS 600
+#define HEIGHT_IN_POINTS 600
+
+static void
+test_clip (cairo_t *cr, double width, double height)
+{
+ cairo_t *cr2;
+
+ /* Basic test; set a square clip and draw a circle to be clipped
+ * against it.*/
+
+ cairo_rectangle (cr, 100, 100, 400, 400);
+ cairo_clip (cr);
+ cairo_arc (cr, 300, 300, 210, 0, 2 * M_PI);
+ cairo_set_source_rgb (cr, 1, 0, 0);
+ cairo_fill (cr);
+
+ /* Add a plus shaped clip path to the square clip and draw a big
+ * green square to test the new clip path. */
+
+ cairo_save (cr);
+
+ cairo_rectangle (cr, 250, 100, 100, 400);
+ cairo_rectangle (cr, 100, 250, 400, 100);
+ cairo_clip (cr);
+
+ cairo_rectangle (cr, 0, 0, 600, 600);
+ cairo_set_source_rgb (cr, 0, 1, 0);
+ cairo_fill (cr);
+
+ cairo_restore (cr);
+
+ /* Set a bezier shape in addition to the rectangle clip set before
+ * the cairo_save() to verify that we successfully removed the
+ * plus shaped clip path and can set a new clip.*/
+
+ cairo_move_to (cr, 600, 0);
+ cairo_curve_to (cr, 300, 600, 0, 300, 600, 0);
+ cairo_clip (cr);
+
+ cairo_rectangle (cr, 0, 0, 600, 600);
+ cairo_set_source_rgb (cr, 0, 0, 1);
+ cairo_fill (cr);
+
+ /* Create a new context for this surface to test overlapped
+ * drawing from two contexts */
+ cr2 = cairo_create (cairo_get_target (cr));
+
+ /* Using the new context, draw a black vertical line, which should
+ * appear unclipped on top of everything drawn so far. */
+ cairo_move_to (cr2, 110, 0);
+ cairo_line_to (cr2, 110, 600);
+ cairo_stroke (cr2);
+
+ /* Using the first context, draw another black vertical line.
+ * This line should be clipped agaist the bezier clipping path set
+ * earlier. */
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_move_to (cr, 400, 0);
+ cairo_line_to (cr, 400, 600);
+ cairo_stroke (cr);
+
+ cairo_destroy (cr2);
+
+ /* Test reset clip. Draw a transparent black circle over
+ * everything. Specifically, make sure the circle extends outside
+ * the square clip set at the top of this function. */
+ cairo_reset_clip (cr);
+ cairo_arc (cr, 300, 300, 220, 0, 2 * M_PI);
+ cairo_set_source_rgba (cr, 0, 0, 0, 0.2);
+ cairo_fill (cr);
+}
+
+int
+main (void)
+{
+ cairo_t *cr;
+ const char *filename = "pdf-clip.pdf";
+ cairo_surface_t *surface;
+
+ printf("\n");
+
+ surface = cairo_pdf_surface_create (filename,
+ WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
+ if (surface == NULL) {
+ fprintf (stderr, "Failed to create pdf surface for file %s\n", filename);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cr = cairo_create (surface);
+
+ test_clip (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
+ cairo_show_page (cr);
+
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+
+ printf ("pdf-surface: Please check %s to make sure it looks happy.\n",
+ filename);
+
+ return 0;
+}
diff --git a/test/pdf-surface.c b/test/pdf-surface.c
new file mode 100644
index 0000000..863da53
--- /dev/null
+++ b/test/pdf-surface.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdio.h>
+
+#include <cairo-pdf.h>
+#include "cairo-test.h"
+
+/* Pretty boring test just to make sure things aren't crashing ---
+ * no verification that we're getting good results yet.
+ * But you can manually view the image to make sure it looks happy.
+ */
+
+#define WIDTH_IN_INCHES 3
+#define HEIGHT_IN_INCHES 3
+#define WIDTH_IN_POINTS (WIDTH_IN_INCHES * 72.0)
+#define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
+
+static void
+draw (cairo_t *cr, double width, double height)
+{
+#define STROKE_WIDTH .04
+
+ double size;
+
+ if (width > height)
+ size = height;
+ else
+ size = width;
+
+ cairo_translate (cr, (width - size) / 2.0, (height - size) / 2.0);
+ cairo_scale (cr, size, size);
+
+ /* Fill face */
+ cairo_arc (cr, 0.5, 0.5, 0.5 - STROKE_WIDTH, 0, 2 * M_PI);
+ cairo_set_source_rgb (cr, 1, 1, 0);
+ cairo_save (cr);
+ {
+ cairo_fill (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ /* Stroke face */
+ cairo_set_line_width (cr, STROKE_WIDTH / 2.0);
+ cairo_stroke (cr);
+
+ /* Eyes */
+ cairo_set_line_width (cr, STROKE_WIDTH);
+ cairo_arc (cr, 0.3, 0.4, STROKE_WIDTH, 0, 2 * M_PI);
+ cairo_fill (cr);
+ cairo_arc (cr, 0.7, 0.4, STROKE_WIDTH, 0, 2 * M_PI);
+ cairo_fill (cr);
+
+ /* Mouth */
+ cairo_move_to (cr, 0.3, 0.7);
+ cairo_curve_to (cr,
+ 0.4, 0.8,
+ 0.6, 0.8,
+ 0.7, 0.7);
+ cairo_stroke (cr);
+}
+
+int
+main (void)
+{
+ cairo_t *cr;
+ const char *filename = "pdf-surface.pdf";
+ cairo_surface_t *surface;
+
+ printf("\n");
+
+ surface = cairo_pdf_surface_create (filename,
+ WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
+ if (surface == NULL) {
+ fprintf (stderr, "Failed to create pdf surface for file %s\n", filename);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cr = cairo_create (surface);
+
+ draw (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
+
+ cairo_show_page (cr);
+
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+
+ printf ("pdf-surface: Please check pdf-surface.pdf to make sure it looks happy.\n");
+
+ return 0;
+}
diff --git a/test/pixman_rotate-ref.png b/test/pixman-rotate-ref.png
index 7e47a4d..7e47a4d 100644
--- a/test/pixman_rotate-ref.png
+++ b/test/pixman-rotate-ref.png
Binary files differ
diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c
new file mode 100644
index 0000000..5c6fe41
--- /dev/null
+++ b/test/pixman-rotate.c
@@ -0,0 +1,76 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <cairo.h>
+#include <cairo-pdf.h>
+
+#include "cairo-test.h"
+
+#define WIDTH 32
+#define HEIGHT WIDTH
+
+#define IMAGE_WIDTH (3 * WIDTH)
+#define IMAGE_HEIGHT IMAGE_WIDTH
+
+cairo_test_t test = {
+ "pixman-rotate",
+ "Exposes pixman off-by-one error when rotating",
+ IMAGE_WIDTH, IMAGE_HEIGHT
+};
+
+/* Draw the word cairo at NUM_TEXT different angles */
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *stamp;
+ cairo_t *cr2;
+
+ stamp = cairo_surface_create_similar (cairo_get_target (cr),
+ CAIRO_FORMAT_ARGB32,
+ WIDTH, HEIGHT);
+ cr2 = cairo_create (stamp);
+ {
+ cairo_new_path (cr2);
+ cairo_rectangle (cr2, WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2);
+ cairo_set_source_rgba (cr2, 1, 0, 0, 0.8);
+ cairo_fill (cr2);
+
+ cairo_rectangle (cr2, 0, 0, WIDTH, HEIGHT);
+ cairo_set_line_width (cr2, 2);
+ cairo_set_source_rgb (cr2, 0, 0, 0);
+ cairo_stroke (cr2);
+ }
+ cairo_destroy (cr2);
+
+ /* Draw a translucent rectangle for reference where the rotated
+ * image should be. */
+ cairo_new_path (cr);
+ cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT);
+ cairo_set_source_rgba (cr, 1, 1, 0, 0.3);
+ cairo_fill (cr);
+
+#if 1 /* Set to 0 to generate reference image */
+ cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT);
+ cairo_rotate (cr, M_PI);
+#else
+ cairo_translate (cr, WIDTH, HEIGHT);
+#endif
+
+ cairo_set_source_surface (cr, stamp, 0, 0);
+ cairo_paint (cr);
+
+ cairo_show_page (cr);
+
+ cairo_surface_destroy (stamp);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test_expect_failure (&test, draw,
+ "known off-by-one bug when rotating a pixman image");
+}
diff --git a/test/pixman_rotate.c b/test/pixman_rotate.c
deleted file mode 100644
index 6a64a9a..0000000
--- a/test/pixman_rotate.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <cairo.h>
-#include <cairo-png.h>
-#include <cairo-pdf.h>
-
-#include "cairo_test.h"
-
-#define WIDTH 32
-#define HEIGHT WIDTH
-
-#define IMAGE_WIDTH (3 * WIDTH)
-#define IMAGE_HEIGHT IMAGE_WIDTH
-
-cairo_test_t test = {
- "pixman_rotate",
- "Exposes pixman off-by-one error when rotating",
- IMAGE_WIDTH, IMAGE_HEIGHT
-};
-
-/* Draw the word cairo at NUM_TEXT different angles */
-static void
-draw (cairo_t *cr, int width, int height)
-{
- cairo_surface_t *target, *stamp;
-
- target = cairo_current_target_surface (cr);
- cairo_surface_reference (target);
-
- stamp = cairo_surface_create_similar (target, CAIRO_FORMAT_ARGB32,
- WIDTH, HEIGHT);
- cairo_set_target_surface (cr, stamp);
- cairo_new_path (cr);
- cairo_rectangle (cr, WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2);
- cairo_set_rgb_color (cr, 1, 0, 0);
- cairo_set_alpha (cr, 0.8);
- cairo_fill (cr);
-
- cairo_rectangle (cr, 0, 0, WIDTH, HEIGHT);
- cairo_set_line_width (cr, 2);
- cairo_set_rgb_color (cr, 0, 0, 0);
- cairo_set_alpha (cr, 1);
- cairo_stroke (cr);
-
- cairo_set_target_surface (cr, target);
-
- /* Draw a translucent rectangle for reference where the rotated
- * image should be. */
- cairo_new_path (cr);
- cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT);
- cairo_set_rgb_color (cr, 1, 1, 0);
- cairo_set_alpha (cr, 0.3);
- cairo_fill (cr);
-
-#if 1 /* Set to 0 to generate reference image */
- cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT);
- cairo_rotate (cr, M_PI);
-#else
- cairo_translate (cr, WIDTH, HEIGHT);
-#endif
-
- cairo_set_alpha (cr, 1);
- cairo_show_surface (cr, stamp, WIDTH + 2, HEIGHT + 2);
-
- cairo_show_page (cr);
-
- cairo_surface_destroy (stamp);
- cairo_surface_destroy (target);
-}
-
-int
-main (void)
-{
- return cairo_test (&test, draw);
-}
diff --git a/test/ps-surface.c b/test/ps-surface.c
new file mode 100644
index 0000000..5d5bf4e
--- /dev/null
+++ b/test/ps-surface.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdio.h>
+
+#include <cairo-ps.h>
+#include "cairo-test.h"
+
+/* Pretty boring test just to make sure things aren't crashing ---
+ * no verification that we're getting good results yet.
+ * But you can manually view the image to make sure it looks happy.
+ */
+
+#define WIDTH_IN_INCHES 3
+#define HEIGHT_IN_INCHES 3
+#define WIDTH_IN_POINTS (WIDTH_IN_INCHES * 72.0)
+#define HEIGHT_IN_POINTS (HEIGHT_IN_INCHES * 72.0)
+
+static void
+draw (cairo_t *cr, double width, double height)
+{
+#define STROKE_WIDTH .04
+
+ double size;
+
+ if (width > height)
+ size = height;
+ else
+ size = width;
+
+ cairo_translate (cr, (width - size) / 2.0, (height - size) / 2.0);
+ cairo_scale (cr, size, size);
+
+ /* Fill face */
+ cairo_arc (cr, 0.5, 0.5, 0.5 - STROKE_WIDTH, 0, 2 * M_PI);
+ cairo_set_source_rgb (cr, 1, 1, 0);
+ cairo_save (cr);
+ {
+ cairo_fill (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ /* Stroke face */
+ cairo_set_line_width (cr, STROKE_WIDTH / 2.0);
+ cairo_stroke (cr);
+
+ /* Eyes */
+ cairo_set_line_width (cr, STROKE_WIDTH);
+ cairo_arc (cr, 0.3, 0.4, STROKE_WIDTH, 0, 2 * M_PI);
+ cairo_fill (cr);
+ cairo_arc (cr, 0.7, 0.4, STROKE_WIDTH, 0, 2 * M_PI);
+ cairo_fill (cr);
+
+ /* Mouth */
+ cairo_move_to (cr, 0.3, 0.7);
+ cairo_curve_to (cr,
+ 0.4, 0.8,
+ 0.6, 0.8,
+ 0.7, 0.7);
+ cairo_stroke (cr);
+}
+
+int
+main (void)
+{
+ cairo_t *cr;
+ const char *filename = "ps-surface.ps";
+ cairo_surface_t *surface;
+
+ printf("\n");
+
+ surface = cairo_ps_surface_create (filename,
+ WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
+ if (surface == NULL) {
+ cairo_test_log ("Failed to create pdf surface for file %s\n", filename);
+ return CAIRO_TEST_FAILURE;
+ }
+
+ cr = cairo_create (surface);
+
+ draw (cr, WIDTH_IN_POINTS, HEIGHT_IN_POINTS);
+
+ cairo_show_page (cr);
+
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
+
+ printf ("ps-surface: Please check ps-surface.ps to make sure it looks happy.\n");
+
+ return 0;
+}
diff --git a/test/read_png.c b/test/read-png.c
index e7e2a92..96259df 100644
--- a/test/read_png.c
+++ b/test/read-png.c
@@ -25,11 +25,26 @@
* Author: Carl D. Worth <cworth@isi.edu>
*/
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INT_TYPES_H
+# include <sys/int_types.h>
+#else
+#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <png.h>
-#include "read_png.h"
+#include "cairo-test.h"
+#include "read-png.h"
#include "xmalloc.h"
static void
@@ -40,18 +55,18 @@ premultiply_data (png_structp png,
int i;
for (i = 0; i < row_info->rowbytes; i += 4) {
- unsigned char *base = &data[i];
- unsigned char blue = base[0];
- unsigned char green = base[1];
- unsigned char red = base[2];
- unsigned char alpha = base[3];
- unsigned long p;
+ uint8_t *base = &data[i];
+ uint8_t blue = base[0];
+ uint8_t green = base[1];
+ uint8_t red = base[2];
+ uint8_t alpha = base[3];
+ uint32_t p;
red = ((unsigned) red * (unsigned) alpha + 127) / 255;
green = ((unsigned) green * (unsigned) alpha + 127) / 255;
blue = ((unsigned) blue * (unsigned) alpha + 127) / 255;
p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
- memcpy (base, &p, sizeof (unsigned long));
+ memcpy (base, &p, sizeof (uint32_t));
}
}
@@ -76,12 +91,14 @@ read_png_argb32 (const char *filename,
file = fopen (filename, "rb");
if (file == NULL) {
+ cairo_test_log ("Error: File not found: %s\n", filename);
return READ_PNG_FILE_NOT_FOUND;
}
sig_bytes = fread (png_sig, 1, PNG_SIG_SIZE, file);
if (png_check_sig (png_sig, sig_bytes) == 0) {
fclose (file);
+ cairo_test_log ("Error: File is not a PNG image: %s\n", filename);
return READ_PNG_FILE_NOT_PNG;
}
@@ -92,6 +109,7 @@ read_png_argb32 (const char *filename,
NULL);
if (png == NULL) {
fclose (file);
+ cairo_test_log ("Error: Out of memory while reading %s\n", filename);
return READ_PNG_NO_MEMORY;
}
@@ -99,6 +117,7 @@ read_png_argb32 (const char *filename,
if (info == NULL) {
fclose (file);
png_destroy_read_struct (&png, NULL, NULL);
+ cairo_test_log ("Error: Out of memory while reading %s\n", filename);
return READ_PNG_NO_MEMORY;
}
diff --git a/test/read_png.h b/test/read-png.h
index 9c9ba43..9c9ba43 100644
--- a/test/read_png.h
+++ b/test/read-png.h
diff --git a/test/rel-path-ref.png b/test/rel-path-ref.png
new file mode 100644
index 0000000..7b7007f
--- /dev/null
+++ b/test/rel-path-ref.png
Binary files differ
diff --git a/test/rel-path.c b/test/rel-path.c
new file mode 100644
index 0000000..0e4c73a
--- /dev/null
+++ b/test/rel-path.c
@@ -0,0 +1,56 @@
+/*
+ * $Id: rel-path.c,v 1.1 2005/05/02 19:36:20 keithp Exp $
+ *
+ * Copyright © 2005 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "cairo-test.h"
+
+#define SIZE 10
+
+cairo_test_t test = {
+ "rel-path",
+ "Tests calls to various relative path functions",
+ SIZE, SIZE
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_move_to (cr, 0, 0);
+ cairo_rel_move_to (cr, SIZE, SIZE/2);
+ cairo_rel_line_to (cr, -SIZE, SIZE/2);
+ cairo_rel_curve_to (cr,
+ SIZE/2, -SIZE/2,
+ SIZE*2/3, -SIZE/3,
+ SIZE/2, -SIZE);
+
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/scale-source-surface-paint-ref.png b/test/scale-source-surface-paint-ref.png
new file mode 100644
index 0000000..ec3c059
--- /dev/null
+++ b/test/scale-source-surface-paint-ref.png
Binary files differ
diff --git a/test/scale-source-surface-paint.c b/test/scale-source-surface-paint.c
new file mode 100644
index 0000000..7b1cc38
--- /dev/null
+++ b/test/scale-source-surface-paint.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "scale-source-surface-paint",
+ "Test call sequence: cairo_scale; cairo_set_source_surface; cairo_paint",
+ 12, 12
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ unsigned long data[16] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff,
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff
+ };
+
+ surface = cairo_image_surface_create_for_data ((unsigned char *) data,
+ CAIRO_FORMAT_ARGB32, 4, 4, 16);
+
+ cairo_scale (cr, 2, 2);
+
+ cairo_set_source_surface (cr, surface, 1 , 1);
+ cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
+ cairo_paint (cr);
+
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/select-font-no-show-text.c b/test/select-font-no-show-text.c
new file mode 100644
index 0000000..b99dfea
--- /dev/null
+++ b/test/select-font-no-show-text.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl Worth <cworth@redhat.com>
+ */
+
+/* Bug history
+ *
+ * 2005-04-12 Carl Worth <cworth@cworth.org>
+ *
+ * I noticed that if we call cairo_select_font_face, but then do a
+ * cairo_destroy before ever drawing any text, then we get:
+ *
+ * *** glibc detected *** double free or corruption (fasttop): 0x083274d0 ***
+ * Aborted
+ *
+ * 2005-04-14 Owen Taylor <otaylor@redhat.com>
+ *
+ * Fixed... just a stray free().
+ */
+
+#include <math.h>
+#include "cairo-test.h"
+
+static cairo_test_t test = {
+ "select-font-no-show-text",
+ "Test calling cairo_select_font_face but never drawing text.",
+ 0, 0
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_select_font_face (cr, "Bitstream Vera Sans",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_BOLD);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/self-copy-ref.png b/test/self-copy-ref.png
new file mode 100644
index 0000000..92a20db
--- /dev/null
+++ b/test/self-copy-ref.png
Binary files differ
diff --git a/test/self-copy.c b/test/self-copy.c
new file mode 100644
index 0000000..5f4398b
--- /dev/null
+++ b/test/self-copy.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Owen Taylor <otaylor@redhat.com>
+ */
+
+#include <math.h>
+#include "cairo-test.h"
+#include <stdio.h>
+
+#define SIZE 40
+
+cairo_test_t test = {
+ "self-copy",
+ "Test copying from a surface to itself with a clip",
+ SIZE, SIZE
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_pattern_t *pattern;
+ cairo_matrix_t matrix;
+
+ /* Paint a diagonal division as a test image */
+ cairo_set_source_rgb (cr, 1, 1, 1); /* White */
+ cairo_paint (cr);
+
+ cairo_move_to (cr, SIZE, 0);
+ cairo_line_to (cr, SIZE, SIZE);
+ cairo_line_to (cr, 0, SIZE);
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_fill (cr);
+
+ /* Create a pattern with the target surface as the source,
+ * offset by SIZE/2
+ */
+ pattern = cairo_pattern_create_for_surface (cairo_get_target (cr));
+
+ cairo_matrix_init_translate (&matrix, - SIZE / 2, - SIZE / 2);
+ cairo_pattern_set_matrix (pattern, &matrix);
+
+ cairo_set_source (cr, pattern);
+ cairo_pattern_destroy (pattern);
+
+ /* Copy two rectangles from the upper-left quarter of the image to
+ * the lower right. It will work if we use cairo_fill(), but the
+ * cairo_clip() cairo_paint() combination fails because the clip
+ * on the surface as a destination affects it as the source as
+ * well.
+ */
+ cairo_rectangle (cr,
+ 2 * SIZE / 4, 2 * SIZE / 4,
+ SIZE / 4, SIZE / 4);
+ cairo_rectangle (cr,
+ 3 * SIZE / 4, 3 * SIZE / 4,
+ SIZE / 4, SIZE / 4);
+ cairo_clip (cr);
+ cairo_paint (cr);
+
+ return CAIRO_TEST_SUCCESS;
+
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/self-intersecting-ref.png b/test/self-intersecting-ref.png
new file mode 100644
index 0000000..384b0ab
--- /dev/null
+++ b/test/self-intersecting-ref.png
Binary files differ
diff --git a/test/self-intersecting.c b/test/self-intersecting.c
new file mode 100644
index 0000000..2dfd796
--- /dev/null
+++ b/test/self-intersecting.c
@@ -0,0 +1,89 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+/* Bug history
+ *
+ * 2005-06-01 Carl Worth <cworth@cworth.org>
+ *
+ * There's a long-standing bug in that self-intersecting paths give
+ * an incorrect result when stroked. The problem is that the
+ * trapezoids are generated incrementally along the stroke and as
+ * such, are not disjoint. The errant intersections of these
+ * trapezoids then leads to overfilled pixels.
+ *
+ * The test belows first creates and fills a path. Then it creates a
+ * second path which has a stroked boundary identical to the first
+ * filled path. But the results of the two operations are
+ * different. The most obvious difference is in the central region
+ * where the entire path intersects itself. But notice that every
+ * time the path turns there are also errors on the inside of the
+ * turn, (since the subsequent trapezoids along the path intersect).
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "self-intersecting",
+ "Test strokes of self-intersecting paths",
+ 10, 20
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_translate (cr, 1.0, 1.0);
+
+ cairo_set_source_rgb (cr, 1, 0, 0); /* red */
+
+ /* First draw the desired shape with a fill */
+ cairo_rectangle (cr, 0.5, 0.5, 4.0, 4.0);
+ cairo_rectangle (cr, 3.5, 3.5, 4.0, 4.0);
+ cairo_rectangle (cr, 3.5, 1.5, -2.0, 2.0);
+ cairo_rectangle (cr, 6.5, 4.5, -2.0, 2.0);
+
+ cairo_fill (cr);
+
+ /* Then try the same thing with a stroke */
+ cairo_translate (cr, 0, 10);
+ cairo_move_to (cr, 1.0, 1.0);
+ cairo_rel_line_to (cr, 3.0, 0.0);
+ cairo_rel_line_to (cr, 0.0, 6.0);
+ cairo_rel_line_to (cr, 3.0, 0.0);
+ cairo_rel_line_to (cr, 0.0, -3.0);
+ cairo_rel_line_to (cr, -6.0, 0.0);
+ cairo_close_path (cr);
+
+ cairo_set_line_width (cr, 1.0);
+ cairo_stroke (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test_expect_failure (&test, draw,
+ "Self-intersecting strokes are wrong due to incremental trapezoidization.");
+}
diff --git a/test/set-source-ref.png b/test/set-source-ref.png
new file mode 100644
index 0000000..c5d5e92
--- /dev/null
+++ b/test/set-source-ref.png
Binary files differ
diff --git a/test/set-source.c b/test/set-source.c
new file mode 100644
index 0000000..568935d
--- /dev/null
+++ b/test/set-source.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "set-source",
+ "Tests calls to various set_source functions",
+ 5, 5
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ int i;
+ /* This color value might need to change in the future when we fix
+ * the rounding in cairo-color.c */
+ unsigned long color = 0x7f19334C;
+ cairo_surface_t *surface;
+ cairo_pattern_t *pattern;
+
+ surface = cairo_image_surface_create_for_data ((unsigned char *) &color,
+ CAIRO_FORMAT_ARGB32, 1, 1, 4);
+ pattern = cairo_pattern_create_for_surface (surface);
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+
+ /* Several different means of making mostly the same color (though
+ * we can't get anything but alpha==1.0 out of
+ * cairo_set_source_rgb. */
+ for (i=0; i < width; i++) {
+ switch (i) {
+ case 0:
+ cairo_set_source_rgb (cr, .6, .7, .8);
+ break;
+ case 1:
+ cairo_set_source_rgba (cr, .2, .4, .6, 0.5);
+ break;
+ case 2:
+#if WE_HAD_SUPPORT_FOR_PREMULTIPLIED
+ cairo_set_source_rgba_premultiplied (cr, .1, .2, .3, 0.5);
+#else
+ cairo_set_source_rgba (cr, .2, .4, .6, 0.5);
+#endif
+ break;
+ case 3:
+ default:
+ cairo_set_source (cr, pattern);
+ break;
+ }
+
+ cairo_rectangle (cr, i, 0, 1, height);
+ cairo_fill (cr);
+ }
+
+ cairo_pattern_destroy (pattern);
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/source-clip-ref.png b/test/source-clip-ref.png
new file mode 100644
index 0000000..8df2bff
--- /dev/null
+++ b/test/source-clip-ref.png
Binary files differ
diff --git a/test/source-clip.c b/test/source-clip.c
new file mode 100644
index 0000000..73be6b4
--- /dev/null
+++ b/test/source-clip.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Owen Taylor <otaylor@redhat.com>
+ */
+
+#include <math.h>
+#include "cairo-test.h"
+#include <stdio.h>
+
+#define SIZE 50
+
+cairo_test_t test = {
+ "source-clip",
+ "Test using a surface with an active clip as a source",
+ SIZE, SIZE
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_pattern_t *pattern;
+ cairo_surface_t *source_surface;
+ cairo_t *cr2;
+
+ source_surface = cairo_surface_create_similar (cairo_get_target (cr),
+ CAIRO_FORMAT_ARGB32,
+ SIZE, SIZE);
+
+ cr2 = cairo_create (source_surface);
+
+ /* Fill the source surface with solid black */
+ cairo_set_source_rgb (cr2, 0, 0, 0);
+ cairo_paint (cr2);
+
+ /* Now leave a clip in place */
+ cairo_rectangle (cr2,
+ SIZE / 4, SIZE / 4,
+ SIZE / 2, SIZE / 2);
+ cairo_clip (cr2);
+
+ /* Fill the destination surface with solid white */
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ /* Now draw the source surface onto the destination surface */
+ pattern = cairo_pattern_create_for_surface (source_surface);
+ cairo_set_source (cr, pattern);
+ cairo_paint (cr);
+
+ /* As the clip shouldn't matter, the result should be solid black */
+
+ cairo_destroy (cr2);
+ cairo_pattern_destroy (pattern);
+ cairo_surface_destroy (source_surface);
+
+ return CAIRO_TEST_SUCCESS;
+
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/source-surface-scale-paint-ref.png b/test/source-surface-scale-paint-ref.png
new file mode 100644
index 0000000..ec3c059
--- /dev/null
+++ b/test/source-surface-scale-paint-ref.png
Binary files differ
diff --git a/test/source-surface-scale-paint.c b/test/source-surface-scale-paint.c
new file mode 100644
index 0000000..9862ba5
--- /dev/null
+++ b/test/source-surface-scale-paint.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "source-surface-scale-paint",
+ "Test call sequence: cairo_set_source_surface; cairo_scale; cairo_paint",
+ 12, 12
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ unsigned long data[16] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff,
+ 0xff00ff00, 0xff00ff00, 0xff0000ff, 0xff0000ff
+ };
+
+ surface = cairo_image_surface_create_for_data ((unsigned char *) data,
+ CAIRO_FORMAT_ARGB32, 4, 4, 16);
+
+ cairo_set_source_surface (cr, surface, 2, 2);
+ cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
+ cairo_scale (cr, 2, 2);
+ cairo_paint (cr);
+
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test_expect_failure (&test, draw,
+ "cairo_set_source needs user space locking semantics");
+}
diff --git a/test/surface-finish-twice.c b/test/surface-finish-twice.c
new file mode 100644
index 0000000..3f24e39
--- /dev/null
+++ b/test/surface-finish-twice.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+/* Bug history
+ *
+ * 2005-04-10 stevech1097@yahoo.com.au
+ *
+ * Subject: [Bug 2950] New: *** glibc detected *** double free or corruption
+ * URL: https://bugs.freedesktop.org/show_bug.cgi?id=2950
+ *
+ * The following short program gives the error message:
+ *
+ * *** glibc detected *** double free or corruption: 0x082a7268 ***
+ * Aborted
+ *
+ * 2005-04-13 Carl Worth <cworth@cworth.org>
+ *
+ * Looks like surface->finished was never being set. Now fixed.
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "surface-finish-twice",
+ "Test to exercise a crash when calling cairo_surface_finish twice on the same surface.",
+ 0, 0
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ cairo_status_t status;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+ status = cairo_surface_finish (surface);
+ if (status != CAIRO_STATUS_SUCCESS)
+ return CAIRO_TEST_FAILURE;
+
+ status = cairo_surface_finish (surface);
+ if (status != CAIRO_STATUS_SURFACE_FINISHED)
+ return CAIRO_TEST_FAILURE;
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
+
diff --git a/test/surface-pattern-ref.png b/test/surface-pattern-ref.png
new file mode 100644
index 0000000..1a64106
--- /dev/null
+++ b/test/surface-pattern-ref.png
Binary files differ
diff --git a/test/surface-pattern.c b/test/surface-pattern.c
new file mode 100644
index 0000000..4f91d43
--- /dev/null
+++ b/test/surface-pattern.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "surface-pattern",
+ "Tests use of a surface pattern",
+ 36, 36
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ cairo_t *cr2;
+ cairo_pattern_t *pattern;
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ 6, 6);
+
+ cr2 = cairo_create (surface);
+ {
+ cairo_rectangle (cr2, 0, 0, 3, 3);
+ cairo_rectangle (cr2, 3, 3, 3, 3);
+ cairo_set_source_rgb (cr2, 1, 1, 0);
+ cairo_fill (cr2);
+
+ cairo_rectangle (cr2, 3, 0, 3, 3);
+ cairo_rectangle (cr2, 0, 3, 3, 3);
+ cairo_set_source_rgb (cr2, 0, 0, 1);
+ cairo_fill (cr2);
+ }
+ cairo_destroy (cr2);
+
+ pattern = cairo_pattern_create_for_surface (surface);
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
+ cairo_set_source (cr, pattern);
+
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_fill (cr);
+
+ cairo_pattern_destroy (pattern);
+ cairo_surface_destroy (surface);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/text_cache_crash.c b/test/text-cache-crash.c
index 6ac3245..547e2a3 100644
--- a/test/text_cache_crash.c
+++ b/test/text-cache-crash.c
@@ -60,26 +60,28 @@
* fixed the orginal test case.
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
cairo_test_t test = {
- "text_cache_crash",
+ "text-cache-crash",
"Test case for bug causing an assertion failure in _cairo_cache_lookup",
0, 0,
};
#include <cairo.h>
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
/* Once there was a bug that choked when selecting the same font twice. */
- cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- cairo_scale_font(cr, 40.0);
-
- cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
- cairo_scale_font(cr, 40.0);
- cairo_move_to(cr, 10, 50);
- cairo_show_text(cr, "hello");
+ cairo_select_font_face (cr, "sans",
+ CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+ cairo_set_font_size (cr, 40.0);
+
+ cairo_select_font_face (cr, "sans",
+ CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+ cairo_set_font_size (cr, 40.0);
+ cairo_move_to (cr, 10, 50);
+ cairo_show_text (cr, "hello");
/* Then there was a bug that choked when selecting a font too big
* for the cache. */
@@ -102,9 +104,11 @@ Aborted
But in the meantime, I need "make check" not to destory work, so
I'm commenting this test out for now.
- cairo_scale_font (cr, 500);
+ cairo_set_font_size (cr, 500);
cairo_show_text (cr, "hello");
*/
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/text_rotate.c b/test/text-rotate.c
index c08c402..6301ad9 100644
--- a/test/text_rotate.c
+++ b/test/text-rotate.c
@@ -57,7 +57,7 @@
* builtin font to cairo for pixel-perfect tests with text.
*/
-#include "cairo_test.h"
+#include "cairo-test.h"
#define WIDTH 150
#define HEIGHT 150
@@ -65,25 +65,25 @@
#define TEXT_SIZE 12
cairo_test_t test = {
- "text_rotate",
+ "text-rotate",
"Tests show_text under various rotations",
WIDTH, HEIGHT
};
/* Draw the word cairo at NUM_TEXT different angles */
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
int i, x_off, y_off;
cairo_text_extents_t extents;
static char text[] = "cairo";
- cairo_select_font (cr, "Bitstream Vera Sans",
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_NORMAL);
- cairo_scale_font (cr, TEXT_SIZE);
+ cairo_select_font_face (cr, "Bitstream Vera Sans",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_set_font_size (cr, TEXT_SIZE);
- cairo_set_rgb_color (cr, 0,0,0);
+ cairo_set_source_rgb (cr, 0, 0, 0);
cairo_translate (cr, WIDTH/2.0, HEIGHT/2.0);
@@ -101,17 +101,20 @@ draw (cairo_t *cr, int width, int height)
cairo_rotate (cr, 2*M_PI*i/NUM_TEXT);
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr, x_off - 0.5, y_off - 0.5, extents.width + 1, extents.height + 1);
- cairo_set_rgb_color (cr, 1, 0, 0);
+ cairo_set_source_rgb (cr, 1, 0, 0);
cairo_stroke (cr);
cairo_move_to (cr, x_off - extents.x_bearing, y_off - extents.y_bearing);
- cairo_set_rgb_color (cr, 0, 0, 0);
+ cairo_set_source_rgb (cr, 0, 0, 0);
cairo_show_text (cr, "cairo");
cairo_restore (cr);
}
+
+ return CAIRO_TEST_SUCCESS;
}
int
main (void)
{
- return cairo_test (&test, draw);
+ return cairo_test_expect_failure (&test, draw,
+ "known bugs in positioning rotated glyphs");
}
diff --git a/test/transforms-ref.png b/test/transforms-ref.png
new file mode 100644
index 0000000..ee5bc7c
--- /dev/null
+++ b/test/transforms-ref.png
Binary files differ
diff --git a/test/transforms.c b/test/transforms.c
new file mode 100644
index 0000000..2c7556a
--- /dev/null
+++ b/test/transforms.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl Worth <cworth@cworth.org>
+ */
+
+#include "cairo-test.h"
+
+#define WIDTH 45
+#define HEIGHT 30
+
+cairo_test_t test = {
+ "transforms",
+ "Test various transformations.",
+ WIDTH, HEIGHT
+};
+
+static void
+draw_L_shape (cairo_t *cr)
+{
+ cairo_move_to (cr, 0, 0);
+ cairo_rel_line_to (cr, 0, 10);
+ cairo_rel_line_to (cr, 5, 0);
+
+ cairo_save (cr);
+ cairo_identity_matrix (cr);
+ cairo_set_line_width (cr, 2.0);
+ cairo_stroke (cr);
+ cairo_restore (cr);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_translate (cr, 5, 5);
+
+ draw_L_shape (cr);
+
+ cairo_translate (cr, 10, 0);
+
+ cairo_save (cr);
+ {
+ cairo_scale (cr, 2, 2);
+ draw_L_shape (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_translate (cr, 15, 0);
+
+ cairo_save (cr);
+ {
+ cairo_rotate (cr, M_PI / 2.0);
+ draw_L_shape (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_translate (cr, 5, 0);
+
+ cairo_save (cr);
+ {
+ cairo_matrix_t skew_y = {
+ 1, -1,
+ 0, 1,
+ 0, 0
+ };
+ cairo_transform (cr, &skew_y);
+ draw_L_shape (cr);
+ }
+ cairo_restore (cr);
+
+ cairo_translate (cr, 5, 10);
+
+ cairo_save (cr);
+ {
+ cairo_matrix_t skew_x = {
+ 1.0, 0.0,
+ -0.5, 1.0,
+ 0.0, 0.0
+ };
+ cairo_transform (cr, &skew_x);
+ draw_L_shape (cr);
+ }
+ cairo_restore (cr);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/translate-show-surface-ref.png b/test/translate-show-surface-ref.png
new file mode 100644
index 0000000..765adc4
--- /dev/null
+++ b/test/translate-show-surface-ref.png
Binary files differ
diff --git a/test/translate-show-surface.c b/test/translate-show-surface.c
new file mode 100644
index 0000000..5a566bc
--- /dev/null
+++ b/test/translate-show-surface.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+/* Bug history
+ *
+ * 2005-04-11 Carl Worth <cworth@cworth.org>
+ *
+ * It appears that calling cairo_show_surface after cairo_translate
+ * somehow applies the translation twice to the surface being
+ * shown. This is pretty easy to demonstrate by bringing up xsvg on
+ * an SVG file with an <image> and panning around a bit with the
+ * arrow keys.
+ *
+ * This is almost certainly a regression, and I suspect there may be
+ * some interaction with the fix for move-to-show-surface.
+ *
+ * 2005-04-12 Carl Worth <cworth@cworth.org>
+ *
+ * I committed a fix for this bug today.
+ */
+
+#include "cairo-test.h"
+
+cairo_test_t test = {
+ "translate-show-surface",
+ "Tests calls to cairo_show_surface after cairo_translate",
+ 2, 2
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *surface;
+ unsigned long colors[4] = {
+ 0xffffffff, 0xffff0000,
+ 0xff00ff00, 0xff0000ff
+ };
+ int i;
+
+ for (i=0; i < 4; i++) {
+ surface = cairo_image_surface_create_for_data ((unsigned char *) &colors[i],
+ CAIRO_FORMAT_ARGB32,
+ 1, 1, 4);
+ cairo_save (cr);
+ {
+ cairo_translate (cr, i % 2, i / 2);
+ cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_paint (cr);
+ }
+ cairo_restore (cr);
+ cairo_surface_destroy (surface);
+ }
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+ return cairo_test (&test, draw);
+}
diff --git a/test/trap-clip-ref.png b/test/trap-clip-ref.png
new file mode 100644
index 0000000..9b5b317
--- /dev/null
+++ b/test/trap-clip-ref.png
Binary files differ
diff --git a/test/coverage.c b/test/trap-clip.c
index 00c86a1..2ad43ea 100644
--- a/test/coverage.c
+++ b/test/trap-clip.c
@@ -24,31 +24,25 @@
*/
#include <math.h>
-#include "cairo_test.h"
+#include "cairo-test.h"
+#include <stdio.h>
#define WIDTH 64
#define HEIGHT 64
#define PAD 10
-/* XXX The test image uses Bitstream Vera Sans as the font - how do we
- * ensure that it's available? Can we ship it with this test? */
-
-const char fontname[] = "Bitstream Vera Sans";
-const int fontsize = 40;
const char png_filename[] = "romedalen.png";
static void
set_solid_pattern (cairo_t *cr, int x, int y)
{
- cairo_set_rgb_color (cr, 0, 0, 0.6);
- cairo_set_alpha (cr, 1.0);
+ cairo_set_source_rgb (cr, 0, 0, 0.6);
}
static void
set_translucent_pattern (cairo_t *cr, int x, int y)
{
- cairo_set_rgb_color (cr, 0, 0, 0.6);
- cairo_set_alpha (cr, 0.5);
+ cairo_set_source_rgba (cr, 0, 0, 0.6, 0.5);
}
static void
@@ -58,10 +52,9 @@ set_gradient_pattern (cairo_t *cr, int x, int y)
pattern =
cairo_pattern_create_linear (x, y, x + WIDTH, y + HEIGHT);
- cairo_pattern_add_color_stop (pattern, 0, 1, 1, 1, 1);
- cairo_pattern_add_color_stop (pattern, 1, 0, 0, 0.4, 1);
- cairo_set_pattern (cr, pattern);
- cairo_set_alpha (cr, 1);
+ cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, 1);
+ cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0.4, 1);
+ cairo_set_source (cr, pattern);
}
static void
@@ -70,25 +63,28 @@ set_image_pattern (cairo_t *cr, int x, int y)
cairo_pattern_t *pattern;
pattern = cairo_test_create_png_pattern (cr, png_filename);
- cairo_set_pattern (cr, pattern);
- cairo_set_alpha (cr, 1);
+ cairo_set_source (cr, pattern);
}
static void
-set_translucent_image_pattern (cairo_t *cr, int x, int y)
+draw_rect (cairo_t *cr, int x, int y)
{
- cairo_pattern_t *pattern;
-
- pattern = cairo_test_create_png_pattern (cr, png_filename);
- cairo_set_pattern (cr, pattern);
- cairo_set_alpha (cr, 0.5);
+ cairo_new_path (cr);
+ cairo_rectangle (cr, x, y, WIDTH, HEIGHT);
+ cairo_fill (cr);
}
static void
-draw_text (cairo_t *cr, int x, int y)
+draw_rects (cairo_t *cr, int x, int y)
{
- cairo_rel_move_to (cr, 0, fontsize);
- cairo_show_text (cr, "Aa");
+ int width = WIDTH / 3;
+ int height = HEIGHT / 2;
+
+ cairo_new_path (cr);
+ cairo_rectangle (cr, x, y, width, height);
+ cairo_rectangle (cr, x + width, y + height, width, height);
+ cairo_rectangle (cr, x + 2 * width, y, width, height);
+ cairo_fill (cr);
}
static void
@@ -105,74 +101,102 @@ draw_polygon (cairo_t *cr, int x, int y)
cairo_fill (cr);
}
+static void
+clip_none (cairo_t *cr, int x, int y)
+{
+}
+
+static void
+clip_rect (cairo_t *cr, int x, int y)
+{
+ cairo_new_path (cr);
+ cairo_rectangle (cr, x + (int)WIDTH / 6, y + (int)HEIGHT / 6,
+ 4 * ((int)WIDTH / 6), 4 * ((int)WIDTH / 6));
+ cairo_clip (cr);
+ cairo_new_path (cr);
+}
+
+static void
+clip_rects (cairo_t *cr, int x, int y)
+{
+ int height = HEIGHT / 3;
+
+ cairo_new_path (cr);
+ cairo_rectangle (cr, x, y, WIDTH, height);
+ cairo_rectangle (cr, x, y + 2 * height, WIDTH, height);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+}
+
+static void
+clip_circle (cairo_t *cr, int x, int y)
+{
+ cairo_new_path (cr);
+ cairo_arc (cr, x + WIDTH / 2, y + HEIGHT / 2,
+ WIDTH / 3, 0, 2 * M_PI);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+}
+
static void (*pattern_funcs[])(cairo_t *cr, int x, int y) = {
set_solid_pattern,
set_translucent_pattern,
set_gradient_pattern,
set_image_pattern,
- set_translucent_image_pattern
};
static void (*draw_funcs[])(cairo_t *cr, int x, int y) = {
- draw_text,
+ draw_rect,
+ draw_rects,
draw_polygon,
};
+static void (*clip_funcs[])(cairo_t *cr, int x, int y) = {
+ clip_none,
+ clip_rect,
+ clip_rects,
+ clip_circle,
+};
+
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
#define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD)
-#define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) * 2 + PAD)
+#define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * ARRAY_SIZE (clip_funcs) * (HEIGHT + PAD) + PAD)
static cairo_test_t test = {
- "coverage",
- "Various coverage test of cairo",
+ "trap-clip",
+ "Trapezoid clipping",
IMAGE_WIDTH, IMAGE_HEIGHT
};
-
-static void
+static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- /* TODO: pattern fill, gradient fill, clipping, gradient clipping,
- path+solid alpha mask clipping */
-
- int i, j, x, y;
-
- cairo_select_font (cr, fontname,
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_BOLD);
- cairo_scale_font (cr, fontsize);
-
- for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
- for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
- x = i * (WIDTH + PAD) + PAD;
- y = j * (HEIGHT + PAD) + PAD;
- cairo_move_to (cr, x, y);
- pattern_funcs[i] (cr, x, y);
- draw_funcs[j] (cr, x, y);
- }
- }
-
- for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
- for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
- x = i * (WIDTH + PAD) + PAD;
- y = (ARRAY_SIZE (draw_funcs) + j) * (HEIGHT + PAD) + PAD;
-
- cairo_save (cr);
+ int i, j, k, x, y;
- cairo_set_alpha (cr, 1.0);
- cairo_new_path (cr);
- cairo_arc (cr, x + WIDTH / 2, y + HEIGHT / 2,
- WIDTH / 3, 0, 2 * M_PI);
- cairo_clip (cr);
+ for (k = 0; k < ARRAY_SIZE (clip_funcs); k++) {
+ for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
+ for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
+ x = i * (WIDTH + PAD) + PAD;
+ y = (ARRAY_SIZE (draw_funcs) * k + j) * (HEIGHT + PAD) + PAD;
- cairo_move_to (cr, x, y);
- pattern_funcs[i] (cr, x, y);
- draw_funcs[j] (cr, x, y);
+ cairo_save (cr);
- cairo_restore (cr);
+ cairo_move_to (cr, x, y);
+ clip_funcs[k] (cr, x, y);
+ pattern_funcs[i] (cr, x, y);
+ draw_funcs[j] (cr, x, y);
+ if (cairo_status (cr))
+ cairo_test_log ("%d %d HERE!\n", i, j);
+ cairo_restore (cr);
+ }
}
}
+
+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
+ cairo_test_log ("%d %d .HERE!\n", i, j);
+
+ return CAIRO_TEST_SUCCESS;
}
int
diff --git a/test/user-data.c b/test/user-data.c
new file mode 100644
index 0000000..d17b933
--- /dev/null
+++ b/test/user-data.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Kristian Høgsberg <krh@redhat.com>
+ */
+
+#include <cairo.h>
+#include <assert.h>
+#include <stdlib.h>
+
+static void
+destroy_data1 (void *p)
+{
+ *(int *) p = 1;
+}
+
+static void
+destroy_data2 (void *p)
+{
+ *(int *) p = 2;
+}
+
+int
+main (void)
+{
+ cairo_surface_t *surface;
+ static const cairo_user_data_key_t key1, key2;
+ int data1, data2;
+
+ data1 = 0;
+ data2 = 0;
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
+ assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1)
+ == CAIRO_STATUS_SUCCESS);
+ assert (cairo_surface_set_user_data (surface, &key2, &data2, destroy_data2)
+ == CAIRO_STATUS_SUCCESS);
+ assert (cairo_surface_get_user_data (surface, &key1) == &data1);
+ assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL)
+ == CAIRO_STATUS_SUCCESS);
+ assert (cairo_surface_get_user_data (surface, &key1) == NULL);
+ assert (data1 == 1);
+ assert (data2 == 0);
+
+ assert (cairo_surface_set_user_data (surface, &key2, NULL, NULL)
+ == CAIRO_STATUS_SUCCESS);
+ assert (data2 == 2);
+
+ data1 = 0;
+ assert (cairo_surface_set_user_data (surface, &key1, &data1, NULL)
+ == CAIRO_STATUS_SUCCESS);
+ assert (cairo_surface_set_user_data (surface, &key1, NULL, NULL)
+ == CAIRO_STATUS_SUCCESS);
+ assert (data1 == 0);
+ assert (cairo_surface_get_user_data (surface, &key1) == NULL);
+
+ assert (cairo_surface_set_user_data (surface, &key1, &data1, destroy_data1)
+ == CAIRO_STATUS_SUCCESS);
+ cairo_surface_destroy (surface);
+ assert (data1 == 1);
+ assert (data2 == 2);
+
+ return 0;
+}
diff --git a/test/write_png.c b/test/write-png.c
index 0ff5bcd..f5a2747 100644
--- a/test/write_png.c
+++ b/test/write-png.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <png.h>
-#include "write_png.h"
+#include "write-png.h"
static void
unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
@@ -55,7 +55,7 @@ unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
}
void
-write_png_argb32 (char *buffer, FILE *file,
+write_png_argb32 (unsigned char *buffer, FILE *file,
int width, int height, int stride)
{
int i;
diff --git a/test/write_png.h b/test/write-png.h
index fe0e92b..8074666 100644
--- a/test/write_png.h
+++ b/test/write-png.h
@@ -29,7 +29,7 @@
#define WRITE_PNG_H
void
-write_png_argb32 (char *buffer, FILE * file,
+write_png_argb32 (unsigned char *buffer, FILE * file,
int width, int height, int stride);
#endif
diff --git a/test/xlib-surface.c b/test/xlib-surface.c
new file mode 100644
index 0000000..d8c241c
--- /dev/null
+++ b/test/xlib-surface.c
@@ -0,0 +1,269 @@
+/*
+ * Copyright © 2005 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth@cworth.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "cairo.h"
+#include "cairo-xlib.h"
+#include "cairo-xlib-xrender.h"
+#include "cairo-test.h"
+#include "cairo-xlib-test.h"
+
+#include "buffer-diff.h"
+
+#define SIZE 100
+#define OFFSCREEN_OFFSET 50
+
+cairo_bool_t result = 0;
+FILE *log_file = NULL;
+
+static void
+draw_pattern (cairo_surface_t *surface)
+{
+ cairo_t *cr = cairo_create (surface);
+ int i;
+
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
+ cairo_paint (cr);
+
+ cairo_set_source_rgba (cr, 0, 0.0, 0.0, 0.50); /* half-alpha-black */
+
+ for (i = 1; i <= 3; i++) {
+ int inset = SIZE / 8 * i;
+
+ cairo_rectangle (cr,
+ inset, inset,
+ SIZE - 2 * inset, SIZE - 2 * inset);
+ cairo_fill (cr);
+ }
+
+ cairo_destroy (cr);
+}
+
+static void
+erase_pattern (cairo_surface_t *surface)
+{
+ cairo_t *cr = cairo_create (surface);
+
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
+}
+
+static cairo_bool_t
+do_test (Display *dpy,
+ unsigned char *reference_data,
+ unsigned char *test_data,
+ unsigned char *diff_data,
+ cairo_bool_t use_render,
+ cairo_bool_t use_pixmap,
+ cairo_bool_t set_size,
+ cairo_bool_t offscreen)
+{
+ cairo_surface_t *surface;
+ cairo_surface_t *test_surface;
+ cairo_t *test_cr;
+ cairo_bool_t result;
+ Drawable drawable;
+ int screen = DefaultScreen (dpy);
+
+ if (use_pixmap && offscreen)
+ return 1;
+
+ if (use_pixmap) {
+ drawable = XCreatePixmap (dpy, DefaultRootWindow (dpy),
+ SIZE, SIZE, DefaultDepth (dpy, screen));
+ } else {
+ XSetWindowAttributes xwa;
+ int x, y;
+
+ xwa.override_redirect = True;
+
+ if (offscreen) {
+ x = - OFFSCREEN_OFFSET;
+ y = - OFFSCREEN_OFFSET;
+ } else {
+ x = 0;
+ y = 0;
+ }
+
+ drawable = XCreateWindow (dpy, DefaultRootWindow (dpy),
+ x, y, SIZE, SIZE, 0,
+ DefaultDepth (dpy, screen), InputOutput,
+ DefaultVisual (dpy, screen),
+ CWOverrideRedirect, &xwa);
+ XMapWindow (dpy, drawable);
+ }
+
+ surface = cairo_xlib_surface_create (dpy,
+ drawable,
+ DefaultVisual (dpy, screen),
+ SIZE, SIZE);
+
+ if (set_size)
+ cairo_xlib_surface_set_size (surface, SIZE, SIZE);
+
+ draw_pattern (surface);
+
+ test_surface = cairo_image_surface_create_for_data (test_data,
+ CAIRO_FORMAT_RGB24,
+ SIZE, SIZE,
+ SIZE * 4);
+
+ test_cr = cairo_create (test_surface);
+ cairo_set_source_surface (test_cr, surface, 0, 0);
+ cairo_paint (test_cr);
+
+ cairo_destroy (test_cr);
+ cairo_surface_destroy (test_surface);
+
+ /* We erase the surface to black in case we get the same
+ * memory back again for the pixmap case.
+ */
+ erase_pattern (surface);
+ cairo_surface_destroy (surface);
+
+ if (use_pixmap)
+ XFreePixmap (dpy, drawable);
+ else
+ XDestroyWindow (dpy, drawable);
+
+ if (offscreen) {
+ size_t offset = 4 * (SIZE * OFFSCREEN_OFFSET + OFFSCREEN_OFFSET);
+
+ result = !buffer_diff (reference_data + offset,
+ test_data + offset,
+ diff_data + offset,
+ SIZE - OFFSCREEN_OFFSET,
+ SIZE - OFFSCREEN_OFFSET,
+ 4 * SIZE);
+ } else {
+ result = !buffer_diff (reference_data,
+ test_data,
+ diff_data,
+ SIZE,
+ SIZE,
+ 4 * SIZE);
+ }
+
+ fprintf (log_file, "xlib-surface: %s, %s, %s%s: %s\n",
+ use_render ? " render" : "no-render",
+ set_size ? " size" : "no-size",
+ use_pixmap ? "pixmap" : "window",
+ use_pixmap ?
+ " " :
+ (offscreen ? ", offscreen" : ", onscreen"),
+ result ? "PASS" : "FAIL");
+
+ return result;
+}
+
+static cairo_bool_t
+check_visual (Display *dpy)
+{
+ Visual *visual = DefaultVisual (dpy, DefaultScreen (dpy));
+
+ if ((visual->red_mask == 0xff0000 &&
+ visual->green_mask == 0x00ff00 &&
+ visual->blue_mask == 0x0000ff) ||
+ (visual->red_mask == 0x0000ff &&
+ visual->green_mask == 0x00ff00 &&
+ visual->blue_mask == 0xff0000))
+ return 1;
+ else
+ return 0;
+}
+
+int
+main (void)
+{
+ Display *dpy;
+ unsigned char *reference_data;
+ unsigned char *test_data;
+ unsigned char *diff_data;
+ cairo_surface_t *reference_surface;
+ cairo_bool_t use_pixmap;
+ cairo_bool_t set_size;
+ cairo_bool_t offscreen;
+ result = 0;
+
+ printf("\n");
+ log_file = fopen ("xlib-surface.log", "w");
+ if (log_file == NULL) {
+ fprintf (stderr, "Error opening log file: %s\n", "xlib-surface.log");
+ log_file = stderr;
+ }
+
+ dpy = XOpenDisplay (NULL);
+ if (!dpy) {
+ fprintf (log_file, "xlib-surface: Cannot open display, skipping\n");
+ return 0;
+ }
+
+ if (!check_visual (dpy)) {
+ fprintf (log_file, "xlib-surface: default visual is not RGB24 or BGR24, skipping\n");
+ return 0;
+ }
+
+ reference_data = malloc (SIZE * SIZE * 4);
+ test_data = malloc (SIZE * SIZE * 4);
+ diff_data = malloc (SIZE * SIZE * 4);
+
+ reference_surface = cairo_image_surface_create_for_data (reference_data,
+ CAIRO_FORMAT_RGB24,
+ SIZE, SIZE,
+ SIZE * 4);
+
+ draw_pattern (reference_surface);
+ cairo_surface_destroy (reference_surface);
+
+ for (set_size = 0; set_size <= 1; set_size++)
+ for (use_pixmap = 0; use_pixmap <= 1; use_pixmap++)
+ for (offscreen = 0; offscreen <= 1; offscreen++)
+ if (!do_test (dpy,
+ reference_data, test_data, diff_data,
+ 1, use_pixmap, set_size, offscreen))
+ result = 1;
+
+ cairo_test_xlib_disable_render ();
+
+ for (set_size = 0; set_size <= 1; set_size++)
+ for (use_pixmap = 0; use_pixmap <= 1; use_pixmap++)
+ for (offscreen = 0; offscreen <= 1; offscreen++)
+ if (!do_test (dpy,
+ reference_data, test_data, diff_data,
+ 0, use_pixmap, set_size, offscreen))
+ result = 1;
+
+ free (reference_data);
+ free (test_data);
+ free (diff_data);
+
+ XCloseDisplay (dpy);
+
+ return result;
+}
diff --git a/test/xmalloc.c b/test/xmalloc.c
index 04ed38a..f5721c5 100644
--- a/test/xmalloc.c
+++ b/test/xmalloc.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "cairo-test.h"
#include "xmalloc.h"
void *
@@ -35,7 +36,7 @@ xmalloc (size_t size)
buf = malloc (size);
if (!buf) {
- fprintf (stderr, "Error: Out of memory. Exiting.\n");
+ cairo_test_log ("Error: Out of memory. Exiting.\n");
exit (1);
}
@@ -49,7 +50,7 @@ xcalloc (size_t nmemb, size_t size)
buf = calloc (nmemb, size);
if (!buf) {
- fprintf (stderr, "Error: Out of memory. Exiting\n");
+ cairo_test_log ("Error: Out of memory. Exiting\n");
exit (1);
}
diff --git a/test/xmalloc.h b/test/xmalloc.h
index a4ba24b..bc1ab69 100644
--- a/test/xmalloc.h
+++ b/test/xmalloc.h
@@ -26,6 +26,8 @@
#ifndef _XMALLOC_H_
#define _XMALLOC_H_
+#include <stdlib.h>
+
void *
xmalloc (size_t size);