source: project/wiki/eggref/4/ezxdisp @ 14790

Last change on this file since 14790 was 14790, checked in by Ivan Raikov, 11 years ago

ezxdisp function signature updates

File size: 4.7 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
17[[easyffi]]
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-point-2d EZX X Y COLOR)</procedure>
69<procedure>(ezx-line-2d EZX X0 Y0 X1 Y1 COLOR WIDTH)</procedure>
70<procedure>(ezx-lines-2d EZX POINTS NPOINTS COLOR WIDTH)</procedure>
71<procedure>(ezx-poly-2d EZX POINTS NPOINTS COLOR)</procedure>
72
73The {{POINTS}} argument should be an SRFI-4 {{s32vector}} containing
74the X and Y coordinates of each point.
75
76<procedure>(ezx-rect-2d EZX X0 Y0 X1 Y1 COLOR WIDTH)</procedure>
77<procedure>(ezx-fillrect-2d EZX X0 Y0 X1 Y1 COLOR)</procedure>
78<procedure>(ezx-circle-2d EZX X0 Y0 R COLOR WIDTH)</procedure>
79<procedure>(ezx-fillcircle-2d EZX X0 Y0 R COLOR)</procedure>
80<procedure>(ezx-str-2d EZX X0 Y0 STRING COLOR)</procedure>
81
82==== Draw 3D graphics
83
84<procedure>(ezx-set-light-3d EZX EX EY EZ)</procedure>
85<procedure>(ezx-set-view-3d EZX EX EY EZ VX VY VZ M)</procedure>
86
87<procedure>(ezx-c3d-to-2d EZX SX SY SZ)</procedure>
88
89Returns two values, {{DX}} and {{DY}}.
90
91<procedure>(ezx-line-3d EZX X0 Y0 Z0 X1 Y1 Z1 COLOR WIDTH)</procedure>
92<procedure>(ezx-str-3d EZX X0 Y0 Z0 STRING COLOR)</procedure>
93<procedure>(ezx-poly-3d EZX POINTS HX HY HZ N COLOR)</procedure>
94<procedure>(ezx-circle-3d EZX X0 Y0 Z0 R COLOR)</procedure>
95
96The {{POINTS}} argument should be a SRFI-4 {{f64vector}} containing
97the X, Y and Z coordinates of each point.
98
99==== Miscellaneous functions
100
101<procedure>(ezx-select-layer EZX LAYER)</procedure>
102
103Focuses on the layer.
104
105
106<procedure>(ezx-raise-window EZX)</procedure>
107
108Raises the window.
109
110<procedure>(ezx-window-name EZX STRING)</procedure>
111
112Sets a name of the window.
113
114<procedure>(ezx-set-background EZX COLOR)</procedure>
115
116Sets the background color of the window.
117
118==== Colors
119
120<procedure>(make-ezx-color R G B)</procedure>
121
122This procedure returns a "color object", which is internally encoded
123as a {{f64vector}}. The red, green and blue components should
124be between 0 and 1.
125
126=== Examples
127
128<examples><example>
129<expr>
130(define ezx (ezx-init 100 100 "Hello, ezxdisp"))
131(ezx-set-background ezx (make-ezx-color 1 1 1))
132(ezx-fillcircle-2d ezx 50 50 25 (make-ezx-color 1 0 0) 1)
133(ezx-redraw ezx)
134
135(let loop ()
136  (let-values ([(b _ _) (ezx-pushbutton ezx)])
137    (when (zero? b) (loop)) ) )
138
139(ezx-quit ezx)
140</expr>
141</example></examples>
142
143A more elaborate example is in the egg distribution in a file named
144{{3d_clock.scm}}, which displays an animated 3D-clock.
145
146=== Changelog
147
148* 2.0 Ported to Chicken 4; updated to upstream version 0.1.4
149* 1.3 Added {{ezx-event-pending}}
150* 1.2 Adapted to externalized {{easyffi}} extension
151* 1.1 {{ezx-set-background}} wasn't documented
152* 1.0 Initial release
153
154=== License
155
156  This program is free software; you can redistribute it and/or modify
157  it under the terms of the GNU General Public License as published by
158  the Free Software Foundation; either version 2 of the License, or
159  (at your option) any later version.
160 
161  This program is distributed in the hope that it will be useful,
162  but WITHOUT ANY WARRANTY; without even the implied warranty of
163  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
164  GNU General Public License for more details.
165 
166  You should have received a copy of the GNU General Public License
167  along with this program; if not, write to the Free Software
168  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
169
Note: See TracBrowser for help on using the repository browser.