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: ChannelsThe actual pixel data. Either
SpecificChannelsorAnyChannelsattributes: LayerAttributesAttributes 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.attributesfor more attributes, like for example layer position.encoding: EncodingHow the pixels are split up and compressed.
Implementations
impl Layer<AnyChannels<FlatSamples>>
fn sample_vec_at(&self, position: Vec2<usize>) -> FlatSamplesPixelUse
samples_atif you can borrow from this layerconst 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
SpecificChannelsorAnyChannels.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) -> IntegerBoundsSometimes 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) -> Headersfn 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) -> ValidationResultThis 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