如何在Windows Phone 7上操作图像 [英] How to manipulate image on windows phone 7

查看:64
本文介绍了如何在Windows Phone 7上操作图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

反正有没有办法操纵Windows Phone相机拍摄的图像?
它不像棕褐色那样编辑它或将其转换成黑白,我想要的是在它上面添加框架,或者其他一些有趣的东西,例如帽子,眼镜或类似的东西.
我进行了搜索,但发现的全部是将图像转换为其他颜色.

Is there anyway to manipulate images taken by the windows phone camera?
Its not editing it like sepia or converting it to black and white, what I would like is adding frames on top of it, or maybe some other funny stuffs like hats or glasses or stuffs like that.
I searched for it, but all I found are converting the images to another colors.

推荐答案

所以,无论如何,因为似乎没有答案,所以这是我最终做到了:

So, anyway, because it seems like there is no answer, here is how i ended up doing it:

public partial class MainPage : PhoneApplicationPage
    {
        WriteableBitmap wb;
        PhotoCamera cam;

        //constructors, other stuffs...
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
                {
                    base.OnNavigatedTo(e);
                    cam = new PhotoCamera();
                    this.cam.CaptureCompleted += new EventHandler(cam_CaptureCompleted);
                    this.cam.CaptureImageAvailable += new EventHandler(cam_CaptureImageAvailable);
                }

    void cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
        {
            Dispatcher.BeginInvoke(() => {
                BitmapImage bi = new BitmapImage();
                bi.SetSource(e.ImageStream);
                previewImage1.Source = bi;
                wb = new WriteableBitmap(ImageStack, null);
                previewImage.Source = wb;
            }); 
        }



因此,基本上,我将一个Image对象,要堆叠在一起的帧/精灵放到一个网格中,在照片捕获了相机之后,图像源将设置为该照片,然后使用该图像栈初始化了一个WritableBitmap ..
当然,因此,图片的分辨率仅限于应用程序的分辨率,但是,总比没有好...



So, basically, i put an Image object, the frames/sprites that i wanted to stack together into a grid, after the photo captured the camera, the image source will be set to that photo, and i initialized a WritableBitmap using that image stack..
of course, because of this, the resolution of the picture is limited to the resolution of the application, but well, better than nothing...


这篇关于如何在Windows Phone 7上操作图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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