Skip to main content

TiffWriteSample

Trait TiffWriteSample 

Source
pub trait TiffWriteSample:
    TiffSample
    + Copy
    + Send
    + Sync {
    const SAMPLE_FORMAT: u16;
    const BITS_PER_SAMPLE: u16;
    const BYTES_PER_SAMPLE: usize;

    // Required methods
    fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8> ;
    fn lerc_encode_block(
        samples: &[Self],
        width: u32,
        height: u32,
        depth: u32,
        max_z_error: f64,
        index: usize,
    ) -> Result<Vec<u8>>;
}
Expand description

Types that can be written as TIFF samples.

Required Associated Constants§

Source

const SAMPLE_FORMAT: u16

TIFF SampleFormat code (1=uint, 2=int, 3=float).

Source

const BITS_PER_SAMPLE: u16

TIFF BitsPerSample value.

Source

const BYTES_PER_SAMPLE: usize

Bytes per sample.

Required Methods§

Source

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Encode a slice of samples into file-order bytes.

Source

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Encode a block of samples as a LERC2 blob.

For LERC-compatible types (i8, u8, i16, u16, i32, u32, f32, f64) this delegates to the lerc-writer crate. For types not supported by LERC (u64, i64), this returns an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TiffWriteSample for f32

Source§

const SAMPLE_FORMAT: u16 = 3

Source§

const BITS_PER_SAMPLE: u16 = 32

Source§

const BYTES_PER_SAMPLE: usize = 4

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for f64

Source§

const SAMPLE_FORMAT: u16 = 3

Source§

const BITS_PER_SAMPLE: u16 = 64

Source§

const BYTES_PER_SAMPLE: usize = 8

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for i8

Source§

const SAMPLE_FORMAT: u16 = 2

Source§

const BITS_PER_SAMPLE: u16 = 8

Source§

const BYTES_PER_SAMPLE: usize = 1

Source§

fn encode_slice(samples: &[Self], _byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for i16

Source§

const SAMPLE_FORMAT: u16 = 2

Source§

const BITS_PER_SAMPLE: u16 = 16

Source§

const BYTES_PER_SAMPLE: usize = 2

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for i32

Source§

const SAMPLE_FORMAT: u16 = 2

Source§

const BITS_PER_SAMPLE: u16 = 32

Source§

const BYTES_PER_SAMPLE: usize = 4

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for i64

Source§

const SAMPLE_FORMAT: u16 = 2

Source§

const BITS_PER_SAMPLE: u16 = 64

Source§

const BYTES_PER_SAMPLE: usize = 8

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( _samples: &[Self], _width: u32, _height: u32, _depth: u32, _max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for u8

Source§

const SAMPLE_FORMAT: u16 = 1

Source§

const BITS_PER_SAMPLE: u16 = 8

Source§

const BYTES_PER_SAMPLE: usize = 1

Source§

fn encode_slice(samples: &[Self], _byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for u16

Source§

const SAMPLE_FORMAT: u16 = 1

Source§

const BITS_PER_SAMPLE: u16 = 16

Source§

const BYTES_PER_SAMPLE: usize = 2

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for u32

Source§

const SAMPLE_FORMAT: u16 = 1

Source§

const BITS_PER_SAMPLE: u16 = 32

Source§

const BYTES_PER_SAMPLE: usize = 4

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( samples: &[Self], width: u32, height: u32, depth: u32, max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Source§

impl TiffWriteSample for u64

Source§

const SAMPLE_FORMAT: u16 = 1

Source§

const BITS_PER_SAMPLE: u16 = 64

Source§

const BYTES_PER_SAMPLE: usize = 8

Source§

fn encode_slice(samples: &[Self], byte_order: ByteOrder) -> Vec<u8>

Source§

fn lerc_encode_block( _samples: &[Self], _width: u32, _height: u32, _depth: u32, _max_z_error: f64, index: usize, ) -> Result<Vec<u8>>

Implementors§