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); }
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); }
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); } }
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(); } }
public void CapturePhoto(PhotoCallback callback) { photoCallback = callback; NatCamBridge.CapturePhoto(); }
public void CapturePhoto(PhotoCallback callback) { }
public void CapturePhoto(PhotoCallback callback) { photoCallback = callback; natcam.CallStatic("capturePhoto"); }
public static extern void RegisterCoreCallbacks(StartCallback startCallback, PreviewCallback previewCallback, PhotoCallback photoCallback);
/// <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(); } }
public static void CapturePhoto(this IntPtr camera, PhotoCallback callback, IntPtr context) { }
public void CapturePhoto(PhotoCallback callback) { photoCallback = callback; core.Call("capturePhoto"); }
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); }