From: Duncan C. <dun...@wo...> - 2007-07-04 15:35:44
|
Tue Jul 3 20:26:35 PDT 2007 Duncan Coutts <du...@ha...> * Add Cairo SVG backend I swear I added this before, the cairo demo certainly already tests it. Somehow I must have managed to not record it, and then loose the code. Fortunately it was only a few lines, so quick to replace. Silly me. hunk ./Makefile.am 1259 + cairo/Graphics/Rendering/Cairo/Internal/Surfaces/SVG.chs.pp \ hunk ./cairo/Graphics/Rendering/Cairo/Internal.hs 28 + , module Graphics.Rendering.Cairo.Internal.Surfaces.SVG hunk ./cairo/Graphics/Rendering/Cairo/Internal.hs 45 +import Graphics.Rendering.Cairo.Internal.Surfaces.SVG hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 195 +#ifdef ENABLE_CAIRO_SVG_SURFACE + -- ** SVG surfaces + , withSVGSurface +#endif + hunk ./cairo/Graphics/Rendering/Cairo.hs.pp 1645 + + +#ifdef ENABLE_CAIRO_SVG_SURFACE +-- | Creates a SVG surface of the specified size in points +-- be written to @filename@. +-- +withSVGSurface :: + FilePath -- ^ @filename@ - a filename for the SVG output (must be writable) + -> Double -- ^ width of the surface, in points (1 point == 1\/72.0 inch) + -> Double -- ^ height of the surface, in points (1 point == 1\/72.0 inch) + -> (Surface -> IO a) -- ^ an action that may use the surface. The surface is + -- only valid within in this action. + -> IO a +withSVGSurface filename width height f = + bracket (Internal.svgSurfaceCreate filename width height) + (\surface -> do status <- Internal.surfaceStatus surface + Internal.surfaceDestroy surface + unless (status == StatusSuccess) $ + Internal.statusToString status >>= fail) + (\surface -> f surface) +#endif |