重命名
This commit is contained in:
87
NeoUI/Melskin/Effects/BrightnessContrastEffect.cs
Normal file
87
NeoUI/Melskin/Effects/BrightnessContrastEffect.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System.Windows.Media.Effects;
|
||||
using VariaStudio.Appearance;
|
||||
|
||||
namespace VariaStudio.Effects;
|
||||
|
||||
/// <summary>
|
||||
/// 亮度对比度效果类。此效果用于调整图像或控件的亮度和对比度。
|
||||
/// 继承自ShaderEffect,使用像素着色器实现对输入源的亮度和对比度调节功能。
|
||||
/// </summary>
|
||||
public class BrightnessContrastEffect : ShaderEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置作为效果输入的画刷。此属性定义了应用亮度对比度调整的基础图像或控件。
|
||||
/// 通过设置不同的画刷,可以改变效果作用的对象。
|
||||
/// </summary>
|
||||
public Brush Input
|
||||
{
|
||||
get => (Brush)GetValue(InputProperty);
|
||||
set => SetValue(InputProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置作为效果输入的画刷。此属性定义了应用亮度对比度调整的基础图像或控件。
|
||||
/// 通过设置不同的画刷,可以改变效果作用的对象。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty InputProperty
|
||||
= RegisterPixelShaderSamplerProperty("Input",
|
||||
typeof(BrightnessContrastEffect), 0);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置亮度效果的值。此属性允许用户调整应用到图像或控件上的亮度级别。
|
||||
/// 亮度值为0时,表示没有亮度调整;正值增加亮度,负值减少亮度。
|
||||
/// </summary>
|
||||
public double Brightness
|
||||
{
|
||||
get => (double)GetValue(BrightnessProperty);
|
||||
set => SetValue(BrightnessProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置亮度效果的值。此属性允许用户调整应用到图像或控件上的亮度级别。
|
||||
/// 亮度值为0时,表示没有亮度调整;正值增加亮度,负值减少亮度。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty BrightnessProperty =
|
||||
DependencyProperty.Register(nameof(Brightness), typeof(double),
|
||||
typeof(BrightnessContrastEffect),
|
||||
new PropertyMetadata(0.0, PixelShaderConstantCallback(0)));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置对比度效果的值。此属性允许用户调整应用到图像或控件上的对比度级别。
|
||||
/// 对比度值为0时,表示没有对比度调整;正值增加对比度,负值减少对比度。
|
||||
/// </summary>
|
||||
public double Contrast
|
||||
{
|
||||
get => (double)GetValue(ContrastProperty);
|
||||
set => SetValue(ContrastProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置对比度效果的值。此属性允许用户调整应用到图像或控件上的对比度级别。
|
||||
/// 对比度值为0时,表示没有对比度调整;正值增加对比度,负值减少对比度。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ContrastProperty =
|
||||
DependencyProperty.Register(nameof(Contrast), typeof(double),
|
||||
typeof(BrightnessContrastEffect),
|
||||
new PropertyMetadata(0.0, PixelShaderConstantCallback(1)));
|
||||
|
||||
/// <summary>
|
||||
/// 亮度对比度效果类。此效果用于调整图像或控件的亮度和对比度。
|
||||
/// 继承自ShaderEffect,使用像素着色器实现对输入源的亮度和对比度调节功能。
|
||||
/// </summary>
|
||||
public BrightnessContrastEffect()
|
||||
{
|
||||
var shaderUri = $"pack://application:,,,/{ThemeManager.LibraryNamespace};component/Shaders/BrightnessContrastEffect.ps";
|
||||
PixelShader = new PixelShader()
|
||||
{
|
||||
UriSource = new Uri(shaderUri)
|
||||
};
|
||||
|
||||
UpdateShaderValue(InputProperty);
|
||||
UpdateShaderValue(BrightnessProperty);
|
||||
UpdateShaderValue(ContrastProperty);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user