gi-pango-1.0.25: Pango bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Pango.Objects.Renderer

Description

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

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

GObject Renderer Source # 
Instance details

Defined in GI.Pango.Objects.Renderer

ManagedPtrNewtype 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 #

HasParentTypes Renderer Source # 
Instance details

Defined in GI.Pango.Objects.Renderer

IsGValue (Maybe Renderer) Source #

Convert Renderer to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Pango.Objects.Renderer

type ParentTypes Renderer Source # 
Instance details

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

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

activate

rendererActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a PangoRenderer

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

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

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

-> b

font: a PangoFont

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

-> Maybe Text

text: the UTF-8 text that glyphItem refers to

-> GlyphItem

glyphItem: a PangoGlyphItem

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

rendererDrawGlyphs Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsFont b) 
=> a

renderer: a PangoRenderer

-> b

font: a PangoFont

-> GlyphString

glyphs: a PangoGlyphString

-> 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 PangoRenderer.

Since: 1.8

drawLayout

rendererDrawLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a, IsLayout b) 
=> a

renderer: a PangoRenderer

-> b

layout: a PangoLayout

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

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a PangoRenderer

-> LayoutLine

line: a PangoLayoutLine

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

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a PangoRenderer

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

-> Int32

height: height of rectangle in Pango units

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

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a PangoRenderer

-> 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 PangoRenderer; coordinates are in device space.

Since: 1.8

getAlpha

rendererGetAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a PangoRenderer

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

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

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

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

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

-> RenderPart

part: the part for which rendering has changed.

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

rendererSetAlpha Source #

Arguments

:: (HasCallStack, MonadIO m, IsRenderer a) 
=> a

renderer: a PangoRenderer

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

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

-> Maybe Matrix

matrix: a PangoMatrix, 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