Beispiel #1
0
        public Task <WImageSource> LoadImageAsync(ImageSource imagesource, CancellationToken cancelationToken = default(CancellationToken))
        {
            WImageSource image = null;

            var imageImageSource = imagesource as SKImageImageSource;

            if (imageImageSource != null)
            {
                image = imageImageSource.Image?.ToWriteableBitmap();
            }

            var bitmapImageSource = imagesource as SKBitmapImageSource;

            if (bitmapImageSource != null)
            {
                image = bitmapImageSource.Bitmap?.ToWriteableBitmap();
            }

            var pixmapImageSource = imagesource as SKPixmapImageSource;

            if (pixmapImageSource != null)
            {
                image = pixmapImageSource.Pixmap?.ToWriteableBitmap();
            }

            var pictureImageSource = imagesource as SKPictureImageSource;

            if (pictureImageSource != null)
            {
                image = pictureImageSource.Picture?.ToWriteableBitmap(pictureImageSource.Dimensions);
            }

            return(Task.FromResult(image));
        }
        public Task <Microsoft.UI.Xaml.Media.ImageSource> LoadImageAsync(ImageSource imagesource, CancellationToken cancellationToken = new CancellationToken())
        {
            Microsoft.UI.Xaml.Media.ImageSource image = null;
            if (imagesource is FileImageSource filesource)
            {
                UpdateImageDirectory(filesource);
                string file = filesource.File;
                image = new BitmapImage(new Uri("ms-appx:///" + file));
            }

            return(Task.FromResult(image));
        }
Beispiel #3
0
 void IImageVisualElementRenderer.SetImage(Microsoft.UI.Xaml.Media.ImageSource image)
 {
     Control.Source = image;
 }