pub struct DTM {
pub pixel_size: u32,
pub channel_count: u32,
pub width: u32,
pub height: u32,
}Expand description
The descriptor of a DTM image.
This value is parsed from the image header during decoding or is specified for encoding.
Fields§
§pixel_size: u32§channel_count: u32§width: u32§height: u32Implementations§
Source§impl DTM
impl DTM
Sourcepub fn decode_file<P: AsRef<Path>>(
path: P,
) -> Result<(Self, Vec<u8>), DecodeError>
pub fn decode_file<P: AsRef<Path>>( path: P, ) -> Result<(Self, Vec<u8>), DecodeError>
Decodes a DTM image from a file into a newly allocated Vec.
Sourcepub fn decode(encoded: &[u8], decoded: &mut [u8]) -> Result<Self, DecodeError>
pub fn decode(encoded: &[u8], decoded: &mut [u8]) -> Result<Self, DecodeError>
Decodes a DTM image from a byte slice into the decoded slice.
Sourcepub fn decode_alloc(encoded: &[u8]) -> Result<(Self, Vec<u8>), DecodeError>
pub fn decode_alloc(encoded: &[u8]) -> Result<(Self, Vec<u8>), DecodeError>
Decodes a DTM image from a byte slice into a newly allocated Vec.
Source§impl DTM
impl DTM
Sourcepub fn encode_file<P: AsRef<Path>>(
&self,
path: P,
decoded: &[u8],
) -> Result<(), EncodeError>
pub fn encode_file<P: AsRef<Path>>( &self, path: P, decoded: &[u8], ) -> Result<(), EncodeError>
Encodes a DTM image from a pixel slice into a file.
Sourcepub fn encode_alloc(&self, decoded: &[u8]) -> Result<Vec<u8>, EncodeError>
pub fn encode_alloc(&self, decoded: &[u8]) -> Result<Vec<u8>, EncodeError>
Encodes a DTM image from a pixel slice into a newly allocated Vec.
Source§impl DTM
impl DTM
Sourcepub fn image_size(&self) -> usize
pub fn image_size(&self) -> usize
Returns the size of the decoded image in bytes .
Sourcepub fn channel_size(&self) -> usize
pub fn channel_size(&self) -> usize
Returns the size of a channel of the decoded image in bytes .
Trait Implementations§
impl Copy for DTM
impl Eq for DTM
impl StructuralPartialEq for DTM
Auto Trait Implementations§
impl Freeze for DTM
impl RefUnwindSafe for DTM
impl Send for DTM
impl Sync for DTM
impl Unpin for DTM
impl UnwindSafe for DTM
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