Windows Phone 8.1中的图像重叠

时间:2014-05-29 13:57:49

标签: c# windows-phone windows-phone-8.1

我正在创建一个Windows Phone应用程序,我需要一个图像(让它成为image1)。 我有100个其他图像,我想要的是在需要时将每个图像重叠到图像1上。

(注意:我想在编辑后保存图像)

在Windows Phone中创建此功能的可能方法是什么。

我熟悉WPForms中的C#,我之前使用过这段代码......

//在这段代码中,我在1.png上绘制了2.png

        string imageFilePath = @"D:\1.png";
        Bitmap bitmap = (Bitmap)Image.FromFile(imageFilePath);//load the image file

        string image = @"D:\2.png";
        Bitmap bitmap2 = (Bitmap)Image.FromFile(image);//load the image file

        using (Graphics graphics = Graphics.FromImage(bitmap))
        {
            graphics.DrawImageUnscaled(bitmap2, 5, 5);
        }

1 个答案:

答案 0 :(得分:0)

试试这个:

WriteableBitmap bmpCurrentScreenImage = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
bmpCurrentScreenImage.Render(LayoutRoot, new MatrixTransform());
bmpCurrentScreenImage.Invalidate();

将位图bmpCurrentScreenImage保存到要保存的位置。