Commit graph

89 commits

Author SHA1 Message Date
Carl Worth
8d3a800b82 Add a start_page function to the paginated_surface_backend.
This allows for any surface using the paginated_surface backend to
easily do stuff at the beginning of each page, (such as writing out
any per-page header necessary).

This replaces some of the per-page state tracking that the PS surface
was doing, (though it still has some left for its optimization of
CLEAR on a blank page).
2006-04-14 14:46:59 -07:00
Emmanuel Pacaud
b9eb4f018e PDF: Fix typo in documentation. 2006-04-14 22:55:48 +02:00
Carl Worth
8f3c60096d Add a new cairo_paginated_surface_backend_t rather than just a single function pointer. 2006-04-14 11:33:48 -07:00
Carl Worth
11b4d24671 Move cairo_pdf_surface_backend to file end so it's easier to find. 2006-04-14 09:36:41 -07:00
Keith Packard
ade195cdba Save PS output in temp file so we can prepend global data (like fonts) 2006-04-08 21:29:14 -07:00
Carl Worth
66ed9811cc Merge branch 'cairo-origin' into analysis-surface
With the string-array-stream stuff that this merge picks up, the
analysis-surface branch is now passing all of the test suite again.
2006-04-04 14:58:52 -07:00
Carl Worth
dd67cf6616 Implement proper cairo-style error-handling for cairo_output_stream_t.
The cairo_output_stream_t object already had an internal status value,
but it was annoyingly returning status values from various functions.
It also was missing proper shutdown-on-error as well as nil-create
semantics.

This fixes those shortcomings and adjusts all callers for the new
semantics, (leading to simpler and more correct calling
code---particularly in the case of cairo-base85-stream.c).
2006-04-04 10:45:38 -07:00
Carl Worth
5a06133eb2 Implement cairo-base85-stream as a filtering output stream not just a write function.
Now _cairo_output_stream_create accepts a new close callback, (which
the base85 stream uses to write its trailer). This eliminates the
former kludge used to fclose the stdio output streams, and required a
bit of touchup to the pdf, ps, and svg-surface usage of streams.
2006-04-03 23:44:51 -07:00
Carl Worth
ecb062a679 Update PDF backend for new paginated API so it at least doesn't crash. 2006-03-24 11:48:35 -08:00
Carl Worth
fc51a78a1e cairo-pdf-surface: Close memory leak during OOM handling.
This fixes bug #6186:

	Memory leak in emit_image_rgb_data (src/cairo-pdf-surface.c)
	https://bugs.freedesktop.org/show_bug.cgi?id=6186
2006-03-13 12:14:47 -08:00
Carl Worth
5ae0b9f912 Implement cairo_surface_get_type 2006-02-27 23:11:32 -08:00
Keith Packard
cb3a445150 Primitive "real" postscript output for stroke/fill/paint 2006-02-27 19:47:14 +01:00
Carl Worth
5928d03b49 Remove private cairo_pattern_type in favor of new public one. Rename
all values to now include TYPE. Drop _GRADIENT from LINEAR and RADIAL.
2006-02-24 15:25:19 -08:00
Carl Worth
074f886c00 Rip the cairo_content_t argument out of ps/pdf_surface_create as per discussion on cairo mailing list. Instead these surface will behave as if CONTENT_COLOR_ALPHA had been passed (that is, compositing operators will behave as if destination alpha were available).
This also has the benefit of preserving the API that has been in place for PS/PDF surface since the (experimental) stuff in 1.0.0.
Track API change.
Continue testing PS/PDF surfaces in the CAIRO_CONTENT_COLOR mode but do it by rendering to an intermediate similar surface rather than constructing the target surface differently.
2006-01-19 17:48:22 +00:00
Carl Worth
ec45efa57c Fix compilation-breaking typo. 2006-01-18 16:44:19 +00:00
Carl Worth
c634e54775 Change documentation to recommend cairo_paint rather than cairo_rectangle;cairo_fill for clearing a surface.
Add documentation. Add a cairo_content_t argument to PDF surface constructors.
Add documentation. Add a cairo_content_t argument to PS surface constructors.
Track changes in PS/PDF surface constructor API.
2006-01-18 16:40:17 +00:00
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