public void CaptureFrame(Texture2D frame) { // Get buffer info IntPtr ptr; NatCamBridge.CaptureFrame(out ptr); // Copy frame.LoadRawTextureData(ptr, preview.width * preview.height * 4); frame.Apply(); }
public void CaptureFrame(Texture2D frame) { // Get buffer info IntPtr ptr; NatCamBridge.CaptureFrame(out ptr); if (ptr == IntPtr.Zero) { return; // Only happens in frame when app is suspended } // Copy frame.LoadRawTextureData(ptr, preview.width * preview.height * 4); frame.Apply(); }
public void CaptureFrame(byte[] pixels, bool flip) { // Handle flip specially if (flip) { var handle = GCHandle.Alloc(pixels, GCHandleType.Pinned); NatCamBridge.InvertFrame(handle.AddrOfPinnedObject()); handle.Free(); } else { IntPtr ptr; NatCamBridge.CaptureFrame(out ptr); Marshal.Copy(ptr, pixels, 0, preview.width * preview.height * 4); } }
public void CaptureFrame(byte[] pixels, bool flip) { // Handle flip specially if (flip) { var handle = GCHandle.Alloc(pixels, GCHandleType.Pinned); NatCamBridge.InvertFrame(handle.AddrOfPinnedObject()); handle.Free(); } else { IntPtr ptr; NatCamBridge.CaptureFrame(out ptr); if (ptr == IntPtr.Zero) { return; // Only happens in frame when app is suspended } Marshal.Copy(ptr, pixels, 0, preview.width * preview.height * 4); } }
public void CaptureFrame(byte[] dest) { NatCamBridge.CaptureFrame(dest); }