gi-pango-1.0.23: Pango bindings

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

GI.Pango.Objects.Renderer

Contents

- Exported types
- Methods
  - Overloaded methods
  - activate
  - deactivate
  - drawErrorUnderline
  - drawGlyph
  - drawGlyphItem
  - drawGlyphs
  - drawLayout
  - drawLayoutLine
  - drawRectangle
  - drawTrapezoid
  - getAlpha
  - getColor
  - getLayout
  - getLayoutLine
  - getMatrix
  - partChanged
  - setAlpha
  - setColor
  - setMatrix

Description

`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
- 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

newtype Renderer Source #

Memory-managed wrapper type.

Constructors

Renderer (ManagedPtr Renderer) |

#### Instances

Instances details

Eq Renderer Source # |
Instance details Defined in GI.Pango.Objects.Renderer Methods (==) :: Renderer -> Renderer -> Bool # (/=) :: Renderer -> Renderer -> Bool #
GObject Renderer Source # |
Instance details Defined in GI.Pango.Objects.Renderer
TypedObject Renderer Source # |
Instance details Defined in GI.Pango.Objects.Renderer Methods glibType :: IO GType Source #
ManagedPtrNewtype Renderer Source # |
Instance details Defined in GI.Pango.Objects.Renderer Methods toManagedPtr :: Renderer -> ManagedPtr Renderer Source #
IsGValue Renderer Source # | Convert `Renderer` to and from `GValue` with `toGValue` and `fromGValue`.
Instance details Defined in GI.Pango.Objects.Renderer Methods toGValue :: Renderer -> IO GValue Source # fromGValue :: GValue -> IO Renderer Source #
HasParentTypes Renderer Source # |
Instance details Defined in GI.Pango.Objects.Renderer
type ParentTypes Renderer Source # |
Instance details Defined in GI.Pango.Objects.Renderer type ParentTypes Renderer = '[Object]

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

Instances details

(GObject o, IsDescendantOf Renderer o) => IsRenderer o Source # |
Instance details Defined in GI.Pango.Objects.Renderer

toRenderer :: (MonadIO m, IsRenderer o) => o -> m Renderer Source #

Cast to `Renderer`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

## Overloaded methods

## activate

rendererActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> 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

rendererDeactivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> m () |

Cleans up after rendering operations on `renderer`. See docs for `rendererActivate`.

Since: 1.8

## drawErrorUnderline

rendererDrawErrorUnderline Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> Int32 | `x`: X coordinate of underline, in Pango units in user coordinate system
-> Int32 | `y`: Y coordinate of underline, in Pango units in user coordinate system
-> Int32 | `width`: width of underline, in Pango units in user coordinate system
-> Int32 | `height`: height of underline, in Pango units in user coordinate system
-> 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

rendererDrawGlyph Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) |
=> a | `renderer`: a `Renderer`
-> b | `font`: a `Font`
-> Word32 | `glyph`: the glyph index of a single glyph
-> Double | `x`: X coordinate of left edge of baseline of glyph
-> Double | `y`: Y coordinate of left edge of baseline of glyph
-> m () |

Draws a single glyph with coordinates in device space.

Since: 1.8

## drawGlyphItem

rendererDrawGlyphItem Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> Maybe Text | `text`: the UTF-8 text that `glyphItem` refers to, or `Nothing`
-> GlyphItem | `glyphItem`: a `GlyphItem`
-> Int32 | `x`: X position of left edge of baseline, in user space coordinates in Pango units.
-> Int32 | `y`: Y position of left edge of baseline, in user space coordinates in Pango units.
-> 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

rendererDrawGlyphs Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) |
=> a | `renderer`: a `Renderer`
-> b | `font`: a `Font`
-> GlyphString | `glyphs`: a `GlyphString`
-> Int32 | `x`: X position of left edge of baseline, in user space coordinates in Pango units.
-> Int32 | `y`: Y position of left edge of baseline, in user space coordinates in Pango units.
-> m () |

Draws the glyphs in `glyphs` with the specified `Renderer`.

Since: 1.8

## drawLayout

rendererDrawLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsLayout b) |
=> a | `renderer`: a `Renderer`
-> b | `layout`: a `Layout`
-> Int32 | `x`: X position of left edge of baseline, in user space coordinates in Pango units.
-> Int32 | `y`: Y position of left edge of baseline, in user space coordinates in Pango units.
-> m () |

Draws `layout` with the specified `Renderer`.

Since: 1.8

## drawLayoutLine

rendererDrawLayoutLine Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> LayoutLine | `line`: a `LayoutLine`
-> Int32 | `x`: X position of left edge of baseline, in user space coordinates in Pango units.
-> Int32 | `y`: Y position of left edge of baseline, in user space coordinates in Pango units.
-> m () |

Draws `line` with the specified `Renderer`.

Since: 1.8

## drawRectangle

rendererDrawRectangle Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: type of object this rectangle is part of
-> Int32 | `x`: X position at which to draw rectangle, in user space coordinates in Pango units
-> Int32 | `y`: Y position at which to draw rectangle, in user space coordinates in Pango units
-> Int32 | `width`: width of rectangle in Pango units in user space coordinates
-> Int32 | `height`: height of rectangle in Pango units in user space coordinates
-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: type of object this trapezoid is part of
-> Double | `y1_`: Y coordinate of top of trapezoid
-> Double | `x11`: X coordinate of left end of top of trapezoid
-> Double | `x21`: X coordinate of right end of top of trapezoid
-> Double | `y2`: Y coordinate of bottom of trapezoid
-> Double | `x12`: X coordinate of left end of bottom of trapezoid
-> Double | `x22`: X coordinate of right end of bottom of trapezoid
-> 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

rendererGetAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: the part to get the alpha for
-> 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

rendererGetColor Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: the part to get the color for
-> m (Maybe Color) | Returns: the color for the specified part, or `Nothing` if it hasn't been set and should be inherited from the environment.

Gets the current rendering color for the specified part.

Since: 1.8

## getLayout

rendererGetLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> m (Maybe Layout) | Returns: the layout, or `Nothing` if no layout is being rendered using `renderer` at this time.

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 #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> m (Maybe LayoutLine) | Returns: the layout line, or `Nothing` if no layout line is being rendered using `renderer` at this time.

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

rendererGetMatrix Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> m (Maybe Matrix) | Returns: the matrix, or `Nothing` if no matrix has been set (which is the same as the identity matrix). The returned matrix is owned by Pango and must not be modified or freed.

Gets the transformation matrix that will be applied when rendering. See `rendererSetMatrix`.

Since: 1.8

## partChanged

rendererPartChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: the part for which rendering has changed.
-> 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

rendererSetAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: the part to set the alpha for
-> Word16 | `alpha`: an alpha value between 1 and 65536, or 0 to unset the alpha
-> 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

rendererSetColor Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> RenderPart | `part`: the part to change the color of
-> Maybe Color | `color`: the new color or `Nothing` to unset the current color
-> m () |

Sets the color for part of the rendering. Also see `rendererSetAlpha`.

Since: 1.8

## setMatrix

rendererSetMatrix Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) |
=> a | `renderer`: a `Renderer`
-> Maybe Matrix | `matrix`: a `Matrix`, or `Nothing` to unset any existing matrix. (No matrix set is the same as setting the identity matrix.)
-> m () |

Sets the transformation matrix that will be applied when rendering.

Since: 1.8