Exemple #1
0
        public override bool dragging(PointF p)
        {
            double len = getLength(prevPoint, p);

            int n = (int)(len / PonyThickness);

            if (n > 0)
            {
                double arc = getArc(prevPoint, p);

                PointF lastPoint = prevPoint;
                Bitmap bitmap    = getBitmap();

                for (int i = 1; i <= n; ++i)
                {
                    PointF pt = new PointF(prevPoint.X + (float)Math.Cos(arc) * (PonyThickness * i + random.Next(-8, 8)),
                                           prevPoint.Y + (float)Math.Sin(arc) * (PonyThickness * i + random.Next(-8, 8)));
                    RectangleF rect = new RectangleF(pt, RandomSize);
                    Element    e    = new Element(rect, PonyVilleView.generateElementBitmap(this, rect.Size, editor.CurrentViewParameters));
                    elements.Add(e);
                    PonyVilleView.drawElement(editor.CanvasGraphics, e, editor.CurrentViewParameters);
                    lastPoint = pt;
                }
                bitmap.Dispose();

                prevPoint = lastPoint;
            }

            return(true);
        }
Exemple #2
0
        public PonyVille(ScreenshotEditor editor, Color color, int thickness, PointF p, ShapeSettingsPanel panel)
            : base(editor, color, thickness, panel)
        {
            psp = (PonySettingsPanel)panel;
            psp.SettingsChanged += settingsChanged;

            RectangleF rect = new RectangleF(p, RandomSize);

            prevPoint = p;

            prevThickness = thickness;

            Element e = new Element(rect, PonyVilleView.generateElementBitmap(this, rect.Size, editor.CurrentViewParameters));

            elements.Add(e);
            PonyVilleView.drawElement(editor.CanvasGraphics, e, editor.CurrentViewParameters);
        }