PurplePen.MapDisplay.DrawBitmapMap C# (CSharp) Method

DrawBitmapMap() private method

private DrawBitmapMap ( IGraphicsTarget grTarget, RectangleF visRect, float minResolution ) : void
grTarget IGraphicsTarget
visRect System.Drawing.RectangleF
minResolution float
return void
        void DrawBitmapMap(IGraphicsTarget grTarget, RectangleF visRect, float minResolution)
        {
            // Setup transform.
            grTarget.PushTransform(BitmapTransform());

            // Setup drawing map and intensity.
            BitmapScaling scalingMode = antialiased ? BitmapScaling.MediumQuality : BitmapScaling.NearestNeighbor;
            if (bitmap.PixelHeight * bitmap.PixelWidth > 50000000)
                scalingMode = BitmapScaling.NearestNeighbor;            // Turn off high quality scaling for very large bitmaps.

            // Get source bitmap. Use the dimmed bitmap if there is one.
            IGraphicsBitmap sourceBitmap;
            if (dimmedBitmap != null)
                sourceBitmap = dimmedBitmap;
            else
                sourceBitmap = bitmap;

            // Draw it.
            grTarget.DrawBitmap(sourceBitmap, new RectangleF(0, 0, bitmap.PixelWidth, bitmap.PixelHeight), scalingMode, minResolution);

            if (mapIntensity < 0.99 && sourceBitmap == bitmap) {
                // Dimming desired, but we don't have a dimmed bitmap. Use an alpha mask instead.
                CmykColor dimmedWhite = CmykColor.FromCmyka(0, 0, 0, 0, 1-mapIntensity);
                object brush = new object();
                grTarget.CreateSolidBrush(brush, dimmedWhite);
                grTarget.FillRectangle(brush, new RectangleF(0, 0, bitmap.PixelWidth, bitmap.PixelHeight));
            }

            // Pop transform
            grTarget.PopTransform();
        }