Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Pango::Renderer Class Reference

A PangoRenderer C++ wrapper class. More...

`#include <xfc/pango/renderer.hh>`

Inheritance diagram for Xfc::Pango::Renderer:

List of all members.

## Public Member Functions

Constructors

- virtual ~Renderer ()
    Destructor.

Accessors

- PangoRenderer * pango_renderer () const
    Get a pointer to the PangoRenderer structure.
- operator PangoRenderer * () const
    Conversion operator; safely converts an Renderer to a PangoRenderer pointer.
- Pointer< Color > get_color (RenderPart part) const
    Gets the current rendering color for the specified part.
- Matrix get_matrix () const
    Gets the transformation matrix that will be applied when rendering (see set_matrix()).

Methods

- void draw_layout (const Layout &layout, int x, int y)
    Draws layout with the renderer.
- void draw_layout_line (const LayoutLine &line, int x, int y)
    Draws line with the renderer.
- void draw_glyphs (const Font &font, const GlyphString &glyphs, int x, int y)
    Draws the glyphs in glyphs with the renderer.
- void draw_rectangle (RenderPart part, int x, int y, int width, int height)
    Draws an axis-aligned rectangle in user space coordinates with the renderer.
- void draw_rectangle (RenderPart part, const Rectangle &rectangle)
    Draws an axis-aligned rectangle in user space coordinates with the renderer.
- void draw_error_underline (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 draw_trapezoid (RenderPart 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 renderer (coordinates are in device space).
- void draw_glyph (const Font &font, Glyph glyph, double x, double y)
    Draws a single glyph with coordinates in device space.
- void activate ()
    Does initial setup before rendering operations on the renderer.
- void deactivate ()
    Cleans up after rendering operations on the renderer (see activate() for details).
- void part_changed (RenderPart part)
    Informs Pango that the way that the renderering is done for part has changed in a way that would prevent multiple pieces being joined together into one drawing call.
- void set_color (RenderPart part, const Color *color)
    Sets the color for part of the rendering.
- void set_matrix (const Matrix *matrix)
    Sets the transformation matrix that will be applied when rendering.

## Protected Member Functions

Constructors

- Renderer (PangoRenderer *renderer, bool owns_reference=false)
    Construct a new Renderer from an existing PangoRenderer.

## Detailed Description

A PangoRenderer C++ wrapper class.

Pango::Renderer is a base class for objects that are used to render Pango objects such as Pango::GlyphString and Pango::Layout.

## Constructor & Destructor Documentation

Xfc::Pango::Renderer::Renderer | ( | PangoRenderer * | renderer,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new Renderer from an existing PangoRenderer.

Parameters:

  | renderer | A pointer to a PangoRenderer.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The renderer can be a newly created PangoRenderer or an existing PangoRenderer. (see G::Object::Object).

## Member Function Documentation

void Xfc::Pango::Renderer::activate | ( |  | ) |

| Does initial setup before rendering operations on the renderer. 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.

void Xfc::Pango::Renderer::draw_error_underline | ( | 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.

Parameters:

  | x | The X coordinate of underline, in Pango units in user coordinate system.
  | y | The Y coordinate of underline, in Pango units in user coordinate system.
  | width | The width of underline, in Pango units in user coordinate system.
  | height | The height of underline, in Pango units in user coordinate system.

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.

void Xfc::Pango::Renderer::draw_glyph | ( | const Font & | font,
|  | Glyph | glyph,
|  | double | x,
|  | double | y
| ) |

Draws a single glyph with coordinates in device space.

Parameters:

  | font | A Pango::Font.
  | glyph | The glyph index of a single glyph.
  | x | The X coordinate of left edge of baseline of glyph.
  | y | The Y coordinate of left edge of baseline of glyph.

void Xfc::Pango::Renderer::draw_glyphs | ( | const Font & | font,
|  | const GlyphString & | glyphs,
|  | int | x,
|  | int | y
| ) |

Draws the glyphs in glyphs with the renderer.

Parameters:

  | font | A Pango::Font.
  | glyphs | A Pango::GlyphString.
  | x | The X position of left edge of baseline, in user space coordinates in Pango units.
  | y | The Y position of left edge of baseline, in user space coordinates in Pango units.

void Xfc::Pango::Renderer::draw_layout | ( | const Layout & | layout,
|  | int | x,
|  | int | y
| ) |

Draws layout with the renderer.

Parameters:

  | layout | A Pango::Layout.
  | x | The X position of left edge of baseline, in user space coordinates in Pango units.
  | y | The Y position of left edge of baseline, in user space coordinates in Pango units.

void Xfc::Pango::Renderer::draw_layout_line | ( | const LayoutLine & | line,
|  | int | x,
|  | int | y
| ) |

Draws line with the renderer.

Parameters:

  | line | A Pango::LayoutLine.
  | x | The X position of left edge of baseline, in user space coordinates in Pango units.
  | y | The Y position of left edge of baseline, in user space coordinates in Pango units.

void Xfc::Pango::Renderer::draw_rectangle | ( | RenderPart | part,
|  | const Rectangle & | rectangle
| ) |

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

Parameters:

  | part | The type of object this rectangle is part of.
  | rectangle | The rectangle to draw, in user space coordinates in Pango units.

void Xfc::Pango::Renderer::draw_rectangle | ( | RenderPart | part,
|  | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |

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

Parameters:

  | part | The type of object this rectangle is part of.
  | x | The x position at which to draw the rectangle, in user space coordinates in Pango units.
  | y | The y position at which to draw the rectangle, in user space coordinates in Pango units.
  | width | The width of rectangle in PangoUnits in user space coordinates.
  | height | The height of rectangle in PangoUnits in user space coordinates.

void Xfc::Pango::Renderer::draw_trapezoid | ( | RenderPart | 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 renderer (coordinates are in device space).

Parameters:

  | part | The type of object this trapezoid is part of.
  | y1 | The Y coordinate of top of trapezoid.
  | x11 | The X coordinate of left end of top of trapezoid.
  | x21 | The X coordinate of right end of top of trapezoid.
  | y2 | The 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.

Pointer<Color> Xfc::Pango::Renderer::get_color | ( | RenderPart | part | ) | const

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 a null pointer.

The method returns null if the color for the specified part hasn't been set and should be inherited from the environment.

Matrix Xfc::Pango::Renderer::get_matrix | ( |  | ) | const

Gets the transformation matrix that will be applied when rendering (see set_matrix()).

Returns:
  The matrix, or null if no matrix has been set (which is the same as the identity matrix).

void Xfc::Pango::Renderer::part_changed | ( | RenderPart | part | ) |

Informs Pango that the way that the renderering is done for part has changed in a way that would prevent multiple pieces being joined together into one drawing call.

Parameters:

  | part | The part for which rendering has changed.

For instance, if a subclass of Renderer was to add a stipple option for drawing underlines, it needs to call:

                 renderer->part_changed(Pango::RENDER_PART_UNDERLINE);

when the stipple changes or underlines with different stipples might be joined together. Pango automatically calls this method for changes to colors (see set_color()).

void Xfc::Pango::Renderer::set_color | ( | RenderPart | part,
|  | const Color * | color
| ) |

Sets the color for part of the rendering.

Parameters:

  | part | The part to change the color of.
  | color | The new color or null to unset the current color.

void Xfc::Pango::Renderer::set_matrix | ( | const Matrix * | matrix | ) |

Sets the transformation matrix that will be applied when rendering.

Parameters:

  | matrix | A Pango::Matrix, or null to unset any existing matrix.

No matrix set is the same as setting the identity matrix.

The documentation for this class was generated from the following file:

- renderer.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3