コード例 #1
0
        public void CapturePhoto(PhotoCallback callback)
        {
            var photo = new Texture2D(PreviewTexture.width, PreviewTexture.height, TextureFormat.RGB24, false, false);

            photo.SetPixels32(PreviewTexture.GetPixels32());
            photo.Apply();
            callback(photo);
        }
コード例 #2
0
 public static void CapturePhoto(PhotoCallback callback)
 {
     if (callback == null)
     {
         Util.LogError("Cannot capture photo when callback is null");
         return;
     }
     if (!Implementation.IsPlaying)
     {
         Util.LogError("Cannot capture photo when session is not running");
         return;
     }
     Implementation.CapturePhoto(callback);
 }
コード例 #3
0
        public void CapturePhoto(PhotoCallback callback)
        {
            if (!supportedDevice || !preview || !preview.isPlaying)
            {
                return;
            }
            var photo = new Texture2D(preview.width, preview.height, TextureFormat.ARGB32, false, false);

            photo.SetPixels32(preview.GetPixels32());
            photo.Apply();
            if (callback != null)
            {
                callback(photo, 0);
            }
        }
コード例 #4
0
ファイル: NatCam.cs プロジェクト: kal5544/DATALAB-Symposium
 public static void CapturePhoto(params PhotoCallback[] callbacks)
 {
     if (!IsPlaying)
     {
         Ext.Warn("Cannot capture photo when session is not running");
         return;
     }
     if (callbacks.Length == 0 && OnPhotoCapture == null)
     {
         Ext.Warn("Cannot capture photo because there is no callback subscribed");
         return;
     }
     else if (callbacks.Length > 0)
     {
         for (int i = 0; i < callbacks.Length; i++)
         {
             PhotoCallback callback       = callbacks[i];
             PhotoCallback captureWrapper = null;
             captureWrapper = (Texture2D photo) => {
                 if (callback != null)
                 {
                     callback(photo);
                 }
                 OnPhotoCapture -= captureWrapper;
             };
             OnPhotoCapture += captureWrapper;
         }
     }
     if (Interface == NatCamInterface.NativeInterface)
     {
         Native.CapturePhoto();
     }
     else
     {
         Fallback.CapturePhoto();
     }
 }
コード例 #5
0
 public void CapturePhoto(PhotoCallback callback)
 {
     photoCallback = callback;
     NatCamBridge.CapturePhoto();
 }
コード例 #6
0
 public void CapturePhoto(PhotoCallback callback)
 {
 }
コード例 #7
0
 public void CapturePhoto(PhotoCallback callback)
 {
     photoCallback = callback;
     natcam.CallStatic("capturePhoto");
 }
コード例 #8
0
 public static extern void RegisterCoreCallbacks(StartCallback startCallback, PreviewCallback previewCallback, PhotoCallback photoCallback);
コード例 #9
0
ファイル: NatCamUtilities.cs プロジェクト: xsvonjhs/VOMO
        /// <summary>
        /// Rotates an image and returns it through the callback. Note that the image will be modified
        /// </summary>
        /// <param name="texture">The texture to be modified</param>
        /// <param name="rotation">Rotation to be applied to the buffer. This is equivalent to the Orientation struct</param>
        /// <param name="workerDispatch">Worker dispatch where the image will be rotated. If null, the calling thread will be used</param>
        /// <param name="mainDispatch">Main dispatch where callback will be invoked (so as to maintain Unity API thread access restrictions)</param>
        /// <param name="callback">Callback to be invoked with the rotated texture</param>
        public static void RotateImage(Texture2D texture, Orientation rotation, IDispatch workerDispatch, IDispatch mainDispatch, PhotoCallback callback)    // NCDOC
        {
            if (callback == null)
            {
                return;
            }
            if (rotation == 0)
            {
                callback(texture, rotation); return;
            }
            Color32[] src        = texture.GetPixels32(), dst = new Color32[texture.width * texture.height];
            Action    completion = () => {
                if (((int)rotation & 7) % 2 != 0)
                {
                    texture.Resize(texture.height, texture.width);
                }
                texture.SetPixels32(dst);
                texture.Apply();
                src = dst = null;
                GC.Collect(); // No guarantees, but just have it anyway
                callback(texture, (Orientation)rotation);
            };
            Action process = () => {
                RotateImage(dst, src, texture.width, texture.height, (byte)rotation);
                if (mainDispatch != null)
                {
                    mainDispatch.Dispatch(completion);
                }
                else
                {
                    completion();
                }
            };

            if (workerDispatch != null)
            {
                workerDispatch.Dispatch(process);
            }
            else
            {
                process();
            }
        }
コード例 #10
0
 public static void CapturePhoto(this IntPtr camera, PhotoCallback callback, IntPtr context)
 {
 }
コード例 #11
0
 public void CapturePhoto(PhotoCallback callback)
 {
     photoCallback = callback;
     core.Call("capturePhoto");
 }
コード例 #12
0
 public static void RegisterEvents(Action Start, Action Update, PhotoCallback Photo, BarcodeCallback Barcode, FaceCallback Face, Action <bool> Focus)
 {
     PropagateStart = Start; PropagateUpdate = Update; PropagatePhoto = Photo; PropagateBarcode = Barcode; PropagateFace = Face; listener.RegisterCallback(Focus);
 }