コード例 #1
0
ファイル: MapViewer.cs プロジェクト: osorensen/PurplePen
        private void Draw(Graphics g, Rectangle clip)
        {
            PointF[] pts = new PointF[2];

            if (mapDisplay == null)
            {
                g.Clear(Color.White);
                return;
            }

            CompositeBitmap(false);
            FastBitmapPaint.PaintBitmap(g, compositedBitmap, clip, new Point(clip.Left, clip.Top));
        }
コード例 #2
0
ファイル: ViewCache.cs プロジェクト: osorensen/PurplePen
        // This is the main entry point to the ViewCache. It asks to draw the part of the map into the graphics
        // requested. This graphics is in pixel (viewport) coordinates. The transform that maps between the
        // two is passed in, so that it doesn't need to be recomputed.
        public void Draw(Graphics g, Rectangle clipRect, Size sizeView, RectangleF mapAreaToView, Matrix transform)
        {
            // Make sure the cache is up to date.
            UpdateCache(sizeView, mapAreaToView, transform);

            try {
                // Draw the requested part of the bitmap to the destinated graphics.
                FastBitmapPaint.PaintBitmap(g, bitmap, clipRect, new Point(clipRect.Left, clipRect.Top));

                // This used to be:
                //g.DrawImage(bitmap, clipRect.Left, clipRect.Top, clipRect, GraphicsUnit.Pixel);
            }
            catch (Exception) {
                // Do nothing. Very occasionally, GDI+ given an overflow exception or ExternalException or OutOfMemory exception.
                // Just ignore it; there's nothing else to do. See bug #1997301.
            }
        }