namespace sys.core
class ColorRGBA
A class representing a logical red, green, blue and alpha channeled color as an object storing each component as 8 bit unsigned integers, using a memory order of red, green, blue and alpha.
This class is only suited for storing low dynamic range colors.
Since all channels are represented using 8 bit unsigned integers, this class is better suited for storing colors rather than manipulating them. But it still has the full set of manipulation API.
this{value: Int};
this{value: DWord};
this{value: Float};
this{value: Double};
this{red: Int, green: Int, blue: Int};
this{red: DWord, green: DWord, blue: DWord};
this{red: Float, green: Float, blue: Float};
this{red: Double, green: Double, blue: Double};
this{red: Int, green: Int, blue: Int, alpha: Int};
this{red: DWord, green: DWord, blue: DWord, alpha: DWord};
this{red: Float, green: Float, blue: Float, alpha: Float};
this{red: Double, green: Double, blue: Double, alpha: Double};
Creates a new instance initializing each component of the color.
If an input component is missing, it will be initialized to the maximum value.
Floating point values are interpreted as having a range of 0.0 to 1.0.
value | the value to use for each component |
---|---|
red | the red component |
green | the green component |
blue | the blue component |
alpha | the alpha component |
this FromUncapped{red: Int, green: Int, blue: Int, alpha: Int};
this FromUncapped{red: DWord, green: DWord, blue: DWord, alpha: DWord};
this FromUncapped{red: Float, green: Float, blue: Float, alpha: Float};
this FromUncapped{red: Double, green: Double, blue: Double, alpha: Double};
Creates a new instance initializing each component of the color from uncapped values. Each input is clamped to the valid range of the color.
Floating point values are interpreted as having a range of 0.0 to 1.0.
red | the red component |
---|---|
green | the green component |
blue | the blue component |
alpha | the alpha component |
this FromRGBA{rgba: DWord};
Creates a new color from an integer encoded in the RGBA memory layout.
rgba | the color integer |
---|
this FromBGRA{bgra: DWord};
Creates a new color from an integer encoded in the BGRA memory layout.
bgra | the color integer |
---|
this FromARGB{argb: DWord};
Creates a new color from an integer encoded in the ARGB memory layout.
argb | the color integer |
---|
this FromABGR{abgr: DWord};
Creates a new color from an integer encoded in the ABGR memory layout.
abgr | the color integer |
---|
func ToRGBA(): DWord;
Encodes the color to an integer using the RGBA memory layout.
the resulting integer
func ToBGRA(): DWord;
Encodes the color to an integer using the BGRA memory layout.
the resulting integer
func ToARGB(): DWord;
Encodes the color to an integer using the ARGB memory layout.
the resulting integer
func ToABGR(): DWord;
Encodes the color to an integer using the ABGR memory layout.
the resulting integer
def Clamp(min: ColorRGBA, max: ColorRGBA);
def Clamp(min: Byte, max: Byte);
Clamps each component of the current mutable instance between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
func Clamped(min: ColorRGBA, max: ColorRGBA): ColorRGBA;
func Clamped(min: Byte, max: Byte): ColorRGBA;
Returns a copy of the color with each component clamped between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
the clamped value
func GetMin(min: ColorRGBA): ColorRGBA;
Returns the member-wise minimum between the current instance and the input.
min | the value to test against |
---|
the member-wise minimum
func GetMax(max: ColorRGBA): ColorRGBA;
Returns the member-wise maximum between the current instance and the input.
max | the value to test against |
---|
the member-wise maximum
func @add(second: ColorRGBA): ColorRGBA;
func @add(second: Int): ColorRGBA;
func @add(second: DWord): ColorRGBA;
func @add(second: Float): ColorRGBA;
func @add(second: Double): ColorRGBA;
Member-wise addition operator. Commutative.
second | the second operand |
---|
the member-wise sum
static func @sub(left: ColorRGBA, right: ColorRGBA): ColorRGBA;
static func @sub(left: Int, right: ColorRGBA): ColorRGBA;
static func @sub(left: ColorRGBA, right: Int): ColorRGBA;
static func @sub(left: DWord, right: ColorRGBA): ColorRGBA;
static func @sub(left: ColorRGBA, right: DWord): ColorRGBA;
static func @sub(left: Float, right: ColorRGBA): ColorRGBA;
static func @sub(left: ColorRGBA, right: Float): ColorRGBA;
static func @sub(left: Double, right: ColorRGBA): ColorRGBA;
static func @sub(left: ColorRGBA, right: Double): ColorRGBA;
Member-wise subtraction operator.
left | the left operand |
---|---|
right | the right operand |
the member-wise subtraction
func @mul(second: ColorRGBA): ColorRGBA;
func @mul(second: Int): ColorRGBA;
func @mul(second: DWord): ColorRGBA;
func @mul(second: Float): ColorRGBA;
func @mul(second: Double): ColorRGBA;
Member-wise multiplication operator. Commutative.
second | the second operand |
---|
the member-wise multiplication
static func @div(left: ColorRGBA, right: ColorRGBA): ColorRGBA;
static func @div(left: Int, right: ColorRGBA): ColorRGBA;
static func @div(left: ColorRGBA, right: Int): ColorRGBA;
static func @div(left: DWord, right: ColorRGBA): ColorRGBA;
static func @div(left: ColorRGBA, right: DWord): ColorRGBA;
static func @div(left: Float, right: ColorRGBA): ColorRGBA;
static func @div(left: ColorRGBA, right: Float): ColorRGBA;
static func @div(left: Double, right: ColorRGBA): ColorRGBA;
static func @div(left: ColorRGBA, right: Double): ColorRGBA;
Member-wise division operator.
left | the left operand |
---|---|
right | the right operand |
the member-wise division
static func @mod(left: ColorRGBA, right: ColorRGBA): ColorRGBA;
static func @mod(left: Int, right: ColorRGBA): ColorRGBA;
static func @mod(left: ColorRGBA, right: Int): ColorRGBA;
static func @mod(left: DWord, right: ColorRGBA): ColorRGBA;
static func @mod(left: ColorRGBA, right: DWord): ColorRGBA;
static func @mod(left: Float, right: ColorRGBA): ColorRGBA;
static func @mod(left: ColorRGBA, right: Float): ColorRGBA;
static func @mod(left: Double, right: ColorRGBA): ColorRGBA;
static func @mod(left: ColorRGBA, right: Double): ColorRGBA;
Member-wise modulo operator.
left | the left operand |
---|---|
right | the right operand |
the member-wise modulo
func @eq(second: Int): Bool;
func @eq(second: DWord): Bool;
func @eq(second: Float): Bool;
func @eq(second: Double): Bool;
Member-wise equality operator.
second | the second operand |
---|
true on equality
func @neq(second: Int): Bool;
func @neq(second: DWord): Bool;
func @neq(second: Float): Bool;
func @neq(second: Double): Bool;
Member-wise inequality operator.
second | the second operand |
---|
true on inequality
val R: Byte;
The red component.
val G: Byte;
The green component.
val B: Byte;
The blue component.
val A: Byte;
The alpha component.