Liking cljdoc? Tell your friends :D

Comparison to Processing

Below you can find comparison Processing functions with Clojure2d.

Assuming that following variables are defined:

  • window - display created with [[show-window]]
  • cnvs - canvas created with [[canvas]] inside drawing context (see [[with-canvas->]] or [[with-canvas]])

And following namespaces are loaded:

(:require [clojure2d.core :refer :all] ;; generaral Clojure2d functions
          [clojure2d.pixels :as p] ;; pixels operations
          [clojure2d.color :as c] ;; color operations
          [fastmath.core :as m] ;; general math functions
          [fastmath.random :as r]) ;; random and noise

Structure

ProcessingClojure2dComments
draw()Any function with following signature (fn [canvas window frame local-state] ...) attached to window created with [[show-window]] (:draw-fn key).Such function is called before refresh of the display. Result is passed as local-state in the next call.
exit()[[close-window]]Closes window programmatically.
loop()not implementedpossible in future versions
noLoop()not implementedpossible in future versions
popStyle()not implemented
pushStyle()not implemented
redraw()not implementednot necessary
setup()Any function with following signature (fn [canvas window] ...) attached to window created with [[show-window]] (:setup key).Returned value is treated as local-state for first call of drawing function.
thread() use future
all the restuse Clojure

Environment

ProcessingClojure2dComments
cursor()not implementedpossible in future versions
delay()not implementeduse Thread/sleep
displayDensity()not implemented
focusednot implementedpossible in future versions
frameCountimplementedframe number is passed to the drawing function as third parameter
frameRate()implementedset :fps key when [[show-window]] is called
frameRatenot implemented
fullScreen()not implementedpossible in future versions
height[[height]]it's a function working on canvas/window/image
noCursor()not implementedpossible in future versions
noSmooth()implementeduse :low quality key in [[canvas]] call
pixelDensity()not implementedfor Retina use two times bigger canvas/window and call (scale canvas 2).
pixelHeightnot implemented
pixelWidthnot implemented
settings()not necessary
size()implementedset size in [[canvas]] or [[show-window]] calls
smooth()implementeduse one of the keys defined in [[rendering-hints]] and pass to [[canvas]] or [[show-window]]
width[[width]]it's a function working on canvas/window/image

Data

Use Clojure2d data types and functions

Control

Use Clojure2d functions

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close