iPlug2 - C++ Audio Plug-in Framework
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
IPattern Struct Reference

Used to store pattern information for gradients. More...

#include <IGraphicsStructs.h>

Public Member Functions

 IPattern (EPatternType type)
 Create an IPattern. More...
 
 IPattern (const IColor &color)
 Create an IPattern with a solid color fill. More...
 
int NStops () const
 
const IColorStopGetStop (int idx) const
 Get the IColorStop at a particular index (will crash if out of bounds) More...
 
void AddStop (IColor color, float offset)
 Add an IColorStop to the IPattern. More...
 
void SetTransform (float xx, float yx, float xy, float yy, float tx, float ty)
 Set the affine transform for the IPattern with values. More...
 
void SetTransform (const IMatrix &transform)
 Set the affine transform for the IPattern with an IMatrix. More...
 

Static Public Member Functions

static IPattern CreateLinearGradient (float x1, float y1, float x2, float y2, const std::initializer_list< IColorStop > &stops={})
 Create a linear gradient IPattern. More...
 
static IPattern CreateLinearGradient (const IRECT &bounds, EDirection direction, const std::initializer_list< IColorStop > &stops={})
 Create a linear gradient IPattern across a rectangular area. More...
 
static IPattern CreateRadialGradient (float x1, float y1, float r, const std::initializer_list< IColorStop > &stops={})
 Create a radial gradient IPattern. More...
 
static IPattern CreateSweepGradient (float x1, float y1, const std::initializer_list< IColorStop > &stops={}, float angleStart=0.f, float angleEnd=360.f)
 Create a sweep gradient IPattern (SKIA only) More...
 

Public Attributes

EPatternType mType
 
EPatternExtend mExtend
 
IColorStop mStops [16]
 
int mNStops
 
IMatrix mTransform
 

Detailed Description

Used to store pattern information for gradients.

Definition at line 2145 of file IGraphicsStructs.h.

Constructor & Destructor Documentation

IPattern::IPattern ( EPatternType  type)
inline

Create an IPattern.

Parameters
typeThe type of pattern, one of EPatternType

Definition at line 2155 of file IGraphicsStructs.h.

IPattern::IPattern ( const IColor color)
inline

Create an IPattern with a solid color fill.

Parameters
colorThe color for the single stop

Definition at line 2161 of file IGraphicsStructs.h.

Member Function Documentation

void IPattern::AddStop ( IColor  color,
float  offset 
)
inline
static IPattern IPattern::CreateLinearGradient ( float  x1,
float  y1,
float  x2,
float  y2,
const std::initializer_list< IColorStop > &  stops = {} 
)
inlinestatic

Create a linear gradient IPattern.

Parameters
x1The start x position
y1The start y position
x2The end x position
y2The end y position
stopsAn initializer list of IColorStops for the stops
Returns
IPattern The new IPattern

Definition at line 2174 of file IGraphicsStructs.h.

References AddStop(), and SetTransform().

Referenced by TestShadowGradientControl::Draw(), IWheelControl::Draw(), IVDisplayControl::DrawWidget(), TestColorControl::OnResize(), and TestGradientControl::OnResize().

static IPattern IPattern::CreateLinearGradient ( const IRECT bounds,
EDirection  direction,
const std::initializer_list< IColorStop > &  stops = {} 
)
inlinestatic

Create a linear gradient IPattern across a rectangular area.

Parameters
boundsThe rectangular area
directionIf the gradient should be horizontal or vertical
stopsAn initializer list of IColorStops for the stops
Returns
IPattern The new IPattern

Definition at line 2207 of file IGraphicsStructs.h.

References IRECT::B, IRECT::L, IRECT::MH(), IRECT::MW(), IRECT::R, and IRECT::T.

static IPattern IPattern::CreateRadialGradient ( float  x1,
float  y1,
float  r,
const std::initializer_list< IColorStop > &  stops = {} 
)
inlinestatic

Create a radial gradient IPattern.

Parameters
x1The x position of the centre
y1The y position of the centre
rThe radius of the gradient
stopsAn initializer list of IColorStops for the stops
Returns
IPattern The new IPattern

Definition at line 2233 of file IGraphicsStructs.h.

References AddStop(), and SetTransform().

Referenced by TestMaskControl::Draw(), ILEDControl::Draw(), and TestGradientControl::OnResize().

static IPattern IPattern::CreateSweepGradient ( float  x1,
float  y1,
const std::initializer_list< IColorStop > &  stops = {},
float  angleStart = 0.f,
float  angleEnd = 360.f 
)
inlinestatic

Create a sweep gradient IPattern (SKIA only)

Parameters
x1The x position of the centre
y1The y position of the centre
stopsAn initializer list of IColorStops for the stops
angleStartthe start angle of the sweep at in degrees clockwise where 0 is up
angleEndthe end angle of the sweep at in degrees clockwise where 0 is up
Returns
IPattern The new IPattern

Definition at line 2254 of file IGraphicsStructs.h.

References AddStop(), and SetTransform().

const IColorStop& IPattern::GetStop ( int  idx) const
inline

Get the IColorStop at a particular index (will crash if out of bounds)

Parameters
idxThe index of the stop
Returns
const IColorStop& The stop

Definition at line 2286 of file IGraphicsStructs.h.

Referenced by IGraphicsCanvas::PathFill(), IGraphicsNanoVG::PathFill(), and IGraphicsNanoVG::PathStroke().

int IPattern::NStops ( ) const
inline
Returns
int The number of IColorStops in the IPattern

Definition at line 2278 of file IGraphicsStructs.h.

Referenced by IGraphicsCanvas::PathFill().

void IPattern::SetTransform ( float  xx,
float  yx,
float  xy,
float  yy,
float  tx,
float  ty 
)
inline

Set the affine transform for the IPattern with values.

Parameters
xxxx component of the affine transformation
yxyx component of the affine transformation
xyxy component of the affine transformation
yyyy component of the affine transformation
txX translation component of the affine transformation
tyY translation component of the affine transformation

Definition at line 2309 of file IGraphicsStructs.h.

Referenced by CreateLinearGradient(), CreateRadialGradient(), CreateSweepGradient(), and IGraphics::DrawRotatedSVG().

void IPattern::SetTransform ( const IMatrix transform)
inline

Set the affine transform for the IPattern with an IMatrix.

Parameters
transformThe affine transform matrix

Definition at line 2316 of file IGraphicsStructs.h.


The documentation for this struct was generated from the following file: