nCine  2025.04.r498-9d36345
A cross-platform 2D game engine
Public Member Functions | Static Public Attributes | List of all members
ncine::Colorf Class Reference

A four channels normalized float color. More...

#include <Colorf.h>

Collaboration diagram for ncine::Colorf:
Collaboration graph
[legend]

Public Member Functions

 Colorf ()
 Default constructor (white color)
 
 Colorf (float red, float green, float blue)
 Three channels constructor.
 
 Colorf (float red, float green, float blue, float alpha)
 Four channels constructor.
 
 Colorf (const float channels[NumChannels])
 Four channels constructor from an array.
 
 Colorf (const Color &color)
 Constructor taking an unsigned char color.
 
 Colorf (const ColorHdr &color)
 Constructor taking an unclamped float color.
 
float r () const
 Gets the red channel of the color.
 
float g () const
 Gets the green channel of the color.
 
float b () const
 Gets the blue channel of the color.
 
float a () const
 Gets the alpha channel of the color.
 
const float * data () const
 Gets the color array.
 
float * data ()
 Gets the color array.
 
void set (float red, float green, float blue, float alpha)
 Sets four color channels.
 
void set (float red, float green, float blue)
 Sets three color channels.
 
void setVec (const float channels[NumChannels])
 Sets four color channels from an array.
 
void setAlpha (float alpha)
 Sets the alpha channel.
 
Colorfoperator= (const Color &color)
 Assignment operator from an unsigned char color.
 
Colorfoperator+= (const Colorf &v)
 
Colorfoperator-= (const Colorf &v)
 
Colorfoperator*= (const Colorf &color)
 
Colorfoperator*= (float scalar)
 Multiplication by a constant scalar.
 
Colorf operator+ (const Colorf &color) const
 
Colorf operator- (const Colorf &color) const
 
Colorf operator* (const Colorf &color) const
 
Colorf operator* (float scalar) const
 Multiplication by a constant scalar.
 

Static Public Attributes

static const int NumChannels = 4
 
static const Colorf Black
 
static const Colorf White
 
static const Colorf Red
 
static const Colorf Green
 
static const Colorf Blue
 
static const Colorf Yellow
 
static const Colorf Magenta
 
static const Colorf Cyan
 

Detailed Description

A four channels normalized float color.


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