ExportDocument class
A class representing a Photoshop document for export operations.
This class provides a comprehensive interface for creating and manipulating Photoshop documents programmatically. It supports various document features including:
- Multiple layers with different dimensions
- Alpha channels
- Metadata attributes
- ICC profiles
- EXIF data
- Thumbnails
- Different color modes and bit depths
The class maintains internal state for all document components and provides methods to update and modify them. It also handles the conversion of raw image data into the appropriate format for PSD files.
Example usage:
// Create a new document
final doc = ExportDocument(800, 600, 8, ExportColorMode.rgb);
// Add a layer
final layer = doc.addLayer(doc, "Background");
// Update layer with image data
doc.updateLayer(
layer!,
ExportChannel.red,
0, 0, 800, 600,
Uint8List(800 * 600),
CompressionType.rle
);
// Add metadata
doc.addMetaData("Author", "John Doe");
// Write to file
doc.write(File());
Constructors
- ExportDocument(int width, int height, int bitsPerChannel, ExportColorMode colorMode)
- Creates a new ExportDocument instance with the specified dimensions and color settings.
Properties
- alphaChannelCount → int
-
Returns the number of alpha channels in the document.
no setter
-
alphaChannelData
↔ List<
Uint8List?> -
Storage for alpha channel data.
getter/setter pair
-
alphaChannels
↔ List<
AlphaChannel?> -
List of alpha channels in the document.
getter/setter pair
- attributeCount → int
-
Returns the number of metadata attributes in the document.
no setter
-
attributes
↔ List<
ExportMetaDataAttribute> ? -
List of metadata attributes associated with the document.
getter/setter pair
- bitsPerChannel → int
-
The number of bits per color channel.
final
- colorMode → ExportColorMode
-
The color mode of the document.
final
- exifData ↔ Uint8List?
-
EXIF metadata associated with the document.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
The height of the document in pixels.
final
- iccProfile ↔ Uint8List?
-
ICC profile data for color management.
getter/setter pair
- layerCount → int
-
Returns the number of layers in the document.
no setter
-
layers
↔ List<
ExportLayer> ? -
List of layers in the document.
getter/setter pair
-
mergedImageData
↔ List<
Uint8List?> -
Storage for merged image data in RGB format.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sizeOfExifData → int
-
Returns the size of the EXIF data in bytes.
no setter
- sizeOfICCProfile → int
-
Returns the size of the ICC profile in bytes.
no setter
- thumbnail ↔ Thumbnail?
-
Thumbnail image for the document.
getter/setter pair
- width → int
-
The width of the document in pixels.
final
Methods
-
addAlphaChannel(
String name, int r, int g, int b, int a, int opacity, int mode) → int - Adds a new alpha channel to the document.
-
addLayer(
ExportDocument document, String name) → ExportLayer? - Adds a new layer to the document.
-
addMetaData(
String name, String value) → ExportMetaDataAttribute - Adds metadata to the document.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateChannel(
int channelIndex, TypedData data) → void - Updates an alpha channel with new data.
-
updateLayer<
T extends TypedData> (ExportLayer layer, ExportChannel channel, int left, int top, int right, int bottom, TypedData planarData, CompressionType compression) → void - Updates a layer with planar image data.
-
updateMergedImage(
TypedData planarDataR, TypedData planarDataG, TypedData planarDataB) → void - Updates the merged image data with new RGB values.
-
write(
File file) → void - Writes the document to a File instance.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- maxAlphaChannelCount → const int
- Maximum number of alpha channels allowed in a document.
- maxAttributeCount → const int
- Maximum number of metadata attributes allowed in a document.
- maxLayerCount → const int
- Maximum number of layers allowed in a document.