Class SharpenSmartFilter
SharpenSmartFilter class
The Sharpen smart filter.
public sealed class SharpenSmartFilter : SmartFilter
Constructors
Name | Description |
---|
SharpenSmartFilter() | Initializes a new instance of the SharpenSmartFilter class. |
SharpenSmartFilter(DescriptorStructure) | Initializes a new instance of the SharpenSmartFilter class. |
Properties
Name | Description |
---|
BlendMode { get; set; } | Gets or sets the blending mode. |
override FilterId { get; } | Gets the smart filter type identifier. |
IsEnabled { get; set; } | Gets or sets the is enabled status of the smart filter. |
override Name { get; } | Gets the smart filter name. |
Opacity { get; set; } | Gets or sets the opacity value of smart filter. |
SourceDescriptor { get; } | The source descriptor structure with smart filter data. |
Methods
Name | Description |
---|
Apply(RasterImage) | Applies the current filter to input RasterImage image. |
ApplyToMask(Layer) | Applies the current filter to input Layer mask data. |
Clone() | Makes the memberwise clone of the current instance of the type. |
Fields
Name | Description |
---|
const FilterType | The identifier of current smart filter. |
Examples
The following code demonstrates support of SharpenSmartFilter.
[C#]
string sourceFile = "sharpen_source.psd";
string outputPsd = "sharpen_output.psd";
string outputPng = "sharpen_output.png";
void AssertAreEqual(object expected, object actual)
{
if (!object.Equals(expected, actual))
{
throw new Exception("Objects are not equal.");
}
}
using (var image = (PsdImage)Image.Load(sourceFile))
{
SmartObjectLayer smartObj = (SmartObjectLayer)image.Layers[1];
// edit smart filters
SharpenSmartFilter sharpen = (SharpenSmartFilter)smartObj.SmartFilters.Filters[0];
// check filter values
AssertAreEqual(BlendMode.Normal, sharpen.BlendMode);
AssertAreEqual(100d, sharpen.Opacity);
AssertAreEqual(true, sharpen.IsEnabled);
// update filter values
sharpen.BlendMode = BlendMode.Divide;
sharpen.Opacity = 75;
sharpen.IsEnabled = false;
// add new filter items
var filters = new List<SmartFilter>(smartObj.SmartFilters.Filters);
filters.Add(new SharpenSmartFilter());
smartObj.SmartFilters.Filters = filters.ToArray();
// apply changes
smartObj.SmartFilters.UpdateResourceValues();
smartObj.UpdateModifiedContent();
image.Save(outputPsd);
image.Save(outputPng, new PngOptions());
}
See Also