public class SmartObjectLayer extends Layer
Defines the SmartObjectLayer class that contains embedded in the PSD file or linked smart object in the external file. With Smart Objects, you can: Perform nondestructive transforms. You can scale, rotate, skew, distort, perspective transform, or warp a layer without losing original image data or quality because the transforms don�t affect the original data. Work with vector data, such as vector artwork from Illustrator, that otherwise would be rasterized. Perform nondestructive filtering. You can edit filters applied to Smart Objects at any time. Edit one Smart Object and automatically update all its linked instances. Apply a layer mask that�s either linked or unlinked to the Smart Object layer. Try various designs with low-resolution placeholder images that you later replace with final versions. In Adobe� Photoshop�, you can embed the contents of an image into a PSD document. More information is here: A layer with an embedded smart object contains placed (PlLd) and SoLd resources with smart object properties. The PlLd resource can be alone for PSD versions older then 10. These resources contain UniqueId of the LiFdDataSource in the global Lnk2Resource with the embedded filename and other parameters, including the embedded file contents in the original format as a byte array.
Layer,
SmartObjectProvider,
LinkDataSourceRasterCachedImage.RotateTestModeBlendSignature, LayerHeaderSize| Modifier and Type | Method and Description |
|---|---|
void |
convertToLinked(String linkedPath)
Converts this embedded smart object to a linked smart object.
|
SmartObjectLayer |
duplicateLayer()
Creates a new smart object layer by coping this one.
|
void |
embedLinked()
Embeds the linked smart object in this layer.
|
void |
exportContents(String filePath)
Exports the embedded or linked contents to a file.
|
byte[] |
getContents()
Gets or sets the smart object layer contents.
|
Rectangle |
getContentsBounds()
Gets or sets the smart object content's bounds.
|
LinkDataSource |
getContentsSource()
Gets or sets the smart object content's source.
|
int |
getContentType()
Gets the type of the smart object layer content.
|
SmartObjectProvider |
getSmartObjectProvider()
Gets the smart object provider.
|
Image |
loadContents(LoadOptions options)
Gets the embedded or linked image contents of the smart object layer.
|
SmartObjectLayer |
newSmartObjectViaCopy()
Creates a new smart object layer by coping this one.
|
void |
relinkToFile(String linkedPath)
Re-links the linked smart object to a new file.
|
void |
replaceContents(Image image)
Replaces the smart object contents embedded in the smart object layer.
|
void |
replaceContents(Image image,
ResolutionSetting resolution)
Replaces the smart object contents embedded in the smart object layer.
|
void |
replaceContents(String linkedPath)
Replaces the contents with a file.
|
void |
replaceContents(String linkedPath,
ResolutionSetting resolution)
Replaces the contents with a file.
|
void |
setContents(byte[] value)
Gets or sets the smart object layer contents.
|
void |
setContentsBounds(Rectangle value)
Gets or sets the smart object content's bounds.
|
void |
setContentsSource(LinkDataSource value)
Gets or sets the smart object content's source.
|
void |
updateModifiedContent()
Updates the smart object layer image cache with the modified content.
|
addLayerMask, drawImage, equals, getBitsPerPixel, getBlendingOptions, getBlendModeKey, getBlendModeSignature, getBottom, getChannelInformation, getChannelsCount, getClipping, getDisplayName, getExtraLength, getFiller, getFillOpacity, getFlags, getHeight, getLayerBlendingRangesData, getLayerCreationDateTime, getLayerLock, getLayerMaskData, getLayerOptions, getLeft, getLength, getName, getOpacity, getResources, getRight, getSheetColorHighlight, getTop, getWidth, hasAlpha, hashCode, isVisible, isVisibleInGroup, mergeLayerTo, save, save, save, save, setBlendModeKey, setBottom, setChannelInformation, setClipping, setDisplayName, setFiller, setFillOpacity, setFlags, setLayerBlendingRangesData, setLayerCreationDateTime, setLayerLock, setLayerMaskData, setLeft, setName, setOpacity, setResources, setRight, setSheetColorHighlight, setTop, setVisible, shallowCopyadjustBrightness, adjustContrast, adjustGamma, adjustGamma, binarizeBradley, binarizeBradley, binarizeFixed, binarizeOtsu, cacheData, crop, dither, doRotate, getRotateMode, grayscale, isCached, resize, resize, rotate, rotateFlipcrop, dither, filter, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getImageOpacity, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getSkewAngle, getTransparentColor, getUpdateXmpData, getUseRawData, getVerticalResolution, getXmpData, hasTransparentColor, isRawDataAvailable, isUsePalette, loadArgb32Pixels, loadArgb64Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, normalizeAngle, normalizeAngle, readArgb32ScanLine, readScanLine, replaceColor, replaceColor, replaceNonTransparentColors, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setTransparentColor, setTransparentColor, setUpdateXmpData, setUseRawData, setVerticalResolution, setXmpData, toBitmap, writeArgb32ScanLine, writeScanLinecanLoad, canLoad, canLoad, canLoad, canSave, create, create, create, getBackgroundColor, getBounds, getBufferSizeHint, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProgressEventHandler, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalettegetDataStreamContainer, save, save, save, setDataStreamContainerclose, dispose, getDisposedpublic final Rectangle getContentsBounds()
Gets or sets the smart object content's bounds.
Value: The smart object bounds.public final void setContentsBounds(Rectangle value)
Gets or sets the smart object content's bounds.
Value: The smart object bounds.public final LinkDataSource getContentsSource()
Gets or sets the smart object content's source.
Value: The smart object data source.public final void setContentsSource(LinkDataSource value)
Gets or sets the smart object content's source.
Value: The smart object data source.public final int getContentType()
Gets the type of the smart object layer content.
The embedded smart object contents is the embedded raw image file: LiFdDataSource.Data.
The linked smart object contents is the raw contents of the linked image file if it is available: LiFeDataSource.
We do not support loading from the Adobe� Photoshop� �� Graphics Library when LinkDataSource.IsLibraryLink(LinkDataSource.isLibraryLink()/LinkDataSource.setLibraryLink(boolean)) is true.
For regular link files, at first, we use LiFeDataSource.RelativePath(LiFeDataSource.getRelativePath()/LiFeDataSource.setRelativePath(String)) to look for the file relatively
to the source image path DataStreamSupporter.SourceImagePath,
if it is not available we look at LiFeDataSource.FullPath(LiFeDataSource.getFullPath()/LiFeDataSource.setFullPath(String)),
if not then we look for the link file in the same directory where our image is: DataStreamSupporter.SourceImagePath.
public final byte[] getContents()
Gets or sets the smart object layer contents.
The embedded smart object contents is the embedded raw image file: LiFdDataSource.Data and its properties.
The linked smart object contents is the raw content of the linked image file if it is available and its properties: LiFeDataSource.
We do not support loading from the Adobe� Photoshop� �� Graphics Library when LinkDataSource.IsLibraryLink(LinkDataSource.isLibraryLink()/LinkDataSource.setLibraryLink(boolean)) is true.
For regular link files, at first, we use LiFeDataSource.RelativePath(LiFeDataSource.getRelativePath()/LiFeDataSource.setRelativePath(String)) to look for the file relatively
to the source image path DataStreamSupporter.SourceImagePath,
if it is not available we look at LiFeDataSource.FullPath(LiFeDataSource.getFullPath()/LiFeDataSource.setFullPath(String)),
if not then we look for the link file in the same directory where our image is: DataStreamSupporter.SourceImagePath.
com.aspose.ms.System.NotSupportedException - Cannot get contents from Adobe� Photoshop� �� library.
Value:
The byte[] smart object layer contents.public final void setContents(byte[] value)
Gets or sets the smart object layer contents.
The embedded smart object contents is the embedded raw image file: LiFdDataSource.Data and its properties.
The linked smart object contents is the raw content of the linked image file if it is available and its properties: LiFeDataSource.
We do not support loading from the Adobe� Photoshop� �� Graphics Library when LinkDataSource.IsLibraryLink(LinkDataSource.isLibraryLink()/LinkDataSource.setLibraryLink(boolean)) is true.
For regular link files, at first, we use LiFeDataSource.RelativePath(LiFeDataSource.getRelativePath()/LiFeDataSource.setRelativePath(String)) to look for the file relatively
to the source image path DataStreamSupporter.SourceImagePath,
if it is not available we look at LiFeDataSource.FullPath(LiFeDataSource.getFullPath()/LiFeDataSource.setFullPath(String)),
if not then we look for the link file in the same directory where our image is: DataStreamSupporter.SourceImagePath.
com.aspose.ms.System.NotSupportedException - Cannot get contents from Adobe� Photoshop� �� library.
Value:
The byte[] smart object layer contents.public final SmartObjectProvider getSmartObjectProvider()
Gets the smart object provider.
Value: The smart object provider.public final void exportContents(String filePath)
Exports the embedded or linked contents to a file.
filePath - The export file path.public final Image loadContents(LoadOptions options)
Gets the embedded or linked image contents of the smart object layer.
options - The options.Image smart object instance.public final void replaceContents(Image image)
Replaces the smart object contents embedded in the smart object layer.
image - The image.public final void replaceContents(Image image, ResolutionSetting resolution)
Replaces the smart object contents embedded in the smart object layer.
image - The image.resolution - The resolution settings. If null the image resolution will be used.PsdImageException - Can only replace embedded smart object.public final void replaceContents(String linkedPath, ResolutionSetting resolution)
Replaces the contents with a file. There is no need to call UpdateModifiedContent method afterwards.
linkedPath - The linked path.resolution - The resolution settings. If null the image resolution will be used.public final void replaceContents(String linkedPath)
Replaces the contents with a file. There is no need to call UpdateModifiedContent method afterwards.
linkedPath - The linked path.public final void embedLinked()
Embeds the linked smart object in this layer.
public final void convertToLinked(String linkedPath)
Converts this embedded smart object to a linked smart object.
linkedPath - The linked path.public final void relinkToFile(String linkedPath)
Re-links the linked smart object to a new file. There is no need to call UpdateModifiedContent method afterwards.
linkedPath - The linked path.public final void updateModifiedContent()
Updates the smart object layer image cache with the modified content.
public final SmartObjectLayer newSmartObjectViaCopy()
Creates a new smart object layer by coping this one.
Reproduces `Layer -> Smart Objects -> New Smart Object via Copy` functionality of Adobe� Photoshop�.
Notice that it is enabled only for embedded smart objects because the embedded image is also copied.
If you want to share the embedded image use SmartObjectLayer.duplicateLayer() method.
SmartObjectLayer instance.public final SmartObjectLayer duplicateLayer()
Creates a new smart object layer by coping this one.
Notice that for embedded smart objects the embedded image is shared.
If you want to copy the embedded image use SmartObjectLayer.newSmartObjectViaCopy() method.
SmartObjectLayer instance.Copyright (c) 2008-2020 Aspose Pty Ltd. All Rights Reserved.