cairo.pattern
Module for [Pattern] class
class Pattern
Types 1
classPattern : gobject.boxed.Boxed
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].
Methods
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) wh...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...cairo.types.Status getColorStopCount(out int count)Gets the number of color stops specified in the given gradient pattern.cairo.types.Status getColorStopRgba(int index, out double offset, out double red, out double green, out double blue, out 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].cairo.types.Dither getDither()Gets the current dithering mode, as set by [cairo.pattern.Pattern.setDither]. Returns: the current dithering mode.cairo.types.Extend getExtend()Gets the current extend mode for a pattern. See #cairoextendt for details on the semantics of each extend strategy. Returns: the current extend strategy used for drawing the pattern.cairo.types.Filter getFilter()Gets the current filter for a pattern. See #cairofiltert for details on each filter. Returns: the current filter used for resizing the pattern.cairo.types.Status getLinearPoints(out double x0, out double y0, out double x1, out double y1)Gets the gradient endpoints for a linear gradient.void getMatrix(out cairo.matrix.Matrix matrix)Stores the pattern's transformation matrix into matrix.cairo.types.Status getRadialCircles(out double x0, out double y0, out double r0, out double x1, out double y1, out double r1)Gets the gradient endpoint circles for a radial gradient, each specified as a center coordinate and a radius.cairo.types.Status getRgba(out double red, out double green, out double blue, out double alpha)Gets the solid color for a solid color pattern.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.cairo.types.PatternType getPatternType()Get the pattern's type. See #cairopatterntype_t for available types. Returns: The type of pattern.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.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 supp...void setExtend(cairo.types.Extend extend)Sets the mode to be used for drawing outside the area of a pattern. See #cairoextendt for details on the semantics of each extend strategy.void setFilter(cairo.types.Filter filter)Sets the filter to be used for resizing when using this pattern. See #cairofiltert for details on each filter.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.cairo.types.Status status()Checks whether an error has previously occurred for this pattern. Returns: [cairo.types.Status.Success], [cairo.types.Status.NoMemory], [cairo.types.Status.InvalidMatrix], [cairo.types.Status.Patte...