ellipse-mode

no-smooth

rect-mode

smooth

stroke-cap

stroke-join

stroke-weight

ellipse-mode

Arguments
[mode]
Docstring

Modifies the origin of the ellipse according to the specified mode:

  • :center - specifies the location of the ellipse as the center of the shape (default).
  • :radius - similar to center, but the width and height parameters to ellipse specify the radius of the ellipse, rather than the diameter.
  • :corner - draws the shape from the upper-left corner of its bounding box.
  • :corners - uses the four parameters to ellipse to set two opposing corners of the ellipse's bounding box.
Works only inside sketch functions?
Yes
Original Processing method
ellipseMode()
Original p5js method
ellipseMode()
Example
(q/stroke-weight 5)
; use :center mode
(q/ellipse-mode :center)
(q/with-translation [125 125]
  (q/ellipse 0 0 100 70)
  (q/point 0 0))
; use :radius mode
(q/ellipse-mode :radius)
(q/with-translation [375 125]
  (q/ellipse 0 0 100 70)
  (q/point 0 0))
; use :corner mode
(q/ellipse-mode :corner)
(q/with-translation [125 375]
  (q/ellipse 0 0 100 70)
  (q/point 0 0))
; use :corners mode
(q/ellipse-mode :corners)
(q/with-translation [375 375]
  (q/ellipse -50 -35 50 35)
  (q/point -50 -35)
  (q/point 50 35))
try example

no-smooth

Arguments
[]
Docstring

Draws all geometry with jagged (aliased) edges. Must be called inside :settings handler.

Works only inside sketch functions?
Yes
Original Processing method
noSmooth()
Original p5js method
noSmooth()
Example
; that's a bad example. smooth is odd
(q/with-translation [125 125]
  (q/ellipse 0 0 200 200))
try example

rect-mode

Arguments
[mode]
Docstring

Modifies the location from which rectangles draw. The default mode is :corner. Available modes are:

  • :corner - Specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect to specify the width and height.
  • :corners - Uses the first and second parameters of rect to set the location of one corner and uses the third and fourth parameters to set the opposite corner.
  • :center - Draws the image from its center point and uses the third and fourth parameters of rect to specify the image's width and height.
  • :radius - Draws the image from its center point and uses the third and forth parameters of rect to specify half of the image's width and height.
Works only inside sketch functions?
Yes
Original Processing method
rectMode()
Original p5js method
rectMode()
Example
(q/stroke-weight 5)
; use :center mode
(q/rect-mode :center)
(q/with-translation [125 125]
  (q/stroke 0)
  (q/rect 0 0 100 70)
  (q/stroke 255 0 0)
  (q/point 0 0))
; use :radius mode
(q/rect-mode :radius)
(q/with-translation [375 125]
  (q/stroke 0)
  (q/rect 0 0 100 70)
  (q/stroke 255 0 0)
  (q/point 0 0))
; use :corner mode
(q/rect-mode :corner)
(q/with-translation [125 375]
  (q/stroke 0)
  (q/rect 0 0 100 70)
  (q/stroke 255 0 0)
  (q/point 0 0))
; use :corners mode
(q/rect-mode :corners)
(q/with-translation [375 375]
  (q/stroke 0)
  (q/rect -50 -35 50 35)
  (q/stroke 255 0 0)
  (q/point -50 -35)
  (q/point 50 35))
try example

smooth

Arguments
[level][]
Docstring

Draws all geometry with smooth (anti-aliased) edges. This will slow down the frame rate of the application, but will enhance the visual refinement.

Must be called inside :settings handler.

The level parameter (int) increases the level of smoothness with the :p2d and :p3d renderers. This is the level of over sampling applied to the graphics buffer. The value 2 will double the rendering size before scaling it down to the display size. This is called 2x anti-aliasing. The value 4 is used for 4x anti-aliasing and 8 is specified for 8x anti-aliasing. If level is set to 0, it will disable all smoothing; it's the equivalent of the function no-smooth. The maximum anti-aliasing level is determined by the hardware of the machine that is running the software.

Note that smooth will also improve image quality of resized images.

Works only inside sketch functions?
Yes
Original Processing method
smooth()
Original p5js method
smooth()
Example
; that's a bad example. smooth is odd
(q/with-translation [125 125]
  (q/ellipse 0 0 200 200))
try example

stroke-cap

Arguments
[cap-mode]
Docstring

Sets the style for rendering line endings. These ends are either squared, extended, or rounded and specified with the corresponding parameters :square, :project, and :round. The default cap is :round.

Works only inside sketch functions?
Yes
Original Processing method
strokeCap()
Original p5js method
strokeCap()
Example
(q/stroke-weight 12)
; use :square cap
(q/stroke-cap :square)
(q/line 230 200 270 200)
; use :project cap
(q/stroke-cap :project)
(q/line 230 250 270 250)
; use :round cap
(q/stroke-cap :round)
(q/line 230 300 270 300)
try example

stroke-join

Arguments
[join-mode]
Docstring

Sets the style of the joints which connect line segments. These joints are either mitered, beveled, or rounded and specified with the corresponding parameters :miter, :bevel, and :round. The default joint is :miter.

This function is not available with the :p2d, :p3d, or :opengl renderers.

Works only inside sketch functions?
Yes
Original Processing method
strokeJoin()
Original p5js method
strokeJoin()
Example
(q/rect-mode :center)
(q/stroke-weight 12)
; use :miter join
(q/stroke-join :miter)
(q/rect 125 125 100 100)
; use :bevel join
(q/stroke-join :bevel)
(q/rect 375 125 100 100)
; use :round join
(q/stroke-join :round)
(q/rect 125 375 100 100)
try example

stroke-weight

Arguments
[weight]
Docstring

Sets the width of the stroke used for lines, points, and the border around shapes. All widths are set in units of pixels.

Works only inside sketch functions?
Yes
Original Processing method
strokeWeight()
Original p5js method
strokeWeight()
Example
(doseq [i (range 1 10)]
  (q/stroke-weight i)
  (q/line 230 (+ (* i 30) 100) 270 (+ (* i 30) 100)))
try example