FastUIDraw
Public Types | Public Member Functions | Static Public Member Functions | List of all members
fastuidraw::PainterGradientBrushShader Class Reference

A PainterGradientBrushShader represents a set of brush shaders to to perform a gradient. Internally it containts four generic parent shaders: More...

#include <painter_gradient_brush_shader.hpp>

Inheritance diagram for fastuidraw::PainterGradientBrushShader:
Inheritance graph
[legend]

Public Types

enum  sub_shader_bits {
  spread_type_num_bits = 2, gradient_type_num_bits = 2, spread_type_bit0 = 0, gradient_type_bit0 = spread_type_bit0 + spread_type_num_bits,
  number_bits = gradient_type_bit0 + gradient_type_num_bits, number_sub_shaders_of_generic_gradient = 1u << number_bits, number_sub_shaders_of_specific_gradient = 1u << spread_type_num_bits
}
 Enumeration describing the roles of the bits for the sub-shader ID's. More...
 
enum  sub_shader_masks { gradient_spread_type_mask = FASTUIDRAW_MASK(spread_type_bit0, spread_type_num_bits), gradient_type_mask = FASTUIDRAW_MASK(gradient_type_bit0, gradient_type_num_bits) }
 
- Public Types inherited from fastuidraw::PainterBrushEnums
enum  filter_t { filter_nearest = 1, filter_linear = 2, filter_cubic = 3 }
 Enumeration specifying what filter to apply to an image. More...
 
enum  gradient_type_t {
  gradient_non = 0, gradient_linear, gradient_radial, gradient_sweep,
  number_gradient_types
}
 
enum  mipmap_t { apply_mipmapping, dont_apply_mipmapping }
 
enum  spread_type_t {
  spread_clamp, spread_mirror, spread_repeat, spread_mirror_repeat,
  number_spread_types
}
 

Public Member Functions

 PainterGradientBrushShader (const reference_counted_ptr< PainterBrushShader > &generic, const reference_counted_ptr< PainterBrushShader > &linear, const reference_counted_ptr< PainterBrushShader > &radial, const reference_counted_ptr< PainterBrushShader > &sweep, const reference_counted_ptr< PainterBrushShader > &white)
 
PainterCustomBrush create_brush (PainterPackedValuePool &pool, const PainterGradientBrushShaderData &brush_data, enum spread_type_t spread) const
 
const reference_counted_ptr< PainterBrushShader > & linear_sub_shader (enum spread_type_t) const
 
const reference_counted_ptr< PainterBrushShader > & radial_sub_shader (enum spread_type_t) const
 
const reference_counted_ptr< PainterBrushShader > & sub_shader (enum spread_type_t, enum gradient_type_t) const
 
const reference_counted_ptr< PainterBrushShader > & sweep_sub_shader (enum spread_type_t) const
 
const reference_counted_ptr< PainterBrushShader > & white_shader (void) const
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Static Public Member Functions

static uint32_t sub_shader_id (enum spread_type_t, enum gradient_type_t)
 
static uint32_t sub_shader_id (enum spread_type_t)
 
- Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
static void add_reference (const reference_counted_base< T, Counter > *p)
 
static void remove_reference (const reference_counted_base< T, Counter > *p)
 

Detailed Description

A PainterGradientBrushShader represents a set of brush shaders to to perform a gradient. Internally it containts four generic parent shaders:

Definition at line 43 of file painter_gradient_brush_shader.hpp.

Member Enumeration Documentation

◆ sub_shader_bits

Enumeration describing the roles of the bits for the sub-shader ID's.

Enumerator
spread_type_num_bits 

Number of bits used to encode a spread_type_t

gradient_type_num_bits 

Number of bits used to encode the gradient type, see PainterBrushEnums::gradient_type_t

spread_type_bit0 

first bit used to encode the spread_type_t

gradient_type_bit0 

first bit used to encode the PainterBrushEnums::gradient_type_t

number_bits 

The total number of bits needed to specify the sub-shader IDs.

number_sub_shaders_of_generic_gradient 

the total number of sub-shaders that the generic parent shader has.

number_sub_shaders_of_specific_gradient 

the total number of sub-shaders that a parent shader for a specific gradient type has.

Definition at line 53 of file painter_gradient_brush_shader.hpp.

◆ sub_shader_masks

Various bit-mask values derived from sub_shader_bits

Enumerator
gradient_spread_type_mask 

mask generated from spread_type_bit0 and spread_type_num_bits

gradient_type_mask 

mask generated from gradient_type_bit0 and gradient_type_num_bits

Definition at line 97 of file painter_gradient_brush_shader.hpp.

Constructor & Destructor Documentation

◆ PainterGradientBrushShader()

fastuidraw::PainterGradientBrushShader::PainterGradientBrushShader ( const reference_counted_ptr< PainterBrushShader > &  generic,
const reference_counted_ptr< PainterBrushShader > &  linear,
const reference_counted_ptr< PainterBrushShader > &  radial,
const reference_counted_ptr< PainterBrushShader > &  sweep,
const reference_counted_ptr< PainterBrushShader > &  white 
)

Ctor.

Parameters
genericPainterBrushShader that supports all gradient and sweep types via its sub-shaders which are indexed by sub_shader_id(enum spread_type_t, enum gradient_type_t)
linearPainterBrushShader that performs linear gradient that supports all sweep types via its sub-shaders which are indexed by sub_shader_id(enum spread_type_t)
radialPainterBrushShader that performs radial gradient that supports all sweep types via its sub-shaders which are indexed by sub_shader_id(enum spread_type_t)
sweepPainterBrushShader that performs sweep gradient that supports all sweep types via its sub-shaders which are indexed by sub_shader_id(enum spread_type_t)
whitePainterBrushShader that applied solid white for the brush

Member Function Documentation

◆ create_brush()

PainterCustomBrush fastuidraw::PainterGradientBrushShader::create_brush ( PainterPackedValuePool pool,
const PainterGradientBrushShaderData brush_data,
enum spread_type_t  spread 
) const

Create a PainterCustomBrush from a PainterGradientBrushShaderData

Parameters
poolPainterPackedValuePool used to create the packed value
brush_dataPainterGradientBrushShaderData specifing gradient
spreadspread pattern for gradient

◆ linear_sub_shader()

const reference_counted_ptr<PainterBrushShader>& fastuidraw::PainterGradientBrushShader::linear_sub_shader ( enum  spread_type_t) const

Returns the sub-shader of the linear gradient parent shader for a specified spread_type_t value.

◆ radial_sub_shader()

const reference_counted_ptr<PainterBrushShader>& fastuidraw::PainterGradientBrushShader::radial_sub_shader ( enum  spread_type_t) const

Returns the sub-shader of the radial gradient parent shader for a specified spread_type_t value.

◆ sub_shader()

const reference_counted_ptr<PainterBrushShader>& fastuidraw::PainterGradientBrushShader::sub_shader ( enum  spread_type_t,
enum  gradient_type_t 
) const

Returns the sub-shader of the generic parent shader for specified gradient_type_t and spread_type_t values.

◆ sub_shader_id() [1/2]

static uint32_t fastuidraw::PainterGradientBrushShader::sub_shader_id ( enum  spread_type_t,
enum  gradient_type_t 
)
static

The sub-shader to take from the generic parent shader for specified gradient_type_t and spread_type_t values.

◆ sub_shader_id() [2/2]

static uint32_t fastuidraw::PainterGradientBrushShader::sub_shader_id ( enum  spread_type_t)
static

The sub-shader to take from the linear, radial or sweep parent shader for a specified spread_type_t value.

◆ sweep_sub_shader()

const reference_counted_ptr<PainterBrushShader>& fastuidraw::PainterGradientBrushShader::sweep_sub_shader ( enum  spread_type_t) const

Returns the sub-shader of the sweep gradient parent shader for a specified spread_type_t value.

◆ white_shader()

const reference_counted_ptr<PainterBrushShader>& fastuidraw::PainterGradientBrushShader::white_shader ( void  ) const

Returns the white shader, i.e. the shader that is solid white to the brush.


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