Esempio n. 1
0
        /// <summary>
        /// Draws overlay.
        /// </summary>
        public void Draw(IEditableFrame Editor, Func <Point, Point> Transform = null)
        {
            if (!_settings.Display)
            {
                return;
            }

            var clickRadius = _settings.Radius;

            var platformServices = ServiceProvider.Get <IPlatformServices>();

            var curPos = platformServices.CursorPosition;

            if (Transform != null)
            {
                curPos = Transform(curPos);
            }

            var d = clickRadius * 2;

            var x = curPos.X - clickRadius;
            var y = curPos.Y - clickRadius;

            Editor.FillEllipse(_settings.Color, new RectangleF(x, y, d, d));

            var border = _settings.BorderThickness;

            if (border > 0)
            {
                x -= border / 2;
                y -= border / 2;
                d += border;

                Editor.DrawEllipse(_settings.BorderColor, border, new RectangleF(x, y, d, d));
            }
        }
Esempio n. 2
0
        public void Draw(IEditableFrame Editor, Func <Point, Point> PointTransform = null)
        {
            if (!_settings.Display)
            {
                return;
            }

            if (_clicked && _currentMouseRatio < MouseRatioMax)
            {
                _currentMouseRatio += MouseRatioDeltaUp;

                if (_currentMouseRatio > MouseRatioMax)
                {
                    _currentMouseRatio = MouseRatioMax;
                }
            }
            else if (!_clicked && _currentMouseRatio > MouseRatioMin)
            {
                _currentMouseRatio -= MouseRatioDeltaDown;

                if (_currentMouseRatio < MouseRatioMin)
                {
                    _currentMouseRatio = MouseRatioMin;
                }
            }

            if (_currentMouseRatio > MouseRatioMin)
            {
                var clickRadius = _settings.Radius * _currentMouseRatio;

                var platformServices = ServiceProvider.Get <IPlatformServices>();

                var curPos = platformServices.CursorPosition;

                if (PointTransform != null)
                {
                    curPos = PointTransform(curPos);
                }

                var d = clickRadius * 2;

                var x = curPos.X - clickRadius;
                var y = curPos.Y - clickRadius;

                var color = GetClickCircleColor();

                color = Color.FromArgb(ToByte(color.A * _currentMouseRatio), color);

                Editor.FillEllipse(color, new RectangleF(x, y, d, d));

                var border = _settings.BorderThickness * _currentMouseRatio;

                if (border > 0)
                {
                    x -= border / 2f;
                    y -= border / 2f;
                    d += border;

                    var borderColor = _settings.BorderColor;

                    borderColor = Color.FromArgb(ToByte(borderColor.A * _currentMouseRatio), borderColor);

                    Editor.DrawEllipse(borderColor, border, new RectangleF(x, y, d, d));
                }
            }
        }