Skip to main content

Layer

Struct Layer 

Source
pub struct Layer {
Show 21 fields pub main_id: i64, pub name: String, pub kind: LayerKind, pub layer_type: i64, pub visible: bool, pub mask_enabled: bool, pub opacity: i64, pub blend: i64, pub clipping: bool, pub locked: bool, pub folder_flags: i64, pub offset: (i64, i64), pub render_offset: (i64, i64), pub mask_offset: (i64, i64), pub mask_render_offset: (i64, i64), pub render_mipmap: i64, pub mask_mipmap: i64, pub first_child: i64, pub next: i64, pub uuid: Option<String>, pub row: Row,
}
Expand description

One row of Layer, with the commonly used columns typed.

Fields§

§main_id: i64

MainId of the row; other rows refer to the layer by it.

§name: String

Name shown in the layer palette (LayerName).

§kind: LayerKind

What the layer is (derived, see LayerKind).

§layer_type: i64

LayerType as stored.

§visible: bool

LayerVisibility bit 0.

§mask_enabled: bool

LayerVisibility bit 1: the layer mask is applied.

§opacity: i64

0–256 (LayerOpacity, 256 = 100 %).

§blend: i64

LayerComposite.

§clipping: bool

Clipped to the layer below (LayerClip).

§locked: bool

LayerLock is set.

§folder_flags: i64

LayerFolder as stored (bit 0 folder, bit 4 open in the palette).

§offset: (i64, i64)

Layer position on the canvas (LayerOffsetX/Y); pixel, vector and text positions are relative to it.

§render_offset: (i64, i64)

Offset of the render offscreen from offset (LayerRenderOffscrOffsetX/Y).

§mask_offset: (i64, i64)

Offset of the mask from offset (LayerMaskOffsetX/Y).

§mask_render_offset: (i64, i64)

Offset of the mask offscreen from the mask offset (LayerMaskOffscrOffsetX/Y).

§render_mipmap: i64

MainId of the Mipmap row of the layer’s pixels (LayerRenderMipmap, 0 = none).

§mask_mipmap: i64

MainId of the Mipmap row of the mask (LayerLayerMaskMipmap, 0 = none).

§first_child: i64

MainId of the bottom child (LayerFirstChildIndex, 0 = none).

§next: i64

MainId of the sibling above (LayerNextIndex, 0 = none).

§uuid: Option<String>

LayerUuid, when set.

§row: Row

The whole row, for the columns not typed here.

Implementations§

Source§

impl Layer

Source

pub fn from_row(row: Row, vector_layers: &HashSet<i64>) -> Self

Types the columns of a Layer row. vector_layers are the LayerIds of VectorObjectList, used to tell vector layers.

Source

pub fn pixel_origin(&self) -> (i64, i64)

Canvas position of the render offscreen’s top-left pixel.

Source

pub fn mask_origin(&self) -> (i64, i64)

Canvas position of the mask offscreen’s top-left pixel. The mask offsets are relative to the layer’s offset (a moved layer keeps its mask in place: offset (7018, 1) with mask offset (−7018, −1) puts a canvas-sized mask at (0, 0)).

Source

pub fn has_mask(&self) -> bool

The layer has a mask.

Source

pub fn opacity_fraction(&self) -> f64

Opacity as 0.0–1.0.

Source

pub fn is_open(&self) -> bool

Folder shown expanded in the layer palette (LayerFolder bit 4).

Source

pub fn color(&self, prefix: &str) -> Option<[u8; 3]>

A colour column pair as 8-bit RGB (DrawColorMainRed …): CSP stores each channel as a 32-bit value whose top byte is the 8-bit value.

Trait Implementations§

Source§

impl Clone for Layer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Layer

Source§

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

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

impl Serialize for Layer

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Layer

§

impl RefUnwindSafe for Layer

§

impl Send for Layer

§

impl Sync for Layer

§

impl Unpin for Layer

§

impl UnsafeUnpin for Layer

§

impl UnwindSafe for Layer

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.