[cairo] Expected behavior of dashes, lines and patterns under transform
cairouser at yahoo.com
Sun Apr 29 18:28:54 PDT 2012
So, would the correct approach to drawing on scaled surface be:
1. Set transform matrix (scale, rotate)
2. Perorm draw operations (i.e. move/lineto)
3. Reset transform matrix
4. Set styles (line width, dash etc)
Is that correct? I guess that's somewhat acceptable, although in cases
where multiple drawing operations follow each other repeated
setting/unsetting of matrices is going to get tedious.
How much of a performance penalty is there in repeatedly
setting/resetting CTM matrix?
> 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?
All of the above/below applies to image surface. I've been talking about
Quartz lately, but this is a different sub-project.
I'll try to get some rendering examples showing what the drawing looks
like rendered with pre-scaled data vs. CTM applied.
>> 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?
I tried many combinations, not sure that any were correct :) I discarded
all the code used in experiments, since it seemed pointless to continue
guessing and I don't like to keep broken code around for too long.
Perhaps a better approach would be some sort of example showing what
this should look like?
More information about the cairo