colortypes-0.6.0 has been yanked.
colortypes
A type safe color conversion library
This crate provides many methods for converting between color types.
Everything is implemented abstractly, and is easily extensible by the user.
When converting you call the from_color method of the colortype struct on your color!
Implemented conversions:
| From | To | Method |
|---|---|---|
| RGB | XYZ | Directly |
| RGB | HSV | Directly |
| RGB | HSL | Directly |
| RGB | LCH | Through XYZ |
| RGB | LAB | Through XYZ |
| LAB | LCH | Directly |
| RGB | YcBcR | Directly |
Example usage
use *;
Colors also implement as methods the following f64 methods directly:
sqrt, cbrt, cos, cosh, acos, acosh, sin, sinh, asin, asinh, tan, tanh, atan, atanh,abs, floor, ceil, round, exp, exp2, exp_m1, ln, ln_1p, log2, log10, recip, signum, powf, atan2, log, max, min, hypot, div_euclid, rem_euclid, mul_add, clamp
let new_color = my_color.mul_add_color;
Complex Usage
pub const MYCOLORSPACE: ColorGamut = ColorGamut ;
// With this you can define your own custom color space
impl_colorspace!
// You'll notice
// [0.0..1.0, 0.0..1.0, 0.0..1.0]
// These are the ranges for each channel
// Heres CIELCH for example
impl_colorspace!
// Then you can implement your conversion method
impl_conversion!;
Images
This crate also provides a type for dealing with images, it's still work in progress
use ;
There are also various iteration methods for Image
// There are various iteration methods
pixels
pixels_mut
pixels_zip
pixels_mut_zip
pixels_zip_mut
pixels_mut_zip_mut
for_each_pixel
for_each_pixel_mut
map_pixels
map_f
map_pixels_with