Re: Expected behavior of dashes, lines and patterns under transform

Chris Wilson <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <1335736280_90599@CP5-2952>
On Sun, 29 Apr 2012 17:39:41 -0400, cu <[email protected]> wrote:
> 
> I've been trying to draw into Cairo context with transform matrix set.
> Under scaling transform (with scaling factor of, say, 1000 with small
> coordinate values supplied to drawing functions which then scale them up
> to user level pixel coordinates) I've seen the following:
> 
> 1. Line widths seem to be scaled up (which is counter-intuitive)

Long-standing bug that was not fixed in time for cairo-1.0, hence now
locked in stone. The matrix for line-widths is the CTM at the time of
the stroke not the CTM at the time of setting the line-width.
 
> 2. Even if transform is set before drawing and reset to identity before
> setting line width, lines don't look quite the same as if scaled
> coordinates are used as input - anialiasing is relatively poor.

That's unexpected since all that happens is the coordinates are
transformed. However, I notice that dashes are handled natively by
Quartz. Are you seeing similar results using an image surface?
 
> 3. Can't tell for sure what happens with dashes - they seem not to work
> half the time (endless loops, perhaps the new release takes care of
> that). It seems that dash lengths are scaled as well. Resetting to
> identity before drawing dashed lines helps somewhat, but dash lengths
> still appear "off" (different from drawing with pre-scaled coordinates).

Dash lengths were broken for rectilinear strokes in cairo-1.12.0. Like
the line-width, the dash lengths will be scaled by the CTM at the time
of the stroke.

> 4. I was unable to draw a source "sprite" pattern  onto a scaled
> surface, no matter what combination of scaling/resetting to
> identity/moving etc. I tried.

That's a basic procedure for compositing and is most definitely expected
to work! Can you show us the code you think should work and perhaps a
sketch of the result you want?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.