GradientOverlayEffect.EffectType

GradientOverlayEffect.EffectType property

获取一种效果

public LayerEffectsTypes EffectType { get; }

例子

以下代码演示了对 ILayerEffect.EffectType 属性的支持。

[C#]

string inputFile = "input.psd";
string outputWithout = "outputWithout.png";
string outputWith = "outputWith.png";

using (PsdImage psdImage = (PsdImage)Image.Load(inputFile, new LoadOptions()))
{
    psdImage.Save(outputWithout, new PngOptions());

    Layer workLayer = psdImage.Layers[1];

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

    foreach (ILayerEffect iEffect in workLayer.BlendingOptions.Effects)
    {
        if (iEffect.EffectType == LayerEffectsTypes.DropShadow)
        {
            // 它抓住了
            psdImage.Save(outputWith, new PngOptions());
        }
    }
}

也可以看看