tpt-cv-core 0.1.0

Zero-copy image buffers, color spaces, and pixel math (no_std)
Documentation
// SPDX-License-Identifier: MIT OR Apache-2.0

//! `tpt-cv-core` — zero-copy image buffers, color spaces, and pixel math.
//!
//! This crate is `no_std` capable: the core math has zero `alloc` dependency in
//! the `no_std` path. Allocating types (owned images, vectors) require the
//! `alloc` or `std` features.
//!
//! # Example
//!
//! ```
//! use tpt_cv_core::image::{Image, ImageBuf};
//! use tpt_cv_core::pixel::Pixel;
//! use tpt_cv_core::ops;
//!
//! // Borrow a byte slice as a 2×1 RGB image (zero-copy).
//! let img = Image::<_, 3>::new(&[10u8, 20, 30, 40, 50, 60], 2, 1).unwrap();
//! assert_eq!(img.pixel(1, 0).channels, [40, 50, 60]);
//!
//! // Owned image + saturating arithmetic into a caller-provided destination.
//! let a = ImageBuf::<u8, 1>::with_value(2, 1, 250);
//! let b = ImageBuf::<u8, 1>::with_value(2, 1, 10);
//! let mut dst = ImageBuf::<u8, 1>::new(2, 1);
//! assert!(ops::add_sat(&a.as_image(), &b.as_image(), &mut dst.as_image_mut()));
//! assert_eq!(dst.as_image().pixel(0, 0).scalar(), 255); // saturating, not 260
//! ```

#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "portable-simd", feature(portable_simd))]
#![deny(missing_docs)]
#![deny(unsafe_op_in_unsafe_fn)]

extern crate alloc;

pub mod color;
pub mod image;
pub mod ops;
pub mod pixel;