draw line with anti-aliasing

前端 未结 1 1443
清歌不尽
清歌不尽 2020-12-22 13:50

I am a Clojure newbie, I want to draw a line and circle on the screen, and it should be anti-aliasing, how to do it? if someone can paste some sample codes to me?

A

相关标签:
1条回答
  • 2020-12-22 14:31

    Take a look at Quil. https://github.com/quil/quil

    It is based on Processing http://processing.org and is easy to get working.

    I think this does what you want...adapted from the example:

    (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])
    
    0 讨论(0)
提交回复
热议问题