iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
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 2136 of file IGraphicsStructs.h.

Constructor & Destructor Documentation

◆ IPattern() [1/2]

IPattern::IPattern ( EPatternType  type)
inline

Create an IPattern.

Parameters
typeThe type of pattern, one of EPatternType

Definition at line 2146 of file IGraphicsStructs.h.

◆ IPattern() [2/2]

IPattern::IPattern ( const IColor color)
inline

Create an IPattern with a solid color fill.

Parameters
colorThe color for the single stop

Definition at line 2152 of file IGraphicsStructs.h.

Member Function Documentation

◆ AddStop()

void IPattern::AddStop ( IColor  color,
float  offset 
)
inline

Add an IColorStop to the IPattern.

Parameters
colorThe IColor
offsetThe offset

Definition at line 2285 of file IGraphicsStructs.h.

References GetStop().

Referenced by TestShadowGradientControl::Draw(), and TestColorControl::OnResize().

◆ CreateLinearGradient() [1/2]

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 2198 of file IGraphicsStructs.h.

◆ CreateLinearGradient() [2/2]

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 2165 of file IGraphicsStructs.h.

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

◆ CreateRadialGradient()

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 2224 of file IGraphicsStructs.h.

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

◆ CreateSweepGradient()

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 2245 of file IGraphicsStructs.h.

◆ GetStop()

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 2277 of file IGraphicsStructs.h.

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

◆ NStops()

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

Definition at line 2269 of file IGraphicsStructs.h.

◆ SetTransform() [1/2]

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 2307 of file IGraphicsStructs.h.

◆ SetTransform() [2/2]

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 2300 of file IGraphicsStructs.h.

Member Data Documentation

◆ mExtend

EPatternExtend IPattern::mExtend

Definition at line 2139 of file IGraphicsStructs.h.

◆ mNStops

int IPattern::mNStops

Definition at line 2141 of file IGraphicsStructs.h.

◆ mStops

IColorStop IPattern::mStops[16]

Definition at line 2140 of file IGraphicsStructs.h.

◆ mTransform

IMatrix IPattern::mTransform

Definition at line 2142 of file IGraphicsStructs.h.

◆ mType

EPatternType IPattern::mType

Definition at line 2138 of file IGraphicsStructs.h.


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