Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Member Functions
Xfc::Cairo::Context Class Reference

Has its own ref counter internaly and are not using G::Object ! More...

#include <context.hh>

List of all members.

Public Member Functions


Detailed Description

Has its own ref counter internaly and are not using G::Object !


Constructor & Destructor Documentation

Xfc::Cairo::Context::Context ( cairo_t *  ctx) [explicit]

Construct a new Context from an existing cairo_t.

Parameters:
ctxA pointer to a cairo_t.

The context can be a newly created cairo_t or an existing CairoContext.


Member Function Documentation

Gets the current shape antialiasing mode, as set by set_shape_antialias().

Returns:
the current shape antialiasing mode.

Gets the current fill rule, as set by set_fill_rule().

Returns:
the current fill rule.

Gets the target surface for the current group as started by the most recent call to push_group() or group_with_content().

This function will return NULL if called "outside" of any group rendering blocks, (that is, after the last balancing call to pop_group() or pop_group_to_source()).

Returns:
the target group surface.

Gets the current line cap style, as set by set_line_cap().

Returns:
the current line cap style.

Gets the current line join style, as set by set_line_join().

Returns:
the current line join style.

Gets the current source pattern.

Returns:
the current source pattern.

Gets the target surface for the cairo context as passed when this object is constructed.

This function will always return a valid pointer, but the result can be a "nil" surface if cr is already in an error state, (ie. status() != STATUS_SUCCESS). A nil surface is indicated by surface_status() != STATUS_SUCCESS.

Returns:
: the target surface.

Terminates the redirection begun by a call to push_group() or push_group_with_content() and returns a new pattern containing the results of all drawing operations performed to the group.

The pop_group() function calls restore(), (balancing a call to save() by the push_group function), so that any changes to the graphics state will not be visible outside the group.

Returns:
a newly created (surface) pattern containing the results of all drawing operations performed to the group. The caller owns the returned object and should call pattern_destroy() when finished with it.

This group functionality can be convenient for performing intermediate compositing.

One common use of a group is to render objects as opaque within the group, (so that they occlude each other), and then blend the result with translucence onto the destination.

Groups can be nested arbitrarily deep by making balanced calls to push_group()/pop_group(). Each call pushes/pops the new target group onto/from a stack.

The push_group() function calls save() so that any changes to the graphics state will not be visible outside the group, (the pop_group functions call restore()).

By default the intermediate group will have a content type of CONTENT_COLOR_ALPHA. Other content types can be chosen for the group by using push_group_with_content() instead.

Temporarily redirects drawing to an intermediate surface known as a group.

The redirection lasts until the group is completed by a call to pop_group() or pop_group_to_source(). These calls provide the result of any drawing to the group as a pattern, (either as an explicit object, or set as the source pattern).

The group will have a content type of content. The ability to control this content type is the only distinction between this function and push_group() which you should see for a more detailed description of group rendering.

Parameters:
content: A Content indicating the type of group that will be created

Makes a copy of the current state of context and saves it on an internal stack of saved states for context.

When restore() is called, context will be restored to the saved state. Multiple calls to cairo_save() and restore() can be nested; each call to restore() restores the state from the matching paired save().

It isn't necessary to clear all saved states before a Context is freed.

Set the antialiasing mode of the rasterizer used for drawing shapes.

This value is a hint, and a particular backend may or may not support a particular value. At the current time, no backend supports ANTIALIAS_SUBPIXEL when drawing shapes.

Note that this option does not affect text rendering, instead see FontOptions::set_antialias().

Parameters:
antialiasthe new antialiasing mode
void Xfc::Cairo::Context::set_dash ( const double *  dashes,
int  num_dashes,
double  offset 
)

Sets the dash pattern to be used by cairo_stroke().

A dash pattern is specified by dashes, an array of positive values. Each value provides the length of alternate "on" and "off" portions of the stroke. The offset specifies an offset into the pattern at which the stroke begins.

Each "on" segment will have caps applied as if the segment were a separate sub-path. In particular, it is valid to use an "on" length of 0.0 with LINE_CAP_ROUND or LINE_CAP_SQUARE in order to distributed dots or squares along a path.

Note: The length values are in user-space units as evaluated at the time of stroking. This is not necessarily the same as the user space at the time of set_dash().

If num_dashes is 0 dashing is disabled.

If num_dashes is 1 a symmetric pattern is assumed with alternating on and off portions of the size specified by the single value in dashes.

If any value in dashes is negative, or if all values are 0, then cr will be put into an error state with a status of #STATUS_INVALID_DASH.

Parameters:
dashesan array specifying alternate lengths of on and off stroke portions
num_dashesthe length of the dashes array
offsetan offset into the dash pattern at which the stroke should start

Set the current fill rule within the cairo context.

The fill rule is used to determine which regions are inside or outside a complex (potentially self-intersecting) path. The current fill rule affects both fill() and clip(). See fillrule for details on the semantics of each available fill rule.

Parameters:
fill_rulea fill rule, specified as a FillRule
void Xfc::Cairo::Context::set_line_cap ( LineCap  line_cap)

Sets the current line cap style within the cairo context.

See LineCap for details about how the available line cap styles are drawn.

As with the other stroke parameters, the current line cap style is examined by stroke(), stroke_extents(), and stroke_to_path(), but does not have any effect during path construction.

Parameters:
line_capa line cap style
void Xfc::Cairo::Context::set_line_join ( LineJoin  line_join)

Sets the current line join style within the cairo context.

See LineJoin for details about how the available line join styles are drawn.

As with the other stroke parameters, the current line join style is examined by stroke(), stroke_extents(), and stroke_to_path(), but does not have any effect during path construction.

Parameters:
line_joina line joint style

Sets the source pattern within cr to source.

This pattern will then be used for any subsequent drawing operation until a new source pattern is set.

Note: The pattern's transformation matrix will be locked to the user space in effect at the time of set_source(). This means that further modifications of the current transformation matrix will not affect the source pattern.

Parameters:
sourcea cairo_pattern_t to be used as the source for subsequent drawing operations.
See also:
Pattern::set_matrix().
void Xfc::Cairo::Context::set_source_rgb ( double  red,
double  green,
double  blue 
)

Sets the source pattern within cr to an opaque color.

This opaque color will then be used for any subsequent drawing operation until a new source pattern is set.

The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

Parameters:
redred component of color
greengreen component of color
blueblue component of color
void Xfc::Cairo::Context::set_source_rgba ( double  red,
double  green,
double  blue,
double  alpha 
)

Sets the source pattern within cr to a translucent color.

This color will then be used for any subsequent drawing operation until a new source pattern is set.

The color and alpha components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

Parameters:
redred component of color
greengreen component of color
blueblue component of color
alphaalpha component of color
void Xfc::Cairo::Context::set_source_surface ( Surface &  surface,
double  x,
double  y 
)

This is a convenience function for creating a pattern from surface and setting it as the source in cr with set_source().

The x and y parameters give the user-space coordinate at which the surface origin should appear. (The surface origin is its upper-left corner before any transformation has been applied.) The x and y patterns are negated and then set as translation values in the pattern matrix.

Other than the initial translation pattern matrix, as described above, all other pattern attributes, (such as its extend mode), are set to the default values. The resulting pattern can be queried with get_source() so that these attributes can be modified if desired, (eg. to create a repeating pattern with Pattern::set_extend()).

Parameters:
surfacea surface to be used to set the source pattern
xUser-space X coordinate for surface origin
yUser-space Y coordinate for surface origin

Checks whether an error has previously occurred for this context.

Returns:
the current status of this context
See also:
Status

The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC