crystal_ball 0.3.0

A path tracing library written in Rust.
Documentation
//! Data types and functions related to colors and images.

pub use color::Color;

pub use self::image::{ColorFormat, Image, Interpolation};
// Use `self` to avoid name conflict with the `image` crate.
pub(crate) use self::image::ImageTile;

mod color;
mod image;

/// A general representation of textures.
///
/// This allows accessing of individual pixels of the respective texture.
pub trait Texture: Send + Sync {
    /// Return the [`Color`] value at the given position.
    ///
    /// `u` and `v` should be in the range \[0, 1\].
    /// While the implementation is left to the user,
    /// it is recommended to wrap the texture if `u` or `v` are out of range.
    fn get_pixel(&self, u: f64, v: f64) -> Color;
}