Class DropShadowEffect

DropShadowEffect class

Drop Shadow Layer effect

public class DropShadowEffect : IShadowEffect

Properties

NameDescription
Angle { get; set; }Gets or sets the angle in degrees.
BlendMode { get; set; }Gets or sets the blend mode.
Color { get; set; }Gets or sets the color.
Distance { get; set; }Gets or sets the distance in pixels.
EffectType { get; }Gets a type of effect
IsVisible { get; set; }Gets or sets a value indicating whether this instance is visible.
KnocksOut { get; set; }Gets or sets a value indicating whether [knocks out].
Noise { get; set; }Gets or sets the noise.
Opacity { get; set; }Gets or sets the opacity.
Size { get; set; }Gets or sets the blur value in pixels.
Spread { get; set; }Gets or sets the intensity as a percent.
UseGlobalLight { get; set; }Gets or sets a value indicating whether [use this angle in all of the layer effects].

Methods

NameDescription
GetEffectBounds(Rectangle, int)Calculate and gets the bounds of effect pixels based on input layer pixels bounds.

Examples

The following code demonstrates support for the PsdImage.GlobalAngle property to change the global angle value.

[C#]

// When DropShadowEffect.UseGlobalLight property is 'true', then DropShadowEffect object use angle value from PsdImage.GlobalAngle property.

using (PsdImage image = (PsdImage)Image.Load("4.psd"))
{
    image.GlobalAngle = 30;
    image.Save("output.psd");
}

The following code demonstrates using the Opacity property of DropShadowEffect.

[C#]

string inputFile = "input.psd";
string outputImage20 = "outputImage20.png";
string outputImage200 = "outputImage200.png";

using (PsdImage psdImage = (PsdImage)Image.Load(inputFile, new LoadOptions()))
{
    Layer workLayer = psdImage.Layers[1];

    DropShadowEffect dropShadowEffect = workLayer.BlendingOptions.AddDropShadow();
    dropShadowEffect.Distance = 0;
    dropShadowEffect.Size = 8;

    // Example with Opacity = 20
    dropShadowEffect.Opacity = 20;
    psdImage.Save(outputImage20, new PngOptions());

    // Example with Opacity = 200
    dropShadowEffect.Opacity = 200;
    psdImage.Save(outputImage200, new PngOptions());
}

See Also