FilterEffectMaskData

FilterEffectMaskData class

The filter mask data class.

public sealed class FilterEffectMaskData

Constructors

Name Description
FilterEffectMaskData(string, Rectangle, int, int, ChannelInformation[], ChannelInformation, Rectangle, ChannelInformation) Initializes a new instance of the FilterEffectMaskData class.

Properties

Name Description
Channels { get; } Gets the channels.
GUID { get; } Gets the GUID.
Length { get; } Gets the filter mask data length in bytes.
MaskRectangle { get; } Gets the sheet mask rectangle.
MaxChannels { get; } Gets the max of channels count.
PixelsDepth { get; } Gets the pixels depth.
Rectangle { get; } Gets the channels rectangle.
SheetMask { get; } Gets the sheet mask.
UserMask { get; } Gets the user mask.

Methods

Name Description
SaveData(StreamContainer) Saves the resource to the specified stream container.

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