1 2 3 4 5 6 7 8 9 10 | CC = gcc GTK2_CFLAGS = `pkg-config --cflags gtk+-2.0` GTK2_LIBS = `pkg-config --libs gtk+-2.0` GUILE_CFLAGS = `guile-config compile` GUILE_LIBS = `guile-config link` all: $(CC) $(GTK2_CFLAGS) $(GUILE_CFLAGS) -c brush.c $(CC) $(GTK2_LIBS) $(GUILE_LIBS) -o brush brush.o clean: rm *.o brush test.png *~ -fr |
1 2 3 4 5 6 7 8 9 10 | ;;;设定前景为蓝色 (_color 0 0 65535) ;;; 宽高均为 100 的 270 度的弧,旋转0度 (_arc 80 100 100 100 0 (* 64 270) #f) ;;; 同上,添充效果 (_arc 200 100 100 100 0 (* 64 270) #t) ;;; 宽高均为 100 的270度的弧,旋转90度 (_arc 320 100 100 100 (* 64 90) (* 64 270) #f) ;;; 同上,添充效果 (_arc 440 100 100 100 (* 64 90) (* 64 270) #t) |
1 2 3 4 5 6 7 8 9 10 11 12 | ;;;set the front color (define set-color (lambda (color) (case color ((white) (_color 65535 65535 65535)) ((black) (_color 0 0 0)) ((red) (_color 65535 0 0)) ((green) (_color 0 65535 0)) ((blue) (_color 0 0 65535)) ;;;如果你知道更多的RGB颜色值请在此处按上面规则扩展 (else (display "Error : color not defined!\n"))))) |
1 2 3 4 5 | (define set-back-color (lambda (red green blue) (begin (_color red green blue) (_rectangle 0 0 600 400 #t)))) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ;;;画点 100 100 (_point 100 100) ;;;画点 150, 150 (define point _point) (point 150 150) ;;;画点 125, 125 (define draw-point _point) (draw-point 125 125) ;;;画点状横线,从x,y开始,宽度为width,每隔5点画一点 (define draw-dot-hline (lambda (x y width) (let ((a x) (b (+ x width))) (while (< a b) (_point a y) (set! a (+ a 5)))))) ;;;测试 (draw-dot-hline 30 30 150) ;;;画带颜色的虚线,颜色为color,从x,y开始,宽度为width (define draw-color-dot-hline (lambda (color x y width) (begin (set-color color) (draw-dot-hline x y width) (set-color 'black)))) ;;;测试 (draw-color-dot-hline 'blue 50 50 200) |
1 2 3 4 5 6 7 8 | ;;;draw a circle (define draw-circle (lambda (x y d) (_arc x y d d 0 (* 64 360) #f))) ;;;fill a circle (define fill-circle (lambda (x y d) (_arc x y d d 0 (* 64 360) #t))) |
1 2 3 4 5 6 7 8 9 | (define item (lambda (x y color str) (begin (set-color color) (fill-rect x y 10 10) (set-color 'black) (draw-string (+ x 12) y str)))) ;;;test (item 250 300 'black "A.com") |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |