From: Axel S. <as...@us...> - 2005-10-17 22:52:58
|
Update of /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17557/gtk/Graphics/UI/Gtk Modified Files: Cairo.chs.pp Log Message: /tmp/cvswg8NOK Index: Cairo.chs.pp =================================================================== RCS file: /cvsroot/gtk2hs/gtk2hs/gtk/Graphics/UI/Gtk/Cairo.chs.pp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Cairo.chs.pp 16 Oct 2005 15:05:34 -0000 1.6 +++ Cairo.chs.pp 17 Oct 2005 22:52:50 -0000 1.7 @@ -25,28 +25,21 @@ -- Portability : portable (depends on GHC) -- -- --- Cairo interaction - functions to support using Cairo --- -module Graphics.UI.Gtk.Cairo ( --- * Detail +-- Gtk specific functions to for redering with Cairo. -- --- | Cairo is a graphics library that supports vector graphics and image +-- Cairo is a graphics library that supports vector graphics and image -- compositing that can be used with Gdk. -- The Cairo API is an addition to Gdk\/Gtk (rather than a replacement). --- As such the user needs to create Cairo contexts --- which can be used to draw on Gdk 'Drawable's. Additional functions allow to --- convert Gdk's rectangles and regions into Cairo paths, to use 'Pixbuf's as --- sources for drawing operations and to draw text laid out by Pango. +-- Cairo rendering can be performed on any 'Graphics.UI.Gtk.Gdk.Drawable' +-- by calling 'renderWithDrawable'. The functions in this module provide +-- ways of drawing Gtk specific elements, such as 'Pixbuf's or text +-- laid out with Pango. -- --- * All functions in this module are only available in Gtk 2.8 or higher. +-- All functions in this module are only available in Gtk 2.8 or higher. -- --- * Methods +module Graphics.UI.Gtk.Cairo ( #if GTK_CHECK_VERSION(2,8,0) && defined(ENABLE_CAIRO) - renderWithDrawable, - setSourceColor, - setSourcePixbuf, - area, - region, + -- * Global Cairo settings. cairoFontMapNew, cairoFontMapSetResolution, cairoFontMapGetResolution, @@ -55,6 +48,11 @@ cairoContextGetResolution, cairoContextSetFontOptions, cairoContextGetFontOptions, + -- * Functions for the 'Render' monad. + renderWithDrawable, + setSourceColor, + setSourcePixbuf, + region, updateContext, createLayout, updateLayout, @@ -127,24 +125,8 @@ (realToFrac pixbufX) (realToFrac pixbufY) --- | Adds the given rectangle to the current path of cr. --- --- * Use qualified import as this name clashes with --- 'Graphics.UI.Gtk.Gdk.Widget.area'. --- -area :: Rectangle -> Render () -area (Rectangle x y width height) = - Cairo.rectangle - (realToFrac x) - (realToFrac y) - (realToFrac width) - (realToFrac height) - -- | Adds the given region to the current path of cr. -- --- * Use qualified import as this name clashes with --- 'Graphics.UI.Gtk.Gdk.Widget.region'. --- region :: Region -> Render () region region = Render $ do cr <- ask @@ -203,7 +185,7 @@ -- | Set the scaling factor of the 'PangoContext'. -- -- * Supplying zero or a negative value will result in the resolution value --- of the underlying 'FontMap' to be used. See also 'cairoFonMapNew'. +-- of the underlying 'FontMap' to be used. See also 'cairoFontMapNew'. cairoContextSetResolution :: PangoContext -> Double -> IO () cairoContextSetResolution pc dpi = {#call unsafe pango_cairo_context_set_resolution#} pc (realToFrac dpi) @@ -220,7 +202,7 @@ -- | Set Cairo font options. -- -- * Applied the given font options to the context. Values set through this --- functions have override those that are applied by 'cairoUpdateContext'. +-- functions have override those that are applied by 'updateContext'. -- cairoContextSetFontOptions :: PangoContext -> FontOptions -> IO () cairoContextSetFontOptions pc fo = @@ -246,7 +228,7 @@ -- * The 'PangoContext' must have been created with -- 'cairoCreateContext'. Any 'PangoLayout's that have been -- previously created with this context have to be update using --- 'layoutContextChanged'. +-- 'Graphics.UI.Gtk.Pango.Layout.layoutContextChanged'. -- updateContext :: PangoContext -> Render () updateContext pc = Render $ do @@ -258,7 +240,7 @@ -- * This is a convenience function that creates a new 'PangoContext' -- within this 'Render' context and creates a new 'PangoLayout'. -- If the transformation or target surface of the 'Render' context --- change, 'cairoUpdateLayout' has to be called on this layout. +-- change, 'updateLayout' has to be called on this layout. -- createLayout :: String -> Render PangoLayout createLayout text = Render $ do @@ -276,8 +258,9 @@ -- * This is a convenience function that calls 'cairoUpdateContext' on the -- (private) 'PangoContext' of the given layout to propagate changes -- from the 'Render' context to the 'PangoContext' and then calls --- 'layoutContextChanged' on the layout. This function is necessary for --- 'cairoCreateLayout' since a private 'PangoContext' is created that is +-- 'Graphics.UI.Gtk.Pango.Layout.layoutContextChanged' on the layout. +-- This function is necessary for +-- 'createLayout' since a private 'PangoContext' is created that is -- not visible to the user. -- updateLayout :: PangoLayout -> Render () |