コード例 #1
0
ファイル: PixelEraser.cs プロジェクト: xxy1991/cozy
        protected override bool OnEnd(Point p)
        {
            base.OnEnd(p);

            if (Target != null && Target.IsReady)
            {
                var points = GenericDraw.GetAllPoint(DrawPoints, Target.DefaultDrawColor);
                var command = new DrawPixelCommand()
                {
                    Points = points.GetDistributionColor(Target, Width),
                    Target = Target,
                };
                CommandManager.Instance.Do(command);

                Target.UpdateDrawable();
                return true;
            }
            return false;
        }
コード例 #2
0
ファイル: PixelLine.cs プロジェクト: xxy1991/cozy
        protected override bool OnEnd(Point p)
        {
            base.OnEnd(p);

            if (Target != null && ColorHolder != null && Target.IsReady)
            {
                var points = new Dictionary<Point, Color>();
                GenericDraw.Line(BeginPoint, p.ToMap(Target.GridWidth), ColorHolder, points);
                var command = new DrawPixelCommand()
                {
                    Points  = points.GetDistributionColor(Target, Width),
                    Target  = Target,
                };
                CommandManager.Instance.Do(command);

                Target.UpdateDrawable();
                return true;
            }
            return false;
        }
コード例 #3
0
ファイル: PixelFill.cs プロジェクト: xxy1991/cozy
        protected override bool OnEnd(Point p)
        {
            base.OnEnd(p);

            if (Target != null && ColorHolder != null && Target.IsReady)
            {
                var mapp    = p.ToMap(Target.GridWidth);
                var points  = GenericDraw.GetPointsWithSameColor(Target, mapp, Target.ReadPixel(mapp));

                var command = new DrawPixelCommand()
                {
                    Points  = points.Select(x => new KeyValuePair<Point, Color>(x.Key, ColorHolder)),
                    Target  = Target,
                };
                CommandManager.Instance.Do(command);

                Target.UpdateDrawable();
                return true;
            }
            return false;
        }