TBZColor32Type = packed array[0..3] of byte;
{ Color format RGBA 32 bits }
TBZColor32 = Record
private
function getColorComponent(Index : Integer): byte;
procedure SetColorComponent(Index : Integer; aValue:Byte);
public
{ Create from x,y,z,w values. Default value for W = 255 }
procedure Create(const aRed, aGreen, aBlue : Byte; const aAlpha : Byte=255); overload;
{ Create from a TBZColor24 and w value. Default value for W = 255 }
procedure Create(Const aValue : TBZColor24 ; const aW : Byte = 255); overload; //TBZColor24
{ Create from a TBZVector3b and w value. Default value for W = 255 }
procedure Create(Const aValue : TBZVector3b ; const aW : Byte = 255); overload; //TBZColor24
{ Return Vector to a formatted string eg "(x, y, z, w)" }
function ToString : String;
{ Add two TBZColor32.
Alpha is not compute, default Alpha same As first Operand A.
Use AddWithAlpha instead if you want compute Alpha to.}
class operator +(constref A, B: TBZColor32): TBZColor32; overload;
{ Sub two TBZColor32.
Alpha is not compute, default Alpha same As first Operand A.
Use SubWithAlpha instead if you want compute Alpha to.}
class operator -(constref A, B: TBZColor32): TBZColor32; overload;
{ Multiply two TBZColor32.
Alpha is not compute, default Alpha same As first Operand A.
Use MulWithAlpha instead if you want compute Alpha to.}
class operator *(constref A, B: TBZColor32): TBZColor32; overload;
{ Divide two TBZColor32.
Alpha is not compute, default Alpha same As first Operand A.
Use DivWithAlpha instead if you want compute Alpha to.}
class operator Div(constref A, B: TBZColor32): TBZColor32; overload;
{ Add one Byte to each component of a TBZColor32.
Alpha is not compute, default Alpha same As first Operand A.
Use AddWithAlpha instead if you want compute Alpha to.}
class operator +(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
{ Sub one Byte to each component of a TBZColor32.
Alpha is not compute, default Alpha same As first Operand A.
Use SubWithAlpha instead if you compute Alpha to.}
class operator -(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
{ Multiply each component of a TBZColor32 by one Byte.
Alpha is not compute, default Alpha same As first Operand A.
Use MulWithAlpha instead if you compute Alpha to.}
class operator *(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
{ Multiply each componentof a TBZColor32 by one Float.
Alpha is not compute, default Alpha same As first Operand A.
Use MulWithAlpha instead if you compute Alpha to.}
class operator *(constref A: TBZColor32; constref B:Single): TBZColor32; overload;
{ Divide each component of a TBZColor32by one Byte.
Alpha is not compute, default Alpha same As first Operand A.
Use DivWithAlpha instead if you compute Alpha to.}
class operator Div(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
{ Compare if two TBZColor32 are equal with Alpha }
class operator =(constref A, B: TBZColor32): Boolean;
{ Compare if two TBZColor32 are not equal with Alpha }
class operator <>(constref A, B: TBZColor32): Boolean;
{ Operator @bold(AND) two TBZColor32
Alpha is not compute, default Alpha same As first Operand A. }
class operator And(constref A, B: TBZColor32): TBZColor32; overload;
{ Operator @bold(OR) two TBZColor32
Alpha is not compute, default Alpha same As first Operand A. }
class operator Or(constref A, B: TBZColor32): TBZColor32; overload;
{ Operator @bold(XOR) two TBZColor32
Alpha is not compute, default Alpha same As first Operand A. }
class operator Xor(constref A, B: TBZColor32): TBZColor32; overload;
{ Operator @bold(AND) one TBZColor32 and one Byte
Alpha is not compute, default Alpha same As first Operand A. }
class operator And(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
{ Operator @bold(OR) one TBZColor32 and one Byte }
class operator or(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
{ Operator @bold(XOR) one TBZColor32 and one Byte
Alpha is not compute, default Alpha same As first Operand A. }
class operator Xor(constref A: TBZColor32; constref B:Byte): TBZColor32; overload;
.....
{ Access properties }
Case Integer of
0 : (V:TBZColor32Type); //< Array access
1 : (X, Y, Z, W : Byte); //< Legacy vector access
//2 : (Red, Green, Blue, Alpha:Byte); //< As Color component
2 : (AsVector3b : TBZVector3b); //< As TBZVector3b
3 : (AsInteger : Cardinal); //< As 32 bit Integer
end;
PBZColor32 = ^TBZColor32;
TBZColor = TBZColor32;