Package ch.bailu.gtk.pango
Class Renderer
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.pango.Renderer
- All Implemented Interfaces:
PointerInterface
`PangoRenderer` is a base class for objects that can render text
provided as `PangoGlyphString` or `PangoLayout`.
By subclassing `PangoRenderer` and overriding operations such as
@draw_glyphs and @draw_rectangle, renderers for particular font
backends and destinations can be created.
provided as `PangoGlyphString` or `PangoLayout`.
By subclassing `PangoRenderer` and overriding operations such as
@draw_glyphs and @draw_rectangle, renderers for particular font
backends and destinations can be created.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Does initial setup before rendering operations on @renderer.void
Cleans up after rendering operations on @renderer.void
drawErrorUnderline
(int x, int y, int width, int height) Draw a squiggly line that approximately covers the given rectangle
in the style of an underline used to indicate a spelling error.void
drawGlyphItem
(Str text, GlyphItem glyph_item, int x, int y) Draws the glyphs in @glyph_item with the specified `PangoRenderer`,
embedding the text associated with the glyphs in the output if the
output format supports it.void
drawGlyphItem
(String text, GlyphItem glyph_item, int x, int y) Draws the glyphs in @glyph_item with the specified `PangoRenderer`,
embedding the text associated with the glyphs in the output if the
output format supports it.void
drawGlyphs
(Font font, GlyphString glyphs, int x, int y) Draws the glyphs in @glyphs with the specified `PangoRenderer`.void
drawLayout
(Layout layout, int x, int y) Draws @layout with the specified `PangoRenderer`.void
drawLayoutLine
(LayoutLine line, int x, int y) Draws @line with the specified `PangoRenderer`.void
drawRectangle
(int part, int x, int y, int width, int height) Draws an axis-aligned rectangle in user space coordinates with the
specified `PangoRenderer`.void
drawTrapezoid
(int part, double y1_, double x11, double x21, double y2, double x12, double x22) Draws a trapezoid with the parallel sides aligned with the X axis
using the given `PangoRenderer`; coordinates are in device space.int
getAlpha
(int part) Gets the current alpha for the specified part.static ClassHandler
getColor
(int part) Gets the current rendering color for the specified part.static int
Gets the layout currently being rendered using @renderer.Gets the layout line currently being rendered using @renderer.Gets the transformation matrix that will be applied when
rendering.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
void
partChanged
(int part) Informs Pango that the way that the rendering is done
for @part has changed.void
setAlpha
(int part, int alpha) Sets the alpha for part of the rendering.void
Sets the color for part of the rendering.void
Sets the transformation matrix that will be applied when rendering.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Renderer
-
-
Method Details
-
getClassHandler
-
activate
public void activate()Does initial setup before rendering operations on @renderer.
[method@Pango.Renderer.deactivate] should be called when done drawing.
Calls such as [method@Pango.Renderer.draw_layout] automatically
activate the layout before drawing on it.
Calls to [method@Pango.Renderer.activate] and
[method@Pango.Renderer.deactivate] can be nested and the
renderer will only be initialized and deinitialized once. -
deactivate
public void deactivate()Cleans up after rendering operations on @renderer.
See docs for [method@Pango.Renderer.activate]. -
drawErrorUnderline
public void drawErrorUnderline(int x, int y, int width, int height) 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 [method@Pango.Renderer.activate] to activate a renderer.- Parameters:
x
- X coordinate of underline, in Pango units in user coordinate systemy
- Y coordinate of underline, in Pango units in user coordinate systemwidth
- width of underline, in Pango units in user coordinate systemheight
- height of underline, in Pango units in user coordinate system
-
drawGlyphItem
Draws the glyphs in @glyph_item 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 @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 %NULL, this simply calls [method@Pango.Renderer.draw_glyphs].
The default implementation of this method simply falls back to
[method@Pango.Renderer.draw_glyphs].- Parameters:
text
- the UTF-8 text that @glyph_item refers toglyph_item
- a `PangoGlyphItem`x
- X position of left edge of baseline, in user space coordinates in Pango unitsy
- Y position of left edge of baseline, in user space coordinates in Pango units
-
drawGlyphItem
Draws the glyphs in @glyph_item 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 @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 %NULL, this simply calls [method@Pango.Renderer.draw_glyphs].
The default implementation of this method simply falls back to
[method@Pango.Renderer.draw_glyphs].- Parameters:
text
- the UTF-8 text that @glyph_item refers toglyph_item
- a `PangoGlyphItem`x
- X position of left edge of baseline, in user space coordinates in Pango unitsy
- Y position of left edge of baseline, in user space coordinates in Pango units
-
drawGlyphs
Draws the glyphs in @glyphs with the specified `PangoRenderer`.- Parameters:
font
- a `PangoFont`glyphs
- a `PangoGlyphString`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.
-
drawLayout
Draws @layout with the specified `PangoRenderer`.
This is equivalent to drawing the lines of the layout, at their
respective positions relative to @x, @y.- Parameters:
layout
- a `PangoLayout`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.
-
drawLayoutLine
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.- Parameters:
line
- a `PangoLayoutLine`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.
-
drawRectangle
public void drawRectangle(int part, int x, int y, int width, int height) Draws an axis-aligned rectangle in user space coordinates with the
specified `PangoRenderer`.
This should be called while @renderer is already active.
Use [method@Pango.Renderer.activate] to activate a renderer.- Parameters:
part
- type of object this rectangle is part ofx
- X position at which to draw rectangle, in user space coordinates in Pango unitsy
- Y position at which to draw rectangle, in user space coordinates in Pango unitswidth
- width of rectangle in Pango unitsheight
- height of rectangle in Pango units
-
drawTrapezoid
public void drawTrapezoid(int part, double y1_, double x11, double x21, double y2, double x12, double x22) Draws a trapezoid with the parallel sides aligned with the X axis
using the given `PangoRenderer`; coordinates are in device space.- Parameters:
part
- type of object this trapezoid is part ofy1_
- Y coordinate of top of trapezoidx11
- X coordinate of left end of top of trapezoidx21
- X coordinate of right end of top of trapezoidy2
- Y coordinate of bottom of trapezoidx12
- X coordinate of left end of bottom of trapezoidx22
- X coordinate of right end of bottom of trapezoid
-
getAlpha
public int getAlpha(int part) Gets the current alpha for the specified part.- Parameters:
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.
-
getColor
Gets the current rendering color for the specified part.- Parameters:
part
- the part to get the color for- Returns:
- the color for the specified part, or %NULL if it hasn't been set and should be inherited from the environment.
-
getLayout
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.- Returns:
- the layout, or %NULL if no layout is being rendered using @renderer at this time.
-
getLayoutLine
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.- Returns:
- the layout line, or %NULL if no layout line is being rendered using @renderer at this time.
-
getMatrix
Gets the transformation matrix that will be applied when
rendering.
See [method@Pango.Renderer.set_matrix].- Returns:
- the matrix, or %NULL 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.
-
partChanged
public void partChanged(int part) 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 [method@Pango.Renderer.set_color])- Parameters:
part
- the part for which rendering has changed.
-
setAlpha
public void setAlpha(int part, int alpha) 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.- Parameters:
part
- the part to set the alpha foralpha
- an alpha value between 1 and 65536, or 0 to unset the alpha
-
setColor
Sets the color for part of the rendering.
Also see [method@Pango.Renderer.set_alpha].- Parameters:
part
- the part to change the color ofcolor
- the new color or %NULL to unset the current color
-
setMatrix
Sets the transformation matrix that will be applied when rendering.- Parameters:
matrix
- a `PangoMatrix`, or %NULL to unset any existing matrix (No matrix set is the same as setting the identity matrix.)
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-