Пример #1
0
        public static SDI.PixelFormat ToPixelFormat(this ImageFormat self)
        {
            switch (self)
            {
            case ImageFormat.ARGB32:
                return(SDI.PixelFormat.Format32bppArgb);

            case ImageFormat.RGB24:
                return(SDI.PixelFormat.Format24bppRgb);

            default:
                throw new ArgumentException();
            }
        }
Пример #2
0
 public GdiImage(int width, int height, XD.ImageFormat format)
 {
     this.Image = new SD.Bitmap(width, height, format.ToGdi());
 }
Пример #3
0
        public object ConvertToBitmap(double width, double height, double scaleFactor, XD.ImageFormat format)
        {
            if (_drawCallback != null)
            {
                var image = new SD.Bitmap((int)width, (int)height, format.ToGdi());
                using (var g = SD.Graphics.FromImage(image)) {
                    g.SetQuality(GdiConverter.PaintHighQuality);
                    g.ScaleTransform((float)scaleFactor, (float)scaleFactor);
                    Draw(g, 0, 0, width, height);
                    g.Flush();
                }
                return(new GdiImage(image));
            }

            throw new NotSupportedException();
        }
Пример #4
0
        public override object ConvertToBitmap(ImageDescription idesc, double scaleFactor, XD.ImageFormat format)
        {
            var image = (GdiImage)idesc.Backend;

            return(image.ConvertToBitmap(idesc.Size.Width, idesc.Size.Height, scaleFactor, format));
        }