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.
 
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 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.
 
TextureMode textureMode () const
 Returns how the texture origin is interpreted.
 
const Imagetexture () const
 Returns the texture image.
 
const PointFtextureOrigin () const
 Returns the texture pattern origin. More...
 
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. More...
 
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.

Member Function Documentation

◆ imageTexture()

static 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().