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: i64MainId of the row; other rows refer to the layer by it.
name: StringName shown in the layer palette (LayerName).
kind: LayerKindWhat the layer is (derived, see LayerKind).
layer_type: i64LayerType as stored.
visible: boolLayerVisibility bit 0.
mask_enabled: boolLayerVisibility bit 1: the layer mask is applied.
opacity: i640–256 (LayerOpacity, 256 = 100 %).
blend: i64LayerComposite.
clipping: boolClipped to the layer below (LayerClip).
locked: boolLayerLock is set.
folder_flags: i64LayerFolder 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: i64MainId of the Mipmap row of the layer’s pixels (LayerRenderMipmap, 0 = none).
mask_mipmap: i64MainId of the Mipmap row of the mask (LayerLayerMaskMipmap, 0 = none).
first_child: i64MainId of the bottom child (LayerFirstChildIndex, 0 = none).
next: i64MainId of the sibling above (LayerNextIndex, 0 = none).
uuid: Option<String>LayerUuid, when set.
row: RowThe whole row, for the columns not typed here.
Implementations§
Source§impl Layer
impl Layer
Sourcepub fn from_row(row: Row, vector_layers: &HashSet<i64>) -> Self
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.
Sourcepub fn pixel_origin(&self) -> (i64, i64)
pub fn pixel_origin(&self) -> (i64, i64)
Canvas position of the render offscreen’s top-left pixel.
Sourcepub fn mask_origin(&self) -> (i64, i64)
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)).
Sourcepub fn opacity_fraction(&self) -> f64
pub fn opacity_fraction(&self) -> f64
Opacity as 0.0–1.0.