Altus Mapping Engine JavaScript API Reference - v2.0.ut.2153.g60764257e - Tuesday May 16, 2022 SDK Documentation | Builds | BA3 Home
AltusUnified::Color Class Reference

Represents a color. More...

Public Member Functions

 Color ()
 Creates a color initialized to black. More...
 
 Color (ubyte r, ubyte g, ubyte b)
 Create a color initialized to specified red, green, and blue components. More...
 
 Color (ubyte r, ubyte g, ubyte b, ubyte a)
 Create a color initialized to specified red, green, blue and alpha components. More...
 
 Color (uint hexcolor)
 Create a color initialized to specified red, green, blue, and alpha components. More...
 
bool eq (Color other)
 Does this Color equal another? More...
 
bool neq (Color other)
 Does this Color not equal another? More...
 
vec4f toVector ()
 Construct and return a vec4f based on the red, green, blue and alpha components of this Color. More...
 
uint toHex ()
 Gets a hex representation of this Color as a uint. Alpha is set to FF. More...
 
string toHexString ()
 Gets a hex representation of this Color as a string. More...
 
bool isBlack ()
 Is this Color black? More...
 
void setSaturation (float newSaturation)
 Adjust saturation based on 0.0 to 1.0 More...
 

Static Public Member Functions

static Color colorFromARGB (int packedColor)
 Creates a color struct from a packed integer in ARGB format. More...
 
static ubyte convert (float value)
 Scales a normalized value (between 0 and 1) to a ubyte (between 0 and 255), with clamping More...
 
static Color lerp (Color first, Color second, double t)
 Perform a linear interpolation between first and second. When t = 0, this returns first; when t = 1, this returns second. More...
 
static Color fromVector (vec4f v)
 Construct and return a color initialized to specified red, green, blue and alpha components. More...
 
static Color fromHexWithAlpha (uint value)
 Construct and return a color initialized to specified red, green, blue and alpha components. More...
 

Public Attributes

ubyte r
 red component More...
 
ubyte g
 green component More...
 
ubyte b
 blue component More...
 
ubyte a
 alpha component More...
 

Detailed Description

Represents a color.

Constructor & Destructor Documentation

AltusUnified::Color::Color ( )

Creates a color initialized to black.

AltusUnified::Color::Color ( ubyte  r,
ubyte  g,
ubyte  b 
)

Create a color initialized to specified red, green, and blue components.

Parameters
rRed component
gGreen component
bBlue component
AltusUnified::Color::Color ( ubyte  r,
ubyte  g,
ubyte  b,
ubyte  a 
)

Create a color initialized to specified red, green, blue and alpha components.

Parameters
rRed component
gGreen component
bBlue component
aAlpha component
AltusUnified::Color::Color ( uint  hexcolor)

Create a color initialized to specified red, green, blue, and alpha components.

Parameters
hexcolora hex color code as a uint

Member Function Documentation

static Color AltusUnified::Color::colorFromARGB ( int  packedColor)
static

Creates a color struct from a packed integer in ARGB format.

static ubyte AltusUnified::Color::convert ( float  value)
static

Scales a normalized value (between 0 and 1) to a ubyte (between 0 and 255), with clamping

bool AltusUnified::Color::eq ( Color  other)

Does this Color equal another?

Parameters
otherThe other Color
static Color AltusUnified::Color::fromHexWithAlpha ( uint  value)
static

Construct and return a color initialized to specified red, green, blue and alpha components.

static Color AltusUnified::Color::fromVector ( vec4f  v)
static

Construct and return a color initialized to specified red, green, blue and alpha components.

bool AltusUnified::Color::isBlack ( )

Is this Color black?

static Color AltusUnified::Color::lerp ( Color  first,
Color  second,
double  t 
)
static

Perform a linear interpolation between first and second. When t = 0, this returns first; when t = 1, this returns second.

bool AltusUnified::Color::neq ( Color  other)

Does this Color not equal another?

Parameters
otherThe other Color
void AltusUnified::Color::setSaturation ( float  newSaturation)

Adjust saturation based on 0.0 to 1.0

uint AltusUnified::Color::toHex ( )

Gets a hex representation of this Color as a uint. Alpha is set to FF.

string AltusUnified::Color::toHexString ( )

Gets a hex representation of this Color as a string.

vec4f AltusUnified::Color::toVector ( )

Construct and return a vec4f based on the red, green, blue and alpha components of this Color.

Member Data Documentation

ubyte AltusUnified::Color::a

alpha component

ubyte AltusUnified::Color::b

blue component

ubyte AltusUnified::Color::g

green component

ubyte AltusUnified::Color::r

red component