DISTRHO Plugin Framework
 All Classes Functions Variables Modules Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Color Struct Reference

#include <Color.hpp>

Public Member Functions

 Color () noexcept
 
 Color (int red, int green, int blue, int alpha=255) noexcept
 
 Color (float red, float green, float blue, float alpha=1.0f) noexcept
 
 Color (const Color &color) noexcept
 
Coloroperator= (const Color &color) noexcept
 
 Color (const Color &color1, const Color &color2, float u) noexcept
 
void interpolate (const Color &other, float u) noexcept
 
bool isEqual (const Color &color, bool withAlpha=true) noexcept
 
bool isNotEqual (const Color &color, bool withAlpha=true) noexcept
 
bool operator== (const Color &color) noexcept
 
bool operator!= (const Color &color) noexcept
 
void fixBounds () noexcept
 
 Color (const NVGcolor &) noexcept
 
 operator NVGcolor () const noexcept
 

Static Public Member Functions

static Color fromHSL (float hue, float saturation, float lightness, float alpha=1.0f)
 
static Color fromHTML (const char *rgb, float alpha=1.0f)
 

Public Attributes

union {
   float   rgba [4]
 
   struct {
      float   red
 
      float   green
 
      float   blue
 
      float   alpha
 
   } 
 
}; 
 

Detailed Description

A color made from red, green, blue and alpha floating-point values in [0..1] range.

Constructor & Destructor Documentation

Color::Color ( )
noexcept

Create black color.

Color::Color ( int  red,
int  green,
int  blue,
int  alpha = 255 
)
noexcept

Create a color from red, green, blue and alpha numeric values. Values must be in [0..255] range.

Color::Color ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)
noexcept

Create a color from red, green, blue and alpha floating-point values. Values must in [0..1] range.

Color::Color ( const Color color)
noexcept

Create a color by copying another color.

Color::Color ( const Color color1,
const Color color2,
float  u 
)
noexcept

Create a color by linearly interpolating two other colors.

Member Function Documentation

static Color Color::fromHSL ( float  hue,
float  saturation,
float  lightness,
float  alpha = 1.0f 
)
static

Create a color specified by hue, saturation and lightness. Values must in [0..1] range.

static Color Color::fromHTML ( const char *  rgb,
float  alpha = 1.0f 
)
static

Create a color from a HTML string like "#333" or "#112233".

void Color::interpolate ( const Color other,
float  u 
)
noexcept

Linearly interpolate this color against another.

bool Color::isEqual ( const Color color,
bool  withAlpha = true 
)
noexcept

Check if this color matches another.

Note
: Comparison is forced within 8-bit color values.
void Color::fixBounds ( )
noexcept

Fix color bounds if needed.

Member Data Documentation

union { ... }

Direct access to the color values.


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