#[non_exhaustive]pub struct LayerInfo {Show 28 fields
pub name: String,
pub opacity: f32,
pub fill_opacity: f32,
pub blend_mode: String,
pub x: i32,
pub y: i32,
pub w: u32,
pub h: u32,
pub image_channel_count: u16,
pub image_data_rgba: Vec<u8>,
pub image_data_k: Vec<u8>,
pub image_data_has_g: bool,
pub image_data_has_b: bool,
pub image_data_has_a: bool,
pub mask_channel_count: u16,
pub mask_info: MaskInfo,
pub image_data_mask: Vec<u8>,
pub group_expanded: bool,
pub group_opener: bool,
pub group_closer: bool,
pub funny_flag: bool,
pub is_clipped: bool,
pub is_alpha_locked: bool,
pub is_visible: bool,
pub adjustment_type: String,
pub adjustment_info: Vec<f32>,
pub adjustment_desc: Option<(String, Vec<(String, DescItem)>)>,
pub effects_desc: Option<(String, Vec<(String, DescItem)>)>,
}Expand description
Describes a single layer stack entry.
This data is very unorganized, and you should not use it directly in your application. You should move it out into your own types.
Returned from parse_layer_records.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringName of the layer.
opacity: f32Normal opacity of the layer.
fill_opacity: f32Photoshop has separate “opacity” and “fill” sliders.
Fill opacity behaves differently for certain blend modes and when layer effects are involved.
blend_mode: StringBlend mode stored as a string. See BlendModeDocs.
x: i32Global X position of the layer, based on the top left of the canvas. Can be negative. Ignored for groups.
y: i32Global Y position of the layer, based on the top left of the canvas. Can be negative. Ignored for groups.
w: u32Layer image data width.
h: u32Layer image data height.
image_channel_count: u16Number of channels in the image data.
image_data_rgba: Vec<u8>Four channels worth of image data. Can be RGBA or CMYA, sometimes with fewer channels. This is non-planar: a single full RGBA pixel is 4 consecutive bytes.
image_data_k: Vec<u8>The K channel of CMYK image data, if present.
image_data_has_g: boolWhether the second channel of the RGBA data came from the PSD file (true) or was synthesized (false).
If the PSD is malformed and has multiple channels of the same type, this flag might be incorrect. But on well-formed PSDs, it’s always correct.
image_data_has_b: boolWhether the third channel of the RGBA data came from the PSD file (true) or was synthesized (false).
If the PSD is malformed and has multiple channels of the same type, this flag might be incorrect. But on well-formed PSDs, it’s always correct.
image_data_has_a: boolWhether the fourth channel of the RGBA data came from the PSD file (true) or was synthesized (false).
If the PSD is malformed and has multiple channels of the same type, this flag might be incorrect. But on well-formed PSDs, it’s always correct.
mask_channel_count: u16Number of channels in the mask image data. They are stored planar (all of ch1, then all of ch2, etc), not interleaved like RGBA.
mask_info: MaskInfoWhere is the mask, and how do you interpret it?
image_data_mask: Vec<u8>Actual mask data. Again, this is planar, unlike RGBA.
group_expanded: boolIf this is a group opener, is the group expanded?
group_opener: boolIs this a group opener?
group_closer: boolIs this a group closer?
funny_flag: boolPSD layers have a “transparency shapes layer” flag. This is the inverse of that flag, i.e. “true” means “the transparency-shapes-layer flag is disabled”. This flag state is funny and does weird things to some blend modes and layer effects.
is_clipped: boolDoes this layer have the “clipping mask” flag enabled?
is_alpha_locked: boolIs this layer alpha locked?
is_visible: boolIs this layer visible?
adjustment_type: StringIs this an adjustment layer, and if so, what kind? Blank if not an adjustment layer.
adjustment_info: Vec<f32>Pile of raw, flattened adjustment layer metadata. Search // Read adjustment data. in the source code and read down from there to see how each adjustment’s data is flattened.
adjustment_desc: Option<(String, Vec<(String, DescItem)>)>Some adjustments use class descriptors instead of “hardcoded” data. Those adjustments get their data here.
effects_desc: Option<(String, Vec<(String, DescItem)>)>What effects, if any, does this layer have attached to it?