Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
PangoRenderer
is a base class for objects that can render text
provided as PangoGlyphString
or PangoLayout
.
By subclassing PangoRenderer
and overriding operations such as
drawGlyphs
and drawRectangle
, renderers for particular font
backends and destinations can be created.
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
- 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 | |
ManagedPtrNewtype Renderer Source # | |
Defined in GI.Pango.Objects.Renderer toManagedPtr :: Renderer -> ManagedPtr Renderer # | |
TypedObject Renderer Source # | |
Defined in GI.Pango.Objects.Renderer | |
HasParentTypes Renderer Source # | |
Defined in GI.Pango.Objects.Renderer | |
IsGValue (Maybe Renderer) Source # | Convert |
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
Click to display all available methods, including inherited ones
Methods
activate, bindProperty, bindPropertyFull, deactivate, drawErrorUnderline, drawGlyph, drawGlyphItem, drawGlyphs, drawLayout, drawLayoutLine, drawRectangle, drawTrapezoid, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, partChanged, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getAlpha, getColor, getData, getLayout, getLayoutLine, getMatrix, getProperty, getQdata.
Setters
setAlpha, setColor, setData, setDataFull, setMatrix, setProperty.
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 () |
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 PangoRenderer
,
embedding the text associated with the glyphs in the output if the
output format supports it.
This is useful for rendering text in PDF.
Note that this method does not handle attributes in glyphItem
.
If you want colors, shapes and lines handled automatically according
to those attributes, you need to use rendererDrawLayoutLine
or rendererDrawLayout
.
Note that text
is the start of the text for layout, which is then
indexed by glyph_item->item->offset
.
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 PangoRenderer
.
Since: 1.8
drawLayout
:: (HasCallStack, MonadIO m, IsRenderer a, IsLayout b) | |
=> a |
|
-> b |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws layout
with the specified PangoRenderer
.
This is equivalent to drawing the lines of the layout, at their
respective positions relative to x
, y
.
Since: 1.8
drawLayoutLine
rendererDrawLayoutLine Source #
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> LayoutLine |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Draws line
with the specified PangoRenderer
.
This draws the glyph items that make up the line, as well as shapes, backgrounds and lines that are specified by the attributes of those items.
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 PangoRenderer
.
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 PangoRenderer
; 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 vfunc, 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 vfunc, 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 |
partChanged
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> RenderPart |
|
-> m () |
Informs Pango that the way that the rendering is done
for part
has changed.
This should be called if the rendering changes in a way that would
prevent multiple pieces being joined together into one drawing call.
For instance, if a subclass of PangoRenderer
was to add a stipple
option for drawing underlines, it needs to call
pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
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 () |
setMatrix
:: (HasCallStack, MonadIO m, IsRenderer a) | |
=> a |
|
-> Maybe Matrix |
|
-> m () |
Sets the transformation matrix that will be applied when rendering.
Since: 1.8