5.3 Brush
A brush is typically installed to a drawing context’s DC.brush property.
class | |||||||
|
A brush’s ink fills pixels that are bounded by a set of lines or curves. The brush’s style describes the shape that is repeated to fill a region of pixels.
If a brush has a stipple bitmap, then some styles are ignored (see Brush.Style), and stipple it is used to fill pixels that otherwise would be covered by the brush’s ink. A monochrome stipple takes on color as it is drawn.
If a brush as a gradient, then color, style, and stipple are ignored. With a gradient, for each point in a drawing destination, the gradient associates a color to the point based on starting and ending colors and starting and ending lines (for a linear gradient) or circles (for a radial gradient); a gradient-assigned color is applied for each point that is touched when drawing with the brush.
A brush like an existing one can be constructed using with and the field names color, style, stipple, and/or gradient.
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
enumeration | |||||||||||
|
value | |
|
class | ||||
| ||||
| ||||
property | ||||
| ||||
| ||||
property | ||||
|
Color transitions are based on a line, where colors are assigned to stop points along the line, and colors for in-between points are interpolated from the stop-point colors. The color of a point on the gradient’s line is propagated to all points in the drawing context that are touched by a line through the point and perpendicular to the gradient’s line.
The line is from pt0 to pt1. The stops list assigns colors to stop points along the line, where 0.0 corresponds to pt0, 1.0 corresponds to pt1, and numbers in between correspond to points in between.
Elements in stops are implicitly sorted by point (i.e., by the number between 0.0 and 1.0). Order is preserved for multiple elements for the same point, in which case the first element for a given point is treated infinitesimally before the point, and additional elements between the first and last for a stop point are effectively ignored.
class | ||||
| ||||
| ||||
property | ||||
| ||||
| ||||
property | ||||
|
Color transitions are based on two circles and the sequence of circles that “morph” from the starting circle to the ending circle. Normally, one of the two circles defining a gradient is nested within the other; in that case, points within the inner circle get the same color as the inner circle’s edge, while points outside the outer circle get the same color as the outer circle’s edge.
Creates a radial gradient with the starting circle as the one with radius r0 centered at pt0 and the ending circle as the one with radius r1 centered at pt1. The stops list assigns colors to circles, where 0.0 corresponds to the starting circle, 1.0 corresponds to the ending circle, and numbers in between correspond to circles in between.
The order of elements within stops and duplicate points are treated in the same way for as LinearGradient.
property | |
| |
function | |