ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Color< T > Class Template Referenceabstract

Abstract base class for representing a color with operations for modification and interpolation. More...

#include <Color.h>

Public Member Functions

virtual Color (T R, T G, T B)=0
 Constructor to initialize a color with red, green, and blue components.
 
virtual ~Color ()
 Virtual destructor.
 
virtual void SetColor (T R, T G, T B)=0
 Sets the color using red, green, and blue components.
 
virtual Color Scale (T maxBrightness)=0
 Scales the color brightness to a maximum brightness level.
 
virtual Color Add (T value)=0
 Adds a constant value to all color channels.
 
virtual Color HueShift (float hueDeg)=0
 Shifts the hue of the color by a specified angle.
 
virtual Color InterpolateColors (Color color1, Color color2, float ratio)=0
 Interpolates between two colors based on a ratio.
 
virtual String ToString ()=0
 Converts the color to a string representation.
 

Detailed Description

template<typename T>
class Color< T >

Abstract base class for representing a color with operations for modification and interpolation.

Template Parameters
TData type for the color channels (e.g., uint8_t, float).

Definition at line 20 of file Color.h.

Constructor & Destructor Documentation

◆ Color()

template<typename T >
virtual Color ( T  R,
T  G,
T  B 
)
pure virtual

Constructor to initialize a color with red, green, and blue components.

Parameters
RThe red component of the color.
GThe green component of the color.
BThe blue component of the color.

◆ ~Color()

template<typename T >
virtual ~Color ( )
inlinevirtual

Virtual destructor.

Definition at line 33 of file Color.h.

Member Function Documentation

◆ Add()

template<typename T >
virtual Color Add ( T  value)
pure virtual

Adds a constant value to all color channels.

Parameters
valueThe value to add to each channel.
Returns
A new color with the added value.

◆ HueShift()

template<typename T >
virtual Color HueShift ( float  hueDeg)
pure virtual

Shifts the hue of the color by a specified angle.

Parameters
hueDegThe hue shift in degrees.
Returns
A new color with the hue shifted.

◆ InterpolateColors()

template<typename T >
virtual Color InterpolateColors ( Color< T color1,
Color< T color2,
float  ratio 
)
pure virtual

Interpolates between two colors based on a ratio.

Parameters
color1The first color.
color2The second color.
ratioThe interpolation ratio (0.0 - 1.0).
Returns
A new color that is the interpolated result.

◆ Scale()

template<typename T >
virtual Color Scale ( T  maxBrightness)
pure virtual

Scales the color brightness to a maximum brightness level.

Parameters
maxBrightnessThe maximum brightness value.
Returns
A new color scaled to the specified brightness.

◆ SetColor()

template<typename T >
virtual void SetColor ( T  R,
T  G,
T  B 
)
pure virtual

Sets the color using red, green, and blue components.

Parameters
RThe red component of the color.
GThe green component of the color.
BThe blue component of the color.

◆ ToString()

template<typename T >
virtual String ToString ( )
pure virtual

Converts the color to a string representation.

Returns
A string representing the color in "R, G, B" format.

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