module charge.math.color
Math

Source file for colors used in graphics.

Code Map

//! Source file for colors used in graphics.
module charge.math.color;


//! A color value with 8 bits of unsigned values per channel.
struct Color4b
{
public:
	r: u8;
	g: u8;
	b: u8;
	a: u8;
	global White: const(Color4b);
	global Black: const(Color4b);


public:
	fn modulate(c: Color4b) { }
	fn blend(c: Color4b) { }
	fn toString() string { }
	fn toABGR() u32 { }
	fn toRGBA() u32 { }
	fn opEquals(other: Color4b) bool { }


public:
	static fn from(rf: f32, gf: f32, bf: f32, af: f32) Color4b { }
	static fn from(r: u8, g: u8, b: u8, a: u8) Color4b { }
	//! Converts a little endian RGBA value to little endian ABGR.
	static fn fromRGBA(value: u32) Color4b { }
	//! Read a little endian ABGR.
	static fn fromABGR(value: u32) Color4b { }
}

struct Color3f
{
public:
	r: f32;
	g: f32;
	b: f32;
	global White: const(Color3f);
	global Black: const(Color3f);


public:
	fn toString() string { }
	fn ptr() f32* { }


public:
	static fn from(r: f32, g: f32, b: f32) Color3f { }
	static fn from(c: Color4b) Color3f { }
}

struct Color4f
{
public:
	r: f32;
	g: f32;
	b: f32;
	a: f32;
	global White: const(Color4f);
	global Black: const(Color4f);


public:
	fn opAddAssign(c: Color4b) { }
	fn opMulAssign(f: f32) { }
	fn toString() string { }
	fn toABGR() u32 { }
	fn toRGBA() u32 { }
	fn ptr() f32* { }


public:
	static fn from(c: Color4b) Color4f { }
	static fn from(c: Color3f) Color4f { }
	static fn from(r: f32, g: f32, b: f32) Color4f { }
	static fn from(r: f32, g: f32, b: f32, a: f32) Color4f { }
}
struct Color4b

A color value with 8 bits of unsigned values per channel.

Is layed out in memory in r, g, b, a order. For little endian machines this means that reading the color as a u32 it will return it in ABGR form.

fn fromRGBA(value: u32) Color4b

Converts a little endian RGBA value to little endian ABGR.

fn fromABGR(value: u32) Color4b

Read a little endian ABGR.