gi-pango-1.0.22: Pango bindings
Copyright Will Thompson Iñaki García Etxebarria and Jonas Platte LGPL-2.1 Iñaki García Etxebarria None Haskell2010

GI.Pango.Objects.Renderer

Description

Renderer is a base class for objects that are used to render Pango objects such as GlyphString and Layout.

Since: 1.8

Synopsis

# Exported types

newtype Renderer Source #

Memory-managed wrapper type.

Constructors

 Renderer (ManagedPtr Renderer)

#### Instances

Instances details
 Source # Instance detailsDefined in GI.Pango.Objects.Renderer Methods Source # Instance detailsDefined in GI.Pango.Objects.Renderer Methods Source # Convert Renderer to and from GValue with toGValue and fromGValue. Instance detailsDefined in GI.Pango.Objects.Renderer Methods Source # Instance detailsDefined in GI.Pango.Objects.Renderer Source # Instance detailsDefined 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
 Source # Instance detailsDefined 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.

A convenience alias for Nothing :: Maybe Renderer.

# Methods

## activate

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

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

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

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

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

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

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

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

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

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

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

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

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() for example.

The returned layout should not be modified while still being rendered.

Since: 1.20

## getLayoutLine

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() for example.

The returned layout line should not be modified while still being rendered.

Since: 1.20

## getMatrix

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

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

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

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

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