Beispiel #1
0
        public static void DrawImage(this IMapContext map, Image image, RectangleF destRect, RectangleF srcRect)
        {
            var gs = map.Graphics.Save();

            map.Graphics.SmoothingMode      = SmoothingMode.HighSpeed;
            map.Graphics.InterpolationMode  = InterpolationMode.NearestNeighbor;
            map.Graphics.PixelOffsetMode    = PixelOffsetMode.HighSpeed;
            map.Graphics.CompositingQuality = CompositingQuality.HighSpeed;

            map.Flip();

            Rectangle destRect2 = new Rectangle((int)destRect.X, (int)destRect.Y, (int)destRect.Width, (int)destRect.Height);

            map.Graphics.DrawImage(image, destRect2, (int)srcRect.X, (int)srcRect.Y, (int)srcRect.Width, (int)srcRect.Height, GraphicsUnit.Pixel, null);

            map.Graphics.Restore(gs);
        }