vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.4k stars 67 forks source link

Drawing thicker points #46

Closed iamFIREcracker closed 10 months ago

iamFIREcracker commented 2 years ago

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 commented 1 year ago

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 commented 10 months ago

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:

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))))