[Haskell-cafe] Drawing an existing image into a cairo surface?
Bulat Ziganshin
bulat.ziganshin at gmail.com
Sun Sep 21 09:55:20 EDT 2008
Hello Rafal,
Sunday, September 21, 2008, 5:43:14 PM, you wrote:
> withImageSurfaceFromPNG file $ \png -> do
> w <- renderWith png $ imageSurfaceGetWidth png
> h <- renderWith png $ imageSurfaceGetHeight png
this is very idiomatic Haskell, consider it as a sort of RAII. you may
even omit additional tab here:
> withImageSurfaceFromPNG file $ \png -> do
> w <- renderWith png $ imageSurfaceGetWidth png
> h <- renderWith png $ imageSurfaceGetHeight png
> ...
afair, Render is a super-IO monad so you can just lift any IO
operation to Render:
x <- liftIO$ imageSurfaceCreateFromPNG file
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe
mailing list