public void OnImageAvailable(ImageReader reader) => _controller.OnImageAvailable(reader);
			public void OnImageAvailable (ImageReader reader)
			{
				Image image = null;
				try 
				{
					image = reader.AcquireLatestImage();
					ByteBuffer buffer = image.GetPlanes()[0].Buffer;
					byte[] bytes = new byte[buffer.Capacity()];
					buffer.Get(bytes);
					Save(bytes);
				}
				catch (FileNotFoundException ex) {
					Log.WriteLine (LogPriority.Info, "Camera capture session", ex.StackTrace);
				}
				catch (IOException ex) {
					Log.WriteLine (LogPriority.Info, "Camera capture session", ex.StackTrace);
				}
				finally {
					if (image != null)
						image.Close ();
				}
			}
Exemplo n.º 3
0
        internal void OnImageAvailable(ImageReader reader)
        {
            _backgroundHandler.Post(() =>
            {
                var image = reader.AcquireNextImage();

                var buffer = image.GetPlanes()[0].Buffer;
                var length = buffer.Remaining();

                var data = new byte[length];
                buffer.Get(data);

                RaisePictureTaken(data);

                image.Close();

                RestartPreview();
            });
        }
 public void OnImageAvailable(ImageReader reader)
 {
     Owner.mBackgroundHandler.Post(new ImageSaver(reader.AcquireNextImage(), File));
 }