package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.pango/Ocgtk_pango/Pango/Wrappers/Renderer/index.html

Module Wrappers.Renderer

type t = [ `renderer | `object_ ] Gobject.obj
val set_matrix : t -> [ `matrix ] Gobject.obj option -> unit

Sets the transformation matrix that will be applied when rendering.

val set_color : t -> Pango_enums.renderpart -> [ `color ] Gobject.obj option -> unit

Sets the color for part of the rendering.

Also see method@Pango.Renderer.set_alpha.

val set_alpha : t -> Pango_enums.renderpart -> UInt16.t -> unit

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.

val part_changed : t -> Pango_enums.renderpart -> unit

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)

val get_matrix : t -> [ `matrix ] Gobject.obj option

Gets the transformation matrix that will be applied when rendering.

See method@Pango.Renderer.set_matrix.

val get_layout_line : t -> [ `layout_line ] Gobject.obj option

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.

val get_layout : t -> [ `layout | `object_ ] Gobject.obj option

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.

val get_color : t -> Pango_enums.renderpart -> [ `color ] Gobject.obj option

Gets the current rendering color for the specified part.

val get_alpha : t -> Pango_enums.renderpart -> UInt16.t

Gets the current alpha for the specified part.

val draw_trapezoid : t -> Pango_enums.renderpart -> float -> float -> float -> float -> float -> float -> unit

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

val draw_rectangle : t -> Pango_enums.renderpart -> int -> int -> int -> int -> unit

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.

val draw_layout_line : t -> [ `layout_line ] Gobject.obj -> int -> int -> unit

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.

val draw_layout : t -> [ `layout | `object_ ] Gobject.obj -> int -> int -> unit

Draws @layout with the specified `PangoRenderer`.

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

val draw_glyphs : t -> [ `font | `object_ ] Gobject.obj -> [ `glyph_string ] Gobject.obj -> int -> int -> unit

Draws the glyphs in @glyphs with the specified `PangoRenderer`.

val draw_glyph_item : t -> string option -> [ `glyph_item ] Gobject.obj -> int -> int -> unit

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.

val draw_error_underline : t -> int -> int -> int -> int -> unit

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.

val deactivate : t -> unit

Cleans up after rendering operations on @renderer.

See docs for method@Pango.Renderer.activate.

val activate : t -> unit

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.