author | Claus Gittinger <cg@exept.de> |
Mon, 10 Feb 1997 14:47:06 +0100 | |
changeset 2376 | d4326d046be4 |
parent 1446 | fabdc1d2598c |
child 2377 | 83a8f10a1234 |
permissions | -rw-r--r-- |
356 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
610 | 13 |
Object subclass:#Geometric |
1283 | 14 |
instanceVariableNames:'' |
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Graphics-Geometry' |
|
356 | 18 |
! |
19 |
||
20 |
!Geometric class methodsFor:'documentation'! |
|
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
Abstract superclass for geometric figures. |
|
39 |
Concrete classes are (currently) Rectangle, Polygon and the classes |
|
40 |
found in goodies/shape. |
|
41 |
||
42 |
These are not graphical objects, but pure mathematical ones. |
|
43 |
I.e. instances do not carry graphics attributes such as color, lineWidth etc. |
|
1355 | 44 |
However, they ``know'' how to display themself as stroked or possibly |
1360 | 45 |
filled picture on a graphicsContext (although, the GC's current |
46 |
paint and lineStyles are used). |
|
1355 | 47 |
|
48 |
Use instances of (subclasses) of DisplayObject or |
|
1360 | 49 |
of the GeometricWrapper classes for objects which keep the color |
50 |
and lineStyle information with them. |
|
356 | 51 |
|
1314 | 52 |
Notice: |
53 |
ST/X does not use Geometric instances for drawing (yet). |
|
1355 | 54 |
Except for Rectangle, Geometry and its subclasses exists mainly |
55 |
for ST-80 compatibility and to provide a home when other (PD) |
|
1314 | 56 |
geometry classes are to be filed in. |
1290 | 57 |
|
58 |
[author:] |
|
59 |
Claus Gittinger |
|
1314 | 60 |
|
61 |
[see also:] |
|
1355 | 62 |
Rectangle Polygon EllipticalArc Circle Spline Point |
1390 | 63 |
LineSegment Curve Arrow ArrowedSpline |
1353 | 64 |
GraphicsContext |
1358 | 65 |
StrokingWrapper FillingWrapper |
356 | 66 |
" |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
67 |
! |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
68 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
69 |
examples |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
70 |
" |
1357 | 71 |
line segment: |
72 |
[exBegin] |
|
73 |
|v l| |
|
74 |
||
75 |
v := (View extent:100@100) openAndWait. |
|
76 |
||
77 |
l := LineSegment from:10@10 to:90@90. |
|
78 |
||
79 |
v paint:Color red. |
|
80 |
l displayStrokedOn:v. |
|
81 |
||
82 |
l start:90@10 end:10@90. |
|
83 |
v paint:Color blue. |
|
84 |
l displayStrokedOn:v. |
|
85 |
[exEnd] |
|
86 |
||
87 |
rectangle, unfilled: |
|
88 |
[exBegin] |
|
89 |
|v r| |
|
90 |
||
91 |
v := (View extent:100@100) openAndWait. |
|
92 |
||
93 |
r := Rectangle origin:10@10 corner:90@90. |
|
94 |
||
95 |
v paint:Color red. |
|
96 |
r displayStrokedOn:v. |
|
97 |
[exEnd] |
|
98 |
||
1353 | 99 |
circle; filled and unfilled: |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
100 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
101 |
|v c| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
102 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
103 |
v := (View extent:200@100) openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
104 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
105 |
c := Circle boundingBox:(10@10 corner:90@90). |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
106 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
107 |
v paint:Color blue. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
108 |
c displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
109 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
110 |
c center:150@50. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
111 |
v paint:Color red. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
112 |
c displayStrokedOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
113 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
114 |
[exEnd] |
1353 | 115 |
circle & rectangle; both filled: |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
116 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
117 |
|v c| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
118 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
119 |
v := (View extent:100@100) openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
120 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
121 |
c := Circle center:50@50 radius:40. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
122 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
123 |
v paint:Color red. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
124 |
c asRectangle displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
125 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
126 |
v paint:Color blue. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
127 |
c displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
128 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
129 |
[exEnd] |
1353 | 130 |
elliptical arcs; filled & unfilled: |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
131 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
132 |
|v e| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
133 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
134 |
v := (View extent:200@100) openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
135 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
136 |
e := EllipticalArc |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
137 |
boundingBox:(10@10 corner:190@90) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
138 |
startAngle:0 |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
139 |
endAngle:270. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
140 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
141 |
v paint:Color blue. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
142 |
e displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
143 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
144 |
v paint:Color red. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
145 |
e displayStrokedOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
146 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
147 |
[exEnd] |
1353 | 148 |
polygon; filled & unfilled: |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
149 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
150 |
|v p| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
151 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
152 |
v := (View extent:100@100) openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
153 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
154 |
p := Polygon vertices: |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
155 |
(Array with:(10@10) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
156 |
with:(90@90) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
157 |
with:(10@90)). |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
158 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
159 |
v paint:Color blue. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
160 |
p displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
161 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
162 |
v paint:Color red. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
163 |
p displayStrokedOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
164 |
[exEnd] |
1353 | 165 |
|
166 |
circles; filled & unfilled: |
|
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
167 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
168 |
|v c| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
169 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
170 |
v := View new openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
171 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
172 |
c := Circle center:50@50 radius:40. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
173 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
174 |
c displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
175 |
50 to:1 by:-1 do:[:r | |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
176 |
c radius:r. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
177 |
v paint:(Color grey:(r * 2)). |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
178 |
c displayStrokedOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
179 |
]. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
180 |
1 to:50 do:[:r | |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
181 |
c radius:r. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
182 |
v paint:(Color grey:100-(r * 2)). |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
183 |
c displayStrokedOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
184 |
] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
185 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
186 |
[exEnd] |
1353 | 187 |
arcs; filled: |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
188 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
189 |
|v ell| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
190 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
191 |
v := View new openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
192 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
193 |
ell := EllipticalArc |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
194 |
boundingBox:(10@10 corner:90@90) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
195 |
startAngle:0 |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
196 |
sweepAngle:0. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
197 |
|
1353 | 198 |
#(45 90 135 180 225 270 315 360) keysAndValuesDo:[:index :angle | |
199 |
index odd ifTrue:[ |
|
200 |
v paint:Color white |
|
201 |
] ifFalse:[ |
|
202 |
v paint:Color black |
|
203 |
]. |
|
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
204 |
ell sweepAngle:angle. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
205 |
ell displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
206 |
Delay waitForSeconds:0.5. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
207 |
]. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
208 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
209 |
[exEnd] |
1353 | 210 |
arcs; filled: |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
211 |
[exBegin] |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
212 |
|v ell| |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
213 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
214 |
v := View new openAndWait. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
215 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
216 |
ell := EllipticalArc |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
217 |
boundingBox:(10@10 corner:90@90) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
218 |
startAngle:0 |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
219 |
sweepAngle:45. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
220 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
221 |
#(45 90 135 180 225 270 315 360) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
222 |
with:#( 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1) |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
223 |
do:[:angle :grey | |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
224 |
ell startAngle:angle-45. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
225 |
v paint:(ColorValue red:grey green:0 blue:0). |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
226 |
ell displayFilledOn:v. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
227 |
]. |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
228 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
229 |
[exEnd] |
1353 | 230 |
spline; filled & unfilled: |
231 |
[exBegin] |
|
232 |
|v p| |
|
233 |
||
234 |
v := (View extent:100@100) openAndWait. |
|
235 |
||
236 |
p := Spline controlPoints: |
|
1354 | 237 |
(Array with:(20@20) |
238 |
with:(80@80) |
|
239 |
with:(20@80)). |
|
1353 | 240 |
|
241 |
v paint:Color blue. |
|
242 |
p displayFilledOn:v. |
|
243 |
||
244 |
v paint:Color red. |
|
245 |
p displayStrokedOn:v. |
|
246 |
[exEnd] |
|
247 |
||
248 |
closed spline; filled & unfilled: |
|
249 |
[exBegin] |
|
250 |
|v p| |
|
251 |
||
252 |
v := (View extent:100@100) openAndWait. |
|
253 |
||
254 |
p := Spline controlPoints: |
|
1354 | 255 |
(Array with:(20@20) |
256 |
with:(80@80) |
|
257 |
with:(20@80) |
|
258 |
with:(20@20)). |
|
1353 | 259 |
|
260 |
v paint:Color blue. |
|
261 |
p displayFilledOn:v. |
|
262 |
||
263 |
v paint:Color red. |
|
264 |
p displayStrokedOn:v. |
|
265 |
[exEnd] |
|
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
266 |
" |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
267 |
! ! |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
268 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
269 |
!Geometric methodsFor:'converting'! |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
270 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
271 |
asFiller |
1353 | 272 |
"return a wrapper which displays the receiver in its filled form" |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
273 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
274 |
^ FillingWrapper on:self |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
275 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
276 |
"Created: 8.5.1996 / 14:38:59 / cg" |
1353 | 277 |
"Modified: 8.5.1996 / 18:22:56 / cg" |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
278 |
! |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
279 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
280 |
asRectangle |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
281 |
"return the enclosing rectangle; same as #bounds" |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
282 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
283 |
^ self bounds |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
284 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
285 |
"Created: 8.5.1996 / 14:36:35 / cg" |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
286 |
! |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
287 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
288 |
asStroker |
1353 | 289 |
"return a wrapper which displays the receiver as stroked outline" |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
290 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
291 |
^ StrokingWrapper on:self |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
292 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
293 |
"Created: 8.5.1996 / 14:38:09 / cg" |
1353 | 294 |
"Modified: 8.5.1996 / 18:23:00 / cg" |
356 | 295 |
! ! |
296 |
||
297 |
!Geometric methodsFor:'displaying'! |
|
298 |
||
610 | 299 |
displayFilledOn:aGC |
300 |
"display myself filled on a graphicsContext; the current graphics |
|
301 |
attributes are used. Since we do not know how to do it, nothing is |
|
302 |
drawn here." |
|
303 |
||
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
304 |
^ self subclassResponsibility |
610 | 305 |
|
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
306 |
"Modified: 8.5.1996 / 09:07:02 / cg" |
610 | 307 |
! |
308 |
||
356 | 309 |
displayOn:aGC |
310 |
"display myself on a graphicsContext; the current graphics |
|
311 |
attributes are used. The default here is to display the outline." |
|
312 |
||
313 |
^ self displayStrokedOn:aGC |
|
314 |
! |
|
315 |
||
316 |
displayStrokedOn:aGC |
|
317 |
"display my outline on a graphicsContext; the current graphics |
|
1357 | 318 |
attributes are used. Since we do not know how to do it, nothing is |
356 | 319 |
drawn here." |
320 |
||
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
321 |
^ self subclassResponsibility |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
322 |
|
1357 | 323 |
"Modified: 8.5.1996 / 21:20:19 / cg" |
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
324 |
! ! |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
325 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
326 |
!Geometric methodsFor:'queries'! |
356 | 327 |
|
1350
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
328 |
bounds |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
329 |
"return the smallest enclosing rectangle" |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
330 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
331 |
^ self subclassResponsibility |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
332 |
|
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
333 |
"Created: 8.5.1996 / 13:56:08 / cg" |
85eec07b093b
doku, comments, examples & more functionality
Claus Gittinger <cg@exept.de>
parents:
1314
diff
changeset
|
334 |
"Modified: 8.5.1996 / 14:06:31 / cg" |
1446
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
335 |
! |
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
336 |
|
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
337 |
canBeFilled |
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
338 |
"return true, if the receiver can be drawn as a filled geometric. |
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
339 |
Return false here, since we dont know." |
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
340 |
|
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
341 |
^ false |
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
342 |
|
fabdc1d2598c
added #canBeFilled for protocol completeness
Claus Gittinger <cg@exept.de>
parents:
1390
diff
changeset
|
343 |
"Created: 1.6.1996 / 11:28:58 / cg" |
2376 | 344 |
! |
345 |
||
346 |
outlineIntersects:aRectangle |
|
347 |
"return true, if the receivers image intersects |
|
348 |
aRectangle, when drawn as an outline. |
|
349 |
Here, all we can do is to ask the boundary rectangle; |
|
350 |
subclasses should reimplement better checks." |
|
351 |
||
352 |
^ self bounds intersects:aRectangle |
|
353 |
||
354 |
"Modified: 10.2.1997 / 13:40:36 / cg" |
|
355 |
! |
|
356 |
||
357 |
regionIntersects:aRectangle |
|
358 |
"return true, if the receivers image intersects |
|
359 |
aRectangle, when drawn as a filled version. |
|
360 |
Here, all we can do is to ask the boundary rectangle; |
|
361 |
subclasses should reimplement better checks." |
|
362 |
||
363 |
^ self bounds intersects:aRectangle |
|
364 |
||
365 |
"Modified: 10.2.1997 / 13:40:00 / cg" |
|
356 | 366 |
! ! |
367 |
||
637 | 368 |
!Geometric class methodsFor:'documentation'! |
369 |
||
370 |
version |
|
2376 | 371 |
^ '$Header: /cvs/stx/stx/libbasic/Geometric.st,v 1.21 1997-02-10 13:47:06 cg Exp $' |
637 | 372 |
! ! |