[][src]Trait pango::RendererExt

pub trait RendererExt: 'static {
    fn activate(&self);
fn deactivate(&self);
fn draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32);
fn draw_glyph<P: IsA<Font>>(&self, font: &P, 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<P: IsA<Font>>(
        &self,
        font: &P,
        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 get_alpha(&self, part: RenderPart) -> u16;
fn get_color(&self, part: RenderPart) -> Option<Color>;
fn get_layout(&self) -> Option<Layout>;
fn get_layout_line(&self) -> Option<LayoutLine>;
fn get_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>); }

Trait containing all Renderer methods.

Implementors

Renderer

Required methods

fn activate(&self)

Does initial setup before rendering operations on self. RendererExt::deactivate should be called when done drawing. Calls such as RendererExt::draw_layout automatically activate the layout before drawing on it. Calls to RendererExt::activate and RendererExt::deactivate can be nested and the renderer will only be initialized and deinitialized once.

fn deactivate(&self)

Cleans up after rendering operations on self. See docs for RendererExt::activate.

fn draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32)

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

fn draw_glyph<P: IsA<Font>>(&self, font: &P, glyph: Glyph, x: f64, y: f64)

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

fn draw_glyph_item(
    &self,
    text: Option<&str>,
    glyph_item: &mut GlyphItem,
    x: i32,
    y: i32
)

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

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

If text is None, this simply calls RendererExt::draw_glyphs.

The default implementation of this method simply falls back to RendererExt::draw_glyphs.

text

the UTF-8 text that glyph_item refers to, or None

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.

fn draw_glyphs<P: IsA<Font>>(
    &self,
    font: &P,
    glyphs: &mut GlyphString,
    x: i32,
    y: i32
)

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.

fn draw_layout(&self, layout: &Layout, x: i32, y: i32)

Draws layout with the specified Renderer.

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.

fn draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32)

Draws line with the specified Renderer.

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.

fn draw_rectangle(
    &self,
    part: RenderPart,
    x: i32,
    y: i32,
    width: i32,
    height: i32
)

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

This should be called while self is already active. Use RendererExt::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 in user space coordinates

height

height of rectangle in Pango units in user space coordinates

fn draw_trapezoid(
    &self,
    part: RenderPart,
    y1_: f64,
    x11: f64,
    x21: f64,
    y2: f64,
    x12: f64,
    x22: f64
)

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

fn get_alpha(&self, part: RenderPart) -> u16

Gets the current alpha for the specified part.

Feature: v1_38

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.

fn get_color(&self, part: RenderPart) -> Option<Color>

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.

fn get_layout(&self) -> Option<Layout>

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.

fn get_layout_line(&self) -> Option<LayoutLine>

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.

fn get_matrix(&self) -> Option<Matrix>

Gets the transformation matrix that will be applied when rendering. See RendererExt::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.

fn part_changed(&self, part: RenderPart)

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 RendererExt::set_color)

part

the part for which rendering has changed.

fn set_alpha(&self, part: RenderPart, alpha: u16)

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.

Feature: v1_38

part

the part to set the alpha for

alpha

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

fn set_color(&self, part: RenderPart, color: Option<&Color>)

Sets the color for part of the rendering. Also see RendererExt::set_alpha.

part

the part to change the color of

color

the new color or None to unset the current color

fn set_matrix(&self, matrix: Option<&Matrix>)

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

Loading content...

Implementors

impl<O: IsA<Renderer>> RendererExt for O[src]

Loading content...