Exemple #1
0
 private static void onPhoto(IntPtr imgPtr, int width, int height)
 {
     using (var dispatch = new MainDispatch()) {
         if (instance.photoCallback != null && imgPtr != IntPtr.Zero)
         {
             var photo = new Texture2D(width, height, TextureFormat.BGRA32, false);
             photo.LoadRawTextureData(unchecked ((IntPtr)(long)(ulong)imgPtr), width * height * 4);
             photo.Apply();
             NatCamBridge.ReleasePhoto(imgPtr);
             instance.photoCallback(photo);
         }
         instance.photoCallback = null;
     }
 }
Exemple #2
0
 private static void onPhoto(IntPtr imgPtr, int width, int height, int size)
 {
     using (var dispatch = new MainDispatch()) {
         if (instance.photoCallback == null)
         {
             NatCamBridge.ReleasePhoto();
             return;
         }
         if (imgPtr == IntPtr.Zero)
         {
             return;
         }
         var photo = new Texture2D(width, height, TextureFormat.BGRA32, false);
         photo.LoadRawTextureData(unchecked ((IntPtr)(long)(ulong)imgPtr), size);
         photo.Apply();
         NatCamBridge.ReleasePhoto();
         instance.photoCallback(photo, 0);
         instance.photoCallback = null;
     }
 }