The OpenD Programming Language

Pattern

A Pattern represents a source when drawing onto a Surface. There are different subtypes of Pattern, for different types of sources; for example, SolidPattern.fromRGB creates a pattern for a solid opaque color.

Other than various Pattern subclasses, some of the pattern types can be implicitly created using various Context.setSource functions; for example Context.setSourceRGB.

The C type of a pattern can be queried with getType(), although D polymorphism features also work.

Memory management of Pattern can be done with the dispose() method, see https://github.com/jpf91/cairoD/wiki/Memory-Management#3-RC-class

Note: This class uses the CairoCountedClass mixin, so all it's members are also available in Pattern classes, although they do not show up in the documentation because of a limitation in ddoc.

Constructors

this
this(cairo_pattern_t* ptr)

Create a Pattern from a existing cairo_pattern_t*. Pattern is a garbage collected class. It will call cairo_pattern_destroy when it gets collected by the GC or when dispose() is called.

Members

Functions

checkError
void checkError()

Method for use in subclasses. Calls cairo_pattern_status(nativePointer) and throws an exception if the status isn't CAIRO_STATUS_SUCCESS

filter
void filter(Filter fil)
Filter filter()

Convenience property

getExtend
Extend getExtend()

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

getFilter
Filter getFilter()

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

getMatrix
Matrix getMatrix()

Returns the pattern's transformation matrix.

getType
PatternType getType()

This function returns the C type of a pattern. See PatternType for available types.

setExtend
void setExtend(Extend ext)

Sets the mode to be used for drawing outside the area of a pattern. See Extend for details on the semantics of each extend strategy. The default extend mode is CAIRO_EXTEND_NONE for surface patterns and CAIRO_EXTEND_PAD for gradient patterns.

setFilter
void setFilter(Filter fil)

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

setMatrix
void setMatrix(Matrix mat)

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

Mixins

__anonymous
mixin CairoCountedClass!(cairo_pattern_t*, "cairo_pattern_")

Properties

matrix
Matrix matrix [@property setter]
Matrix matrix [@property getter]

Convenience property

type
PatternType type [@property getter]

Convenience property

Static functions

createFromNative
Pattern createFromNative(cairo_pattern_t* ptr, bool adjRefCount)

The createFromNative method for the Pattern classes. See https://github.com/jpf91/cairoD/wiki/Memory-Management#createFromNative for more information.

Mixed In Members

From mixin CairoCountedClass!(cairo_pattern_t*, "cairo_pattern_")

_count
uint _count [@property getter]

Reference count. For use in child classes

_reference
void _reference()

Increase reference count. For use in child classes

_dereference
void _dereference()

Decrease reference count. For use in child classes

nativePointer
T nativePointer;

The underlying $(T) handle

debugging
bool debugging;

Enable / disable memory management debugging for this instance. Only available if both cairoD and the cairoD user code were compiled with "debug=RefCounted"

dispose
void dispose()

Explicitly drecrease the reference count.

~this
~this()

Destructor. Call dispose() if it hasn't been called manually.

Meta