kanzi::TextureSwizzleMask Class Reference

Texture swizzle mask. More...

#include <kanzi/core.ui/platform/graphics_backend/gl/graphics_swizzle_mask.hpp>

Public Types

enum  ColorComponent {
  Zero, One, Red, Green,
  Blue, Alpha, Count
}
 Wraps the graphics library's color components. More...
 

Public Member Functions

 TextureSwizzleMask (ColorComponent redChannelMask, ColorComponent greenChannelMask, ColorComponent blueChannelMask, ColorComponent alphaChannelMask)
 Constructs the mask using separate value for each channel. More...
 
 TextureSwizzleMask (ColorComponent mask)
 Constructs the mask using the same value for each color channel. More...
 
 ~TextureSwizzleMask ()
 Destructor. More...
 
GLSwizzleMask getMask () const
 Gets the swizzle mask. More...
 

Detailed Description

Texture swizzle mask.

The texture swizzle mask can used to reorder the color channel value, returned by the texture function in a shader. For more info see https://www.khronos.org/opengl/wiki/Texture#Swizzle_mask. Note: To apply a swizzle mask, the target platform must support GL_ARB_texture_swizzle or GL_EXT_texture_swizzle extension.

Example

TextureSwizzleMask redOverAlphaMask = TextureSwizzleMask(ColorComponent::Zero, ColorComponent::Zero, ColorComponent::Zero, ColorComponent::Red); Renderer::setTextureSwizzleMask(..., redOverAlphaMask); This mask will map the red channel in the texture to the alpha channel.

Member Enumeration Documentation

Wraps the graphics library's color components.

Enumerator
Zero 

The component is disabled.

Maps to KZS_GL_ZERO.

One 

The component is kept as-is.

Maps to KZS_GL_ONE.

Red 

The value for this component comes from the red channel of the texture.

All texture color formats have at least a red channel. Maps to KZS_GL_RED.

Green 

The value for this component comes from the green channel of the texture, or 0 if it has no green channel.

Maps to KZS_GL_GREEN.

Blue 

The value for this component comes from the blue channel of the texture, or 0 if it has no blue channel.

Maps to KZS_GL_BLUE.

Alpha 

The value for this component comes from the alpha channel of the texture, or 1 if it has no alpha channel.

Maps to KZS_GL_ALPHA.

Count 

The number of supported color components.

Constructor & Destructor Documentation

kanzi::TextureSwizzleMask::TextureSwizzleMask ( ColorComponent  redChannelMask,
ColorComponent  greenChannelMask,
ColorComponent  blueChannelMask,
ColorComponent  alphaChannelMask 
)
inlineexplicit

Constructs the mask using separate value for each channel.

Parameters
redChannelMaskMask for red channel.
greenChannelMaskMask for green channel.
blueChannelMaskMask for blue channel.
alphaChannelMaskMask for alpha channel.
kanzi::TextureSwizzleMask::TextureSwizzleMask ( ColorComponent  mask)
inlineexplicit

Constructs the mask using the same value for each color channel.

Parameters
maskSwizzle mask for all the channels.
kanzi::TextureSwizzleMask::~TextureSwizzleMask ( )
inline

Destructor.

Member Function Documentation

GLSwizzleMask kanzi::TextureSwizzleMask::getMask ( ) const

Gets the swizzle mask.

Returns
Internal GL representation of the swizzle mask.

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