本文介绍了用抗锯齿画线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Clojure新手,想在屏幕上画线画圆,而且应该是抗锯齿的,怎么做?如果有人可以粘贴一些示例代码给我?
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?
另一个问题,我定义了一个Map:
Another problem, I define a Map:
(def {:a 1, :b 2, :c 3}, i try to change it to be {:a 1, :b 99, :c 3},
怎么做?
推荐答案
看看 Quil.https://github.com/quil/quil
它基于 Processing http://processing.org 并且很容易上手.
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])
这篇关于用抗锯齿画线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!