VCV Rack API v2
Loading...
Searching...
No Matches
rack::color Namespace Reference

Utilities for NVGcolor More...

Functions

bool isEqual (NVGcolor a, NVGcolor b)
 Returns whether all RGBA color components are equal.
 
NVGcolor clamp (NVGcolor a)
 Limits RGBA color components between 0 and 1.
 
NVGcolor minus (NVGcolor a, NVGcolor b)
 Subtracts RGB color components elementwise.
 
NVGcolor plus (NVGcolor a, NVGcolor b)
 Adds RGB color components elementwise.
 
NVGcolor mult (NVGcolor a, NVGcolor b)
 Multiplies RGB color components elementwise.
 
NVGcolor mult (NVGcolor a, float x)
 Multiplies RGB color components by a scalar.
 
NVGcolor lerp (NVGcolor a, NVGcolor b, float t)
 Interpolates RGBA color components.
 
NVGcolor screen (NVGcolor a, NVGcolor b)
 Screen blending with alpha compositing.
 
NVGcolor alpha (NVGcolor a, float alpha)
 Multiplies alpha value by a scalar.
 
NVGcolor fromHexString (std::string s)
 Converts from hex string of the form "#RRGGBB" or "#RRGGBBAA".
 
std::string toHexString (NVGcolor c)
 Converts color to hex string of the form "#RRGGBB" if opaque or "#RRGGBBAA" if alpha < 255.
 

Variables

static const NVGcolor BLACK_TRANSPARENT = nvgRGBA(0x00, 0x00, 0x00, 0x00)
 
static const NVGcolor WHITE_TRANSPARENT = nvgRGBA(0xff, 0xff, 0xff, 0x00)
 
static const NVGcolor BLACK = nvgRGB(0x00, 0x00, 0x00)
 
static const NVGcolor RED = nvgRGB(0xff, 0x00, 0x00)
 
static const NVGcolor GREEN = nvgRGB(0x00, 0xff, 0x00)
 
static const NVGcolor BLUE = nvgRGB(0x00, 0x00, 0xff)
 
static const NVGcolor CYAN = nvgRGB(0x00, 0xff, 0xff)
 
static const NVGcolor MAGENTA = nvgRGB(0xff, 0x00, 0xff)
 
static const NVGcolor YELLOW = nvgRGB(0xff, 0xff, 0x00)
 
static const NVGcolor WHITE = nvgRGB(0xff, 0xff, 0xff)
 

Detailed Description

Utilities for NVGcolor

Function Documentation

◆ isEqual()

bool rack::color::isEqual ( NVGcolor a,
NVGcolor b )

Returns whether all RGBA color components are equal.

◆ clamp()

NVGcolor rack::color::clamp ( NVGcolor a)

Limits RGBA color components between 0 and 1.

◆ minus()

NVGcolor rack::color::minus ( NVGcolor a,
NVGcolor b )

Subtracts RGB color components elementwise.

Alpha value is copied from a.

◆ plus()

NVGcolor rack::color::plus ( NVGcolor a,
NVGcolor b )

Adds RGB color components elementwise.

Alpha value is copied from a.

◆ mult() [1/2]

NVGcolor rack::color::mult ( NVGcolor a,
NVGcolor b )

Multiplies RGB color components elementwise.

Alpha value is copied from a.

◆ mult() [2/2]

NVGcolor rack::color::mult ( NVGcolor a,
float x )

Multiplies RGB color components by a scalar.

Alpha value is untouched.

◆ lerp()

NVGcolor rack::color::lerp ( NVGcolor a,
NVGcolor b,
float t )

Interpolates RGBA color components.

◆ screen()

NVGcolor rack::color::screen ( NVGcolor a,
NVGcolor b )

Screen blending with alpha compositing.

https://en.wikipedia.org/wiki/Blend_modes#Screen

◆ alpha()

NVGcolor rack::color::alpha ( NVGcolor a,
float alpha )

Multiplies alpha value by a scalar.

RGB color components are untouched.

◆ fromHexString()

NVGcolor rack::color::fromHexString ( std::string s)

Converts from hex string of the form "#RRGGBB" or "#RRGGBBAA".

Must include "#". Returns WHITE on error.

◆ toHexString()

std::string rack::color::toHexString ( NVGcolor c)

Converts color to hex string of the form "#RRGGBB" if opaque or "#RRGGBBAA" if alpha < 255.

Floating point color components are rounded to nearest 8-bit integer.

Variable Documentation

◆ BLACK_TRANSPARENT

const NVGcolor rack::color::BLACK_TRANSPARENT = nvgRGBA(0x00, 0x00, 0x00, 0x00)
static

◆ WHITE_TRANSPARENT

const NVGcolor rack::color::WHITE_TRANSPARENT = nvgRGBA(0xff, 0xff, 0xff, 0x00)
static

◆ BLACK

const NVGcolor rack::color::BLACK = nvgRGB(0x00, 0x00, 0x00)
static

◆ RED

const NVGcolor rack::color::RED = nvgRGB(0xff, 0x00, 0x00)
static

◆ GREEN

const NVGcolor rack::color::GREEN = nvgRGB(0x00, 0xff, 0x00)
static

◆ BLUE

const NVGcolor rack::color::BLUE = nvgRGB(0x00, 0x00, 0xff)
static

◆ CYAN

const NVGcolor rack::color::CYAN = nvgRGB(0x00, 0xff, 0xff)
static

◆ MAGENTA

const NVGcolor rack::color::MAGENTA = nvgRGB(0xff, 0x00, 0xff)
static

◆ YELLOW

const NVGcolor rack::color::YELLOW = nvgRGB(0xff, 0xff, 0x00)
static

◆ WHITE

const NVGcolor rack::color::WHITE = nvgRGB(0xff, 0xff, 0xff)
static