2012-09-18 43 views
-3

我是Clojure的新手,我想画一个线条和圆圈在屏幕上,它应该是反走样的,该怎么做呢?如果有人可以贴一些示例代码给我?用消除锯齿画线

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

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

怎么办呢?

+1

见'RenderingHints'。 – trashgod

回答

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])