color.eh
Header for easily manipulating pixels More...
Types
Functions
Description
Type details
type Color {
r: Int = 0,
g: Int = 0,
b: Int = 0
} |
A structure that defines a single pixel with colors made up of red, green, and blue components ranging from 0 (0x00) to 255 (0xFF) each.
Function details
Will return the distance of the 3D vector (r, g, b) from the center (0, 0, 0) in the 3D cartesian plane.
This function is NOT made for accuracy but for speed.
Therefore, it returns values from 0 to 195,075 instead of 0 to 0 to 441.
Will subtract two colors, returns
new Color(this.r-c.r, this.g-c.g, this.b-c.b)
Will convert a Color to Int, suitable for using in
Graphics.set_color()
Int is in the form of
0xRRGGBB
.
def Color.luminosity(): Color;
|
Converts a Color into greyscale.
def Color.closest_index(pal: List): Int;
|
Will return the index of the closest color in the palette as compared to this.
Will return the closest Color in the palette as compared to this.
Will return a pixel from this Image coordinates (x, y).
If coordinates is bigger than image, will return an error.
Returns width of image.
Returns height of image.
Returns the index of the highest number in the list.
def Color.correct(): Color;
|
Will check if the Color contains valid values, and correct them accordingly.
Add two colors together, returning
new Color(this.r+c.r, this.g+c.g, this.b+c.b)
.
Add a greyscale color to this, returning
new Color(this.r+i, this.g+i, this.b+i)
.
Multiply a color by a/b, returning
new Color(this.r*a/b, this.g*a/b, this.b*a/b)
.
Will return a pixel from this Image coordinates (x, y).
If coordinates is bigger than image, will return
new Color(0, 0, 0)
.
Convert color to HTML format, returns a string "#RRGGBB"
Convert an Int to color. Int should be in 0xRRGGBB format.