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

Class to hold the blend mode as exposed by typical 3D APIs. More...

#include <blend_mode.hpp>

Public Types

enum  equation_t {
  ADD, SUBTRACT, REVERSE_SUBTRACT, MIN,
  MAX, NUMBER_OPS
}
 Enumeration to specify blend equation, i.e. glBlendEquation. More...
 
enum  func_t {
  ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR,
  DST_COLOR, ONE_MINUS_DST_COLOR, SRC_ALPHA, ONE_MINUS_SRC_ALPHA,
  DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR,
  CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA, SRC_ALPHA_SATURATE, SRC1_COLOR,
  ONE_MINUS_SRC1_COLOR, SRC1_ALPHA, ONE_MINUS_SRC1_ALPHA, NUMBER_FUNCS
}
 Enumeration to specify the blend coefficient factor, i.e. glBlendFunc. More...
 

Public Member Functions

 BlendMode (void)
 
BlendModeblending_on (bool v)
 
bool blending_on (void) const
 
BlendModeequation (enum equation_t v)
 
BlendModeequation_alpha (enum equation_t v)
 
enum equation_t equation_alpha (void) const
 
BlendModeequation_rgb (enum equation_t v)
 
enum equation_t equation_rgb (void) const
 
BlendModefunc (enum func_t src, enum func_t dst)
 
BlendModefunc_dst (enum func_t v)
 
BlendModefunc_dst_alpha (enum func_t v)
 
enum func_t func_dst_alpha (void) const
 
enum func_t func_dst_rgb (void) const
 
BlendModefunc_dst_rgb (enum func_t v)
 
BlendModefunc_src (enum func_t v)
 
BlendModefunc_src_alpha (enum func_t v)
 
enum func_t func_src_alpha (void) const
 
enum func_t func_src_rgb (void) const
 
BlendModefunc_src_rgb (enum func_t v)
 
bool is_valid (void) const
 
bool operator!= (BlendMode rhs) const
 
bool operator== (BlendMode rhs) const
 
BlendModeset_as_invalid (void)
 
BlendModeset_as_valid (void)
 

Static Public Member Functions

static c_string label (enum equation_t v)
 
static c_string label (enum func_t v)
 

Detailed Description

Class to hold the blend mode as exposed by typical 3D APIs.

Definition at line 37 of file blend_mode.hpp.

Member Enumeration Documentation

◆ equation_t

Enumeration to specify blend equation, i.e. glBlendEquation.

Enumerator
ADD 

Indicates to add the values.

SUBTRACT 

Indicates to subtract the values.

REVERSE_SUBTRACT 

Indicates to reverse-subtract the values.

MIN 

Indicates to min the values.

MAX 

Indicates to max the values.

Definition at line 44 of file blend_mode.hpp.

◆ func_t

Enumeration to specify the blend coefficient factor, i.e. glBlendFunc.

Enumerator
ZERO 

Indicates the coefficient value of 0 in each channel.

ONE 

Indicates the coefficient value of 1 in each channel.

SRC_COLOR 

Indicates the coefficient where each channel value is the output of the fragment shader.

ONE_MINUS_SRC_COLOR 

Indicates the coefficient where each channel value is one minus the output of the fragment shader.

DST_COLOR 

Indicates the coefficient where each channel value is the value in the framebuffer.

ONE_MINUS_DST_COLOR 

Indicates the coefficient where each channel value is one minus the value in the framebuffer.

SRC_ALPHA 

Indicates the coefficient where each channel value is the alpha value of the output of the fragment shader.

ONE_MINUS_SRC_ALPHA 

Indicates the coefficient where each channel value is one minus the alpha value of the output of the fragment shader.

DST_ALPHA 

Indicates the coefficient where each channel value is the alpha value in the framebuffer.

ONE_MINUS_DST_ALPHA 

Indicates the coefficient where each channel value is one minus the alpha value in the framebuffer.

CONSTANT_COLOR 

Indicates the coefficient where each channel value comes from the constant color value specified as part of the 3D API state.

ONE_MINUS_CONSTANT_COLOR 

Indicates the coefficient where each channel value comes from one minus the constant color value specified as part of the 3D API state.

CONSTANT_ALPHA 

Indicates the coefficient where each channel is the alpha channel of the constant color value specified as part of the 3D API state.

ONE_MINUS_CONSTANT_ALPHA 

Indicates the coefficient where each channel is one minus the alpha channel of the constant color value specified as part of the 3D API state.

SRC_ALPHA_SATURATE 

Indicates the coefficient where each channel value is the alpha value of the output of the fragment shader clamped to [0, 1].

SRC1_COLOR 

Indicates the coefficient where each channel value is the secondary output of the fragment shader (the secondary output as present in dual-src blending).

ONE_MINUS_SRC1_COLOR 

Indicates the coefficient where each channel value is one minus the secondary output of the fragment shader (the secondary output as present in dual-src blending).

SRC1_ALPHA 

Indicates the coefficient where each channel value is the alpha channel of the secondary output of the fragment shader (the secondary output as present in dual-src blending).

ONE_MINUS_SRC1_ALPHA 

Indicates the coefficient where each channel value is one minus the alpha channel of the secondary output of the fragment shader (the secondary output as present in dual-src blending).

Definition at line 79 of file blend_mode.hpp.

Constructor & Destructor Documentation

◆ BlendMode()

fastuidraw::BlendMode::BlendMode ( void  )
inline

Ctor. Initializes as valid with blending on, with blend equation as add in all channels, with src func in all channels as ONE and dest func in all channels as ZERO.

Definition at line 215 of file blend_mode.hpp.

Member Function Documentation

◆ blending_on() [1/2]

BlendMode& fastuidraw::BlendMode::blending_on ( bool  v)
inline

Set that 3D API blending is on or off. Default value is true.

Definition at line 279 of file blend_mode.hpp.

◆ blending_on() [2/2]

bool fastuidraw::BlendMode::blending_on ( void  ) const
inline

Return the value as set by blending_on(bool).

Definition at line 290 of file blend_mode.hpp.

◆ equation()

BlendMode& fastuidraw::BlendMode::equation ( enum equation_t  v)
inline

Provided as a conveniance, equivalent to

Definition at line 345 of file blend_mode.hpp.

◆ equation_alpha() [1/2]

BlendMode& fastuidraw::BlendMode::equation_alpha ( enum equation_t  v)
inline

Set the blend equation for the Alpha channel. Default value is ADD.

Definition at line 321 of file blend_mode.hpp.

◆ equation_alpha() [2/2]

enum equation_t fastuidraw::BlendMode::equation_alpha ( void  ) const
inline

Return the value as set by equation_alpha(enum equation_t).

Definition at line 332 of file blend_mode.hpp.

◆ equation_rgb() [1/2]

enum equation_t fastuidraw::BlendMode::equation_rgb ( void  ) const
inline

Return the value as set by equation_rgb(enum equation_t).

Definition at line 311 of file blend_mode.hpp.

◆ equation_rgb() [2/2]

BlendMode& fastuidraw::BlendMode::equation_rgb ( enum equation_t  v)
inline

Set the blend equation for the RGB channels. Default value is ADD.

Definition at line 300 of file blend_mode.hpp.

◆ func()

BlendMode& fastuidraw::BlendMode::func ( enum func_t  src,
enum func_t  dst 
)
inline

Provided as a conveniance, equivalent to

func_src(src);
func_dst(dst);

Definition at line 471 of file blend_mode.hpp.

◆ func_dst()

BlendMode& fastuidraw::BlendMode::func_dst ( enum func_t  v)
inline

Provided as a conveniance, equivalent to

Definition at line 457 of file blend_mode.hpp.

◆ func_dst_alpha() [1/2]

BlendMode& fastuidraw::BlendMode::func_dst_alpha ( enum func_t  v)
inline

Set the destication coefficient for the Alpha channel. Default value is ZERO.

Definition at line 433 of file blend_mode.hpp.

◆ func_dst_alpha() [2/2]

enum func_t fastuidraw::BlendMode::func_dst_alpha ( void  ) const
inline

Return the value as set by func_dst_alpha(enum t).

Definition at line 444 of file blend_mode.hpp.

◆ func_dst_rgb() [1/2]

enum func_t fastuidraw::BlendMode::func_dst_rgb ( void  ) const
inline

Return the value as set by func_dst_rgb(enum t).

Definition at line 423 of file blend_mode.hpp.

◆ func_dst_rgb() [2/2]

BlendMode& fastuidraw::BlendMode::func_dst_rgb ( enum func_t  v)
inline

Set the destication coefficient for the RGB channels. Default value is ZERO.

Definition at line 412 of file blend_mode.hpp.

◆ func_src()

BlendMode& fastuidraw::BlendMode::func_src ( enum func_t  v)
inline

Provided as a conveniance, equivalent to

Definition at line 401 of file blend_mode.hpp.

◆ func_src_alpha() [1/2]

enum func_t fastuidraw::BlendMode::func_src_alpha ( void  ) const
inline

Return the value as set by func_src_alpha(enum t).

Definition at line 388 of file blend_mode.hpp.

◆ func_src_alpha() [2/2]

BlendMode& fastuidraw::BlendMode::func_src_alpha ( enum func_t  v)
inline

Set the source coefficient for the Alpha channel. Default value is ONE.

Definition at line 377 of file blend_mode.hpp.

◆ func_src_rgb() [1/2]

BlendMode& fastuidraw::BlendMode::func_src_rgb ( enum func_t  v)
inline

Set the source coefficient for the RGB channels. Default value is ONE.

Definition at line 356 of file blend_mode.hpp.

◆ func_src_rgb() [2/2]

enum func_t fastuidraw::BlendMode::func_src_rgb ( void  ) const
inline

Return the value as set by func_src_rgb(enum t).

Definition at line 367 of file blend_mode.hpp.

◆ is_valid()

bool fastuidraw::BlendMode::is_valid ( void  ) const
inline

Returns true if the BlendMode has been marked as invalid, see set_as_invalid() and set_as_valid().

Definition at line 269 of file blend_mode.hpp.

◆ label() [1/2]

static c_string fastuidraw::BlendMode::label ( enum equation_t  v)
static

Returns a c_string for an enumerated value.

Parameters
vvalue to get the label-string of.

◆ label() [2/2]

static c_string fastuidraw::BlendMode::label ( enum func_t  v)
static

Returns a c_string for an enumerated value.

Parameters
vvalue to get the label-string of.

◆ operator!=()

bool fastuidraw::BlendMode::operator!= ( BlendMode  rhs) const
inline

Inequality comparison operator.

Definition at line 239 of file blend_mode.hpp.

◆ operator==()

bool fastuidraw::BlendMode::operator== ( BlendMode  rhs) const
inline

Equality comparison operator.

Definition at line 230 of file blend_mode.hpp.

◆ set_as_invalid()

BlendMode& fastuidraw::BlendMode::set_as_invalid ( void  )
inline

Set the BlendMode to a value to mark it as invalid.

Definition at line 248 of file blend_mode.hpp.

◆ set_as_valid()

BlendMode& fastuidraw::BlendMode::set_as_valid ( void  )
inline

Set the BlendMode to a value to mark it as valid.

Definition at line 258 of file blend_mode.hpp.


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