pub struct Channel {
pub hshift: u32,
pub vshift: u32,
/* private fields */
}Expand description
A single channel in a modular image.
Channels store i32 values, which can represent:
- Raw pixel values (0-255 for 8-bit, 0-65535 for 16-bit)
- Prediction residuals (can be negative)
- Transformed values (after RCT, Squeeze, etc.)
Fields§
§hshift: u32Horizontal subsampling shift (0 = no subsampling).
vshift: u32Vertical subsampling shift (0 = no subsampling).
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn new(width: usize, height: usize) -> Result<Self>
pub fn new(width: usize, height: usize) -> Result<Self>
Creates a new channel filled with zeros.
Sourcepub fn from_vec(data: Vec<i32>, width: usize, height: usize) -> Result<Self>
pub fn from_vec(data: Vec<i32>, width: usize, height: usize) -> Result<Self>
Creates a channel from existing data.
Sourcepub fn get_clamped(&self, x: isize, y: isize) -> i32
pub fn get_clamped(&self, x: isize, y: isize) -> i32
Gets a pixel with boundary handling (returns 0 outside bounds).
Sourcepub fn get_clamped_to_edge(&self, x: isize, y: isize) -> i32
pub fn get_clamped_to_edge(&self, x: isize, y: isize) -> i32
Gets a pixel, clamping coordinates to valid range.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnwindSafe for Channel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more