Exemple #1
0
            public static Bitmap generateElementBitmap(PonyVille ponyVille, SizeF s, ViewParameters p)
            {
                int w = (int)(s.Width * p.ZoomRatio);
                int h = (int)(s.Height * p.ZoomRatio);

                if (w == 0)
                {
                    w = 1;
                }
                if (h == 0)
                {
                    h = 1;
                }

                Bitmap   b    = new Bitmap(w, h);
                Bitmap   pony = ponyVille.getBitmap();
                Graphics g    = Graphics.FromImage(b);

                g.InterpolationMode = InterpolationMode.HighQualityBicubic;

                Point[] pts = new Point[3];
                pts[0] = new Point(0, 0);
                pts[1] = new Point(w, 0);
                pts[2] = new Point(0, h);

                g.DrawImage(pony, pts);

                pony.Dispose();

                return(b);
            }
Exemple #2
0
            public override void paint(Graphics g, bool drawHandles, ViewParameters parameters)
            {
                if (parameters != prevParams)
                {
                    resizeBitmaps(parameters);
                    prevParams = parameters;
                }

                Bitmap bitmap = p.getBitmap();
                Brush  brush  = new SolidBrush(Color.FromArgb(0x80, shape.ShapeColor));

                foreach (Element e in p.elements)
                {
                    Point ptAbs = parameters.toAbsolute(e.r.Location);
                    if (!shape.ShapeColor.Equals(shape.ShapeColorNoHilight))
                    {
                        g.FillEllipse(brush, ptAbs.X, ptAbs.Y, e.r.Width * parameters.ZoomRatio, e.r.Height * parameters.ZoomRatio);
                    }
                    g.DrawImageUnscaled(e.b, ptAbs);
                }
                brush.Dispose();
                bitmap.Dispose();
            }