WithAlpha

inline Rgba WithAlpha(
float newAlpha ) const;

Creates a new color with the same color components but a different alpha value

This function can be particulary useful if you wish to create gradients from an opaque version of a color to a rather transparent one. Also in some cases you might wish to not to modify the alpha value of the color but to get a modified copy of the color instead.

Examples

// Get a 30% opaque red color //
Rgba color = Rgba::RED.WithAlpha0.30 );

// Get a 70% opaque red color //
Rgba otherColor = color.WithAlpha0.70 );


Other functions of the class Rgba
MixWith
Mixes two colors together with the given factor
WithAlpha
Creates a new color with the same color components but a different alpha value

Advanced functions

Packed
Returns the color packed in an integer
Select
Selects the color as the active OpenGL color


Questions about WithAlpha? Click here.