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 scale ) : Image
scale double Scale to apply to the image size
return Image
        public Image Scale(double scale)
        {
            if (!HasFixedSize)
                throw new InvalidOperationException ("Image must have a size in order to be scaled");

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

Same methods

Image::Scale ( double scaleX, double scaleY ) : 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();
        }