[Haskell-cafe] Drawing an existing image into a cairo surface?

Jefferson Heard jefferson.r.heard at gmail.com
Sun Sep 21 12:31:34 EDT 2008

Sorry.  In a hurry, and I don't have a lot of time to read the
message, so if I'm offering a lot of info you already have, I
apologize.  The best thing to do is to allocate either a pixmap or
Gtk.DrawingArea -- you can then use widgetGetDrawable to get the
drawing context from it and newGC to take drawing context and get a
graphics context.  After you have a drawing and graphics context, you
can use drawPixbuf to draw or update any image you want, then use the
same DrawngArea for Cairo after you've drawing the image.

If you need more help with it, let me know, and I can send some code
that will do it later today.

-- Jeff

On Sun, Sep 21, 2008 at 10:09 AM, Rafal Kolanski <xs at xaph.net> wrote:
> Bulat Ziganshin wrote:
>> afair, Render is a super-IO monad so you can just lift any IO
>> operation to Render:
>> x <- liftIO$ imageSurfaceCreateFromPNG file
> You are indeed correct.
> I feel really silly now, using unsafePerformIO in the IO monad. D'oh!
> Thank you very much!
> Rafal Kolanski.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

I try to take things like a crow; war and chaos don't always ruin a
picnic, they just mean you have to be careful what you swallow.

-- Jessica Edwards

More information about the Haskell-Cafe mailing list