public override void Test() { int maxSize = 1024; AN_Camera.CaptureImage(maxSize, (result) => { if (result.IsSucceeded) { Texture2D image = result.Media.Thumbnail; AN_Logger.Log("Captured image Color: " + image.GetPixel(10, 10)); AN_Logger.Log("Captured image Color: " + image.GetPixel(50, 50)); AN_Logger.Log("m_texture.width: " + image.width + " height: " + image.height); } SetAPIResult(result); }); }
public void TakePicture(int thumbnailSize, Action <UM_MediaResult> callback) { AN_Camera.CaptureImage(thumbnailSize, (result) => { UM_MediaResult pickResult; if (result.IsSucceeded) { var media = new UM_Media(result.Media.Thumbnail, result.Media.Path, UM_MediaType.Image); pickResult = new UM_MediaResult(media); } else { pickResult = new UM_MediaResult(result.Error); } callback.Invoke(pickResult); }); }
private void Awake() { AddFitter(m_image.gameObject); AddFitter(m_sprite.gameObject); m_captureAdvanced.onClick.AddListener(() => { var maxSize = 1024; AN_Camera.CaptureImage(maxSize, (result) => { PrintCaptureResult(result); }); }); m_captureVideo.onClick.AddListener(() => { var maxSize = 1024; AN_Camera.CaptureVideo(maxSize, (result) => { PrintCaptureResult(result); }); }); m_getVideos.onClick.AddListener(() => { var picker = new AN_MediaPicker(AN_MediaType.Video); picker.AllowMultiSelect = true; picker.MaxSize = 512; picker.Show((result) => { PrintPickerResult(result); }); }); m_getMixed.onClick.AddListener(() => { var picker = new AN_MediaPicker(AN_MediaType.Image, AN_MediaType.Video); picker.AllowMultiSelect = true; picker.MaxSize = 512; picker.Show((result) => { PrintPickerResult(result); }); }); m_getPictures.onClick.AddListener(() => { var picker = new AN_MediaPicker(AN_MediaType.Image); // Defines if multiple images picker is allowed. // The default value is < c > false </ c > picker.AllowMultiSelect = true; // Max thumbnail size that will be transferred to the Unity side. // The thumbnail will be resized before it sent. // The default value is 512. picker.MaxSize = 512; // Starts pick media from a gallery flow. picker.Show((result) => { PrintPickerResult(result); }); }); m_saveScreenshot.onClick.AddListener(() => { SA_ScreenUtil.TakeScreenshot(512, (screenshot) => { AN_Gallery.SaveImageToGallery(screenshot, "ExampleScreenshot", (result) => { if (result.IsFailed) { AN_Logger.Log("Filed: " + result.Error.Message); return; } AN_Logger.Log("Screenshot has been saved to: " + result.Path); }); }); }); }