|
| Graphics.Rendering.Cairo | | Portability | portable | | Stability | experimental | | Maintainer | p.martini@neuralnoise.com |
|
|
|
|
|
| Description |
The Cairo 2D graphics library.
Cairo is a 2D graphics library with support for multiple output devices.
Currently supported output targets include the X Window System, win32, and
image buffers. Experimental backends include OpenGL (through glitz), Quartz,
XCB, PostScript and PDF file output.
Cairo is designed to produce consistent output on all output media while
taking advantage of display hardware acceleration when available (eg.
through the X Render Extension).
The cairo API provides operations similar to the drawing operators of
PostScript and PDF. Operations in cairo including stroking and filling cubic
Bezier splines, transforming and compositing translucent images, and
antialiased text rendering. All drawing operations can be transformed by any
affine transformation (scale, rotation, shear, etc.)
Cairo is free software and is available to be redistributed and/or modified
under the terms of either the GNU Lesser General Public License (LGPL)
version 2.1 or the Mozilla Public License (MPL) version 1.1.
For more information see http://cairographics.org
- Note the Haskell bindings do not support all the possible cairo backends
because it would require bindings for the associated technology (eg X11,
glitz, etc) however bindings to other backends may be implemented
externally. For example, Gtk2Hs provides a binding to the backend for X11
(and win32 on Windows).
|
|
| Synopsis |
|
| renderWith :: MonadIO m => Surface -> Render a -> m a | | | save :: Render () | | | restore :: Render () | | | status :: Render Status | | | withTargetSurface :: (Surface -> Render a) -> Render a | | | setSourceRGB :: Double -> Double -> Double -> Render () | | | setSourceRGBA :: Double -> Double -> Double -> Double -> Render () | | | setSource :: Pattern -> Render () | | | setSourceSurface :: Surface -> Double -> Double -> Render () | | | getSource :: Render Pattern | | | setAntialias :: Antialias -> Render () | | | setDash :: [Double] -> Double -> Render () | | | setFillRule :: FillRule -> Render () | | | getFillRule :: Render FillRule | | | setLineCap :: LineCap -> Render () | | | getLineCap :: Render LineCap | | | setLineJoin :: LineJoin -> Render () | | | getLineJoin :: Render LineJoin | | | setLineWidth :: Double -> Render () | | | getLineWidth :: Render Double | | | setMiterLimit :: Double -> Render () | | | getMiterLimit :: Render Double | | | setOperator :: Operator -> Render () | | | getOperator :: Render Operator | | | setTolerance :: Double -> Render () | | | getTolerance :: Render Double | | | clip :: Render () | | | clipPreserve :: Render () | | | resetClip :: Render () | | | fill :: Render () | | | fillPreserve :: Render () | | | fillExtents :: Render (Double, Double, Double, Double) | | | inFill :: Double -> Double -> Render Bool | | | mask :: Pattern -> Render () | | | maskSurface :: Surface -> Double -> Double -> Render () | | | paint :: Render () | | | paintWithAlpha :: Double -> Render () | | | stroke :: Render () | | | strokePreserve :: Render () | | | strokeExtents :: Render (Double, Double, Double, Double) | | | inStroke :: Double -> Double -> Render Bool | | | copyPage :: Render () | | | showPage :: Render () | | | getCurrentPoint :: Render (Double, Double) | | | newPath :: Render () | | | closePath :: Render () | | | arc :: Double -> Double -> Double -> Double -> Double -> Render () | | | arcNegative :: Double -> Double -> Double -> Double -> Double -> Render () | | | curveTo :: Double -> Double -> Double -> Double -> Double -> Double -> Render () | | | lineTo :: Double -> Double -> Render () | | | moveTo :: Double -> Double -> Render () | | | rectangle :: Double -> Double -> Double -> Double -> Render () | | | textPath :: String -> Render () | | | relCurveTo :: Double -> Double -> Double -> Double -> Double -> Double -> Render () | | | relLineTo :: Double -> Double -> Render () | | | relMoveTo :: Double -> Double -> Render () | | | withRGBPattern :: Double -> Double -> Double -> (Pattern -> Render a) -> Render a | | | withRGBAPattern :: Double -> Double -> Double -> Double -> (Pattern -> Render a) -> Render a | | | withPatternForSurface :: Surface -> (Pattern -> Render a) -> Render a | | | withLinearPattern :: Double -> Double -> Double -> Double -> (Pattern -> Render a) -> Render a | | | withRadialPattern :: Double -> Double -> Double -> Double -> Double -> Double -> (Pattern -> Render a) -> Render a | | | patternAddColorStopRGB :: Pattern -> Double -> Double -> Double -> Double -> Render () | | | patternAddColorStopRGBA :: Pattern -> Double -> Double -> Double -> Double -> Double -> Render () | | | patternSetMatrix :: Pattern -> Matrix -> Render () | | | patternGetMatrix :: Pattern -> Render Matrix | | | patternSetExtend :: Pattern -> Extend -> Render () | | | patternGetExtend :: Pattern -> Render Extend | | | patternSetFilter :: Pattern -> Filter -> Render () | | | patternGetFilter :: Pattern -> Render Filter | | | translate :: Double -> Double -> Render () | | | scale :: Double -> Double -> Render () | | | rotate :: Double -> Render () | | | transform :: Matrix -> Render () | | | setMatrix :: Matrix -> Render () | | | getMatrix :: Render Matrix | | | identityMatrix :: Render () | | | userToDevice :: Double -> Double -> Render (Double, Double) | | | userToDeviceDistance :: Double -> Double -> Render (Double, Double) | | | deviceToUser :: Double -> Double -> Render (Double, Double) | | | deviceToUserDistance :: Double -> Double -> Render (Double, Double) | | | selectFontFace :: String -> FontSlant -> FontWeight -> Render () | | | setFontSize :: Double -> Render () | | | setFontMatrix :: Matrix -> Render () | | | getFontMatrix :: Render Matrix | | | showText :: String -> Render () | | | fontExtents :: Render FontExtents | | | textExtents :: String -> Render TextExtents | | | fontOptionsCreate :: Render FontOptions | | | fontOptionsCopy :: FontOptions -> Render FontOptions | | | fontOptionsMerge :: FontOptions -> FontOptions -> Render () | | | fontOptionsHash :: FontOptions -> Render Int | | | fontOptionsEqual :: FontOptions -> FontOptions -> Render Bool | | | fontOptionsSetAntialias :: FontOptions -> Antialias -> Render () | | | fontOptionsGetAntialias :: FontOptions -> Render Antialias | | | fontOptionsSetSubpixelOrder :: FontOptions -> SubpixelOrder -> Render () | | | fontOptionsGetSubpixelOrder :: FontOptions -> Render SubpixelOrder | | | fontOptionsSetHintStyle :: FontOptions -> HintStyle -> Render () | | | fontOptionsGetHintStyle :: FontOptions -> Render HintStyle | | | fontOptionsSetHintMetrics :: FontOptions -> HintMetrics -> Render () | | | fontOptionsGetHintMetrics :: FontOptions -> Render HintMetrics | | | withSimilarSurface :: Surface -> Content -> Int -> Int -> (Surface -> IO a) -> IO a | | | createSimilarSurface :: Surface -> Content -> Int -> Int -> IO Surface | | | renderWithSimilarSurface :: Content -> Int -> Int -> (Surface -> Render a) -> Render a | | | surfaceGetFontOptions :: Surface -> Render FontOptions | | | surfaceFinish :: MonadIO m => Surface -> m () | | | surfaceFlush :: Surface -> Render () | | | surfaceMarkDirty :: Surface -> Render () | | | surfaceMarkDirtyRectangle :: Surface -> Int -> Int -> Int -> Int -> Render () | | | surfaceSetDeviceOffset :: Surface -> Double -> Double -> Render () | | | withImageSurface :: Format -> Int -> Int -> (Surface -> IO a) -> IO a | | | createImageSurface :: Format -> Int -> Int -> IO Surface | | | imageSurfaceGetWidth :: Surface -> Render Int | | | imageSurfaceGetHeight :: Surface -> Render Int | | | withImageSurfaceFromPNG :: FilePath -> (Surface -> IO a) -> IO a | | | surfaceWriteToPNG :: Surface -> FilePath -> IO () | | | liftIO | | | version :: Int | | | versionString :: String | | | data Matrix | | | data Surface | | | data Pattern | | | | | | | | | | | | | | | data ScaledFont | | | data FontFace | | | data Glyph | | | data TextExtents = TextExtents {} | | | data FontExtents = FontExtents {} | | | | | | | | | | | | | data FontOptions | | | data Path | | | | | | | | |
|
|
|
| Drawing
|
|
| renderWith |
| :: MonadIO m | | | => Surface | the target surface for the Render context
| | -> Render a | | | -> m a | | | Creates a new Render context with all graphics state parameters set to
default values and with the given surface as a target surface. The target
surface should be constructed with a backend-specific function such as
withImageSurface (or any other with<backend>Surface variant).
|
|
|
| save :: Render () |
| Makes a copy of the current state and saves it on an internal stack of
saved states. When restore is called, the saved state is restored.
Multiple calls to save and restore can be nested; each call to restore
restores the state from the matching paired save.
|
|
| restore :: Render () |
| Restores to the state saved by a preceding call to save and removes that
state from the stack of saved states.
|
|
| status :: Render Status |
| Ask for the status of the current Render monad.
|
|
| withTargetSurface :: (Surface -> Render a) -> Render a |
| Gets the target surface for the Render context as passed to renderWith.
|
|
| setSourceRGB |
| :: Double | red component of colour
| | -> Double | green component of colour
| | -> Double | blue compoment of colour
| | -> Render () | | Sets the source pattern within the context to an opaque color. This opaque
color will then be used for any subsequent drawing operation until a new source
pattern is set.
The color components are floating point numbers in the range 0 to 1. If the
values passed in are outside that range, they will be clamped.
|
|
|
| setSourceRGBA |
| :: Double | red component of color
| | -> Double | green component of color
| | -> Double | blue component of color
| | -> Double | alpha component of color
| | -> Render () | | Sets the source pattern within the context to a translucent color. This
color will then be used for any subsequent drawing operation until a new
source pattern is set.
The color and alpha components are floating point numbers in the range 0 to
1. If the values passed in are outside that range, they will be clamped.
|
|
|
| setSource |
| :: Pattern | a Pattern to be used as the source for subsequent drawing
operations.
| | -> Render () | | Sets the source pattern within the context to source. This pattern will
then be used for any subsequent drawing operation until a new source pattern
is set.
Note: The pattern's transformation matrix will be locked to the user space
in effect at the time of setSource. This means that further
modifications of the current transformation matrix will not affect the source
pattern. See setMatrix.
|
|
|
| setSourceSurface |
| :: Surface | a surface to be used to set the source pattern
| | -> Double | user-space X coordinate for surface origin
| | -> Double | user-space Y coordinate for surface origin
| | -> Render () | | This is a convenience function for creating a pattern from surface and
setting it as the source in the context with setSource.
The x and y parameters give the user-space coordinate at which the surface
origin should appear. (The surface origin is its upper-left corner before any
transformation has been applied.) The x and y patterns are negated and then
set as translation values in the pattern matrix.
Other than the initial translation pattern matrix, as described above, all
other pattern attributes, (such as its extend mode), are set to the default
values as in patternCreateForSurface. The resulting pattern can be queried
with getSource so that these attributes can be modified if desired, (eg. to
create a repeating pattern with patternSetExtent.
|
|
|
| getSource :: Render Pattern |
| Gets the current source pattern.
|
|
| setAntialias |
| :: Antialias | the new antialiasing mode
| | -> Render () | | Set the antialiasing mode of the rasterizer used for drawing shapes. This
value is a hint, and a particular backend may or may not support a particular
value. At the current time, no backend supports AntialiasSubpixel when
drawing shapes.
Note that this option does not affect text rendering, instead see
fontOptionsSetAntilias.
|
|
|
| setDash |
| :: [Double] | dashes a list specifying alternate lengths of on and off
portions of the stroke
| | -> Double | an offset into the dash pattern at which the stroke should
start
| | -> Render () | | Sets the dash pattern to be used by stroke. A dash pattern is specified
by dashes, a list of positive values. Each value provides the user-space
length of altenate on and off portions of the stroke. The offset
specifies an offset into the pattern at which the stroke begins.
If dashes is [] then dashing is disabled.
|
|
|
| setFillRule |
| :: FillRule | a fill rule
| | -> Render () | | | Set the current fill rule within the cairo context. The fill rule is used
to determine which regions are inside or outside a complex (potentially
self-intersecting) path. The current fill rule affects both fill and
clip. See FillRule for details on the semantics of each available fill
rule.
|
|
|
| getFillRule :: Render FillRule |
| Gets the current fill rule, as set by setFillrule.
|
|
| setLineCap |
| :: LineCap | a line cap style
| | -> Render () | | Sets the current line cap style within the cairo context. See LineCap
for details about how the available line cap styles are drawn.
As with the other stroke parameters, the current line cap style is examined
by stroke, strokeExtents, and strokeToPath, but does not have any
effect during path construction.
|
|
|
| getLineCap :: Render LineCap |
| Gets the current line cap style, as set by setLineCap.
|
|
| setLineJoin |
| :: LineJoin | a line joint style
| | -> Render () | | Sets the current line join style within the cairo context. See LineJoin
for details about how the available line join styles are drawn.
As with the other stroke parameters, the current line join style is examined
by stroke, strokeExtents, and strokeToPath, but does not have any
effect during path construction.
|
|
|
| getLineJoin :: Render LineJoin |
| Gets the current line join style, as set by setLineJoin.
|
|
| setLineWidth |
| :: Double | a line width
| | -> Render () | | Sets the current line width within the cairo context. The line width
specifies the diameter of a pen that is circular in user-space.
As with the other stroke parameters, the current line cap style is examined
by stroke, strokeExtents, and strokeToPath, but does not have any
effect during path construction.
|
|
|
| getLineWidth :: Render Double |
| Gets the current line width, as set by setLineWidth.
|
|
| setMiterLimit |
|
|
| getMiterLimit :: Render Double |
| Gets the current miter limit, as set by setMiterLimit.
|
|
| setOperator |
| :: Operator | a compositing operator
| | -> Render () | | | Sets the compositing operator to be used for all drawing operations.
See Operator for details on the semantics of each available compositing
operator.
|
|
|
| getOperator :: Render Operator |
| Gets the current compositing operator for a cairo context.
|
|
| setTolerance |
| :: Double | the tolerance, in device units (typically pixels)
| | -> Render () | | | Sets the tolerance used when converting paths into trapezoids. Curved
segments of the path will be subdivided until the maximum deviation between
the original path and the polygonal approximation is less than tolerance.
The default value is 0.1. A larger value will give better performance,
a smaller value, better appearance. (Reducing the value from the default
value of 0.1 is unlikely to improve appearance significantly.)
|
|
|
| getTolerance :: Render Double |
| Gets the current tolerance value, as set by setTolerance.
|
|
| clip :: Render () |
Establishes a new clip region by intersecting the current clip region with
the current path as it would be filled by fill and according to the current
fill rule (see setFillRule).
After clip, the current path will be cleared from the cairo context.
The current clip region affects all drawing operations by effectively masking
out any changes to the surface that are outside the current clip region.
Calling clip can only make the clip region smaller, never larger. But the
current clip is part of the graphics state, so a temporary restriction of the
clip region can be achieved by calling clip within a save' pair.
The only other means of increasing the size of the clip region is resetClip.
|
|
| clipPreserve :: Render () |
Establishes a new clip region by intersecting the current clip region with
the current path as it would be filled by fill and according to the current
fill rule (see setFillRule).
Unlike clip, cairoClipPreserve preserves the path within the cairo context.
The current clip region affects all drawing operations by effectively masking
out any changes to the surface that are outside the current clip region.
Calling clip can only make the clip region smaller, never larger. But the
current clip is part of the graphics state, so a temporary restriction of the
clip region can be achieved by calling clip within a save' pair.
The only other means of increasing the size of the clip region is resetClip.
|
|
| resetClip :: Render () |
Reset the current clip region to its original, unrestricted state. That is,
set the clip region to an infinitely large shape containing the target
surface. Equivalently, if infinity is too hard to grasp, one can imagine the
clip region being reset to the exact bounds of the target surface.
Note that code meant to be reusable should not call resetClip as it will
cause results unexpected by higher-level code which calls clip. Consider
using save and restore around clip as a more robust means of
temporarily restricting the clip region.
|
|
| fill :: Render () |
A drawing operator that fills the current path according to the current
fill rule, (each sub-path is implicitly closed before being filled).
After fill, the current path will be cleared from the cairo context.
See setFillRule and fillPreserve.
|
|
| fillPreserve :: Render () |
A drawing operator that fills the current path according to the current
fill rule, (each sub-path is implicitly closed before being filled).
Unlike fill, fillPreserve preserves the path within the cairo context.
See setFillRule and fill.
|
|
| fillExtents :: Render (Double, Double, Double, Double) |
|
| inFill :: Double -> Double -> Render Bool |
|
| mask |
| :: Pattern | a Pattern
| | -> Render () | | | A drawing operator that paints the current source using the alpha channel
of pattern as a mask. (Opaque areas of mask are painted with the source,
transparent areas are not painted.)
|
|
|
| maskSurface |
| :: Surface | a Surface
| | -> Double | X coordinate at which to place the origin of surface
| | -> Double | Y coordinate at which to place the origin of surface
| | -> Render () | | | A drawing operator that paints the current source using the alpha channel
of surface as a mask. (Opaque areas of surface are painted with the source,
transparent areas are not painted.)
|
|
|
| paint :: Render () |
| A drawing operator that paints the current source everywhere within the
current clip region.
|
|
| paintWithAlpha |
| :: Double | alpha value, between 0 (transparent) and 1 (opaque)
| | -> Render () | | | A drawing operator that paints the current source everywhere within the
current clip region using a mask of constant alpha value alpha. The effect
is similar to paint, but the drawing is faded out using the alpha value.
|
|
|
| stroke :: Render () |
A drawing operator that strokes the current path according to the current
line width, line join, line cap, and dash settings. After issuing stroke,
the current path will be cleared from the Render monad.
See setLineWidth, setLineJoin, setLineCap, setDash, and strokePreserve.
|
|
| strokePreserve :: Render () |
A drawing operator that strokes the current path according to the current
line width, line join, line cap, and dash settings. Unlike stroke,
strokePreserve preserves the path within the Render monad.
See setLineWidth, setLineJoin, setLineCap, setDash, and strokePreserve.
|
|
| strokeExtents :: Render (Double, Double, Double, Double) |
|
| inStroke :: Double -> Double -> Render Bool |
|
| copyPage :: Render () |
|
| showPage :: Render () |
|
| Paths
|
|
| getCurrentPoint :: Render (Double, Double) |
Gets the current point of the current path, which is conceptually the final
point reached by the path so far.
The current point is returned in the user-space coordinate system. If there
is no defined current point then x and y will both be set to 0.0.
Most path construction functions alter the current point. See the following
for details on how they affect the current point: newPath, moveTo,
lineTo, curveTo, arc, relMoveTo, relLineTo, relCurveTo,
arcNegative, textPath, strokeToPath.
|
|
| newPath :: Render () |
| Clears the current path. After this call there will be no current point.
|
|
| closePath :: Render () |
Adds a line segment to the path from the current point to the beginning of
the current subpath, (the most recent point passed to moveTo), and closes
this subpath.
The behavior of closePath is distinct from simply calling lineTo with the
equivalent coordinate in the case of stroking. When a closed subpath is
stroked, there are no caps on the ends of the subpath. Instead, their is a
line join connecting the final and initial segments of the subpath.
|
|
| arc |
| :: Double | xc - X position of the center of the arc
| | -> Double | yc - Y position of the center of the arc
| | -> Double | radius - the radius of the arc
| | -> Double | angle1 - the start angle, in radians
| | -> Double | angle2 - the end angle, in radians
| | -> Render () | | Adds a circular arc of the given radius to the current path. The arc is
centered at (xc, yc), begins at angle1 and proceeds in the direction of
increasing angles to end at angle2. If angle2 is less than angle1 it
will be progressively increased by 2*pi until it is greater than angle1.
If there is a current point, an initial line segment will be added to the
path to connect the current point to the beginning of the arc.
Angles are measured in radians. An angle of 0 is in the direction of the
positive X axis (in user-space). An angle of pi radians (90 degrees) is in
the direction of the positive Y axis (in user-space). Angles increase in the
direction from the positive X axis toward the positive Y axis. So with the
default transformation matrix, angles increase in a clockwise direction.
(To convert from degrees to radians, use degrees * (pi / 180).)
This function gives the arc in the direction of increasing angles; see
arcNegative to get the arc in the direction of decreasing angles.
The arc is circular in user-space. To achieve an elliptical arc, you can
scale the current transformation matrix by different amounts in the X and Y
directions. For example, to draw an ellipse in the box given by x, y, width,
height:
save
translate (x + width / 2) (y + height / 2)
scale (1 / (height / 2.)) (1 / (width / 2))
arc 0 0 1 0 (2 * pi)
restore
|
|
|
| arcNegative |
| :: Double | xc - X position of the center of the arc
| | -> Double | yc - Y position of the center of the arc
| | -> Double | radius - the radius of the arc
| | -> Double | angle1 - the start angle, in radians
| | -> Double | angle2 - the end angle, in radians
| | -> Render () | | Adds a circular arc of the given radius to the current path. The arc is
centered at (xc, yc), begins at angle1 and proceeds in the direction of
decreasing angles to end at angle2. If angle2 is greater than angle1 it
will be progressively decreased by 2*pi until it is greater than angle1.
See arc for more details. This function differs only in the direction of
the arc between the two angles.
|
|
|
| curveTo |
| :: Double | x1 - the X coordinate of the first control point
| | -> Double | y1 - the Y coordinate of the first control point
| | -> Double | x2 - the X coordinate of the second control point
| | -> Double | y2 - the Y coordinate of the second control point
| | -> Double | x3 - the X coordinate of the end of the curve
| | -> Double | y3 - the Y coordinate of the end of the curve
| | -> Render () | | | Adds a cubic Bezier spline to the path from the current point to position
(x3, y3) in user-space coordinates, using (x1, y1) and (x2, y2)
as the control points. After this call the current point will be (x3, y3).
|
|
|
| lineTo |
| :: Double | x - the X coordinate of the end of the new line
| | -> Double | y - the Y coordinate of the end of the new line
| | -> Render () | | | Adds a line to the path from the current point to position (x, y) in
user-space coordinates. After this call the current point will be (x, y).
|
|
|
| moveTo |
| :: Double | x - the X coordinate of the new position
| | -> Double | y - the Y coordinate of the new position
| | -> Render () | | | If the current subpath is not empty, begin a new subpath. After this call
the current point will be (x, y).
|
|
|
| rectangle |
| :: Double | x - the X coordinate of the top left corner of the rectangle
| | -> Double | y - the Y coordinate of the top left corner of the rectangle
| | -> Double | width - the width of the rectangle
| | -> Double | height - the height of the rectangle
| | -> Render () | | | Adds a closed-subpath rectangle of the given size to the current path at
position (x, y) in user-space coordinates.
|
|
|
| textPath |
| :: String | | | -> Render () | | Render text at the current path.
- See showText for why you should use Gtk functions.
|
|
|
| relCurveTo |
| :: Double | dx1 - the X offset to the first control point
| | -> Double | dy1 - the Y offset to the first control point
| | -> Double | dx2 - the X offset to the second control point
| | -> Double | dy2 - the Y offset to the second control point
| | -> Double | dx3 - the X offset to the end of the curve
| | -> Double | dy3 - the Y offset to the end of the curve
| | -> Render () | | Relative-coordinate version of curveTo. All offsets are relative to the
current point. Adds a cubic Bezier spline to the path from the current point
to a point offset from the current point by (dx3, dy3), using points
offset by (dx1, dy1) and (dx2, dy2) as the control points. After this
call the current point will be offset by (dx3, dy3).
Given a current point of (x, y), relCurveTo dx1 dy1 dx2 dy2 dx3 dy3
is logically equivalent to curveTo (x + dx1) (y + dy1) (x + dx2) (y + dy2) (x + dx3) (y + dy3).
|
|
|
| relLineTo |
| :: Double | dx - the X offset to the end of the new line
| | -> Double | dy - the Y offset to the end of the new line
| | -> Render () | | Relative-coordinate version of lineTo. Adds a line to the path from the
current point to a point that is offset from the current point by (dx, dy)
in user space. After this call the current point will be offset by (dx, dy).
Given a current point of (x, y), relLineTo dx dy is logically equivalent
to lineTo (x + dx) (y + dy).
|
|
|
| relMoveTo |
| :: Double | dx - the X offset
| | -> Double | dy - the Y offset
| | -> Render () | | If the current subpath is not empty, begin a new subpath. After this call
the current point will offset by (x, y).
Given a current point of (x, y), relMoveTo dx dy is logically equivalent
to moveTo (x + dx) (y + dy)
|
|
|
| Patterns
|
|
| withRGBPattern |
| :: Double | red component of the color
| | -> Double | green component of the color
| | -> Double | blue component of the color
| | -> (Pattern -> Render a) | a nested render action using the pattern
| | -> Render a | | Creates a new Pattern corresponding to an opaque color. The color
components are floating point numbers in the range 0 to 1. If the values
passed in are outside that range, they will be clamped.
For example to create a solid red pattern:
withRBGPattern 1 0 0 $ do
...
...
|
|
|
| withRGBAPattern |
| :: Double | red component of color
| | -> Double | green component of color
| | -> Double | blue component of color
| | -> Double | alpha component of color
| | -> (Pattern -> Render a) | a nested render action using the pattern
| | -> Render a | | Creates a new Pattern corresponding to a translucent color. The color
components are floating point numbers in the range 0 to 1. If the values
passed in are outside that range, they will be clamped.
For example to create a solid red pattern at 50% transparency:
withRBGPattern 1 0 0 0.5 $ do
...
...
|
|
|
| withPatternForSurface |
|
|
| withLinearPattern |
| :: Double | x0 - x coordinate of the start point
| | -> Double | y0 - y coordinate of the start point
| | -> Double | x1 - x coordinate of the end point
| | -> Double | y1 - y coordinate of the end point
| | -> (Pattern -> Render a) | a nested render action using the pattern
| | -> Render a | | Create a new linear gradient Pattern along the line defined by (x0, y0)
and (x1, y1). Before using the gradient pattern, a number of color stops
should be defined using patternAddColorStopRGB and patternAddColorStopRGBA.
- Note: The coordinates here are in pattern space. For a new pattern,
pattern space is identical to user space, but the relationship between the
spaces can be changed with patternSetMatrix.
|
|
|
| withRadialPattern |
| :: Double | cx0 - x coordinate for the center of the start circle
| | -> Double | cy0 - y coordinate for the center of the start circle
| | -> Double | radius0 - radius of the start cirle
| | -> Double | cx1 - x coordinate for the center of the end circle
| | -> Double | cy1 - y coordinate for the center of the end circle
| | -> Double | radius1 - radius of the end circle
| | -> (Pattern -> Render a) | a nested render action using the pattern
| | -> Render a | | Creates a new radial gradient Pattern between the two circles defined by
(x0, y0, c0) and (x1, y1, c0). Before using the gradient pattern, a
number of color stops should be defined using patternAddColorStopRGB
or patternAddColorStopRGBA.
- Note: The coordinates here are in pattern space. For a new pattern,
pattern space is identical to user space, but the relationship between the
spaces can be changed with patternSetMatrix.
|
|
|
| patternAddColorStopRGB |
| :: Pattern | a Pattern
| | -> Double | an offset in the range [0.0 .. 1.0]
| | -> Double | red component of color
| | -> Double | green component of color
| | -> Double | blue component of color
| | -> Render () | | Adds an opaque color stop to a gradient pattern. The offset specifies the
location along the gradient's control vector. For example, a linear gradient's
control vector is from (x0,y0) to (x1,y1) while a radial gradient's control
vector is from any point on the start circle to the corresponding point on
the end circle.
The color is specified in the same way as in setSourceRGB.
Note: If the pattern is not a gradient pattern, (eg. a linear or radial
pattern), then the pattern will be put into an error status with a status of
StatusPatternTypeMismatch.
|
|
|
| patternAddColorStopRGBA |
| :: Pattern | a Pattern
| | -> Double | an offset in the range [0.0 .. 1.0]
| | -> Double | red component of color
| | -> Double | green component of color
| | -> Double | blue component of color
| | -> Double | alpha component of color
| | -> Render () | | Adds a translucent color stop to a gradient pattern. The offset specifies
the location along the gradient's control vector. For example, a linear
gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's
control vector is from any point on the start circle to the corresponding
point on the end circle.
The color is specified in the same way as in setSourceRGBA.
Note: If the pattern is not a gradient pattern, (eg. a linear or radial
pattern), then the pattern will be put into an error status with a status of
StatusPatternTypeMismatch.
|
|
|
| patternSetMatrix |
| :: Pattern | a Pattern
| | -> Matrix | a Matrix
| | -> Render () | | Sets the pattern's transformation matrix to matrix. This matrix is a
transformation from user space to pattern space.
When a pattern is fi |
|