Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
Renderer
is a base class for objects that are used to
render Pango objects such as GlyphString
and
Layout
.
Since: 1.8
Synopsis
- newtype Renderer = Renderer (ManagedPtr Renderer)
- class (GObject o, IsDescendantOf Renderer o) => IsRenderer o
- toRenderer :: (MonadIO m, IsRenderer o) => o -> m Renderer
- noRenderer :: Maybe Renderer
- rendererActivate :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m ()
- rendererDeactivate :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m ()
- rendererDrawErrorUnderline :: (HasCallStack, MonadIO m, IsRenderer a) => a -> Int32 -> Int32 -> Int32 -> Int32 -> m ()
- rendererDrawGlyph :: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) => a -> b -> Word32 -> Double -> Double -> m ()
- rendererDrawGlyphItem :: (HasCallStack, MonadIO m, IsRenderer a) => a -> Maybe Text -> GlyphItem -> Int32 -> Int32 -> m ()
- rendererDrawGlyphs :: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) => a -> b -> GlyphString -> Int32 -> Int32 -> m ()
- rendererDrawLayout :: (HasCallStack, MonadIO m, IsRenderer a, IsLayout b) => a -> b -> Int32 -> Int32 -> m ()
- rendererDrawLayoutLine :: (HasCallStack, MonadIO m, IsRenderer a) => a -> LayoutLine -> Int32 -> Int32 -> m ()
- rendererDrawRectangle :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> Int32 -> Int32 -> Int32 -> Int32 -> m ()
- rendererDrawTrapezoid :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> Double -> Double -> Double -> Double -> Double -> Double -> m ()
- rendererGetAlpha :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> m Word16
- rendererGetColor :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> m (Maybe Color)
- rendererGetLayout :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m (Maybe Layout)
- rendererGetLayoutLine :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m (Maybe LayoutLine)
- rendererGetMatrix :: (HasCallStack, MonadIO m, IsRenderer a) => a -> m (Maybe Matrix)
- rendererPartChanged :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> m ()
- rendererSetAlpha :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> Word16 -> m ()
- rendererSetColor :: (HasCallStack, MonadIO m, IsRenderer a) => a -> RenderPart -> Maybe Color -> m ()
- rendererSetMatrix :: (HasCallStack, MonadIO m, IsRenderer a) => a -> Maybe Matrix -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Renderer Source # | |
GObject Renderer Source # | |
Defined in GI.Pango.Objects.Renderer gobjectType :: IO GType # | |
IsGValue Renderer Source # | Convert |
HasParentTypes Renderer Source # | |
Defined in GI.Pango.Objects.Renderer | |
type ParentTypes Renderer Source # | |
Defined in GI.Pango.Objects.Renderer |
class (GObject o, IsDescendantOf Renderer o) => IsRenderer o Source #
Type class for types which can be safely cast to Renderer
, for instance with toRenderer
.
Instances
(GObject o, IsDescendantOf Renderer o) => IsRenderer o Source # | |
Defined in GI.Pango.Objects.Renderer |
toRenderer :: (MonadIO m, IsRenderer o) => o -> m Renderer Source #
Methods
Overloaded methods
activate
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m () |
Does initial setup before rendering operations on renderer
.
rendererDeactivate
should be called when done drawing.
Calls such as rendererDrawLayout
automatically
activate the layout before drawing on it. Calls to
rendererActivate
and rendererDeactivate
can
be nested and the renderer will only be initialized and
deinitialized once.
Since: 1.8
deactivate
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m () |
Cleans up after rendering operations on renderer
. See
docs for rendererActivate
.
Since: 1.8
drawErrorUnderline
rendererDrawErrorUnderline Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draw a squiggly line that approximately covers the given rectangle in the style of an underline used to indicate a spelling error. (The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle)
This should be called while renderer
is already active. Use
rendererActivate
to activate a renderer.
Since: 1.8
drawGlyph
:: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) | |
=> a |
|
-> b |
|
-> Word32 |
|
-> Double |
|
-> Double |
|
-> m () |
Draws a single glyph with coordinates in device space.
Since: 1.8
drawGlyphItem
rendererDrawGlyphItem Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> Maybe Text |
|
-> GlyphItem |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws the glyphs in glyphItem
with the specified Renderer
,
embedding the text associated with the glyphs in the output if the
output format supports it (PDF for example).
Note that text
is the start of the text for layout, which is then
indexed by <literal>glyphItem
->item->offset</literal>.
If text
is Nothing
, this simply calls rendererDrawGlyphs
.
The default implementation of this method simply falls back to
rendererDrawGlyphs
.
Since: 1.22
drawGlyphs
:: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) | |
=> a |
|
-> b |
|
-> GlyphString |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws the glyphs in glyphs
with the specified Renderer
.
Since: 1.8
drawLayout
:: (HasCallStack, MonadIO m, IsRenderer a, IsLayout b) | |
=> a |
|
-> b |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws layout
with the specified Renderer
.
Since: 1.8
drawLayoutLine
rendererDrawLayoutLine Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> LayoutLine |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws line
with the specified Renderer
.
Since: 1.8
drawRectangle
rendererDrawRectangle Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws an axis-aligned rectangle in user space coordinates with the
specified Renderer
.
This should be called while renderer
is already active. Use
rendererActivate
to activate a renderer.
Since: 1.8
drawTrapezoid
rendererDrawTrapezoid Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> m () |
Draws a trapezoid with the parallel sides aligned with the X axis
using the given Renderer
; coordinates are in device space.
Since: 1.8
getAlpha
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> m Word16 | Returns: the alpha for the specified part, or 0 if it hasn't been set and should be inherited from the environment. |
Gets the current alpha for the specified part.
Since: 1.38
getColor
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> m (Maybe Color) | Returns: the color for the
specified part, or |
Gets the current rendering color for the specified part.
Since: 1.8
getLayout
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m (Maybe Layout) | Returns: the layout, or |
Gets the layout currently being rendered using renderer
.
Calling this function only makes sense from inside a subclass's
methods, like in its draw_shape() for example.
The returned layout should not be modified while still being rendered.
Since: 1.20
getLayoutLine
rendererGetLayoutLine Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m (Maybe LayoutLine) | Returns: the layout line, or |
Gets the layout line currently being rendered using renderer
.
Calling this function only makes sense from inside a subclass's
methods, like in its draw_shape() for example.
The returned layout line should not be modified while still being rendered.
Since: 1.20
getMatrix
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> m (Maybe Matrix) | Returns: the matrix, or |
Gets the transformation matrix that will be applied when
rendering. See rendererSetMatrix
.
Since: 1.8
partChanged
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> m () |
Informs Pango that the way that the rendering is done
for part
has changed in a way that would prevent multiple
pieces being joined together into one drawing call. For
instance, if a subclass of Renderer
was to add a stipple
option for drawing underlines, it needs to call
<informalexample><programlisting> pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE); </programlisting></informalexample>
When the stipple changes or underlines with different stipples
might be joined together. Pango automatically calls this for
changes to colors. (See rendererSetColor
)
Since: 1.8
setAlpha
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> Word16 |
|
-> m () |
Sets the alpha for part of the rendering.
Note that the alpha may only be used if a color is
specified for part
as well.
Since: 1.38
setColor
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> Maybe Color |
|
-> m () |
Sets the color for part of the rendering.
Also see rendererSetAlpha
.
Since: 1.8
setMatrix
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> Maybe Matrix |
|
-> m () |
Sets the transformation matrix that will be applied when rendering.
Since: 1.8