Class BaseFxResource

BaseFxResource class

Base effects resource

public abstract class BaseFxResource : LayerResource

Properties

NameDescription
DescriptorVersion { get; }Gets the descriptor version.
Key { get; }Gets the layer resource key.
override Length { get; }Gets the layer resource length in bytes.
PsdVersion { get; }Gets the minimal psd version required for layer resource. 0 indicates no restrictions.
virtual Signature { get; }Gets the signature.

Methods

NameDescription
override Save(StreamContainer, int)Saves the resource to the specified stream container.
override ToString()Returns a String that represents this instance.

Examples

The following code demonstrates suport of multi-effects resource.

[C#]

// PSD image contains 2 Drop Shadow effects 
string sourceFile = "MultiExample.psd";
string outputFile1 = "export1.png";
string outputFile2 = "export2.png";
string outputFile3 = "export3.png";

using (PsdImage image = (PsdImage)Aspose.PSD.Image.Load(sourceFile, new PsdLoadOptions() { LoadEffectsResource = true }))
{
    // It renders PSD image with 2 Drop Shadow effects
    image.Save(outputFile1, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });

    var blendingOptions = image.Layers[0].BlendingOptions;

    // It adds a third Drop Shadow effect.
    DropShadowEffect dropShadowEffect3 = blendingOptions.AddDropShadow();
    dropShadowEffect3.Color = Color.Red;
    dropShadowEffect3.Distance = 50;
    dropShadowEffect3.Angle = 0;

    // It renders PSD image with 3 Drop Shadow effects
    image.Save(outputFile2, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });

    // The imfx resource is used if the layer contains multiple effects of the same type.
    var imfx = (ImfxResource)image.Layers[0].Resources[0];

    // It clears all effects
    blendingOptions.Effects = new ILayerEffect[0];

    DropShadowEffect dropShadowEffect1 = blendingOptions.AddDropShadow();
    dropShadowEffect1.Color = Color.Blue;
    dropShadowEffect1.Distance = 10;

    // It renders PSD image with 1 Drop Shadow effects (others was deleted)
    image.Save(outputFile3, new PngOptions { ColorType = PngColorType.TruecolorWithAlpha });

    // The lfx2 resource is used if the layer does not contain multiple effects of the same type.
    var lfx2 = (Lfx2Resource)image.Layers[0].Resources[14];
}

See Also