Class WorkingPathResource
Contents
[
Hide
]WorkingPathResource class
Working path resource.
public sealed class WorkingPathResource : ResourceBlock, IVectorPathData
Constructors
Name | Description |
---|---|
WorkingPathResource(byte[]) | Initializes a new instance of the WorkingPathResource class. |
Properties
Name | Description |
---|---|
override DataSize { get; } | Gets the resource data size in bytes. |
ID { get; set; } | Gets or sets the unique identifier for the resource. |
IsDisabled { get; set; } | Gets or sets a value indicating whether this instance is disabled. |
IsInverted { get; set; } | Gets or sets a value indicating whether this instance is inverted. |
IsNotLinked { get; set; } | Gets or sets a value indicating whether this instance is not linked. |
override MinimalVersion { get; } | Gets the minimal required PSD version. |
Name { get; set; } | Gets or sets the resource name. Pascal string, padded to make the size even (a null name consists of two bytes of 0). |
Paths { get; set; } | Gets or sets the path records. |
Signature { get; } | Gets the resource signature. Should be always ‘8BIM’. |
Size { get; } | Gets the resource block size in bytes including its data. |
Version { get; set; } | Gets or sets the version. |
Methods
Name | Description |
---|---|
Save(StreamContainer) | Saves the resource block to the specified stream. |
virtual ValidateValues() | Validates the resource values. |
Examples
This example demonstrates the support of ‘WorkingPathResource’ resource in PsdImage.ImageResources fo correct working of Crop operation.
[C#]
// Crop image and save.
using (var psdImage = (PsdImage)Image.Load(sourceFile))
{
// Search WorkingPathResource resource.
ResourceBlock[] imageResources = psdImage.ImageResources;
WorkingPathResource workingPathResource = null;
foreach (var imageResource in imageResources)
{
if (imageResource is WorkingPathResource)
{
workingPathResource = (WorkingPathResource)imageResource;
break;
}
}
BezierKnotRecord record = workingPathResource.Paths[3] as BezierKnotRecord;
if (record.Points[0].X != 2572506 || record.Points[0].Y != 8535408)
{
throw new Exception("Values is incorrect.");
}
// Crop and save.
psdImage.Crop(0, 500, 0, 200);
psdImage.Save(outputFile);
}
// Load saved image and check the changes.
using (var psdImage = (PsdImage)Image.Load(outputFile))
{
// Search WorkingPathResource resource.
ResourceBlock[] imageResources = psdImage.ImageResources;
WorkingPathResource workingPathResource = null;
foreach (var imageResource in imageResources)
{
if (imageResource is WorkingPathResource)
{
workingPathResource = (WorkingPathResource)imageResource;
break;
}
}
BezierKnotRecord record = workingPathResource.Paths[3] as BezierKnotRecord;
if (record.Points[0].X != 4630510 || record.Points[0].Y != 22761088)
{
throw new Exception("Values is incorrect.");
}
}
See Also
- class ResourceBlock
- interface IVectorPathData
- namespace Aspose.PSD.FileFormats.Psd.Resources
- assembly Aspose.PSD