Skip to main content

Header

Struct Header 

Source
#[non_exhaustive]
pub struct Header { pub width: u32, pub height: u32, pub components: Vec<ComponentInfo>, pub max_reduction: u8, pub quality_layers: u16, pub image_area: Window, pub tiles: TileGrid, pub jp2: Option<Jp2Metadata>, }
Expand description

An image’s header: what decode would return, without the samples.

The fields describe two things. width, height, components and jp2 describe the image a decode under the same options returns, so under read_header_with they follow the options: the reduction, window, tile, component subset, raw_channels and color. image_area, tiles, max_reduction and quality_layers describe the file’s main header, and are the same whatever the options.

The struct is #[non_exhaustive], so more of the header can be added without a breaking change.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§width: u32

The image area’s width, as Image::width: on the reduced grid under a resolution reduction.

§height: u32

The image area’s height, as Image::height: on the reduced grid under a resolution reduction.

§components: Vec<ComponentInfo>

One entry per Image::components entry, in the same order: for a palettized JP2 file, the palette’s channels.

§max_reduction: u8

The largest resolution_reduction the main header allows: the fewest decomposition levels any component has in the main header’s COD and COC markers. A larger reduction is Error::InvalidOptions. A tile-part COD or COC with fewer levels can still refuse a reduction up to this one, but only the decode finds that.

§quality_layers: u16

The number of quality layers the main header’s COD marker declares (SGcod, at least 1). A max_quality_layers cap (set with with_max_quality_layers) at or past it decodes every layer of a tile that keeps this COD. A tile-part COD can declare another count for its tile, and only the decode reads that.

§image_area: Window

The image area on the reference grid, as the SIZ marker declares it: XOsiz..Xsiz by YOsiz..Ysiz, at full resolution. A Region::Window is in the same coordinates, so a window of the image’s top-left 64 x 64 samples starts at (image_area.x0, image_area.y0), not at (0, 0).

§tiles: TileGrid

The tile grid the SIZ marker declares. Its count is how many tiles Region::Tile can name: 0 to count() - 1.

§jp2: Option<Jp2Metadata>

What decode would put on Image::jp2: None for a raw codestream.

Trait Implementations§

Source§

impl Clone for Header

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Header

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Header

Source§

impl PartialEq for Header

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Header

Auto Trait Implementations§

§

impl Forget for Header

§

impl Freeze for Header

§

impl Move for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnsafeUnpin for Header

§

impl UnwindSafe for Header

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.