Exemplo n.º 1
0
 public override void OnResourceReady(Java.Lang.Object resource, ITransition transition)
 {
     if (resource is BitmapDrawable drawable)
     {
         _panoramaView.LoadImageFromBitmap(drawable.Bitmap, _options);
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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}");
            }
        }