The OpenD Programming Language

LinearGradient

A linear gradient.

Use the this(Point!double p1, Point!double p2) constructor to create an instance.

Constructors

this
this(cairo_pattern_t* ptr)

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

this
this(Point!double p1, Point!double p2)
this(double x1, double y1, double x2, double y2)

Create a new linear gradient Pattern along the line defined by p1 and p2. Before using the gradient pattern, a number of color stops should be defined using Gradient.addColorStopRGB() or Gradient.addColorStopRGBA().

Members

Aliases

linearPoints
alias linearPoints = getLinearPoints

Convenience alias

Functions

getLinearPoints
Point!(double)[2] getLinearPoints()

Gets the gradient endpoints for a linear gradient.

Inherited Members

From Gradient

addColorStopRGB
void addColorStopRGB(double offset, RGB color)
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 LinearGradient's control vector is from (x0,y0) to (x1,y1) while a RadialGradient's control vector is from any point on the start circle to the corresponding point on the end circle.

addColorStopRGBA
void addColorStopRGBA(double offset, RGBA color)
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
int getColorStopCount()

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

colorStopCount
alias colorStopCount = getColorStopCount

Convenience alias

getColorStopRGBA
void getColorStopRGBA(int index, double offset, RGBA color)

Gets the color and offset information at the given index for a gradient pattern. Values of index are 0 to 1 less than the number returned by getColorStopCount().

Meta