pub struct Psd { /* private fields */ }
Expand description
Represents the contents of a PSD file
PSB Support
We do not currently support PSB since the original authors didn’t need it, but adding support should be trivial. If you’d like to support PSB please open an issue.
Implementations
sourceimpl Psd
impl Psd
sourcepub fn layers(&self) -> &Vec<PsdLayer>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn layers(&self) -> &Vec<PsdLayer>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get all of the layers in the PSD
sourcepub fn layer_by_name(&self, name: &str) -> Option<&PsdLayer>
pub fn layer_by_name(&self, name: &str) -> Option<&PsdLayer>
Get a layer by name
sourcepub fn layer_by_idx(&self, idx: usize) -> &PsdLayer
pub fn layer_by_idx(&self, idx: usize) -> &PsdLayer
Get a layer by index.
index 0 is the bottom layer, index 1 is the layer above that, etc
sourcepub fn groups(&self) -> &HashMap<u32, PsdGroup>
pub fn groups(&self) -> &HashMap<u32, PsdGroup>
Get all of the groups in the PSD, in the order that they appear in the PSD file.
sourcepub fn group_ids_in_order(&self) -> &Vec<u32>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn group_ids_in_order(&self) -> &Vec<u32>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get the group ID’s in the order that they appear in Photoshop. (i.e. from the bottom of layers view to the top of the layers view).
sourcepub fn get_group_sub_layers(&self, id: &u32) -> Option<&[PsdLayer]>
pub fn get_group_sub_layers(&self, id: &u32) -> Option<&[PsdLayer]>
Returns sub layers of group by group id
sourcepub fn flatten_layers_rgba(
&self,
filter: &dyn Fn((usize, &PsdLayer)) -> bool
) -> Result<Vec<u8>, PsdError>
pub fn flatten_layers_rgba(
&self,
filter: &dyn Fn((usize, &PsdLayer)) -> bool
) -> Result<Vec<u8>, PsdError>
Given a filter, combine all layers in the PSD that pass the filter into a vector of RGBA pixels.
We’ll start from the top most layer and iterate through the pixels.
If the pixel is transparent, recursively blend it with the pixels below it until we hit an opaque pixel or we hit the bottom of the stack.
TODO: Take the layer’s blend mode into account when blending layers. Right now we just use ONE_MINUS_SRC_ALPHA blending regardless of the layer.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Psd
impl Send for Psd
impl Sync for Psd
impl Unpin for Psd
impl UnwindSafe for Psd
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more