Class Context

java.lang.Object
io.github.jwharm.cairobindings.Proxy
org.freedesktop.cairo.Context

public final class Context extends Proxy
The cairo drawing context.

Context is the main object used when drawing with cairo. To draw with cairo, you create a Context, set the target surface, and drawing options for the Context, create shapes with functions like moveTo(double, double) and lineTo(double, double), and then draw shapes with stroke() or fill().

Context's can be pushed to a stack via save(). They may then safely be changed, without losing the current state. Use restore() to restore to the saved state.

The functions with text in their name form cairo's toy text API. The toy API takes UTF-8 encoded text and is limited in its functionality to rendering simple left-to-right text with no advanced features. That means for example that most complex scripts like Hebrew, Arabic, and Indic scripts are out of question. No kerning or correct positioning of diacritical marks either. The font selection is pretty limited too and doesn't handle the case that the selected font does not cover the characters in the text. This set of functions are really that, a toy text API, for testing and demonstration purposes. Any serious application should avoid them.

The functions with glyphs in their name form cairo's low-level text API. The low-level API relies on the user to convert text to a set of glyph indexes and positions. This is a very hard problem and is best handled by external libraries, like the pangocairo that is part of the Pango text layout and rendering library.

The tag functions (tagBegin(String, String) and tagEnd(String)) provide the ability to specify hyperlinks and document logical structure on supported backends. The following tags are supported:

Since:
1.0