public static void CapturePhoto() { if (!supportedDevice) { Ext.Warn("Current device has no cameras"); return; } if (Preview == null) { return; } if (!Preview.isPlaying) { return; } #if ALLOCATE_NEW_PHOTO_TEXTURES Photo = new Texture2D(Preview.width, Preview.height); #else if (Photo == null) { Photo = new Texture2D(Preview.width, Preview.height); } #endif lock (bufferLock) { Preview.GetPixels32(PreviewBuffer); Photo.SetPixels32(PreviewBuffer); } Photo.Apply(); PropagatePhoto(Photo); }
private static void CheckBuffer() { width = Preview.width; height = Preview.height; if (PreviewBuffer == null) { PreviewBuffer = new Color32[width * height]; } if (PreviewBuffer.Length != width * height) { PreviewBuffer = new Color32[width * height]; } if (mMetadataDetection) { lock (bufferLock) Preview.GetPixels32(PreviewBuffer); } }