这里要实现的效果指的是对图片像素点区域进行颜色叠加,首先要做的是得到图片非透明部分的区域,效果如图:
实现步骤:1、在主窗体添加控制控件:
<Label Grid.Row="4" Grid.Column="0" Content="蒙板" VerticalAlignment="Center" HorizontalAlignment="Left"></Label>
<Rectangle x:Name="rPicMaskColor" Grid.Row="4" Grid.Column="1" Fill="Black" Width="30" Height="30" VerticalAlignment="Center" HorizontalAlignment="Left" MouseLeftButtonDown="rPicMaskColor_MouseLeftButtonDown"></Rectangle>
2、图片处理类型枚举添加蒙板类型:
//图片处理类型枚举
public enum ImageProcessingEffect
{
Normal = 0,//原始图片
Emboss = 1,//浮雕
Sharpening = 2,//锐化
BlackAndWhite = 3,//黑白
MirrorHorizontal = 4,//水平镜像
MirrorVertical = 5,//垂直镜像
CenterRotate = 6,/