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.4.0"}}}
deps.edn
Extensible Data Notation

Make sure you set the headless property first.

(System/setProperty "java.awt.headless" "true")
0.1s
Clojure
clojure2d

We start by setting up a canvas:

(require '[clojure2d.core :as c])
(c/canvas 400 100)
14.6s
Clojure
clojure2d

And start drawing:

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

Appendix

Saving the environment for faster boot times.

clj -Stree
82.4s
clojure2d (Bash)

This sets up the reusable environment.

Runtimes (2)