pub trait RendererExt:
IsA<Renderer>
+ Sealed
+ 'static {
Show 19 methods
// Provided 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>) { ... }
}
Provided Methods§
Sourcefn activate(&self)
fn activate(&self)
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.
Sourcefn deactivate(&self)
fn deactivate(&self)
Cleans up after rendering operations on @self.
See docs for activate()
.
Sourcefn draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32)
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 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
Sourcefn draw_glyph_item(
&self,
text: Option<&str>,
glyph_item: &mut GlyphItem,
x: i32,
y: i32,
)
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.
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
§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
Sourcefn draw_glyphs(
&self,
font: &impl IsA<Font>,
glyphs: &mut GlyphString,
x: i32,
y: i32,
)
fn draw_glyphs( &self, font: &impl IsA<Font>, glyphs: &mut GlyphString, x: i32, y: i32, )
Sourcefn draw_layout(&self, layout: &Layout, x: i32, y: i32)
fn draw_layout(&self, layout: &Layout, x: i32, y: i32)
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.
Sourcefn draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32)
fn draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32)
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
§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.
Sourcefn draw_rectangle(
&self,
part: RenderPart,
x: i32,
y: i32,
width: i32,
height: i32,
)
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 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
Sourcefn draw_trapezoid(
&self,
part: RenderPart,
y1_: f64,
x11: f64,
x21: f64,
y2: f64,
x12: f64,
x22: f64,
)
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
Sourcefn alpha(&self, part: RenderPart) -> u16
fn alpha(&self, part: RenderPart) -> u16
Sourcefn color(&self, part: RenderPart) -> Option<Color>
fn color(&self, part: RenderPart) -> Option<Color>
Sourcefn layout(&self) -> Option<Layout>
fn 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.
Sourcefn layout_line(&self) -> Option<LayoutLine>
fn 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.
Sourcefn matrix(&self) -> Option<Matrix>
fn matrix(&self) -> Option<Matrix>
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.
Sourcefn part_changed(&self, part: RenderPart)
fn part_changed(&self, part: RenderPart)
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.
Sourcefn set_alpha(&self, part: RenderPart, alpha: u16)
fn set_alpha(&self, part: RenderPart, alpha: u16)
Sourcefn set_color(&self, part: RenderPart, color: Option<&Color>)
fn set_color(&self, part: RenderPart, color: Option<&Color>)
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.