public override void DidFinishProcessingPhoto(AVCapturePhotoOutput output, AVCapturePhoto photo, NSError error) { if (error != null) { Console.WriteLine($"Error capturing photo: {error.LocalizedDescription}"); } else { photoData = photo.FileDataRepresentation; } }
public void DidFinishProcessingPhoto(AVCapturePhotoOutput output, AVCapturePhoto photo, NSError error) { var imageData = photo.FileDataRepresentation; if (imageData != null) { var previewImage = new UIImage(imageData); previewImage.SaveToPhotosAlbum((img, err) => { if (err == null) { App.Current.MainPage.DisplayAlert("", "Saved image to photos", "OK"); } else { App.Current.MainPage.DisplayAlert("", "Save image to photos Fail", "OK"); } }); delege?.ImageTake(previewImage); } }
override public void DidFinishProcessingPhoto(AVCapturePhotoOutput output, AVCapturePhoto photo, NSError error) { string localFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); var localPath = System.IO.Path.Combine(localFolder, $"Photo_{DateTime.Now.ToString("yyMMdd_hhmmss")}.jpg"); var errMsg = error?.Description; try { System.IO.File.WriteAllBytes(localPath, photo.FileDataRepresentation.ToArray()); // write to local storage } catch (Exception ex) { errMsg = ex.Message; } finally { if (SavedPhoto != null) { SavedPhoto(this, new ListEventArgs(localPath, errMsg)); } } }
// ReSharper disable once UnusedMember.Local private void PhotoCaptureComplete(AVCapturePhotoOutput captureOutput, AVCapturePhoto photo, NSError error) { try { if (error != null) { _cameraModule.ErrorMessage = error.ToString(); } else if (photo != null) { if (!(_cameraModule.BluetoothOperator.PairStatus == PairStatus.Connected && !_cameraModule.BluetoothOperator.IsPrimary)) { LockPictureSpecificSettingsIfApplicable(); } using (var cgImage = photo.CGImageRepresentation) using (var uiImage = UIImage.FromImage(cgImage, 1, GetOrientationForCorrection())) { var imageBytes = uiImage.AsJPEG().ToArray(); if (_cameraModule.BluetoothOperator.PairStatus == PairStatus.Connected && !_cameraModule.BluetoothOperator.IsPrimary) { _cameraModule.BluetoothOperator.SendCapture(imageBytes); } else { _cameraModule.CapturedImage = imageBytes; } } } } catch (Exception e) { _cameraModule.ErrorMessage = e.ToString(); } }
// ReSharper disable once UnusedMember.Local private void PhotoCaptureComplete(AVCapturePhotoOutput captureOutput, AVCapturePhoto photo, NSError error) { try { if (error != null) { _cameraModule.ErrorMessage = error.ToString(); } else if (photo != null) { LockPictureSpecificSettingsIfNothingCaptured(); using (var cgImage = photo.CGImageRepresentation) using (var uiImage = UIImage.FromImage(cgImage, 1, GetOrientationForCorrection())) { _cameraModule.CapturedImage = uiImage.AsJPEG().ToArray(); } } } catch (Exception e) { _cameraModule.ErrorMessage = e.ToString(); } }
public override void DidFinishProcessingPhoto(AVCapturePhotoOutput output, AVCapturePhoto photo, NSError error) { Picture = photo.CGImageRepresentation; FinishedProcessing?.Invoke(this, null); }
public static NSData FileDataRepresentation(this AVCapturePhoto This) { return(Runtime.GetNSObject <NSData>(global::ApiDefinition.Messaging.IntPtr_objc_msgSend(This.Handle, Selector.GetHandle("fileDataRepresentation")))); }
public virtual void DidFinishProcessingPhoto(AVCapturePhotoOutput captureOutput, AVCapturePhoto photo, NSError error) { if (error != null) { Console.WriteLine($"Error capturing photo: {error}", error); return; } PhotoData = photo.FileDataRepresentation(); }
public virtual void DidFinishProcessingPhoto(AVCapturePhotoOutput captureOutput, AVCapturePhoto photo, NSError error) { if (error != null) { Console.WriteLine($"Error capturing photo: {error}", error); return; } PhotoData = photo.FileDataRepresentation(); imageBytes = new byte[PhotoData.Length]; System.Runtime.InteropServices.Marshal.Copy(PhotoData.Bytes, imageBytes, 0, Convert.ToInt32(PhotoData.Length)); }
public override void DidFinishProcessingPhoto(AVCapturePhotoOutput output, AVCapturePhoto photo, NSError error) { Debug.WriteLine(error); handler(photo); }
public virtual void DidFinishProcessingPhoto(AVCapturePhotoOutput captureOutput, AVCapturePhoto photo, NSError error) { if (error != null) { Console.WriteLine($"Error capturing photo: {error}", error); return; } PhotoData = photo.FileDataRepresentation(); DataManager.SheduleAddMachinePhotoRequest(Application.selectedMachine.ID, PhotoData.ToArray(), null); }