资 源 简 介
Visual C# WPF实现图片浮雕、凹凸的图像效果,看上去很有雕刻的效果,这个功能对于熟悉PS的朋友,可能不陌生,用C#的WPF技术,可以轻松实现类似效果,只是说法不一样,在本例中,叫做“凹凸位图特效”,本代码在功能实现上,分为全部实现和局部实现,代码参考如下:
private void button1_Click(object sender, RoutedEventArgs e)
{//凹凸位图特效全部作用于图像
this.image1.BitmapEffectInput = null;
var MyEffect = new System.Windows.Media.Effects.EmbossBitmapEffect();
MyEffect.Relief = 0.8;
MyEffect.LightAngle =320;
this.image1.BitmapEffect = MyEffect;
}
private void button2_Click(object sender, RoutedEventArgs e)
{//凹凸位图特效部分作用于图像
var MyEffect = new System.Windows.Media.Effects.EmbossBitmapEffect();
MyEffect.Relief = 0.8;
MyEffect.LightAngle = 320;
this.image1.BitmapEffect = MyEffect;
var MyInput = new System.Windows.Media.Effects.BitmapEffectInput();
MyInput.AreaToApplyEffect = new Rect(.25, .25, .50, .50);
MyInput.AreaToApplyEffectUnits = System.Windows.Media.BrushMappingMode.RelativeToBoundingBox;
this.image1.BitmapEffectInput= MyInput;
}
完整