public final class VogkResource extends LayerResource
The Vector Origination Data resource.
An example of reading and modifying a Vector Origination Data resource.
// Keep the methods in the local scope for simplicity class LocalScopeExtension { VogkResource findFirstVogkResource(LayerResource[] layerResources) { VogkResource vogkResource = null; for (LayerResource layerResource : layerResources) { if (layerResource instanceof VogkResource) { vogkResource = (VogkResource)layerResource; break; } } if (vogkResource == null) { throw new Exception("VogkResource not found."); } return vogkResource; } } LocalScopeExtension $ = new LocalScopeExtension(); String inPsdFilePath = "VectorOriginationDataResource.psd"; String outPsdFilePath = "out_VectorOriginationDataResource_.psd"; // Load a PSD file containing a predefined VOGK resource PsdImage psdImage = (PsdImage)Image.load(inPsdFilePath); try { // Find first VogkResource in resources of the predefined layer VogkResource vogkResource = $.findFirstVogkResource( psdImage.getLayers()[1].getResources()); // Verify predefined resource properties if (vogkResource.getShapeOriginSettings().length != 1 || !vogkResource.getShapeOriginSettings()[0].isShapeInvalidated() || vogkResource.getShapeOriginSettings()[0].getOriginIndex() != 0) { throw new Exception("VogkResource was misread."); } // Modify some VogkResource properties vogkResource.setShapeOriginSettings(new VectorShapeOriginSettings[] { vogkResource.getShapeOriginSettings()[0], new VectorShapeOriginSettings(true, 1) }); // Save a modified copy of loaded PSD file on the path psdImage.save(outPsdFilePath); } finally { psdImage.dispose(); }
Modifier and Type | Field and Description |
---|---|
static int |
TypeToolKey
The type tool info key.
|
PsbResourceSignature, ResourceSignature
Constructor and Description |
---|
VogkResource() |
Modifier and Type | Method and Description |
---|---|
int |
getKey()
Gets the layer resource key.
|
int |
getLength()
Gets the layer resource length in bytes.
|
int |
getPsdVersion()
Gets the minimal psd version required for layer resource.
|
VectorShapeOriginSettings[] |
getShapeOriginSettings()
Gets or sets the shape origin settings.
|
int |
getSignature()
Gets the layer resource signature.
|
int |
getVersion()
Gets or sets the version.
|
void |
save(StreamContainer streamContainer,
int psdVersion)
Saves the resource to the specified stream container.
|
void |
setShapeOriginSettings(VectorShapeOriginSettings[] value)
Gets or sets the shape origin settings.
|
void |
setVersion(int value)
Gets or sets the version.
|
toString
public static final int TypeToolKey
The type tool info key.
public int getSignature()
Gets the layer resource signature.
getSignature
in class LayerResource
public int getKey()
Gets the layer resource key.
getKey
in class LayerResource
public int getPsdVersion()
Gets the minimal psd version required for layer resource. 0 indicates no restrictions.
getPsdVersion
in class LayerResource
public final int getVersion()
Gets or sets the version.
Value: The version.public final void setVersion(int value)
Gets or sets the version.
Value: The version.public int getLength()
Gets the layer resource length in bytes.
getLength
in class LayerResource
public final VectorShapeOriginSettings[] getShapeOriginSettings()
Gets or sets the shape origin settings.
public final void setShapeOriginSettings(VectorShapeOriginSettings[] value)
Gets or sets the shape origin settings.
public void save(StreamContainer streamContainer, int psdVersion)
Saves the resource to the specified stream container.
save
in class LayerResource
streamContainer
- The stream container to save to.psdVersion
- The PSD version.Copyright (c) 2008-2020 Aspose Pty Ltd. All Rights Reserved.