Xwt.Drawing.Image.Scale C# (CSharp) Method

Scale() public method

Retuns a scaled copy of the image
This is a lightweight operation. The image is scaled when it is rendered. The method doesn't make a copy of the image data.
public Scale ( double scaleX, double scaleY ) : Image
scaleX double Scale to apply to the width of the image
scaleY double Scale to apply to the height of the image
return Image
        public Image Scale(double scaleX, double scaleY)
        {
            if (!HasFixedSize)
                throw new InvalidOperationException ("Image must have a size in order to be scaled");

            double w = Size.Width * scaleX;
            double h = Size.Height * scaleY;
            return new Image (this) {
                requestedSize = new Size (w, h)
            };
        }

Same methods

Image::Scale ( double scale ) : Image

Usage Example

Ejemplo n.º 1
0
        private void ScaleImage(Xwt.Drawing.Image image)
        {
            double num = (image.Width > image.Height) ? image.Width : image.Height;

            if (num > 46.0)
            {
                double num2 = 46.0 / num;
                image = image.Scale(num2, num2);
            }
            this.imageWidget.Image = image;
            this.imageWidget.QueueDraw();
        }