PsdWriter

Struct PsdWriter 

Source
pub struct PsdWriter {
    psd: PsdFile,
    color_type: ImageColorType,
    compress: bool,
    zlib_compression_level: u32,
    encoding: Encoding,
}
Available on crate feature utils-psd only.
Expand description

A simple PSD writer.

Fields§

§psd: PsdFile§color_type: ImageColorType§compress: bool§zlib_compression_level: u32§encoding: Encoding

Implementations§

Source§

impl PsdWriter

Source

pub fn new( width: u32, height: u32, color_type: ImageColorType, depth: u8, encoding: Encoding, ) -> Result<Self>

Creates a new PSD writer with the specified dimensions, color type, and bit depth.

Source

pub fn compress(self, compress: bool) -> Self

Sets whether to compress image data in the PSD file.

Source

pub fn zlib_compression_level(self, level: u32) -> Self

Sets the zlib compression level for the PSD file.

Source

pub fn add_layer( &mut self, name: &str, x: u32, y: u32, data: ImageData, option: Option<PsdLayerOption>, ) -> Result<()>

Add a layer to the PSD file.

  • name - The name of the layer.
  • x - The x position of the layer.
  • y - The y position of the layer.
  • data - The image data of the layer.
  • option - The options for the layer.
Source

pub fn add_layer_group( &mut self, name: &str, is_closed: bool, option: Option<PsdLayerOption>, ) -> Result<()>

Adds the start of a layer group to the PSD file.

Source

pub fn add_layer_group_end(&mut self) -> Result<()>

Adds the end of a layer group to the PSD file.

Source

pub fn save<T: Write>(&mut self, data: ImageData, writer: T) -> Result<()>

Saves the PSD file to the specified writer with the given encoding.

  • data - The final composite image data to be saved in the PSD file.

Auto Trait Implementations§

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V