绘制线与抗锯齿 [英] draw line with anti-aliasing

查看:131
本文介绍了绘制线与抗锯齿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个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?

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

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。 a href =https://github.com/quil/quil =nofollow> https://github.com/quil/quil

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

它是基于处理 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])

这篇关于绘制线与抗锯齿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆