[cairo] Pretty-please, help with cropping

Marty Sherrill Marty.Sherrill at celera.com
Tue Mar 6 12:28:30 PST 2007


I think I posted my question right in the heat of your big release 
yesterday, so I hope you'll forgive me for re-posting it today.

Would one of you experts be willing to give me just a quick hint at how to 
size (or resize) an image surface *after* I've drawn the content, in order 
to output a .PNG that is right-sized for the drawing?  I've spent hours 
fumbling with clipping functions without success. . .

I'm currently drawing everything once *just* to find the extents, then 
throwing it away and drawing everything all over again on the correct size 
surface!  Please save me from this humiliation!

Congratulations on Cairo version 1.4.0.  It's really a super package.

 - Marty

p.s. I'm using rcairo on Red Hat, if that matters.

----- Forwarded by Marty Sherrill/CRA/PEC on 03/06/2007 02:57 PM -----

Marty Sherrill/CRA/PEC wrote on 03/05/2007 02:52:09 PM:

> Hello all,
> 
> I'm looking for help understanding how to crop an image (or 
> otherwise set its dimensions) in memory just after it's drawn.  I'm 
> drawing images that need to be different sizes according to their 
> content, and it's not practical to figure out the dimensions before 
> doing the actual drawing.
> 
> I have the idea in mind to draw on a larger-than-necessary surface, 
> track the extents of my drawing, and then crop off the extra space.
> 
> Is that a good approach?  If so, could I get some advice as to how 
> the cropping step can be accomplished?
> 
> Best regards,
> 
>  - Marty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/cairo/attachments/20070306/cd971e76/attachment.html


More information about the cairo mailing list