module Color: sig
.. end
Definition of colormaps, i.e. mappings from real RGB colors to
integers. The integer corresponding to a color c
is an index i
into a vector of colors whose i
th element is c
.
exception Too_many_colors
type 'a
map = {
|
mutable max : int ; |
|
mutable map : 'a array ; |
}
This is copied in Images also
val size : 'a map -> int
Colormap manipulation functions
Returns the size of a colormap.
val find_exact : 'a map -> 'a -> int
Finds a color in the colormap and returns its color index.
Raises exception Not_found
if the color is not in the colormap.
val add_color : 'a map -> 'a -> int
Add a new color into the given colormap and return its index.
If the color is already in the colormap, it is not
added again, and the corresponding color index is returned.
val add_colors : 'a map -> 'a list -> int list
Add the list of new colors into the given colormap and return
their indices. If a color is already in the colormap, it is not
added again, and the corresponding color index is returned.
val copy : 'a map -> 'a map
Copy a colormap
module Rgb: sig
.. end
type
rgb = Rgb.t
= {
|
mutable r : int ; |
|
mutable g : int ; |
|
mutable b : int ; |
}
module Rgba: sig
.. end
type
rgba = Rgba.t
= {
|
color : rgb ; |
|
mutable alpha : int ; |
}
RGB with alpha (transparent) information
module Cmyk: sig
.. end
type
cmyk = Cmyk.t
= {
|
mutable c : int ; |
|
mutable m : int ; |
|
mutable y : int ; |
|
mutable k : int ; |
}
Cyan Magenta Yellow blacK color model
val rgb_square_distance : rgb -> rgb -> int
Rgb specialized functions (for backward compatibility)
Compute the distance between two colours.
val plus : rgb -> rgb -> rgb
val minus : rgb -> rgb -> rgb
val brightness : rgb -> int
val color_parse : string -> rgb
val colormap_parse : string array -> rgb array * int