pub struct TileBuffer {
pub region: TileRegion,
pub data: Vec<u8>,
pub stride: usize,
pub channels: u8,
}Expand description
Raw pixel data extracted from (or destined for) a single tile.
use oximedia_codec::tile_encoder::{TileRegion, TileBuffer};
let region = TileRegion::new(0, 0, 0, 0, 4, 4);
let buf = TileBuffer::new(region, 3); // 3 channels (RGB)
assert_eq!(buf.data.len(), 4 * 4 * 3);
assert_eq!(buf.stride, 4 * 3);Fields§
§region: TileRegionSpatial position of this tile in the frame.
data: Vec<u8>Raw pixel bytes for this tile (row-major, tightly packed).
stride: usizeRow stride in bytes (width * channels).
channels: u8Bytes per pixel.
Implementations§
Source§impl TileBuffer
impl TileBuffer
Sourcepub fn new(region: TileRegion, channels: u8) -> Self
pub fn new(region: TileRegion, channels: u8) -> Self
Allocate an all-zero TileBuffer for region with channels bytes per pixel.
Sourcepub fn extract_from_frame(&mut self, frame: &[u8], frame_stride: usize)
pub fn extract_from_frame(&mut self, frame: &[u8], frame_stride: usize)
Copy the tile’s pixels from frame (a packed, row-major buffer).
frame_stride is the number of bytes per row in the full frame
(i.e. frame_width * channels).
Sourcepub fn write_to_frame(&self, frame: &mut [u8], frame_stride: usize)
pub fn write_to_frame(&self, frame: &mut [u8], frame_stride: usize)
Write this tile’s pixels back into frame.
frame_stride must match the full frame’s row stride.
Trait Implementations§
Source§impl Clone for TileBuffer
impl Clone for TileBuffer
Source§fn clone(&self) -> TileBuffer
fn clone(&self) -> TileBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TileBuffer
impl RefUnwindSafe for TileBuffer
impl Send for TileBuffer
impl Sync for TileBuffer
impl Unpin for TileBuffer
impl UnsafeUnpin for TileBuffer
impl UnwindSafe for TileBuffer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more