Beispiel #1
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var source      = image.ToSD();
            var hasAlpha    = (source.Flags & (int)sdi.ImageFlags.HasAlpha) != 0;
            var pixelFormat = source.PixelFormat;

            if (
                pixelFormat == sdi.PixelFormat.Indexed ||
                pixelFormat == sdi.PixelFormat.Format1bppIndexed ||
                pixelFormat == sdi.PixelFormat.Format4bppIndexed ||
                pixelFormat == sdi.PixelFormat.Format8bppIndexed)
            {
                pixelFormat = hasAlpha ? sdi.PixelFormat.Format32bppArgb : sdi.PixelFormat.Format32bppRgb;
            }
            Control = new sd.Bitmap(width, height, pixelFormat);

            using (var graphics = sd.Graphics.FromImage(Control))
            {
                graphics.InterpolationMode = interpolation.ToSD();
                var rect = new sd.Rectangle(0, 0, width, height);
                if (hasAlpha)
                {
                    graphics.Clear(sd.Color.Transparent);
                }
                graphics.DrawImage(source, rect);
            }
        }
Beispiel #2
0
        public void DrawImage(Image image, float x, float y, float width, float height)
        {
            SetOffset(true);
            var bmp = image.ToDx(Control);

            Control.DrawBitmap(bmp, new s.RectangleF(x, y, width, height), 1f, ImageInterpolation.ToDx());
        }
Beispiel #3
0
 public void CreateFromImage(Bitmap image)
 {
     Control = SD.Graphics.FromImage((SD.Image)image.ControlObject);
     Control.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.None;
     this.Control.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     this.ImageInterpolation    = Eto.Drawing.ImageInterpolation.Default;
 }
Beispiel #4
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var source = image.ToUI();

            // todo: use interpolation
            Control = source.Scale(new SD.SizeF(width, height), 0f);
        }
        static Volume <byte> Scaled(Volume <byte> source, V2d scaleFactor, ImageInterpolation ip = ImageInterpolation.Cubic)
        {
            var targetSize = (new V2d(0.5, 0.5) + scaleFactor * (V2d)source.Size.XY).ToV2l();
            var target     = new V3l(targetSize.X, targetSize.Y, source.Size.Z).CreateImageVolume <byte>();

            for (int c = 0; c < source.Size.Z; c++)
            {
                var targetMat = target.SubXYMatrixWindow(0);
                var sourceMat = source.SubXYMatrixWindow(0);
                switch (ip)
                {
                case ImageInterpolation.Near: targetMat.SetScaledNearest(sourceMat); break;

                case ImageInterpolation.Linear:
                    targetMat.SetScaledLinear(sourceMat, (s, a, b) => (byte)s.Lerp(a, b), (s, a, b) => (byte)s.Lerp(a, b));
                    break;

                case ImageInterpolation.Cubic: targetMat.SetScaledCubic(sourceMat); break;

                case ImageInterpolation.Lanczos: targetMat.SetScaledLanczos(sourceMat); break;

                default: throw new NotImplementedException();
                }
            }
            return(target);
        }
Beispiel #6
0
        public void DrawImage(Image image, float x, float y, float width, float height)
        {
            SetOffset(true);
            var bmp = image.ToDx(Control, Size.Ceiling(CurrentTransform.TransformSize(new SizeF(width, height))));

            Control.DrawBitmap(bmp, new s.RectangleF(x, y, width, height), 1f, ImageInterpolation.ToDx());
        }
Beispiel #7
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var source = image.ToSD();

            Control = new SD.Bitmap(width, height, source.PixelFormat);
            using (var graphics = SD.Graphics.FromImage(Control)) {
                graphics.InterpolationMode = interpolation.ToSD();
                var rect = new SD.Rectangle(0, 0, width, height);
                graphics.FillRectangle(SD.Brushes.Transparent, rect);
                graphics.DrawImage(source, rect);
            }
        }
Beispiel #8
0
		public static NSImageRep Resize(this NSImageRep image, CGSize newsize, ImageInterpolation interpolation = ImageInterpolation.Default, CGSize? imageSize = null)
		{
			var newrep = new NSBitmapImageRep(IntPtr.Zero, (nint)newsize.Width, (nint)newsize.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * (nint)newsize.Width, 32);
			newrep.Size = imageSize ?? newsize;

			var graphics = NSGraphicsContext.FromBitmap(newrep);
			NSGraphicsContext.GlobalSaveGraphicsState();
			NSGraphicsContext.CurrentContext = graphics;
			graphics.GraphicsPort.InterpolationQuality = interpolation.ToCG();
			image.DrawInRect(new CGRect(CGPoint.Empty, newrep.Size), CGRect.Empty, NSCompositingOperation.SourceOver, 1f, true, DrawHints);
			NSGraphicsContext.GlobalRestoreGraphicsState();
			return newrep;
		}
Beispiel #9
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var imageHandler = (ImageHandler <TWidget>)image.Handler;

            Control = new sw.Bitmap(SDFactory.WicImagingFactory, width, height, imageHandler.Control.PixelFormat, sw.BitmapCreateCacheOption.CacheOnLoad);
            using (var graphics = new Graphics(Widget as Bitmap))
            {
                graphics.ImageInterpolation = interpolation;
                var rect = new Rectangle(0, 0, width, height);
                graphics.FillRectangle(Colors.Transparent, rect);
                graphics.DrawImage(image, rect);
            }
        }
Beispiel #10
0
		public static NSImage Resize(this NSImage image, sd.Size newsize, ImageInterpolation interpolation = ImageInterpolation.Default)
		{
			var newimage = new NSImage(newsize);
			var newrep = new NSBitmapImageRep(IntPtr.Zero, newsize.Width, newsize.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * newsize.Width, 32);
			newimage.AddRepresentation(newrep);

			var graphics = NSGraphicsContext.FromBitmap(newrep);
			NSGraphicsContext.GlobalSaveGraphicsState();
			NSGraphicsContext.CurrentContext = graphics;
			graphics.GraphicsPort.InterpolationQuality = interpolation.ToCG();
			image.DrawInRect(new sd.RectangleF(sd.PointF.Empty, newimage.Size), new sd.RectangleF(sd.PointF.Empty, image.Size), NSCompositingOperation.SourceOver, 1f);
			NSGraphicsContext.GlobalRestoreGraphicsState();
			return newimage;
		}
Beispiel #11
0
        public static NSImageRep Resize(this NSImageRep image, CGSize newsize, ImageInterpolation interpolation = ImageInterpolation.Default, CGSize?imageSize = null)
        {
            var newrep = new NSBitmapImageRep(IntPtr.Zero, (nint)newsize.Width, (nint)newsize.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * (nint)newsize.Width, 32);

            newrep.Size = imageSize ?? newsize;

            var graphics = NSGraphicsContext.FromBitmap(newrep);

            NSGraphicsContext.GlobalSaveGraphicsState();
            NSGraphicsContext.CurrentContext           = graphics;
            graphics.GraphicsPort.InterpolationQuality = interpolation.ToCG();
            image.DrawInRect(new CGRect(CGPoint.Empty, newrep.Size), CGRect.Empty, NSCompositingOperation.SourceOver, 1f, true, DrawHints);
            NSGraphicsContext.GlobalRestoreGraphicsState();
            return(newrep);
        }
Beispiel #12
0
		Control CreateImage(ImageInterpolation interpolation)
		{
			var image = TestIcons.TestImage;
			var drawable = new Drawable { Size = new Size(250, 160) };

			drawable.Paint += (sender, pe) =>
			{
				pe.Graphics.ImageInterpolation = interpolation;
				pe.Graphics.DrawImage(image, 0, 0, 20, 20);
				pe.Graphics.DrawImage(image, 0, 20, 50, 50);
				pe.Graphics.DrawImage(image, 0, 70, 100, 100);
				pe.Graphics.DrawImage(image, 120, 0, 300, 300);
			};

			return drawable;
		}
Beispiel #13
0
        public static NSImage Resize(this NSImage image, sd.Size newsize, ImageInterpolation interpolation = ImageInterpolation.Default)
        {
            var newimage = new NSImage(newsize);
            var newrep   = new NSBitmapImageRep(IntPtr.Zero, newsize.Width, newsize.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * newsize.Width, 32);

            newimage.AddRepresentation(newrep);

            var graphics = NSGraphicsContext.FromBitmap(newrep);

            NSGraphicsContext.GlobalSaveGraphicsState();
            NSGraphicsContext.CurrentContext           = graphics;
            graphics.GraphicsPort.InterpolationQuality = interpolation.ToCG();
            image.DrawInRect(new sd.RectangleF(sd.PointF.Empty, newimage.Size), new sd.RectangleF(sd.PointF.Empty, image.Size), NSCompositingOperation.SourceOver, 1f);
            NSGraphicsContext.GlobalRestoreGraphicsState();
            return(newimage);
        }
Beispiel #14
0
		public static Cairo.Filter ConvertC (ImageInterpolation value)
		{
			switch (value) {
			case ImageInterpolation.Default:
				return  Cairo.Filter.Bilinear;
			case ImageInterpolation.None:
				return Cairo.Filter.Nearest;
			case ImageInterpolation.High:
				return  Cairo.Filter.Best;
			case ImageInterpolation.Low:
				return  Cairo.Filter.Fast;
			case ImageInterpolation.Medium:
				return  Cairo.Filter.Good;
			default:
				throw new NotSupportedException();
			}
		}
Beispiel #15
0
        public static sd.BitmapInterpolationMode ToDx(this ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.None:
                return(sd.BitmapInterpolationMode.NearestNeighbor);

            case ImageInterpolation.Default:
            case ImageInterpolation.Low:
            case ImageInterpolation.Medium:
            case ImageInterpolation.High:
                return(sd.BitmapInterpolationMode.Linear);

            default:
                throw new NotSupportedException();
            }
        }
		Control CreateImage (ImageInterpolation interpolation)
		{
			var resourceStream = GetType().Assembly.GetManifestResourceStream ("Eto.Test.TestImage.png");

			var image = new Bitmap (resourceStream);
			var drawable = new Drawable { Size = new Size(250, 160) };

			drawable.Paint += (sender, pe) => {
				pe.Graphics.ImageInterpolation = interpolation;
				pe.Graphics.DrawImage (image, 0, 0, 20, 20);
				pe.Graphics.DrawImage (image, 0, 20, 50, 50);
				pe.Graphics.DrawImage (image, 0, 70, 100, 100);
				pe.Graphics.DrawImage (image, 120, 0, 300, 300);
			};

			return drawable;
		}
Beispiel #17
0
 /// <summary>
 /// Create a new scaled bitmap with the specified <paramref name="width"/> and <paramref name="height"/>
 /// </summary>
 /// <param name="image">Image to scale</param>
 /// <param name="width">Width to scale the source image to</param>
 /// <param name="height">Height to scale the source image to</param>
 /// <param name="interpolation">Interpolation quality</param>
 public Bitmap(Image image, int?width = null, int?height = null, ImageInterpolation interpolation = ImageInterpolation.Default)
 {
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
     if (width != null && width <= 0)
     {
         throw new ArgumentOutOfRangeException("width", "width must be greater than zero");
     }
     if (height != null && height <= 0)
     {
         throw new ArgumentOutOfRangeException("height", "height must be greater than zero");
     }
     Handler.Create(image, width ?? image.Size.Width, height ?? image.Size.Height, interpolation);
     Initialize();
 }
Beispiel #18
0
        Control CreateImage(ImageInterpolation interpolation)
        {
            var image    = TestIcons.TestImage;
            var drawable = new Drawable {
                Size = new Size(250, 160)
            };

            drawable.Paint += (sender, pe) =>
            {
                pe.Graphics.ImageInterpolation = interpolation;
                pe.Graphics.DrawImage(image, 0, 0, 20, 20);
                pe.Graphics.DrawImage(image, 0, 20, 50, 50);
                pe.Graphics.DrawImage(image, 0, 70, 100, 100);
                pe.Graphics.DrawImage(image, 120, 0, 300, 300);
            };

            return(drawable);
        }
Beispiel #19
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            ApplicationHandler.InvokeIfNecessary(() => {
                var source = image.ToWpf();
                // use drawing group to allow for better quality scaling
                var group = new swm.DrawingGroup();
                swm.RenderOptions.SetBitmapScalingMode(group, interpolation.ToWpf());
                group.Children.Add(new swm.ImageDrawing(source, new sw.Rect(0, 0, width, height)));

                var drawingVisual = new swm.DrawingVisual();
                using (var drawingContext = drawingVisual.RenderOpen())
                    drawingContext.DrawDrawing(group);

                var resizedImage = new swm.Imaging.RenderTargetBitmap(width, height, source.DpiX, source.DpiY, swm.PixelFormats.Default);
                resizedImage.Render(drawingVisual);
                Control = resizedImage;
            });
        }
        Control CreateImage(ImageInterpolation interpolation)
        {
            var resourceStream = GetType().Assembly.GetManifestResourceStream("Eto.Test.TestImage.png");

            var image    = new Bitmap(resourceStream);
            var drawable = new Drawable {
                Size = new Size(250, 160)
            };

            drawable.Paint += (sender, pe) => {
                pe.Graphics.ImageInterpolation = interpolation;
                pe.Graphics.DrawImage(image, 0, 0, 20, 20);
                pe.Graphics.DrawImage(image, 0, 20, 50, 50);
                pe.Graphics.DrawImage(image, 0, 70, 100, 100);
                pe.Graphics.DrawImage(image, 120, 0, 300, 300);
            };

            return(drawable);
        }
Beispiel #21
0
        public static NSImageInterpolation Convert(ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.None:
                return(NSImageInterpolation.None);

            case ImageInterpolation.Low:
                return(NSImageInterpolation.Low);

            case ImageInterpolation.Medium:
                return(NSImageInterpolation.Medium);

            case ImageInterpolation.High:
                return(NSImageInterpolation.High);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #22
0
        public static NSImageRep Resize(this NSImageRep image, CGSize newsize, ImageInterpolation interpolation = ImageInterpolation.Default, CGSize?imageSize = null)
        {
            var newrep = new NSBitmapImageRep(IntPtr.Zero, (nint)newsize.Width, (nint)newsize.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * (nint)newsize.Width, 32);

            newrep.Size = imageSize ?? newsize;

            var graphics = NSGraphicsContext.FromBitmap(newrep);

            NSGraphicsContext.GlobalSaveGraphicsState();
            NSGraphicsContext.CurrentContext           = graphics;
            graphics.GraphicsPort.InterpolationQuality = interpolation.ToCG();
#if XAMMAC
            // Xamarin.Mac doesn't allow null for hints, remove this when it does.
            Messaging.bool_objc_msgSend_CGRect_CGRect_UIntPtr_nfloat_bool_IntPtr(image.Handle, selDrawInRect_FromRect_Operation_Fraction_RespectFlipped_Hints_Handle, new CGRect(CGPoint.Empty, newrep.Size), CGRect.Empty, (UIntPtr)(ulong)NSCompositingOperation.SourceOver, 1f, true, IntPtr.Zero);
#else
            image.DrawInRect(new CGRect(CGPoint.Empty, newrep.Size), CGRect.Empty, NSCompositingOperation.SourceOver, 1f, true, null);
#endif
            NSGraphicsContext.GlobalRestoreGraphicsState();
            return(newrep);
        }
Beispiel #23
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var source      = image.ToSD();
            var pixelFormat = source.PixelFormat;

            if (
                pixelFormat == SD.Imaging.PixelFormat.Indexed ||
                pixelFormat == SD.Imaging.PixelFormat.Format1bppIndexed ||
                pixelFormat == SD.Imaging.PixelFormat.Format4bppIndexed ||
                pixelFormat == SD.Imaging.PixelFormat.Format8bppIndexed)
            {
                pixelFormat = SD.Imaging.PixelFormat.Format32bppRgb;
            }
            Control = new SD.Bitmap(width, height, pixelFormat);
            using (var graphics = SD.Graphics.FromImage(Control))
            {
                graphics.InterpolationMode = interpolation.ToSD();
                var rect = new SD.Rectangle(0, 0, width, height);
                graphics.FillRectangle(SD.Brushes.Transparent, rect);
                graphics.DrawImage(source, rect);
            }
        }
Beispiel #24
0
        public static sd2.InterpolationMode ToSD(this ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.Default:
                return(sd2.InterpolationMode.High);

            case ImageInterpolation.None:
                return(sd2.InterpolationMode.NearestNeighbor);

            case ImageInterpolation.Low:
                return(sd2.InterpolationMode.Low);

            case ImageInterpolation.Medium:
                return(sd2.InterpolationMode.High);

            case ImageInterpolation.High:
                return(sd2.InterpolationMode.HighQualityBilinear);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #25
0
        public static CGInterpolationQuality ToCG(this ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.Default:
                return(CGInterpolationQuality.Default);

            case ImageInterpolation.None:
                return(CGInterpolationQuality.None);

            case ImageInterpolation.Low:
                return(CGInterpolationQuality.Low);

            case ImageInterpolation.Medium:
                return(CGInterpolationQuality.Medium);

            case ImageInterpolation.High:
                return(CGInterpolationQuality.High);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #26
0
        public static Gdk.InterpType ToGdk(this ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.Default:
                return(Gdk.InterpType.Bilinear);

            case ImageInterpolation.None:
                return(Gdk.InterpType.Nearest);

            case ImageInterpolation.High:
                return(Gdk.InterpType.Hyper);

            case ImageInterpolation.Low:
                return(Gdk.InterpType.Tiles);

            case ImageInterpolation.Medium:
                return(Gdk.InterpType.Bilinear);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #27
0
        public static s.BitmapScalingMode ToWpf(this ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.Default:
                return(s.BitmapScalingMode.Unspecified);

            case ImageInterpolation.None:
                return(s.BitmapScalingMode.NearestNeighbor);

            case ImageInterpolation.Low:
                return(s.BitmapScalingMode.LowQuality);

            case ImageInterpolation.Medium:
                return(s.BitmapScalingMode.HighQuality);

            case ImageInterpolation.High:
                return(s.BitmapScalingMode.HighQuality);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #28
0
        public static Cairo.Filter ToCairo(this ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.Default:
                return(Cairo.Filter.Bilinear);

            case ImageInterpolation.None:
                return(Cairo.Filter.Nearest);

            case ImageInterpolation.High:
                return(Cairo.Filter.Best);

            case ImageInterpolation.Low:
                return(Cairo.Filter.Fast);

            case ImageInterpolation.Medium:
                return(Cairo.Filter.Good);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #29
0
        public static SD.Drawing2D.InterpolationMode Convert(ImageInterpolation value)
        {
            switch (value)
            {
            case ImageInterpolation.Default:
                return(SD.Drawing2D.InterpolationMode.Default);

            case ImageInterpolation.None:
                return(SD.Drawing2D.InterpolationMode.NearestNeighbor);

            case ImageInterpolation.Low:
                return(SD.Drawing2D.InterpolationMode.Low);

            case ImageInterpolation.Medium:
                return(SD.Drawing2D.InterpolationMode.High);

            case ImageInterpolation.High:
                return(SD.Drawing2D.InterpolationMode.HighQualityBilinear);

            default:
                throw new NotSupportedException();
            }
        }
Beispiel #30
0
		/// <summary>
		/// Create a new scaled bitmap with the specified <paramref name="width"/> and <paramref name="height"/>
		/// </summary>
		/// <param name="image">Image to scale</param>
		/// <param name="width">Width to scale the source image to</param>
		/// <param name="height">Height to scale the source image to</param>
		/// <param name="interpolation">Interpolation quality</param>
		public Bitmap(Image image, int? width = null, int? height = null, ImageInterpolation interpolation = ImageInterpolation.Default)
		{
			Handler.Create(image, width ?? image.Size.Width, height ?? image.Size.Height, interpolation);
			Initialize();
		}
Beispiel #31
0
 protected override GLib.Value GetValueInternal(object dataItem, int dataColumn, int row)
 {
     if (Widget.Binding != null)
     {
         var ret   = Widget.Binding.GetValue(dataItem);
         var image = ret as Image;
         if (image != null)
         {
             return(new GLib.Value(((IGtkPixbuf)image.Handler).GetPixbuf(new Size(16, 16), ImageInterpolation.ToGdk())));
         }
     }
     return(new GLib.Value((Gdk.Pixbuf)null));
 }
Beispiel #32
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var source = image.ToNS();

            Control = source.Resize(new CGSize(width, height), interpolation);
        }
Beispiel #33
0
		public static SD.Drawing2D.InterpolationMode Convert (ImageInterpolation value)
		{
			switch (value) {
			case ImageInterpolation.Default:
				return SD.Drawing2D.InterpolationMode.Default;
			case ImageInterpolation.None:
				return SD.Drawing2D.InterpolationMode.NearestNeighbor;
			case ImageInterpolation.Low:
				return SD.Drawing2D.InterpolationMode.Low;
			case ImageInterpolation.Medium:
				return SD.Drawing2D.InterpolationMode.High;
			case ImageInterpolation.High:
				return SD.Drawing2D.InterpolationMode.HighQualityBilinear;
			default:
				throw new NotSupportedException();
			}
		}
Beispiel #34
0
		/// <summary>
		/// Create a new scaled bitmap with the specified <paramref name="width"/> and <paramref name="height"/>
		/// </summary>
		/// <param name="image">Image to scale</param>
		/// <param name="width">Width to scale the source image to</param>
		/// <param name="height">Height to scale the source image to</param>
		/// <param name="interpolation">Interpolation quality</param>
		public Bitmap(Image image, int? width = null, int? height = null, ImageInterpolation interpolation = ImageInterpolation.Default)
		{
			if (image == null)
				throw new ArgumentNullException("image");
			if (width != null && width <= 0)
				throw new ArgumentOutOfRangeException("width", "width must be greater than zero");
			if (height != null && height <= 0)
				throw new ArgumentOutOfRangeException("height", "height must be greater than zero");
			Handler.Create(image, width ?? image.Size.Width, height ?? image.Size.Height, interpolation);
			Initialize();
		}
Beispiel #35
0
        public void DrawImage(Image image, float x, float y)
        {
            var bmp = image.ToDx(Control);

            Control.DrawBitmap(bmp, new s.RectangleF(x, y, bmp.Size.Width, bmp.Size.Height), 1f, ImageInterpolation.ToDx());
        }
Beispiel #36
0
 public void Create(Image image, int width, int height, ImageInterpolation interpolation)
 {
     Control = ag.Bitmap.CreateScaledBitmap(image.ToAndroid(), width, height, false);
 }
Beispiel #37
0
 public void Create(Image image, int width, int height, ImageInterpolation interpolation)
 {
     throw new NotImplementedException();
 }
Beispiel #38
0
		public static NSImageInterpolation Convert (ImageInterpolation value)
		{
			switch (value) {
			case ImageInterpolation.None:
				return NSImageInterpolation.None;
			case ImageInterpolation.Low:
				return NSImageInterpolation.Low;
			case ImageInterpolation.Medium:
				return NSImageInterpolation.Medium;
			case ImageInterpolation.High:
				return NSImageInterpolation.High;
			default:
				throw new NotSupportedException();
			}
		}
Beispiel #39
0
        public void Create(Image image, int width, int height, ImageInterpolation interpolation)
        {
            var pixbuf = image.ToGdk();

            Control = pixbuf.ScaleSimple(width, height, interpolation.ToGdk());
        }
Beispiel #40
0
		public Bitmap(Image image, int? width, int? height, ImageInterpolation interpolation, Generator generator)
			: this(generator)
		{
			Handler.Create(image, width ?? image.Size.Width, height ?? image.Size.Height, interpolation);
		}
Beispiel #41
0
		public static swm.BitmapScalingMode Convert (ImageInterpolation value)
		{
			switch (value) {
			case ImageInterpolation.Default:
				return swm.BitmapScalingMode.Unspecified;
			case ImageInterpolation.None:
				return swm.BitmapScalingMode.NearestNeighbor;
			case ImageInterpolation.Low:
				return swm.BitmapScalingMode.LowQuality;
			case ImageInterpolation.Medium:
				return swm.BitmapScalingMode.HighQuality;
			case ImageInterpolation.High:
				return swm.BitmapScalingMode.HighQuality;
			default:
				throw new NotSupportedException ();
			}
		}
Beispiel #42
0
		/// <summary>
		/// Create a new scaled bitmap with the specified <paramref name="width"/> and <paramref name="height"/>
		/// </summary>
		/// <param name="image">Image to scale</param>
		/// <param name="width">Width to scale the source image to</param>
		/// <param name="height">Height to scale the source image to</param>
		/// <param name="interpolation">Interpolation quality</param>
		/// <param name="generator">Generator to create the bitmap</param>
		public Bitmap(Image image, int? width = null, int? height = null, ImageInterpolation interpolation = ImageInterpolation.Default, Generator generator = null)
			: this (generator)
		{
			Handler.Create (image, width ?? image.Size.Width, height ?? image.Size.Height, interpolation);
		}
Beispiel #43
0
		public void Create(Image image, int width, int height, ImageInterpolation interpolation)
		{
			throw new NotImplementedException();
		}
Beispiel #44
0
		public static CGInterpolationQuality ConvertCG (ImageInterpolation value)
		{
			switch (value) {
			case ImageInterpolation.Default:
				return CGInterpolationQuality.Default;
			case ImageInterpolation.None:
				return CGInterpolationQuality.None;
			case ImageInterpolation.Low:
				return CGInterpolationQuality.Low;
			case ImageInterpolation.Medium:
				return CGInterpolationQuality.Medium;
			case ImageInterpolation.High:
				return CGInterpolationQuality.High;
			default:
				throw new NotSupportedException();
			}
		}