Commit graph

73 commits

Author SHA1 Message Date
Carl Worth
b5c5fb613d Big change to the test infrastructure and supporting internals. The goal now is to test both a COLOR_ALPHA and a COLOR content for each surface backend, (since the semantics are different and we probably need to support both in each backend.
The PS/PDF backends don't allow a content to be passed in right now, so they fail against the rgb24 tests, but the trivial addition to the constructors will allow them to pass all tests with both content values.
And new constructors (currently internal only) to create an image surface with a cairo_content_t rather than a cairo_format_t.
Add a cairo_content_t argument to the constructor.
Add a cairo_content_t to the constructor and use this content value when constructing intermediate image surfaces in acquire_source, show_page, copy_page, and snapshot.
Add image flattening by compositing over white, as is done in cairo-ps-surface.c.
Track changes to cairo-paginates-surface which now requires a cairo_content_t value (no change to public PS/PDF constructors yet).
Track change in meta-surface and paginated-surface interfaces by now accepting a cairo_content_t rather than a cairo_format_t.
Ignore new output files (argb32 from pdf and ps as well as rgb24 from test-fallback, test-meta, and test-paginated).
Add new utility for flattening PNG images in order to generate the -argbf-ref.png images.
Add image_diff_flattened for comparing flattened output from PS and PDF backend with ARGB reference images by first blending the reference images over white.
Get rid of conditional, format-specific background-color initialization before running tests. Now uses ARGB(0,0,0,0) in all cases. Switch from specifying tests with a format value to specifying tests with a content value. Add support for a 'fake' COLOR_ALPHA_FLATTENED content for testing the PS and PDF output against a flattened version of the argb32 reference images (first blended over white).
Track change in cairo_ps_surface_create (now requires cairo_content_t value).
Adjust tests that draw in default (black) to first paint white so that the results are visible.
Adjust ARGB32 reference images for new white background for changed tests.
Adjust RGB24 reference images for new black background due to changed initialization (and the tests themselves being unchanged).
2006-01-17 16:59:08 +00:00
Carl Worth
c23d7d4758 Note that from here on out, the PDF output should always pass the entire test suite!
Add new functions needed by users of cairo_paginated_surface_t.
Always snapshot a paginated surface to an image surface, rather than a surface similar to the target. We do this since paginated target surfaces are allowed to not be complete surfaces, (such as not implementing acquire_source_surface).
Switch the implementation of cairo_pdf_surface_t to use cairo_paginated_surface_t. For now this means that all PDF output is fallback images, but this can change incrementally as we go forward.
2006-01-11 11:53:33 +00:00
David Reveman
6995a83597 Gradient updates in SVG backend and no sorting of color stops in SVG or PDF backend 2006-01-05 15:00:37 +00:00
David Reveman
5ac6e85455 Update gradient code in PDF backend 2006-01-05 05:06:50 +00:00
Christian Biesinger
6ba7772138 Globally rename "operator" to "op", to allow writing backends in C++
reviewed by: cworth
2005-12-16 03:02:35 +00:00
Carl Worth
9341c254a0 Rename old, rarely used _cairo_array_append to _cairo_array_append_multiple. Add much more common _cairo_array_append. Fix both to return a cairo_status_t. Remove undocumented code to allow a non-copying append when elements is NULL, (let's not encourage unintialized data, shall we?)
Cleanup to not rely on undocumented copy-avoidance in _cairo_array_append.
Track change in number of arguments and return value of _cairo_array_append.
2005-11-04 16:13:30 +00:00
Carl Worth
39eca22bfe Rework support in the surface backend for the five basic drawing operations (paint, mask, stroke, fill, and show_glyphs). Now, all 5 operations have backend functions, and all use a consistent convention for argument naming and ordering. The old fill_path has been replaced with a new fill. The old show_glyphs function was recently renamed to old_show_glyphs and has not yet been ported to the new show_glyphs, (so all backends have a NULL show_glyphs function). In fact, of the 5 new backend functions, fill is the only one that has an implementation in any backend. As part of this cleanup a new cairo_stroke_style_t object is introduced to capture the many settings unique to the stroke operation, (line_width, line_cap, line_join, miter_limit, dash, num_dashes, and dash_offset).
Track changes in surface backend from fill_path to fill.
Track the new canonical argument naming and ordering for the 5 drawing operations.
Move various stroke style settings into new cairo_stroke_style_t.
Drop NULL fill_path backend function which no longer exists.
2005-11-04 11:16:38 +00:00
Carl Worth
719334c52c Rename surface->backend->show_glyphs to surface->backend->old_show_glyphs.
Move show_glyphs fallback from gstate to surface where it belongs.
Reviewed by: keithp
2005-11-01 16:40:37 +00:00
Carl Worth
9d27993ced Add comment for obviously broken function. 2005-10-13 20:15:29 +00:00
Carl Worth
31a561e2c2 Push fill_path fallbacks down from gstate into the surface where all the other fallbacks are.
Add _cairo_surface_is_meta.
Add antialias to the fill_path meta-surface command.
Add an antialias parameter to the backend fill_path function.
Fix test description.
Reviewed by: keithp
2005-10-13 16:55:14 +00:00
Carl Worth
990dfde447 Add return value at ASSERT_NOT_REACHED. 2005-10-12 13:33:38 +00:00
Kristian Høgsberg
d794c624cc Implement non-uniformly spaced color stops for PDF gradients. Patch from Jens Taprogge (#4722). 2005-10-11 13:20:44 +00:00
Kristian Høgsberg
f39816e016 Transform source pattern for _cairo_surface_fill_path() also (#4673).
Use cairo_fill_preserve() instead of cairo_save()/cairo_restore().
Add missing return values.
2005-10-10 09:36:39 +00:00
Billy Biggs
ea7ac21d3b Add a "nearest" extend mode, where the closest pixel is repeated for pixels outside of the source area. Note that for gradients, applications which had explicitly set a repeat mode of NONE will now need to change to use NEAREST to get the same behaviour.
Split CARIO_EXTEND_DEFAULT to indicate defaults for surfaces and gradients. The default for gradients is still the NEAREST beaviour.
Support the NEAREST mode, change NONE to be TRANSPARENT.
Update the extend mode code to use the pixman support.
Handle NEAREST, note that support for NONE is not yet handled for gradients.
Add a check for NEAREST but don't do anything useful.
Add a check for NEAREST but don't do anything useful.
Update a comment about the extend support in the image backend.
reviewed by: davidr, cworth, otaylor
2005-10-09 09:18:16 +00:00
Kristian Høgsberg
27e12fc1db Apply patch from #4672 by Jens Taprogge to implement color stop sorting and multiple color stops for gradients. 2005-10-07 13:21:01 +00:00
Owen Taylor
1f68f77a10 Ignore really small fonts, since size zero fonts give xpdf fits. (#2938) 2005-08-19 14:05:14 +00:00
Kristian Høgsberg
a2e798b5a1 Add this missing fuction.
Document this funtion.
2005-08-19 10:36:43 +00:00
Billy Biggs
53444c286e Add a new API for disabling antialiasing of shapes drawn by cairo. This is a hint and is not supported by all backends.
Store the antialiasing mode in the gstate and pass it to the backend for trapezoid rendering and for clipping.
Pass the antialiasing parameter down to the backend where appropriate.
Pass the antialiasing parameter down to the backend where appropriate.
Add support for A1 format trapezoid rendering, and remove the _create_mask_image function, creating a temporary image from memory we allocate and clear.
Support A1 masks to disable antialiasing using the RENDER extension when requested.
Support A1 masks to disable antialiasing using the RENDER extension when requested.
Blindly pass through the antialising parameter.
Add the antialiasing parameter but don't support it.
Add a test case and a reference image from the latest libpixman.
Add the new antialiasing disabling API to the docs.
Update progress on a parameter to disable antialiasing.
reviewed by: cworth, otaylor
2005-08-08 18:35:22 +00:00
Kristian Høgsberg
27573750eb Change *_reference() functions to return the object being referenced. 2005-08-04 18:44:29 +00:00
Carl Worth
2b5d9c8e00 Add CAIRO_STATUS_INVALID_CONTENT, CAIRO_STATUS_INVALID_FORMAT, and CAIRO_STATUS_INVALID_VISUAL.
Change functions to return type of void:
cairo_scaled_font_extents cairo_surface_finish
Add new functions to query object status:
cairo_scaled_font_status cairo_surface_status
Implementation of new error handling scheme for cairo_surface_t and cairo_scaled_font_t.
Track change in return value of cairo_surface_finish.
2005-07-27 15:39:34 +00:00
Carl Worth
ea1218a434 Replace all occurences of refcount with ref_count.
Replace refcounted with reference-counted.
2005-07-25 16:23:05 +00:00
Owen Taylor
075cf23cdc src/cairo-font-options.c src/cairo.h src/cairoint.h src/Makefile.am: Add an opaque cairo_font_options_t structure.
src/cairo-font.c src/cairo.h src/cairoint.h: Add a cairo_font_options_t object to cairo_scaled_font_create().
src/cairo-surface.c src/cairoint.h: Add virtualized cairo_surface_get_font_options() to get the font options for a surface.
Adapt to cairo_scaled_font_create() change.
Add an implementation of get_font_options() that turns off metrics hinting.
src/cairo-xlib-screen.c src/cairo-xlib-private.h: Add a "screen info" structure that holds (for now) information about the default font options for the screen.
Implement get_font_options()
src/cairo-ft-font.c src/cairo-ft.h: Add functions to apply a cairo_font_options_t to a FcPattern or get the load flags for a cairo_font_options_t.
Adapt to font options additions. Add support for non-antialiased rendering of scalable fonts. Add support for turning off metrics hinting.
Adapt to font options additions.
doc/public/Makefile.am doc/public/cairo-sections.txt: Update.
reviewed by: cworth
2005-07-21 06:52:13 +00:00
Carl Worth
6df1baa395 Call _cairo_array_fini on the several array objects to patch memory leaks. 2005-07-14 17:52:17 +00:00
Carl Worth
6725cc9d7f New predicates to allow checking for cairo_ft derivates of generic font type.
Add explicit checks for cairo_ft derivatives of generic fonts rather than just blindly assuming that's what we get.
2005-07-13 11:01:25 +00:00
Carl Worth
9a2ba48b29 Give enum tags an underscore prefix to match the style of the struct tags. Add new cairo_content_t and change cairo_surface_create_similar to accept a cairo_content_t rather than a cairo_format_t.
Change surface backend create_similar call to accept a cairo_content_t rather than a cairo_format_t.
Fix all calls into create_similar to pass a cairo_content_t rather than a cairo_format_t.
2005-07-08 10:12:28 +00:00
Kristian Høgsberg
b1130276d5 Split out font subsetting code from here,
and put it here.
2005-06-21 15:38:51 +00:00
Kristian Høgsberg
66f8b1202e Remove matrix, filter and repeat from the cairo_surface_t struct. 2005-06-17 13:25:19 +00:00
Kristian Høgsberg
476fe9a66e Implement path clipping and refactor _cairo_gstate_clip() out in three different functions corresponding to the three different clipping modes.
Add NULL pointers for intersect_clip_path.
New test case to exercise PDF clipping code.
2005-06-14 19:45:22 +00:00
Carl Worth
663e39a63c Remove Boolean 'drawable' parameter from the create_similar surface backend function since nothing anywhere is actually using this parameter. 2005-06-14 15:38:15 +00:00
Carl Worth
6cd484a4c0 Originally: 2005-06-09 Carl Worth <cworth@cworth.org>
Rework occurrences of 'if (status == CAIRO_STATUS_SUCCESS)' to use 'if (status)' instead where trivial.
2005-06-10 12:46:49 +00:00
Carl Worth
31dcb954fe Remove STATUS_OK macro which was not being used universally. 2005-06-10 12:18:20 +00:00
Keith Packard
c1c8c57b90 Font matrix was output incorrectly; the implicit mirror-in-y transformation was not computed correctly, missing a negation of the 'xy' component. 2005-06-07 23:28:12 +00:00
Carl Worth
4f2f520dce Allow NULL as a valid value for several objects. That is, calling reference or destroy on these objects will simply do nothing, successfully.
Remove extra whitespace.
2005-06-03 16:45:46 +00:00
Carl Worth
36beed9bf1 Add CODING_STYLE document to standardize on some style issues.
Standardize brace handling around all else clauses according to new CODING_STYLE guidelines.
2005-06-03 14:51:57 +00:00
Kristian Høgsberg
f87fd91bcf Patch from Tomasz Cholewo <cholewo@ieee-cis.org>:
Store the index of the checksum instea of a pointer to the location.
2005-06-03 10:28:42 +00:00
Carl Worth
c56938e568 Rename CAIRO_OK to STATUS_OK. No intended changes in functionality. 2005-06-01 13:24:10 +00:00
Carl Worth
f0923288c5 Two fixes from Kristion Høgsberg:
Fix to close the file if we opened it.
Grab the status from out of the stream _before_ we destroy the stream.
2005-05-17 12:40:55 +00:00
Carl Worth
84bc5a32d6 Remove destroy_closure from cairo_output_stream_t interface.
Remove destroy_closure argument from cairo_pdf_surface_create_for_stream. Rename width,height to width_in_points, height_in_points for better clarity.
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.
Make it a little more clear that the width and height being passed around are in units of points.
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 05:58:01 +00:00
Kristian Høgsberg
ea410111d3 Take a filename instead of a FILE pointer. 2005-05-16 11:41:42 +00:00
Kristian Høgsberg
15ecc87763 Make this a varg function and use the new _cairo_output_stream_vprintf() function to format extra dict contents.
Reimplement the printf logic so we can special case formatting of doubles to be locale independent and trim trailing zeros.
2005-05-13 14:04:22 +00:00
Kristian Høgsberg
b9db66eb17 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 09:26:20 +00:00
Carl Worth
d7fe527e0f 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.
Deal with all of the removals.
2005-05-06 13:32:53 +00:00
Kristian Høgsberg
8e485ec8c2 Fills as paths patch originally by Owen Taylor.
Make sure we have a current point for the relative path operators.
Add fill_path backend method.
Implement fill_path in the PDF backend.
2005-05-03 14:28:50 +00:00
Carl Worth
9c10b54e5e Add new cairo_paint function.
Add new get_extents function to the surface backend interface.
Add function to query current clip_extents.
Implement the new get_extents function for each backend.
Save the clip extents from set_clip_region and implement _cairo_surface_get_clip_extents.
Abstract away the evil XGetGeometry roundtrip in _cairo_xlib_surface_get_size.
Rewrite a couple of tests to call cairo_paint.
2005-04-19 16:29:04 +00:00
Carl Worth
828094aef8 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.
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
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.
Track removal of pattern->alpha, simplifying the code considerably
Track _cairo_color interface changes. Remove gstate->alpha. Propagate down set_source renamings.
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.
Track pattern and color interface changes.
Add const where appropriate on cairo_color_t*.
Add private type inspection predicate. (cairo_xlib_surface_set_size): Add check for surface type mismatch, (no useful error reporting yet, though).
Note coverage as en expected failure.
Improve line wrap on expected failure messages.
Port all tests to new cairo_set_source interfaces.
2005-04-14 14:42:26 +00:00
Owen Taylor
c803908d95 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.
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.
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.
Update the docs to describe how to figure out when the FT_Face can be freed.
Fix refcount leaks when creating fonts.
Remove excess call to _cairo_unscaled_font_reference().
Remove stray initialization of font matrix to the identity.
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.
Don't append an element when user_data is NULL.
2005-04-08 13:14:17 +00:00
Carl Worth
9bef5b6f14 Change to allow NULL backend function pointers to indicate unsupported functions.
Eliminate stub functions and replace with NULL in surface backend table.
2005-04-07 14:25:00 +00:00
Owen Taylor
47824dee31 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.
Rename cairo_font_get_extents() to cairo_font_extents()
split font functions into a separate section.
Fix locking order problem.
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-07 11:03:59 +00:00
Carl Worth
d135938efd 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.
Track changes to cairo_matrix_t interface.
Add a test case showing the same path drawn under various transforms, (including skews set directly by initializing a cairo_matrix_t).
2005-04-07 10:01:49 +00:00
Carl Worth
027057bf62 Drop cairo_default_matrix since it is now always identical to cairo_identity_matrix.
Remove gstate->pixels_per inch. Change default matrix to always be the identity matrix.
Drop pixels_per_inch function from surface backend interface as it is no longer needed.
2005-04-04 06:49:19 +00:00