Trait pango::prelude::RendererExt [−][src]
pub trait RendererExt: 'static {}Show methods
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 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
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.
fn deactivate(&self)
fn deactivate(&self)
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 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 draw_glyphs()
.
The default implementation of this method simply falls back to
draw_glyphs()
.
text
the UTF-8 text that glyph_item
refers to, or None
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.
fn draw_glyphs<P: IsA<Font>>(
&self,
font: &P,
glyphs: &mut GlyphString,
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(&self, layout: &Layout, x: i32, y: i32)
fn draw_layout_line(&self, line: &LayoutLine, 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_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 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
)
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 alpha(&self, part: RenderPart) -> u16
fn alpha(&self, part: RenderPart) -> u16
fn color(&self, part: RenderPart) -> Option<Color>
fn color(&self, part: RenderPart) -> Option<Color>
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 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.
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.
fn 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 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 set_color()
)
part
the part for which rendering has changed.
fn set_alpha(&self, part: RenderPart, alpha: u16)
fn set_alpha(&self, part: RenderPart, alpha: u16)
fn 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