#include <Pt/Gfx/Brush.h>

Fill color, gradient or texture. More...

Public Types

enum  FillStyle
 Identifies the fill source used by the brush.
enum  PositionMode
 Identifies how brush coordinates are interpreted.
enum  GradientStyle
 Identifies the gradient variant used by the brush.
enum  TextureMode
 Identifies how image texture coordinates are interpreted.

Public Member Functions

 Brush ()
 Contructs a null brush.
 Brush (const Color &color)
 Constructs a solid brush.
FillStyle fillStyle () const
 Returns the brushes fill style.
PositionMode positionMode () const
 Returns how brush coordinates are interpreted.
void setColor (const Color &color)
 Sets the solid fill color.
const Colorcolor () const
 Returns the solid or first gradient color.
GradientStyle gradient () const
 Returns the gradient style.
const ColorgradientColor () const
 Returns the legacy secondary gradient color.
const ColorStopsgradientStops () const
 Color stops of a gradient.
const PointF & gradientBegin () const
 Begin of a linear or radial gradient.
float gradientBeginRadius () const
 Radius of a radial gradient begin circle.
const PointF & gradientEnd () const
 End of a linear or radial gradient.
float gradientEndRadius () const
 Radius of a radial gradient end circle.
TextureMode textureMode () const
 Returns how the texture origin is interpreted.
const Image & texture () const
 Returns the texture image.
const PointF & textureOrigin () const
 Returns the texture pattern origin.
bool isGradient () const
 Returns true if the brush uses a gradient.
bool isTexture () const
 Returns true if the brush uses a texture.
bool isNull () const
 Returns true if the brush is null.

Static Public Member Functions

static Brush imageTexture (const Image &image, const Gfx::PointF &origin=Gfx::PointF())
 Constructs an image texture brush.
static Brush verticalGradient (const Color &from, const Color &to)
 Constructs a vertical gradient brush from two colors.
static Brush horizontalGradient (const Color &from, const Color &to)
 Constructs a horizontal gradient brush from two colors.
static Brush verticalGradient (const ColorStops &colorStops)
 Constructs a vertical gradient brush from color stops.
static Brush horizontalGradient (const ColorStops &colorStops)
 Constructs a horizontal gradient brush from color stops.
static Brush linearGradient (const PointF &begin, const PointF &end, const ColorStops &colorStops)
 Constructs an absolute positioned linear gradient.
static Brush linearGradient (float beginX, float beginY, float endX, float endY, const ColorStops &colorStops)
 Constructs a relative positioned linear gradient.
static Brush radialGradient (const PointF &begin, float beginRadius, const PointF &end, float endRadius, const ColorStops &colorStops)
 Constructs an absolute positioned radial gradient.
static Brush radialGradient (float beginX, float beginY, float beginRadius, float endX, float endY, float endRadius, const ColorStops &colorStops)
 Constructs a relative positioned radial gradient.

Detailed Description

Brush describes how a painter fills closed shapes, paths, and text. A solid brush is a Color. A gradient interpolates ColorStop values along a line or between two circles. A texture repeats an Image. The default brush is null and does not fill.

PositionMode chooses whether gradient and texture coordinates are absolute or relative to the shape being filled. Relative coordinates map the unit square onto that shape.

Member Function Documentation

◆ imageTexture()

Brush imageTexture ( const Image & image,
const Gfx::PointF & origin = Gfx::PointF() )
static

The texture origin is expressed in source image pixel coordinates.

Parameters
imageThe source image used as the repeating tile.
originThe texture pattern origin in source pixel coordinates.

◆ textureOrigin()

const PointF & textureOrigin ( ) const

The coordinates are expressed in the space identified by Brush::textureMode().