We keep the clip in surface-backend coordinates always, so it needs
fixing whenever we change the target surface out in the gstate. The
only place this happens is in push_group, so fix it as part of
gstate_redirect().
This patch adds the following API calls:
cairo_push_group
cairo_push_group_with_content
cairo_pop_group
cairo_pop_group_to_source
cairo_get_group_target
These methods support implementing layers on top of a cairo context,
allowing for drawing with transparency and temporary buffering.
cairo_get_group_target allows an app to get access to the actual surface
created by the last push_group call, in case itneeds to perform native
drawing to it.
This is a mega-patch that has the advantage that the entire test suite
passes both immediately before and immediately after this commit.
The disadvantage of the mega-patch is that it does not reflect the
development history of the device-offset branch, (with its various
fumblings and flailings). To capture that history, we will next merge
in that branch.
This device scale stuff is currently not being used. However it is also adding
complexity to the current device-offset rework. And since it's not being tested
I'm sure we're getting it wrong. It's better to not even have it here rather
than having it be broken.
Remove all device offsets handling from internal cairo_surface methods,
which will become truly internal shortly. Have all device offsets
handled by top-level entry points (stroke/fill/paint/show_glyphs/mask, and
clipping).
Patch from cworth@cworth.org.
The trick with this one is that the test suite is using device offsets
in a rather fabricated way, and the final copy from an offset surface
to a non-offset surface is between two surfaces of the same size, so
must be 1:1. To get this we turn the device offset off before the
copy.
In a more conventional use of device offsets the surfaces would be of
different sizes, and the offset would be desired during the copy.
Scaled glyph image surfaces have device offsets set on them to indicate
the location of the glyph origin; however, those offsets weren't being
taken into account for the call to composite, so the glyphs were
being doubly-offset by this amount.
This patch implements device offset/scale at the cairo-surface layer,
instead of them just being multiplied into the CTM at operation time.
This allows identical drawing operations/clips/paths/etc. to operate
identically on a surface with or without a device offset (and still
have things end up in the same place relative to the dev offset).
Shrink linear-gradient and text-pattern test outuput.
The real motivation for this is to hide an annoying difference in the
gradient output that occurs when under the influence of a device
offsets. My opinion is that the gradient output should not change due
to just an integer offset, but we currently don't have a precise
gradient specification, so this minor deviation really isn't relevant.
A better fix for this might have been to make the test suite more
forgiving of tiny differences, (perhaps on a per-test basis), but
another advantage of shrinking these tests is that they now run a lot
faster.
It is true that these tests now also exercise fewer different output
values, but that's not the designed purpose of the tests so I don't
feel bad about losing that characteristic.
[With this change, two tests with gradients exhibit subtle differences
under device offsets. I don't think we actually care about them
though. -cworth]
This commit adds the following new functions to the cairo-ps API:
cairo_ps_surface_dsc_comment
cairo_ps_surface_dsc_begin_setup
cairo_ps_surface_dsc_begin_page_setup
Many thanks are due to Michael Sweet who provided invaluble guidance
during the design of this API.
It is hoped that with this API in place, basically all printer control
that is likely to be desired to be performed with cairo PostScript
output is now possible.
This commit augments the ps-features test to exercise the new API.