绘制具有抗锯齿功能的行

时间:2012-09-18 10:42:07

标签: swing clojure

我是Clojure的新手,我想在屏幕上画一条线和圆圈,它应该是抗锯齿,怎么办呢?如果有人可以粘贴一些示例代码给我?

另一个问题,我定义了一个地图:

(def {:a 1, :b 2, :c 3}, i try to change it to be {:a 1, :b 99, :c 3},

怎么做?

1 个答案:

答案 0 :(得分:1)

看看Quil。 https://github.com/quil/quil

它基于处理http://processing.org,很容易上班。

我认为这可以做你想要的......改编自例子:

(ns foo
  (:use quil.core))

(defn setup []
  (smooth)                          ;;Turn on anti-aliasing
  (frame-rate 10)                    ;;Set framerate to 10 FPS
  (background 200))                 ;;Set the background colour to
                                    ;;  a nice shade of grey.
(defn draw []
  (stroke 0)              ;;Set the stroke colour to a black
  (stroke-weight 3)       ;;Set the stroke thickness to 3
  (line 10 10 50 50)
  (line 20 20 100 50))

(defsketch example                  ;;Define a new sketch named example
  :title "foo"  ;;Set the title of the sketch
  :setup setup                      ;;Specify the setup fn
  :draw draw                        ;;Specify the draw fn
  :size [323 200])