Skip to main content

PNMHeader

Struct PNMHeader 

Source
pub struct PNMHeader { /* private fields */ }
Expand description

Stores the complete header data of a file.

Internally, provides mechanisms for lossless reencoding. After reading a file with the decoder it is possible to recover the header and construct an encoder. Using the encoder on the just loaded image should result in a byte copy of the original file (for single image pnms without additional trailing data).

Implementations§

Source§

impl PNMHeader

Source

pub fn subtype(&self) -> PNMSubtype

Retrieve the format subtype from which the header was created.

Source

pub fn width(&self) -> u32

The width of the image this header is for.

Source

pub fn height(&self) -> u32

The height of the image this header is for.

Source

pub fn maximal_sample(&self) -> u32

The biggest value a sample can have. In other words, the colour resolution.

Source

pub fn as_bitmap(&self) -> Option<&BitmapHeader>

Retrieve the underlying bitmap header if any

Source

pub fn as_graymap(&self) -> Option<&GraymapHeader>

Retrieve the underlying graymap header if any

Source

pub fn as_pixmap(&self) -> Option<&PixmapHeader>

Retrieve the underlying pixmap header if any

Source

pub fn as_arbitrary(&self) -> Option<&ArbitraryHeader>

Retrieve the underlying arbitrary header if any

Source

pub fn write(&self, writer: &mut dyn Write) -> Result<(), Error>

Write the header back into a binary stream

Trait Implementations§

Source§

impl From<ArbitraryHeader> for PNMHeader

Source§

fn from(header: ArbitraryHeader) -> PNMHeader

Converts to this type from the input type.
Source§

impl From<BitmapHeader> for PNMHeader

Source§

fn from(header: BitmapHeader) -> PNMHeader

Converts to this type from the input type.
Source§

impl From<GraymapHeader> for PNMHeader

Source§

fn from(header: GraymapHeader) -> PNMHeader

Converts to this type from the input type.
Source§

impl From<PixmapHeader> for PNMHeader

Source§

fn from(header: PixmapHeader) -> PNMHeader

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V