Pattern

A #cairo_pattern_t represents a source when drawing onto a surface. There are different subtypes of #cairo_pattern_t, for different types of sources; for example, cairo.global.patternCreateRgb creates a pattern for a solid opaque color.

Other than various <function>cairo_pattern_create_<emphasis>type</emphasis>()</function> functions, some of the pattern types can be implicitly created using various <function>cairo_set_source_<emphasis>type</emphasis>()</function> functions; for example cairo.context.Context.setSourceRgb.

The type of a pattern can be queried with cairo.pattern.Pattern.getPatternType.

Memory management of #cairo_pattern_t is done with cairo.pattern.Pattern.reference and cairo.pattern.Pattern.destroy.

Members

Functions

addColorStopRgb
void addColorStopRgb(double offset, double red, double green, double blue)

Adds an opaque color stop to a gradient pattern. The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

addColorStopRgba
void addColorStopRgba(double offset, double red, double green, double blue, double alpha)

Adds a translucent color stop to a gradient pattern. The offset specifies the location along the gradient's control vector. For example, a linear gradient's control vector is from (x0,y0) to (x1,y1) while a radial gradient's control vector is from any point on the start circle to the corresponding point on the end circle.

getColorStopCount
cairo.types.Status getColorStopCount(int count)

Gets the number of color stops specified in the given gradient pattern.

getColorStopRgba
cairo.types.Status getColorStopRgba(int index, double offset, double red, double green, double blue, double alpha)

Gets the color and offset information at the given index for a gradient pattern. Values of index range from 0 to n-1 where n is the number returned by cairo.pattern.Pattern.getColorStopCount.

getDither
cairo.types.Dither getDither()

Gets the current dithering mode, as set by cairo.pattern.Pattern.setDither.

getExtend
cairo.types.Extend getExtend()

Gets the current extend mode for a pattern. See #cairo_extend_t for details on the semantics of each extend strategy.

getFilter
cairo.types.Filter getFilter()

Gets the current filter for a pattern. See #cairo_filter_t for details on each filter.

getLinearPoints
cairo.types.Status getLinearPoints(double x0, double y0, double x1, double y1)

Gets the gradient endpoints for a linear gradient.

getMatrix
void getMatrix(cairo.matrix.Matrix matrix)

Stores the pattern's transformation matrix into matrix.

getPatternType
cairo.types.PatternType getPatternType()

Get the pattern's type. See #cairo_pattern_type_t for available types.

getRadialCircles
cairo.types.Status getRadialCircles(double x0, double y0, double r0, double x1, double y1, double r1)

Gets the gradient endpoint circles for a radial gradient, each specified as a center coordinate and a radius.

getRgba
cairo.types.Status getRgba(double red, double green, double blue, double alpha)

Gets the solid color for a solid color pattern.

getSurface
cairo.types.Status getSurface(cairo.surface.Surface surface)

Gets the surface of a surface pattern. The reference returned in surface is owned by the pattern; the caller should call cairo.surface.Surface.reference if the surface is to be retained.

getUserData
void* getUserData(cairo.types.UserDataKey key)

Return user data previously attached to pattern using the specified key. If no user data has been attached with the given key this function returns null.

setDither
void setDither(cairo.types.Dither dither)

Set the dithering 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, only pixman is supported.

setExtend
void setExtend(cairo.types.Extend extend)

Sets the mode to be used for drawing outside the area of a pattern. See #cairo_extend_t for details on the semantics of each extend strategy.

setFilter
void setFilter(cairo.types.Filter filter)

Sets the filter to be used for resizing when using this pattern. See #cairo_filter_t for details on each filter.

setMatrix
void setMatrix(cairo.matrix.Matrix matrix)

Sets the pattern's transformation matrix to matrix. This matrix is a transformation from user space to pattern space.

status
cairo.types.Status status()

Checks whether an error has previously occurred for this pattern.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.