pub trait RendererExt: 'static {
Show 19 methods fn activate(&self); fn deactivate(&self); fn draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32); fn draw_glyph(&self, font: &impl IsA<Font>, glyph: Glyph, x: f64, y: f64); fn draw_glyph_item(
        &self,
        text: Option<&str>,
        glyph_item: &mut GlyphItem,
        x: i32,
        y: i32
    ); fn draw_glyphs(
        &self,
        font: &impl IsA<Font>,
        glyphs: &mut GlyphString,
        x: i32,
        y: i32
    ); fn draw_layout(&self, layout: &Layout, x: i32, y: i32); fn draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32); fn draw_rectangle(
        &self,
        part: RenderPart,
        x: i32,
        y: i32,
        width: i32,
        height: i32
    ); fn draw_trapezoid(
        &self,
        part: RenderPart,
        y1_: f64,
        x11: f64,
        x21: f64,
        y2: f64,
        x12: f64,
        x22: f64
    ); fn alpha(&self, part: RenderPart) -> u16; fn color(&self, part: RenderPart) -> Option<Color>; fn layout(&self) -> Option<Layout>; fn layout_line(&self) -> Option<LayoutLine>; fn matrix(&self) -> Option<Matrix>; fn part_changed(&self, part: RenderPart); fn set_alpha(&self, part: RenderPart, alpha: u16); fn set_color(&self, part: RenderPart, color: Option<&Color>); fn set_matrix(&self, matrix: Option<&Matrix>);
}
Expand description

Trait containing all Renderer methods.

Implementors

Renderer

Required Methods

Does initial setup before rendering operations on @self.

deactivate() should be called when done drawing. Calls such as draw_layout() automatically activate the layout before drawing on it.

Calls to activate() and deactivate() can be nested and the renderer will only be initialized and deinitialized once.

Cleans up after rendering operations on @self.

See docs for activate().

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 @self is already active. Use activate() to activate a renderer.

x

X coordinate of underline, in Pango units in user coordinate system

y

Y coordinate of underline, in Pango units in user coordinate system

width

width of underline, in Pango units in user coordinate system

height

height of underline, in Pango units in user coordinate system

Draws a single glyph with coordinates in device space.

font

a Font

glyph

the glyph index of a single glyph

x

X coordinate of left edge of baseline of glyph

y

Y coordinate of left edge of baseline of glyph

Draws the glyphs in @glyph_item with the specified Renderer, 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 @glyph_item. If you want colors, shapes and lines handled automatically according to those attributes, you need to use pango_renderer_draw_layout_line() or pango_renderer_draw_layout().

Note that @text is the start of the text for layout, which is then indexed by glyph_item->item->offset.

If @text is None, this simply calls draw_glyphs().

The default implementation of this method simply falls back to draw_glyphs().

text

the UTF-8 text that @glyph_item refers to

glyph_item

a GlyphItem

x

X position of left edge of baseline, in user space coordinates in Pango units

y

Y position of left edge of baseline, in user space coordinates in Pango units

Draws the glyphs in @glyphs with the specified Renderer.

font

a Font

glyphs

a GlyphString

x

X position of left edge of baseline, in user space coordinates in Pango units.

y

Y position of left edge of baseline, in user space coordinates in Pango units.

Draws @layout with the specified Renderer.

This is equivalent to drawing the lines of the layout, at their respective positions relative to @x, @y.

layout

a Layout

x

X position of left edge of baseline, in user space coordinates in Pango units.

y

Y position of left edge of baseline, in user space coordinates in Pango units.

Draws @line with the specified Renderer.

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.

line

a LayoutLine

x

X position of left edge of baseline, in user space coordinates in Pango units.

y

Y position of left edge of baseline, in user space coordinates in Pango units.

Draws an axis-aligned rectangle in user space coordinates with the specified Renderer.

This should be called while @self is already active. Use activate() to activate a renderer.

part

type of object this rectangle is part of

x

X position at which to draw rectangle, in user space coordinates in Pango units

y

Y position at which to draw rectangle, in user space coordinates in Pango units

width

width of rectangle in Pango units

height

height of rectangle in Pango units

Draws a trapezoid with the parallel sides aligned with the X axis using the given Renderer; coordinates are in device space.

part

type of object this trapezoid is part of

y1_

Y coordinate of top of trapezoid

x11

X coordinate of left end of top of trapezoid

x21

X coordinate of right end of top of trapezoid

y2

Y coordinate of bottom of trapezoid

x12

X coordinate of left end of bottom of trapezoid

x22

X coordinate of right end of bottom of trapezoid

Gets the current alpha for the specified part.

part

the part to get the alpha for

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 rendering color for the specified part.

part

the part to get the color for

Returns

the color for the specified part, or None if it hasn’t been set and should be inherited from the environment.

Gets the layout currently being rendered using @self.

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.

Returns

the layout, or None if no layout is being rendered using @self at this time.

Gets the layout line currently being rendered using @self.

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.

Returns

the layout line, or None if no layout line is being rendered using @self at this time.

Gets the transformation matrix that will be applied when rendering.

See set_matrix().

Returns

the matrix, or None 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.

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 Renderer 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 set_color())

part

the part for which rendering has changed.

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.

part

the part to set the alpha for

alpha

an alpha value between 1 and 65536, or 0 to unset the alpha

Sets the color for part of the rendering.

Also see set_alpha().

part

the part to change the color of

color

the new color or None to unset the current color

Sets the transformation matrix that will be applied when rendering.

matrix

a Matrix, or None to unset any existing matrix (No matrix set is the same as setting the identity matrix.)

Implementors