pxlfmt/
lib.rs

1//! A foundational crate for type-safe, zero-cost pixel format manipulation.
2//!
3//! ## Features
4//!
5//! ### `bytemuck`
6//!
7//! Implements `bytemuck::{Pod, Zeroable}` for raw pixel wrappers and `Pixel`
8//!
9//! # Example
10//!
11//! ```rust
12//! use pxlfmt::prelude::*;
13//!
14//! // A single pixel in the Rgba8888 format, wrapping a u32 value.
15//! let mut pixel = Pixel::<Rgba8888>::with_rgba(0xFF, 0x00, 0x00, 0xFF);
16//!
17//! // The API provides convenient accessors based on the format.
18//! assert_eq!(pixel.red(), 0xFF);
19//! assert_eq!(pixel.alpha(), 0xFF);
20//!
21//! // Modify the pixel's channels.
22//! pixel.set_green(0x88);
23//! pixel.set_blue(0x44);
24//!
25//! // The underlying raw value reflects the changes.
26//! assert_eq!(pixel.as_raw().into_inner(), 0xFF4488FF);
27//! ```
28
29#![no_std]
30
31pub mod formats;
32pub mod pixel;
33pub mod prelude;
34pub mod uint;
35
36pub(crate) mod internal;