Making science reproducible @nextjournal

clojure2d

Remix this to get started with clojure2d. Thanks to generatme for getting this to work!

{:deps
 {org.clojure/clojure {:mvn/version "1.10.1"}
  clojure2d {:mvn/version "1.2.0-SNAPSHOT"}}}
deps.edn
Extensible Data Notation

Make sure you set the headless property first.

(System/setProperty "java.awt.headless" "true")

We start by setting up a canvas:

(require '[clojure2d.core :as c])
(c/canvas 200 200)

And start drawing:

(c/save (c/with-canvas-> (c/canvas 200 200)
  (c/set-background :maroon)
  (c/set-color :white)
  (c/text "HEADLESS TEST!" 100 100 :center)) "/results/headless.jpg")