[Fencommits] fenfire-hs: non-compiling image vob

Tuukka Hastrup Tuukka.Hastrup at iki.fi
Fri Mar 9 16:52:07 EET 2007


Fri Mar  9 16:45:22 EET 2007  Tuukka Hastrup <Tuukka.Hastrup at iki.fi>
  * non-compiling image vob
diff -rN -u old-fenfire-hs/Cairo.fhs new-fenfire-hs/Cairo.fhs
--- old-fenfire-hs/Cairo.fhs	2007-03-09 16:52:07.000000000 +0200
+++ new-fenfire-hs/Cairo.fhs	2007-03-09 16:52:07.000000000 +0200
@@ -106,8 +106,11 @@
 clip :: Cairo cx r => cx Path -> Endo r
 clip p = cxWrap $ \ren -> ffor p $ \p' -> do
     C.save; renderPath p'; C.clip; ren; C.restore
-    
-    
+
+withSurface :: Cairo cx r => cx C.Surface -> Endo r    
+withSurface s = cxWrap $ \ren -> ffor s $ \s' -> do
+    C.save; C.setSourceSurface s' 0 0; ren; C.restore
+
 withColor :: Cairo cx r => cx Color -> Endo r
 withColor c = cxWrap $ \ren -> ffor c $ \(Color r g b a) -> do
     C.save; C.setSourceRGBA r g b a; ren; C.restore
diff -rN -u old-fenfire-hs/Vobs.fhs new-fenfire-hs/Vobs.fhs
--- old-fenfire-hs/Vobs.fhs	2007-03-09 16:52:07.000000000 +0200
+++ new-fenfire-hs/Vobs.fhs	2007-03-09 16:52:07.000000000 +0200
@@ -210,6 +210,12 @@
     return $ renderable (realToFrac w, realToFrac h) $ showLayout layout
 
                           
+image :: Ord k => FilePath -> Vob k
+image file = unsafePerformIO $ C.withImageSurfaceFromPNG file $ \surface -> do
+    w <- C.renderWith surface $ C.imageSurfaceGetWidth surface
+    h <- C.renderWith surface $ C.imageSurfaceGetHeight surface
+    return $ renderable (realToFrac w, realToFrac h) $ withSurface #surface $ fill extents
+
 fadedColor :: Ord k => Endo (Cx k Color)
 fadedColor c = liftM3 interpolate (asks rcFade) (asks rcFadeColor) c
 




More information about the Fencommits mailing list