我有2张图片,我想将它们合并到Windows Phone中的应用程序中。
我的WP相机拍摄的第一张图像,第二张图像是一个框架(边框,滤镜等),用户可以在我们的模板中选择。那么如何将它们合并为一个呢?
谢谢和最诚挚的问候。
答案 0 :(得分:7)
我不太明白你的要求。但我想你想要将1张图像叠加在另一张图像之上。如果是这样,那么已经有答案here。在<grid>
内,您可以同时提供图片,并自定义每张图片的不透明度以使其重叠。
<强>编辑:强> 您可以使用Writeablebitmap,并且已经存在here的库。在WP7项目中添加WriteableBitmapExWinPhone后,您可以通过执行以下操作合并图像和框架:
var photo = ...//you writeablebitmap of image here
var frame = ...//your writeablebitmap of frame here
var merge = new WriteableBitmap(435, 435); //size of merge canvas
merge .Clear(Colors.White); //white background
merge.Blit(new Rect(oX, oY, w, h), photo, new Rect(0, 0, photo.PixelWidth, photo.PixelHeight)); //draw the photo first
merge.Blit(new Rect(0, 0, 435, 435), frame, new Rect(0, 0, frame.PixelWidth, frame.PixelHeight)); //draw the frame