Class FXidResource
FXidResource class
The Filter Effects resource contains channels, a user mask, and a sheet mask for the smart filter.
public sealed class FXidResource : LayerResource
Constructors
Name | Description |
---|
FXidResource(int, int, FilterEffectMaskData[]) | Initializes a new instance of the FXidResource class. |
Properties
Name | Description |
---|
FilterEffectMasks { get; } | Gets the filter effect masks. |
override Key { get; } | Gets the layer resource key. |
override Length { get; } | Gets the layer resource length in bytes. |
override PsdVersion { get; } | Gets the minimal psd version required for layer resource. 0 indicates no restrictions. |
override Signature { get; } | Gets the layer resource signature. |
Version { get; } | Gets the version. |
Methods
Name | Description |
---|
override Save(StreamContainer, int) | Saves the resource to the specified stream container. |
override ToString() | Returns a String that represents this instance. |
Fields
Examples
This example demonstrates how to get and set properties of the FXidResource resource.
[C#]
string inputFilePath = "psdnet414_3.psd";
string output = "out_psdnet414_3.psd";
int resLength = 1144;
int maskLength = 369;
void AssertAreEqual(object expected, object actual, string message = null)
{
if (!object.Equals(expected, actual))
{
throw new FormatException(message ?? "Objects are not equal.");
}
}
using (var psdImage = (PsdImage)Image.Load(inputFilePath))
{
FXidResource fXidResource = (FXidResource)psdImage.GlobalLayerResources[3];
AssertAreEqual(resLength, fXidResource.Length);
foreach (var maskData in fXidResource.FilterEffectMasks)
{
AssertAreEqual(maskLength, maskData.Length);
}
psdImage.Save(output);
}
// check after saving
using (var psdImage = (PsdImage)Image.Load(output))
{
FXidResource fXidResource = (FXidResource)psdImage.GlobalLayerResources[3];
AssertAreEqual(resLength, fXidResource.Length);
foreach (var maskData in fXidResource.FilterEffectMasks)
{
AssertAreEqual(maskLength, maskData.Length);
}
}
See Also