在WPF将两张位图图像 [英] Overlay two bitmap images in WPF

查看:146
本文介绍了在WPF将两张位图图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要覆盖两个图像(比如,JPEG和PNG透明)。

I need to overlay two images (say, JPEG and PNG with transparency).

输入:
- JPEG图像
- PNG图像

Input: - JPEG image - PNG image

输出:
- 施加PNG JPEG图像

Output: - JPEG image with PNG applied.

什么是做的最好的方法?

What is the best approach to do that?

感谢您事先的答复和提示!

Thank you in advance for the replies and hints!

干杯

推荐答案

您可以使用这样一个DrawingGroup:

You can use a DrawingGroup like this:

var group = new DrawingGroup();
group.Children.Add(new ImageDrawing(new BitmapImage(new Uri(@"...\Some.jpg", UriKind.Absolute)), new Rect(0, 0, ??, ??)));
group.Children.Add(new ImageDrawing(new BitmapImage(new Uri(@"...\Some.png", UriKind.Absolute)), new Rect(0, 0, ??, ??)));

MyImage.Source = new DrawingImage(group);

这篇关于在WPF将两张位图图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆