Commit graph

118 commits

Author SHA1 Message Date
Kristian Høgsberg
13a05830f5 Update pdf font emit code to try to emit a truetype subset before type3. 2006-05-16 16:42:44 -04:00
Carl Worth
05b1d2f9c5 PDF: Fix broken per-page sizes in PDF output.
This was first broken in:

	PDF: Fold (unused) cairo_pdf_document_t into cairo_pdf_surface_t
	f500cef19f

Thanks, git bisect!
2006-05-16 01:04:59 -07:00
Carl Worth
bf2ab0de92 PDF: Add Type3 font support to PDF output.
This uses the recently added cairo-scaled-font-subsets interface in a
style very similar to what the PS surface does.
2006-05-15 10:04:53 -07:00
Carl Worth
6f417fed51 PDF: Move Resources dictionary up from Page objects to Pages object.
This allows for more sharing of resource objects. It also avoids some
confusion in trying to set independent resources at a global and a
per-page level, (which doesn't work since the inheritance only works
for an entire resources object---it can only be overriden in its
entirety, not for subsets of the resources).
2006-05-15 10:00:18 -07:00
Carl Worth
049100fb87 PDF: Use consistent style for typedef struct and macro naming. 2006-05-15 09:52:57 -07:00
Carl Worth
f500cef19f PDF: Fold (unused) cairo_pdf_document_t into cairo_pdf_surface_t 2006-05-12 14:56:11 -07:00
Carl Worth
d84a1cac1c PDF: Use cairo_pdf_resource_t more consistently.
Eliminate the named structure cairo_pdf_stream_t. This structure was
being dynamically allocated, passed around, and leaked when only an ID
was actually needed to be passed around.

Similarly, many other uses of PDF resources were passing bare unsigned
int types rather than the safer and more legible cairo_pdf_resource_t.
2006-05-12 13:31:12 -07:00
Robert O'Callahan
7bcf957b4e Rename cairo_rectangle_t to cairo_rectangle_fixed_t.
This is in preparation for a later function addition for extracting
clip rectangles from a cairo_t, (which will add a public
cairo_rectangle_t).
2006-05-04 03:43:34 -07:00
Carl Worth
7beb3e27a5 Quiet some 'may be used uninitialized' warnings. 2006-05-03 16:45:33 -07:00
Carl Worth
eb1b102e9a PDF: Add new cairo_pdf_surface_set_size for doing per-page size changes 2006-05-03 12:39:23 -07:00
Emmanuel Pacaud
a732058920 Implement paginated create_similar, moving similar images down to PS and PDF.
The new paginated create_similar simply forwards to target backend create_similar.

We maintain the fact that PS and PDF surfaces are returning image
surfaces for create_similar by moving that explicitly to their own
create_similar functions.

(This commit is the combination of the following original commits:

	6b69e8c012adb4f2fc2ee9c1579fed8214e8f510
	2589db92a4395f8e900dbc4eafc45982f0d985d3
)
2006-04-27 06:36:16 -07:00
Carl Worth
22ab0e5f16 Fix default font options for PS and PDF backends.
The paginated surface layer was missing its get_font_options function.
It now defers to the target surface. The PDF backend already had a
get_font_options function, but the PS backend was also missing it.

This should fix the problem with 72DPI hinting seen in glyph paths in
PostScript output.

Thanks to Owen Taylor for identifying this problem and the correct
fix.
2006-04-25 05:44:08 -07:00
Keith Packard
8d635a3aa9 PDF: Execute entire path in user coordinates when stroking so that line params are interpreted correctly 2006-04-25 04:04:10 -07:00
Carl Worth
134c508bf0 PDF: Add SMask output and simplify analysis to support all OVER operations.
With this SMask support, the PDF backend is now able to handle a very
large subset of the things that are likely to be thrown at it in
common operation, (for example, when handling images and text from web
pages).
2006-04-25 03:45:37 -07:00
Carl Worth
c072119043 PDF: Remove unused backend functions.
Since the switch to using paginated, we have a guarantee that the following functions
will never be called. So we drop them now:

	_cairo_pdf_surface_composite
	_cairo_pdf_surface_fill_rectangles
	_cairo_pdf_surface_composite_trapezoids
	_cairo_pdf_surface_old_show_glyphs
2006-04-25 03:26:25 -07:00
Carl Worth
32a7edc42d PDF: Fix surface pattern transformation and support for EXTEND_NONE.
There's a bunch of careful matrix transformation here needed to
resolve the differences between cairo and PDF pattern matrices,
(primarily due to the different location for the origin).

This fixes the several PDF test suite failures that recently appeared
when we switched from ARGB32 to RGB24 source surface patterns.
2006-04-24 16:11:21 -07:00
Carl Worth
28e25e1cce Fix broken error-checking in cairo_{ps,pdf}_surface_set_dpi 2006-04-24 12:40:30 -07:00
Carl Worth
12c4c375af Fix invalid restore that was causing subsequent pages after first to be inverted 2006-04-24 11:15:09 -07:00
Carl Worth
7fa8bfd738 PDF: Cleanup error handling of emit_image_rgb_data 2006-04-20 10:01:45 -07:00
Carl Worth
c5d5687ac0 PDF: Add simple implementation of _cairo_pdf_surface_show_glyphs (text as paths).
This isn't very exciting text output---it simply turns every call to
cairo_show_glyphs into a single filled path. But at the very least,
text will no longer trigger image fallbacks for the PDF backend.

With this commit, the following tests change from all-fallback to
all-native for the PDF backend:

	show-text-current-point
	text-antialias-gray
	text-antialias-none
	text-antialias-subpixel
	text-cache-crash
	text-rotate

There are rasterization differences in the output (cairo vs. freetype)
so this commit also adds new PDF-specific reference images for some of
those tests so that the suite continues to report PASS.
2006-04-19 11:07:19 -07:00
Carl Worth
ab2546009f Use fallbacks in PDF backend for CAIRO_ANTIALIAS_NONE.
Perhaps there's a way to preserve that hint in PDF output, but until
we have code that actually does that, the correct thing to do is to
call it unsupported and let the fallbacks do their thing.

With this commit, the two regressions that were recently introduced
now pass again. Specifically:

	rectangle-rounding-error
	unantialiased-shapes
2006-04-18 23:31:53 -07:00
Carl Worth
241c6480cd Add implementation of _cairo_pdf_surface_paint (and fix emit_surface_pattern).
Fix general broken-ness in emit_surface_pattern, enough so that a new
implementation of _cairo_pdf_surface_paint does something useful. With
this commit, the following tests switch from all-fallback to
all-native and still pass the test suite with flying colors:

	caps-joins
	caps-sub-paths
	clip-fill-rule
	clip-fill-rule-pixel-aligned
	clip-nesting
	clip-twice
	dash-caps-joins
	dash-offset-negative
	leaky-polygon
	line-width
	paint
	path-data
	transforms

Meanwhile, the following two tests also switch from fallback to
native, but cause the test suite to complain about failures. These
both look like a mostly harmless failure to respect the ANTIALIAS_NONE
hint in the PDF output:

	rectangle-rounding-error-pdf-argb32-out.pdf
	unantialiased-shapes-pdf-argb32-out.pdf
2006-04-18 23:31:52 -07:00
Carl Worth
b1b699593b Add support for _cairo_pdf_surface_stroke.
Generalize all functions that emit a source pattern to emit both
for the stroking and non-stroking PDF properties. Also add an
implementation of _cairo_pdf_surface_stroke.

With this commit in place, the following tests change from
all-fallback to all-native output while no tests report any new
failures:

	dash-zero-legnth
	fill-and-stroke
	multi-page
	new-sub-path
	rel-path
	self-intersecting
2006-04-18 16:53:23 -07:00
Carl Worth
448e904b2a Merge branch 'cairo' into new-sub-path
Conflicts:

	src/cairo-path-stroke.c
	src/cairo-pdf-surface.c
	src/cairo-ps-surface.c
2006-04-18 15:18:31 -07:00
Carl Worth
3f84df97dd Enable real analysis for _cairo_pdf_surface_paint.
After this patch we have three PDF tests passing with native output:

	clip-all
	fill-rule
	nil-surface
2006-04-18 11:33:49 -07:00
Carl Worth
b7309d065e Farm out the surface and pattern analysis functions away from cairo-ps-surface.c.
We're setting things up here for better sharing as PDF surface (and
others) now want to do some of the same analysis.
2006-04-14 17:25:54 -07:00
Carl Worth
c7fd35fac2 Add tests for PAGINATED_MODE_ANALYZE to PDF (no real analysis yet) 2006-04-14 16:50:16 -07:00
Carl Worth
b8fb8dc375 Add stub implementations of drawing operations for the PDF backend.
These new stubs explicitly return UNSUPPORTED unconditionally. This is
no different than the implicit UNSUPPORTED which the analysis surface
was inferring from NULL for 4 of the functions before.

However, _cairo_pdf_surface_fill was actually trying to draw things,
but without correctly characterizing it during the analysis stage.
This was just an oversight, as the PDF surface was always triggereing
full page fall backs anway due to the initial unsupported paint with
CLEAR.

Now, we explicitly return UNSUPPORTED for all drawing operations so we
get image fallbacks by design and not by accident.
2006-04-14 15:23:30 -07:00
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
1dc1b57b4e cairo_new_sub_path: Making cairo_arc easier to use and more.
This adds a new function which has as its only effect the elimination
of
the current point. This makes it much easier to use the various
cairo_arc calls when the initial line_to is not actually desired.

This function also unifies and generalizes the long-existing behavior
of cairo_line_to being treated as cairo_move_to when there is no
current point. With the addition of cairo_new_sub_path this becomes a
documented feature with similar behavior in cairo_curve_to as well.
2006-02-23 22:01:07 -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