[cairo] Image rendering help?

Carl Worth cworth at cworth.org
Thu Oct 23 12:58:53 PDT 2008

On Thu, 2008-10-02 at 13:01 -0300, Ian Britten wrote:

Hi Ian,

I've had your message flagged in my email client for a while so that I
could come back and take some time to answer it. I hadn't gotten around
to doing so previously for a few reasons, (lots of different questions
together, not totally minimal code, using cairomm which I don't
necessarily understand and which *might* introduce problems of its own
if it has bugs).

None of that is to complain, just to point out that any slightly more
focued question might have gotten a quicker answer. But then again, I
know that when things just aren't working it's often very hard to know
exactly what the focused question should be.

But I've noticed that nobody answered and I feel bad about that and want
to help.

Since a lot of time has passed now, have you worked through the problems
and gotten things working? If not, I'm still glad to help where I can.

> - To try to get the Image to fill my Surface, I tried adding
>    a scale() call to the tmpMatrix before setting it on the
>    pattern.  However, my image just disappears then :(
>    Shouldn't a call like
>          cairo_matrix_scale(&tmpMatrix, 2, 2);
>    result in my image drawing at twice its size?

This one is at least a simple answer: No. A pattern matrix maps from
user space to image space. So the effect from image space to user space
is the opposite.

That is, you want a matrix of:

	cairo_matrix_scale (&tmpMatrix, 0.5, 0.5);

on your pattern matrix in order to make an image appear twice as large.

I admit that this can be quite counter-intuitive.

> Am I maybe going about this the wrong way?
> Any help/explanation would be _most_ appreciated!

It really shouldn't be that hard to draw a scaled image, so maybe we're
missing a section in a tutorial somewhere.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.cairographics.org/archives/cairo/attachments/20081023/6d98e0c8/attachment.pgp 

More information about the cairo mailing list