예제 #1
0
        protected override void UpdateWithLocation(Rectangle rect, Keys modifiers, Point end)
        {
            shouldApplyCharacter = ApplyCharacter;       //modifiers.HasFlag (Key.Shift | Application.Instance.CommonModifier) ^ ApplyCharacter;
            shouldApplyColour    = ApplyColour;          //modifiers.HasFlag (Key.Alt | Application.Instance.CommonModifier) ^ ApplyColour;

            var oldRect = currentRect;

            rect.Normalize();
            lines.Clear();
            if (!Filled)
            {
                var templines = new ScanLines();
                currentRect = rect = templines.AddEllipse(rect);
                ScanLinesDrawDelegate draw = (drawrect) => {
                    lines.AddRect(drawrect);
                };
                templines.Outline(draw);
            }
            else
            {
                currentRect = rect = lines.AddEllipse(rect);
            }

            if (oldRect != null)
            {
                rect = Rectangle.Union(rect, oldRect.Value);
            }
            UpdatingCursor         = true;
            Handler.CursorPosition = end;
            UpdatingCursor         = false;
            Handler.InvalidateCharacterRegion(rect, false, false);
        }
예제 #2
0
        public void Do(Point?cursorPosition, Rectangle rect, CanvasElement element, bool applyColour, bool applyCharacter, bool filled)
        {
            var canvas = Handler.CurrentPage.Canvas;

            Handler.Undo.Save(cursorPosition, cursorPosition, rect);

            var lines = new ScanLines();

            lines.AddEllipse(rect);

            ScanLinesDrawDelegate draw = (linerect) => {
                if (applyColour && applyCharacter)
                {
                    canvas.Fill(linerect, element);
                }
                else if (applyColour)
                {
                    canvas.Fill(linerect, element.Attribute);
                }
                else if (applyCharacter)
                {
                    canvas.Fill(linerect, element.Character);
                }
            };

            if (filled)
            {
                lines.Fill(draw);
            }
            else
            {
                lines.Outline(draw);
            }

            Handler.InvalidateCharacterRegion(rect, true, false);
            Handler.Document.IsModified = true;
        }