Ejemplo n.º 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
                });
            }
            // WINUI
            //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.");
        }
Ejemplo n.º 2
0
        public static Graphics.Size GetImageSourceSize(this WImageSource source)
        {
            if (source is null)
            {
                return(Graphics.Size.Zero);
            }
            else if (source is BitmapSource bitmap)
            {
                return(new Graphics.Size
                {
                    Width = bitmap.PixelWidth,
                    Height = bitmap.PixelHeight
                });
            }
            else if (source is CanvasImageSource canvas)
            {
                return(new Graphics.Size
                {
                    Width = canvas.Size.Width,
                    Height = canvas.Size.Height
                });
            }

            throw new InvalidCastException($"\"{source.GetType().FullName}\" is not supported.");
        }
Ejemplo n.º 3
0
        void UpdateThumbStyle()
        {
            if (_thumb == null)
            {
                return;
            }

            WImageSource imageSource = ThumbImageSource;

            if (imageSource != null)
            {
                _thumb.Style = ImageThumbStyle;
                _thumb.Tag   = imageSource;
            }
            else
            {
                _thumb.Style = _originalThumbStyle;
                _thumb.Tag   = null;
            }
        }
Ejemplo n.º 4
0
 void IImageVisualElementRenderer.SetImage(Microsoft.UI.Xaml.Media.ImageSource image)
 {
     _image.Source = image;
 }