module Color:sig..end
Color provides some function to operate on color values
and basic support for ICC based color profiles to
precisely specify how to interpret raw color samples.
typet =Gg.color
0., a fully transparent color, to 1. a completly opaque
one.typestops =(float * Gg.color) list
val v : float -> float -> float -> float -> Gg.colorv r g b a is the linear sRGB color (r, g, b, a) as
a color value.val v_srgb : ?a:float -> float -> float -> float -> Gg.colorv r g b ~a is the sRGB color (r, g, b, a) converted to a color
value.val v_srgbi : ?a:float -> int -> int -> int -> Gg.colorv_srgbi r g b ~a is the sRGB color (r,g,b,a) converted to
a color value by (v_srgb (float r /. 255.) (float g /. 255.)
(float b /. 255.) ~a)val r : Gg.color -> floatr c is the red component of c.val g : Gg.color -> floatg c is the green component of c.val b : Gg.color -> floatb c is the blue component of c.val a : Gg.color -> floata c is the alpha component of c.val void : Gg.colorvoid is (v 0. 0. 0. 0.) an invisible color.val black : Gg.colorblack is (v 0. 0. 0. 1.)val gray : ?a:float -> float -> Gg.colorgray a g is the sRGB color (g, g, g, a) converted to color a
value.val white : Gg.colorwhite is (v 1. 1. 1. 1.)val red : Gg.colorred is (v 1. 0. 0. 1.)val green : Gg.colorgreen is (v 0. 1. 0. 1.)val blue : Gg.colorblue is (v 0. 0. 1. 1.)val blend : Gg.color -> Gg.color -> Gg.colorblend src dst is src blended over dst using
source over destination alpha blending. See Alvy Ray Smith. Image
compositing fundamentals. 1995.val clamp : Gg.color -> Gg.colorclamp c is c with all components clamped to [0;1]. nan
components are left untouched.val with_a : Gg.color -> float -> Gg.colorwith_a c a is the same color as c but with the alpha
component a.
Note. In the following conversions all color spaces carry an
alpha component. The alpha component is always left untouched
by the conversions.
typesrgb =Gg.v4
val of_srgb : srgb -> Gg.colorof_srgb c is the sRGB color c as a Gg color.val to_srgb : Gg.color -> srgbto_srgb c is the Gg color c as a sRGB color.typeluv =Gg.v4
0. to 100.-134. to 220.-140. to 122.val of_luv : luv -> Gg.colorof_luv c is the L*u*v* color c as a Gg color.val to_luv : Gg.color -> luvto_luv c is the Gg color c as a L*u*v* color.typelch_uv =Gg.v4
0. to 100.0. to 260.77 in practice.0. to 2pi.val of_lch_uv : lch_uv -> Gg.colorof_lch_uv c is the L*C*huv color c as a Gg color.val to_lch_uv : Gg.color -> lch_uvto_lch_uv c is the Gg color c as a L*C*huv.typelab =Gg.v4
0. to 100.-128. to 127.val of_lab : Gg.v4 -> Gg.colorof_lab c is the L*a*b* color c as a Gg color value.val to_lab : Gg.color -> Gg.v4to_lab c is the Gg color c as a L*a*b* color.typelch_ab =Gg.v4
0. to 100.0. to
181.02, but less in practice.0. to 2pi.val of_lch_ab : lch_ab -> Gg.colorof_lch_ab c is the L*C*hab color c as a Gg color.val to_lch_ab : Gg.color -> lch_abto_lch_ab c is the Gg color c as a L*C*hab.typespace =[ `CLR2
| `CLR3
| `CLR4
| `CLR5
| `CLR6
| `CLR7
| `CLR8
| `CLR9
| `CLRA
| `CLRB
| `CLRC
| `CLRD
| `CLRE
| `CLRF
| `CMY
| `CMYK
| `Gray
| `HLS
| `HSV
| `Lab
| `Luv
| `RGB
| `XYZ
| `YCbr
| `Yxy ]
val space_dim : space -> intspace_dim s is the dimension of the color space s.val pp_space : Format.formatter -> space -> unitpp_space s prints a textual representation of s on ppf.type profile
This module defines only a profile for the color space of
Gg.color and a grayscale color space.
val profile_of_icc : string -> profile optionprofile_of_icc s is a profile from the ICC profile byte
stream s. None is returned if s doesn't seem to be a ICC profile.
Note A profile value is returned if a color space can be
extracted, it doesn't guarantee a correct ICC profile byte stream.
val profile_to_icc : profile -> stringprofile_to_icc p is p's ICC profile byte stream.val profile_space : profile -> spaceprofile_space p is p's color space.val profile_dim : profile -> intprofile_space p is space_dim (profile_space d).val p_gray_l : profilep_gray_l is a linear gray color profileval p_rgb_l : profile