Struct Layer

pub struct Layer<Channels> { pub channel_data: Channels, pub attributes: LayerAttributes, pub size: Vec2<usize>, pub encoding: Encoding }

A single Layer, including fancy attributes and compression settings. Channels can be either SpecificChannels or AnyChannels

Fields

channel_data: Channels

The actual pixel data. Either SpecificChannels or AnyChannels

attributes: LayerAttributes

Attributes that apply to this layer. May still contain attributes that should be considered global for an image file. Excludes technical meta data: Does not contain data window size, line order, tiling, or compression attributes. The image also has attributes, which do not differ per layer.

size: Vec2<usize>

The pixel resolution of this layer. See layer.attributes for more attributes, like for example layer position.

encoding: Encoding

How the pixels are split up and compressed.

Implementations

impl Layer<AnyChannels<FlatSamples>>

fn sample_vec_at(&self, position: Vec2<usize>) -> FlatSamplesPixel

Use samples_at if you can borrow from this layer

const fn samples_at(&self, position: Vec2<usize>) -> FlatSampleIterator<'_>

Lookup all channels of a single pixel in the image

impl<'s, ChannelData: 's> Layer<ChannelData>

fn new(dimensions: impl Into<Vec2<usize>>, attributes: LayerAttributes, encoding: Encoding, channels: ChannelData) -> Self
where
    ChannelData: WritableChannels<'s>,

Create a layer with the specified size, attributes, encoding and channels. The channels can be either SpecificChannels or AnyChannels.

fn levels_with_resolution<'l, L>(&self, levels: &'l Levels<L>) -> Box<dyn Iterator<Item = (&'l L, Vec2<usize>)> + 'l>

Panics for images with Scanline encoding.

impl<Channels> Layer<Channels>

fn absolute_bounds(&self) -> IntegerBounds

Sometimes called "data window"

Trait Implementations

impl ApplyCroppedView for Layer<CroppedChannels<AnyChannels<FlatSamples>>>

type Reallocated = Layer<AnyChannels<FlatSamples>>;
fn reallocate_cropped(self) -> Self::Reallocated

impl InspectSample for Layer<AnyChannels<FlatSamples>>

type Sample = SmallVec<[Sample; 8]>;
fn inspect_sample(&self, local_index: Vec2<usize>) -> FlatSamplesPixel

impl<'slf, Channels: WritableChannels<'slf>> WritableLayers<'slf> for Layer<Channels>

type Writer = LayerWriter<<Channels as WritableChannels<'slf>>::Writer>;
fn infer_headers(&self, image_attributes: &ImageAttributes) -> Headers
fn create_writer(&'slf self, headers: &[Header]) -> Self::Writer

impl<Channels> Crop for Layer<Channels>

type Cropped = Layer<CroppedChannels<Channels>>;
fn crop(self, bounds: IntegerBounds) -> Self::Cropped

impl<Channels: Clone> Clone for Layer<Channels>

fn clone(&self) -> Self

impl<Channels: Debug> Debug for Layer<Channels>

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

impl<Channels: PartialEq> PartialEq for Layer<Channels>

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

impl<Channels: PartialEq> StructuralPartialEq for Layer<Channels>

impl<Px, Desc> ValidateResult for Layer<SpecificChannels<Px, Desc>> where SpecificChannels<Px, Desc>: ValidateResult,

fn validate_result(&self, other: &Self, _overridden: ValidationOptions, location: impl Fn() -> String) -> ValidationResult

This does an approximate comparison for all channels, even if some channels can be compressed without loss.

impl<S> GetBounds for Layer<S>

fn bounds(&self) -> IntegerBounds

impl<S> ValidateResult for Layer<AnyChannels<S>> where AnyChannel<S>: ValidateResult, S: for<'a> WritableSamples<'a>,

fn validate_result(&self, other: &Self, _overridden: ValidationOptions, location: impl Fn() -> String) -> ValidationResult

impl<Samples, Channels> InspectSample for Layer<SpecificChannels<Samples, Channels>> where Samples: GetPixel,

type Sample = <Samples as GetPixel>::Pixel;
fn inspect_sample(&self, local_index: Vec2<usize>) -> Samples::Pixel

Auto Trait Implementations

impl<Channels> Freeze for Layer<Channels> where Channels: Freeze,

impl<Channels> RefUnwindSafe for Layer<Channels> where Channels: RefUnwindSafe,

impl<Channels> Send for Layer<Channels> where Channels: Send,

impl<Channels> Sync for Layer<Channels> where Channels: Sync,

impl<Channels> Unpin for Layer<Channels> where Channels: Unpin,

impl<Channels> UnsafeUnpin for Layer<Channels> where Channels: UnsafeUnpin,

impl<Channels> UnwindSafe for Layer<Channels> where Channels: UnwindSafe,

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for Layer<Channels> where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for Layer<Channels> where ST: ?Sized, DT: ?Sized,

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

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

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

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

impl<T> CropWhere<<T as InspectSample>::Sample> for Layer<Channels> where T: Crop + InspectSample,

impl<T> From<T> for Layer<Channels>

impl<T> Pointable for Layer<Channels>

impl<T> Read<Exclusive, BecauseExclusive> for Layer<Channels> where T: ?Sized,

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

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

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

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