source: project/wiki/eggref/3/ezxdisp @ 14119

Last change on this file since 14119 was 14119, checked in by sjamaan, 11 years ago

Change all user links so they point to /users/NAME instead of just NAME

File size: 4.3 KB
Line 
1[[tags: egg]]
2
3== ezxdisp
4
5[[toc:]]
6
7=== Description
8
9A simple graphics library for X11.
10
11=== Author
12
13n-sibata and Morihiko Tamai, packaged for CHICKEN by [[/users/felix winkelmann|felix winkelmann]].
14
15=== Requirements
16
17Requires the [[easyffi]] egg.
18
19=== Download
20
21[[http://www.call-with-current-continuation.org/eggs/ezxdisp.egg|ezxdisp.egg]]
22
23=== Documentation
24
25ezxdisp is a simple graphics library for 2D/3D graphical applications.
26(The official distribution can be found [[http://mimi.aist-nara.ac.jp/~morihi-t/ezxdisp|here]]).
27
28==== Initialize/Finalize a window
29
30<procedure>(ezx-init SIZE_X SIZE_Y WINDOW_NAME)</procedure>
31
32This procedure returns a {{EZX}} object all other procedures accept.
33
34<procedure>(ezx-quit EZX)</procedure>
35
36==== Update the graphics in the window
37
38<procedure>(ezx-redraw EZX)</procedure>
39
40==== Erase the graphics in the window/layer
41
42<procedure>(ezx-wipe EZX)</procedure>
43<procedure>(ezx-wipe-layer EZX LAYER)</procedure>
44
45{{LAYER}} should be an exact integer between 0 and 8.
46
47==== Get the pointer coordinates
48
49
50<procedure>(ezx-sensebutton EZX)</procedure>
51
52Returns the current pointer coordinates as three values:
53{{BUTTON}}, {{X}} and {{Y}}
54
55
56<procedure>(ezx-pushbutton EZX)</procedure>
57
58Block until an event is received.  Returns three values:
59{{BUTTON}}, {{X}} and {{Y}}
60
61The BUTTON result is 1, 2 or 3 for the first, second and third mouse
62button, respectively. The button number is additionally bitwise OR'd
63with 8 if the shift key is pressed and with 16 if the control key is
64pressed.
65
66==== Draw 2D graphics
67
68<procedure>(ezx-line-2d EZX X0 Y0 X1 Y1 COLOR WIDTH)</procedure>
69<procedure>(ezx-circle-2d EZX X0 Y0 R COLOR WIDTH)</procedure>
70<procedure>(ezx-fillcircle-2d EZX X0 Y0 R COLOR WIDTH)</procedure>
71<procedure>(ezx-str-2d EZX X0 Y0 STRING COLOR)</procedure>
72<procedure>(ezx-fillrect-2d EZX X0 Y0 X1 Y1 COLOR)</procedure>
73
74==== Draw 3D graphics
75
76<procedure>(ezx-set-light-3d EZX EX EY EZ)</procedure>
77<procedure>(ezx-set-view-3d EZX EX EY EZ VX VY VZ M)</procedure>
78
79<procedure>(ezx-c3d-to-2d EZX SX SY SZ)</procedure>
80
81Returns two values, {{DX}} and {{DY}}.
82
83<procedure>(ezx-line-3d EZX X0 Y0 Z0 X1 Y1 Z1 COLOR WIDTH)</procedure>
84<procedure>(ezx-str-3d EZX X0 Y0 Z0 STRING COLOR WIDTH)</procedure>
85<procedure>(ezx-poly-3d EZX POINTS HX HY HZ N COLOR)</procedure>
86<procedure>(ezx-circle-3d EZX X0 Y0 Z0 R COLOR)</procedure>
87
88The {{POINTS}} argument should be a SRFI-4 {{f64vector}} containing X, Y and Z coordinates.
89
90==== Miscellaneous functions
91
92<procedure>(ezx-select-layer EZX LAYER)</procedure>
93
94Focuses on the layer.
95
96
97<procedure>(ezx-raise-window EZX)</procedure>
98
99Raises the window.
100
101<procedure>(ezx-window-name EZX STRING)</procedure>
102
103Sets a name of the window.
104
105<procedure>(ezx-set-background EZX COLOR)</procedure>
106
107Sets the background color of the window.
108
109==== Colors
110
111<procedure>(make-ezx-color R G B)</procedure>
112
113This procedure returns a "color object", which is internally encoded
114as a {{f64vector}}. The red, green and blue components should
115be between 0 and 1.
116
117=== Examples
118
119<examples><example>
120<expr>
121(define ezx (ezx-init 100 100 "Hello, ezxdisp"))
122(ezx-set-background ezx (make-ezx-color 1 1 1))
123(ezx-fillcircle-2d ezx 50 50 25 (make-ezx-color 1 0 0) 1)
124(ezx-redraw ezx)
125
126(let loop ()
127  (let-values ([(b _ _) (ezx-pushbutton ezx)])
128    (when (zero? b) (loop)) ) )
129
130(ezx-quit ezx)
131</expr>
132</example></examples>
133
134A more elaborate example is in the egg distribution in a file named
135{{3d_clock.scm}}, which displays an animated 3D-clock.
136
137=== Changelog
138
139* 1.3 Added {{ezx-event-pending}}
140* 1.2 Adapted to externalized {{easyffi}} extension
141* 1.1 {{ezx-set-background}} wasn't documented
142* 1.0 Initial release
143
144=== License
145
146  This program is free software; you can redistribute it and/or modify
147  it under the terms of the GNU General Public License as published by
148  the Free Software Foundation; either version 2 of the License, or
149  (at your option) any later version.
150 
151  This program is distributed in the hope that it will be useful,
152  but WITHOUT ANY WARRANTY; without even the implied warranty of
153  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
154  GNU General Public License for more details.
155 
156  You should have received a copy of the GNU General Public License
157  along with this program; if not, write to the Free Software
158  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
159
Note: See TracBrowser for help on using the repository browser.