public void LoadImageInto( Context context, ImageSource imageSource, VrPanoramaView panoramaView, VrPanoramaView.Options options ) { if (imageSource is UriImageSource uriImageSource) { var target = new VrImageTarget(panoramaView, options); Glide.With(context).Load(uriImageSource.Uri.ToString()).Into(target); } else if (imageSource is FileImageSource fileImageSource) { var assetUri = Android.Net.Uri.Parse($"file:///android_asset/{fileImageSource.File}"); var target = new VrImageTarget(panoramaView, options); Glide.With(context).Load(assetUri).Into(target); } }
private async Task LoadPanoramaFromIntent() { var options = new VrPanoramaView.Options { InputType = Intent.GetIntExtra(VrIntentExtras.IMAGE_TYPE, VrPanoramaView.Options.TypeMono) }; if (Intent.HasExtra(VrIntentExtras.IMAGE_ASSET_NAME)) { var imageStream = Assets.Open(Intent.GetStringExtra(VrIntentExtras.IMAGE_ASSET_NAME)); var imageBitmap = BitmapFactory.DecodeStream(imageStream); _panoramaView.LoadImageFromBitmap(imageBitmap, options); } else if (Intent.HasExtra(VrIntentExtras.IMAGE_URL)) { var imageUrl = Intent.GetStringExtra(VrIntentExtras.IMAGE_URL); var imageStream = await _httpClient.GetStreamAsync(imageUrl); var imageBitmap = await BitmapFactory.DecodeStreamAsync(imageStream); _panoramaView.LoadImageFromBitmap(imageBitmap, options); } }
public virtual async void LoadImageInto( Context context, ImageSource imageSource, VrPanoramaView panoramaView, VrPanoramaView.Options options ) { var bitmap = await LoadBitmapFromImageSource(context, imageSource).ConfigureAwait(false); if (bitmap == null) { return; } try { panoramaView.LoadImageFromBitmap(bitmap, options); } catch (Java.IO.IOException) { Log.Error(TAG, $"Could not load image {imageSource}"); } }
public VrImageTarget(VrPanoramaView _panoramaView, VrPanoramaView.Options _options) { this._panoramaView = _panoramaView; this._options = _options; }