2012-09-18 45 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])