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
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,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Layer<Channels>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Layer<Channels>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Layer<Channels>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> CropWhere<<T as InspectSample>::Sample> for Layer<Channels>
where
T: Crop + InspectSample,
type Cropped = <T as Crop>::Cropped;fn crop_where(self, discard_if: impl Fn(<T as InspectSample>::Sample) -> bool) -> CropResult<<T as CropWhere<<T as InspectSample>::Sample>>::Cropped, T>fn crop_where_eq(self, discard_color: impl Into<<T as InspectSample>::Sample>) -> CropResult<<T as CropWhere<<T as InspectSample>::Sample>>::Cropped, T> where <T as InspectSample>::Sample: PartialEq,fn crop_nowhere(self) -> <T as CropWhere<<T as InspectSample>::Sample>>::Cropped
impl<T> From<T> for Layer<Channels>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for Layer<Channels>
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for Layer<Channels>
where
T: ?Sized,
impl<T> ToOwned for Layer<Channels>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Layer<Channels>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Layer<Channels>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Layer<Channels>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>