load-shape

shape

shape-mode

load-shape

Arguments
[filename]
Docstring
Load a geometry from a file as a PShape.
Works only inside sketch functions?
Yes
Original Processing method
loadShape()
Example
clojure specific
  • (let
      [sh (q/load-shape
            "https://upload.wikimedia.org/wikipedia/en/2/22/Heckert_GNU_white.svg")]
      (q/shape sh 0 0 500 500))
clojurescript specific
  • (let [sh (q/load-shape "Heckert_GNU_white.svg")] (q/shape sh 0 0 500 500))
    try example

shape

Arguments
[sh x y width height][sh x y][sh]
Docstring
Displays shapes to the screen. The shapes must have been loaded
with load-shape. Processing currently works with SVG shapes
only. The sh parameter specifies the shape to display and the x and
y parameters define the location of the shape from its upper-left
corner. The shape is displayed at its original size unless the width
and height parameters specify a different size. The shape-mode
fn changes the way the parameters work. A call to
(shape-mode :corners), for example, will change the width and height
parameters to define the x and y values of the opposite corner of
the shape.

Note complex shapes may draw awkwardly with the renderers :p2d, :p3d, and
:opengl. Those renderers do not yet support shapes that have holes
or complicated breaks.
Works only inside sketch functions?
Yes
Original Processing method
shape()
Example
clojure specific
  • (let
      [sh (q/load-shape
            "https://upload.wikimedia.org/wikipedia/en/2/22/Heckert_GNU_white.svg")]
      (q/shape sh)
      (q/shape sh 100 100)
      (q/shape sh 300 300 200 200))
clojurescript specific
  • (let [sh (q/load-shape "Heckert_GNU_white.svg")]
      (q/shape sh)
      (q/shape sh 100 100)
      (q/shape sh 300 300 200 200))
    try example

shape-mode

Arguments
[mode]
Docstring
Modifies the location from which shapes draw. Available modes are
:corner, :corners and :center. Default is :corner.

:corner  - specifies the location to be the upper left corner of the
           shape and uses the third and fourth parameters of shape
           to specify the width and height.

:corners - uses the first and second parameters of shape to set
           the location of one corner and uses the third and fourth
           parameters to set the opposite corner.

:center  - draws the shape from its center point and uses the third
           and forth parameters of shape to specify the width and
           height. 
Works only inside sketch functions?
Yes
Original Processing method
shapeMode()
Example
clojure specific
  • (let
      [sh (q/load-shape
            "https://upload.wikimedia.org/wikipedia/en/2/22/Heckert_GNU_white.svg")]
      (q/stroke-weight 5)
      (q/stroke 255 0 0)
      (q/shape-mode :corner)
      (q/shape sh 20 20 200 200)
      (q/point 20 20)
      (q/shape-mode :corners)
      (q/shape sh 270 20 370 120)
      (q/point 270 20)
      (q/point 370 120)
      (q/shape-mode :center)
      (q/shape sh 100 350 150 150)
      (q/point 100 350))
clojurescript specific
  • (let [sh (q/load-shape "Heckert_GNU_white.svg")]
      (q/stroke-weight 5)
      (q/stroke 255 0 0)
      (q/shape-mode :corner)
      (q/shape sh 20 20 200 200)
      (q/point 20 20)
      (q/shape-mode :corners)
      (q/shape sh 270 20 370 120)
      (q/point 270 20)
      (q/point 370 120)
      (q/shape-mode :center)
      (q/shape sh 100 350 150 150)
      (q/point 100 350))
    try example