示例#1
0
        public static Size GetImageSourceSize(this WImageSource source)
        {
            if (source is null)
            {
                return(Size.Zero);
            }
            else if (source is BitmapSource bitmap)
            {
                return(new Size
                {
                    Width = bitmap.PixelWidth,
                    Height = bitmap.PixelHeight
                });
            }
            else if (source is CanvasImageSource canvas)
            {
                return(new Size
                {
                    Width = canvas.Size.Width,
                    Height = canvas.Size.Height
                });
            }

            throw new InvalidCastException($"\"{source.GetType().FullName}\" is not supported.");
        }
示例#2
0
 void IImageVisualElementRenderer.SetImage(global::Windows.UI.Xaml.Media.ImageSource image)
 {
     _image.Source = image;
 }