Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
 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);
 }