当前位置: 首页>>代码示例>>C#>>正文


C# PhotoCamera.CaptureImage方法代码示例

本文整理汇总了C#中PhotoCamera.CaptureImage方法的典型用法代码示例。如果您正苦于以下问题:C# PhotoCamera.CaptureImage方法的具体用法?C# PhotoCamera.CaptureImage怎么用?C# PhotoCamera.CaptureImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhotoCamera的用法示例。


在下文中一共展示了PhotoCamera.CaptureImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            _cam = new PhotoCamera();
              previewCanvas.SetSource(_cam);
              previewCanvas.RelativeTransform = new CompositeTransform() {CenterX = 0.5, CenterY = 0.5, Rotation = 90};

              _cam.CaptureImageAvailable += (sender, args) => {
              //var library = new MediaLibrary();
              string fileName = "wp8_kochbuch_" + _imgCounter + ".jpg";
              _library.SavePictureToCameraRoll(fileName, args.ImageStream);
            };

              _cam.CaptureCompleted += (sender, args) => { _imgCounter++; };

              CameraButtons.ShutterKeyPressed += (sender, args) => _cam.CaptureImage();
              CameraButtons.ShutterKeyHalfPressed += (sender, args) => _cam.Focus();
              //CameraButtons.ShutterKeyReleased += (sender, args) => { };

              base.OnNavigatedTo(e);
        }
开发者ID:rolkun,项目名称:WP8Kochbuch,代码行数:20,代码来源:MainPage.xaml.cs

示例2: Init


//.........这里部分代码省略.........

                return MoSync.Constants.MA_CAMERA_RES_OK;
            };

            /**
             * Returns the number of available Camera on the device.
             */
            ioctls.maCameraNumber = delegate()
            {
                if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) && PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
                    return 2;
                else if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) || PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
                    return 1;
                return 0;
            };

            /**
             * Captures an image and stores it as a new data object in the
             * supplied placeholder.
             * @param _formatIndex int the required format.
             * @param _placeHolder int the placeholder used for storing the image.
             */
            ioctls.maCameraSnapshot = delegate(int _formatIndex, int _placeHolder)
            {
                AutoResetEvent are = new AutoResetEvent(false);

                System.Windows.Size dim;
                if (GetCameraFormat(_formatIndex, out dim) == false)
                    return MoSync.Constants.MA_CAMERA_RES_FAILED;

                mCamera.Resolution = dim;

                if (mCameraSnapshotDelegate != null)
                    mCamera.CaptureImageAvailable -= mCameraSnapshotDelegate;
                mCameraSnapshotDelegate = delegate(object o, ContentReadyEventArgs args)
                {
                    MoSync.Util.RunActionOnMainThreadSync(() =>
                    {
                        Resource res = runtime.GetResource(MoSync.Constants.RT_PLACEHOLDER, _placeHolder);
                        Stream data = args.ImageStream;
                        MemoryStream dataMem = new MemoryStream((int)data.Length);
                        MoSync.Util.CopySeekableStreams(data, 0, dataMem, 0, (int)data.Length);
                        res.SetInternalObject(dataMem);
                    });
                    are.Set();
                };

                mCamera.CaptureImageAvailable += mCameraSnapshotDelegate;

                mCamera.CaptureImage();

                are.WaitOne();
                return 0;
            };

            /**
             * Sets the property represented by the string situated at the
             * _property address with the value situated at the _value address.
             * @param _property int the property name address
             * @param _value int the value address
             *
             * Note: the fallowing properties are not available on windows phone
             *      MA_CAMERA_FOCUS_MODE, MA_CAMERA_IMAGE_FORMAT, MA_CAMERA_ZOOM,
             *      MA_CAMERA_MAX_ZOOM.
             */
            ioctls.maCameraSetProperty = delegate(int _property, int _value)
开发者ID:qlmhuge,项目名称:MoSync,代码行数:67,代码来源:MoSyncCameraModule.cs


注:本文中的PhotoCamera.CaptureImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。