Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing thicker points #46

Closed
iamFIREcracker opened this issue Nov 15, 2021 · 2 comments · Fixed by #109
Closed

Drawing thicker points #46

iamFIREcracker opened this issue Nov 15, 2021 · 2 comments · Fixed by #109

Comments

@iamFIREcracker
Copy link
Contributor

POINT seems to be always drawing a 1x1 rectangle:

(defun point (x y)
  (declare (type real x y))
  (with-pen (make-pen :fill (pen-stroke (env-pen *env*)))
    (rect x y 1 1)))

What if I wanted to increase the thickness of my points instead? I know I can replace all my calls to POINT with RECT, but what if POINT used the current PEN's weight to figure out how big the rectangle should be?

(defun point (x y)
  (declare (type real x y))
  (let ((weight (or (pen-weight (env-pen *env*)) 1)))
    (with-pen (make-pen :fill (pen-stroke (env-pen *env*)))
      (rect (- x (floor weight 2))
            (- y (floor weight 2))
            weight
            weight))))

I am happy to open an PR if there is interest in this.

@vydd
Copy link
Owner

vydd commented Oct 16, 2022

I know I'm almost a year late with the response, sorry about that.
Would it make more sense to draw a circle instead of a rect?

@iamFIREcracker
Copy link
Contributor Author

I know I'm almost a year late with the response, sorry about that.

And now it's more than one year since your last reply. Sorry about that!

Would it make more sense to draw a circle instead of a rect?

I guess you might be right:

  • for big strokes, a circle will probably match user expectations better than a square would
  • for small strokes instead, it would not make much of a difference

You want me to open a PR for this? I assume you are suggesting something like:

(defun point (x y)
  (declare (type real x y))
  (let ((weight (or (pen-weight (env-pen *env*)) 1)))
    (with-pen (make-pen :fill (pen-stroke (env-pen *env*)))
      (circle x y weight))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants