ChunkOpts

Struct ChunkOpts 

Source
pub struct ChunkOpts {
Show 14 fields pub byte_order: ByteOrder, pub image_width: u32, pub image_height: u32, pub bits_per_sample: u8, pub samples: u16, pub sample_format: SampleFormat, pub photometric_interpretation: PhotometricInterpretation, pub compression_method: CompressionMethod, pub predictor: Predictor, pub jpeg_tables: Option<Arc<Vec<u8>>>, pub planar_config: PlanarConfiguration, pub chunk_type: ChunkType, pub strip_decoder: Option<StripDecodeState>, pub tile_attributes: Option<TileAttributes>,
}
Expand description

Struct that holds all relevant metadata that is needed to decode a chunk (strip or tile). this does not include chunkoffsets or -bytes, since those may be partial and then mutated. once we implement partial tags

Fields§

§byte_order: ByteOrder

tiff byte order

§image_width: u32

width of the image in pixels

§image_height: u32

height of the image in pixels

§bits_per_sample: u8

bits per sample

§samples: u16

samples per pixel

§sample_format: SampleFormat

datatype of samples

§photometric_interpretation: PhotometricInterpretation

photometric interpretation

§compression_method: CompressionMethod

compression method

supported decoding:

  • LZW
  • ModernJPEG
  • Deflate
  • `PackBits``
§predictor: Predictor

horizontal predictor type

Allows for more efficient compression

§jpeg_tables: Option<Arc<Vec<u8>>>

Jpeg tables

In case of ModernJPEG compression, the compression infomation can be in this tag, where it is prepended to chunks before decoding. still an Arc, because we want to do error sharing.

§planar_config: PlanarConfiguration

Planar configuration:

example: RGB

  • Chunky: [RGBRGBRGB]
  • Planar: [RRR] [GGG] [BBB]
§chunk_type: ChunkType

Chunk type

Either Strip or Tile Strip => Some(StripDecoder) && None Tile => None && Some(TileAttributes)

§strip_decoder: Option<StripDecodeState>§tile_attributes: Option<TileAttributes>

Implementations§

Source§

impl ChunkOpts

Source

pub fn samples_per_pixel(&self) -> usize

Samples per pixel within chunk.

In planar config, samples are stored in separate strips/chunks, also called bands.

Example with bits_per_sample = [8, 8, 8] and PhotometricInterpretation::RGB:

  • PlanarConfiguration::Chunky -> 3 (RGBRGBRGB…)
  • PlanarConfiguration::Planar -> 1 (RRR…) (GGG…) (BBB…)
Source

pub fn output_row_stride(&self, chunk_index: u32) -> TiffResult<usize>

The length of a chunk row in bytes, taking padding into account.

Source

pub fn chunk_dimensions(&self) -> TiffResult<(u32, u32)>

dimensions of a chunk, not taking padding into account.

Can be directly deduced from ChunkType and corresponding data

Source

pub fn chunk_data_dimensions(&self, chunk_index: u32) -> TiffResult<(u32, u32)>

return the dimensions of an expanded chunk, taking into account padding at the bottom and right side of the file.

Source

pub fn colortype(&self) -> TiffResult<ColorType>

Derive colortype from info

§TODO: fix:
  • RGB++
  • TransparencyMask
  • CIELab

Trait Implementations§

Source§

impl Clone for ChunkOpts

Source§

fn clone(&self) -> ChunkOpts

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ChunkOpts

Source§

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

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

impl PartialEq for ChunkOpts

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ChunkOpts

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.