Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Spectrum type #70

Closed
wants to merge 13 commits into from
Closed
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ strict = []

[dependencies]
num = "0.1"
ordered-float = "0.5.0"
approx = "0.1"
error-chain = "0.10.0"

[dependencies.phf]
version = "0.7"
Expand Down
12 changes: 12 additions & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//! Module containing the errors that can be
//! produced by the library.

error_chain!{
errors {
/// Error representing an intensity sample being less than zero.
SpectrumIntensityOutOfRange {
description("Spectrum intensity value is out of range.")
display("Spectrum intensity value must be >= 0.")
}
}
}
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,17 @@
#![cfg_attr(feature = "strict", deny(missing_docs))]
#![cfg_attr(feature = "strict", deny(warnings))]

// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]

#[cfg_attr(test, macro_use)]
extern crate approx;

#[macro_use]
extern crate error_chain;

extern crate num;
extern crate ordered_float;

#[cfg(feature = "phf")]
extern crate phf;
Expand All @@ -71,6 +78,7 @@ pub use hsv::{Hsv, Hsva};
pub use hsl::{Hsl, Hsla};
pub use yxy::{Yxy, Yxya};
pub use hwb::{Hwb, Hwba};
pub use spectrum::Spectrum;

pub use hues::{LabHue, RgbHue};
pub use convert::{FromColor, IntoColor};
Expand Down Expand Up @@ -229,6 +237,7 @@ macro_rules! assert_ranges {
);
}

pub mod errors;
pub mod gradient;
pub mod pixel;
pub mod blend;
Expand All @@ -246,6 +255,7 @@ mod lch;
mod hsv;
mod hsl;
mod hwb;
mod spectrum;

mod hues;

Expand Down
Loading