Brush Class Reference

#include <Pt/Gfx/Brush.h>

Fill description for shapes and text. 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.
 

Public Member Functions

 Brush ()
 Contructs a null brush.
 
 Brush (const Color &color)
 Constructs a solid brush.
 
 Brush (const Image &texture, Pt::int32_t offX=0, Pt::int32_t offY=0)
 Constructs a texture 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 PointFgradientBegin () const
 Begin of a linear or radial gradient.
 
float gradientBeginRadius () const
 Radius of a radial gradient begin circle.
 
const PointFgradientEnd () const
 End of a linear or radial gradient.
 
float gradientEndRadius () const
 Radius of a radial gradient end circle.
 
void setTexture (const Image &texture, Pt::int32_t offX=0, Pt::int32_t offY=0)
 Sets the texture image and offset.
 
const Imagetexture () const
 Returns the texture image.
 
Pt::int32_t offsetX () const
 Returns the horizontal texture offset.
 
Pt::int32_t offsetY () const
 Returns the vertical texture offset.
 
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 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 closed geometry is filled. It can represent solid colors, textures and gradients with absolute or relative coordinates so that painters can reuse the same fill definition across targets.