author | Claus Gittinger <cg@exept.de> |
Wed, 03 Dec 2008 13:01:17 +0100 | |
changeset 2573 | 8259385b69e3 |
parent 1789 | f52f0a0d8448 |
child 2635 | dd576df334a4 |
permissions | -rw-r--r-- |
245 | 1 |
" |
2 |
COPYRIGHT (c) 1996 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 |
||
13 |
||
14 |
||
1789 | 15 |
"{ Package: 'stx:libview2' }" |
16 |
||
252 | 17 |
GeometricWrapper subclass:#FillingWrapper |
245 | 18 |
instanceVariableNames:'' |
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
1789 | 21 |
category:'Compatibility-ST80-Graphics-Display Objects' |
245 | 22 |
! |
23 |
||
24 |
!FillingWrapper class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
||
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
a wrapper for a geometric object, which is to be drawn filled. |
|
45 |
This allows any geometric thingy to be used as a filled component in a view. |
|
46 |
||
254 | 47 |
(background info: geometrics are mathematical objects - they do not |
48 |
keep any color or lineStyle attributes. Wrappers add this information |
|
49 |
and can also be used as components of a view) |
|
50 |
||
265 | 51 |
Notice: |
52 |
this class was implemented using protocol information |
|
365 | 53 |
from alpha testers, from reading PD programs and |
54 |
from the Hopkins/Horan book. |
|
265 | 55 |
- it may not be complete or compatible to the corresponding ST-80 class. |
56 |
If you encounter any incompatibilities, please forward a note |
|
57 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
58 |
||
248 | 59 |
[see also:] |
60 |
StrokingWrapper Geometric GraphicsContext |
|
61 |
||
245 | 62 |
[author:] |
63 |
Claus Gittinger |
|
64 |
" |
|
65 |
||
66 |
||
67 |
! |
|
68 |
||
69 |
examples |
|
70 |
" |
|
254 | 71 |
wrap an ellipticArc and display it |
72 |
(notice, that no automatic redraw is performed): |
|
245 | 73 |
[exBegin] |
254 | 74 |
|v e component| |
75 |
||
76 |
v := (View extent:250@250) openAndWait. |
|
77 |
||
78 |
e := EllipticalArc boundingBox:(10@10 corner:90@90) |
|
79 |
startAngle:0 |
|
80 |
sweepAngle:270. |
|
81 |
component := FillingWrapper on:e. |
|
245 | 82 |
|
254 | 83 |
component displayOn:v. |
84 |
[exEnd] |
|
85 |
wrap an spline and display it |
|
86 |
(notice, that no automatic redraw is performed): |
|
87 |
[exBegin] |
|
88 |
|v s component| |
|
89 |
||
90 |
v := (View extent:250@250) openAndWait. |
|
245 | 91 |
|
254 | 92 |
s := Spline controlPoints: |
93 |
(Array with:(20@20) |
|
94 |
with:(80@80) |
|
95 |
with:(20@80) |
|
96 |
with:(20@20)). |
|
97 |
component := FillingWrapper on:s. |
|
98 |
component foregroundColor:(Color green darkened). |
|
99 |
component displayOn:v. |
|
100 |
[exEnd] |
|
101 |
wrap ellipticArcs |
|
102 |
and add them as components to a View |
|
103 |
(notice, that doing so makes the redraw automatic): |
|
104 |
[exBegin] |
|
105 |
|v e component| |
|
245 | 106 |
|
254 | 107 |
v := View extent:250@250. |
108 |
||
109 |
e := EllipticalArc boundingBox:(10@10 corner:90@90) |
|
110 |
startAngle:0 |
|
111 |
sweepAngle:270. |
|
112 |
v addComponent:(StrokingWrapper on:e). |
|
113 |
||
114 |
e := EllipticalArc boundingBox:(110@110 corner:190@190) |
|
115 |
startAngle:0 |
|
116 |
sweepAngle:270. |
|
117 |
v addComponent:(FillingWrapper on:e). |
|
118 |
v open |
|
245 | 119 |
[exEnd] |
120 |
||
121 |
||
254 | 122 |
wrap a rectangle and an ellipticArc, |
123 |
and add them as components to a View |
|
124 |
(notice, that doing so makes the redraw automatic): |
|
245 | 125 |
[exBegin] |
254 | 126 |
|v e component| |
245 | 127 |
|
254 | 128 |
v := View new. |
129 |
v extent:250@250. |
|
245 | 130 |
|
254 | 131 |
e := Rectangle origin:10@10 corner:90@90. |
132 |
component := FillingWrapper on:e. |
|
133 |
component foregroundColor:Color red. |
|
245 | 134 |
|
254 | 135 |
v addComponent:component. |
245 | 136 |
|
254 | 137 |
e := EllipticalArc boundingBox:(10@10 corner:90@90) |
138 |
startAngle:0 sweepAngle:270. |
|
139 |
component := StrokingWrapper on:e. |
|
140 |
component lineWidth:5. |
|
245 | 141 |
|
254 | 142 |
v addComponent:component. |
245 | 143 |
|
254 | 144 |
v addComponent:(Button label:'hello'). |
245 | 145 |
|
254 | 146 |
v open |
245 | 147 |
[exEnd] |
266
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
148 |
|
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
149 |
spline as a Buttons-label (hugh ?): |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
150 |
[exBegin] |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
151 |
|a b| |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
152 |
|
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
153 |
a := ArrowedSpline controlPoints: |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
154 |
(Array with:(00@00) |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
155 |
with:(60@60) |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
156 |
with:(00@60)). |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
157 |
|
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
158 |
b := Button label:(((StrokingWrapper on:a) |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
159 |
foregroundColor:Color red; |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
160 |
lineWidth:3; |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
161 |
lineStyle:#dashed)). |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
162 |
b open. |
e9d35cd74f64
wrappers usable as label in Label/Button etc.
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
163 |
[exEnd] |
245 | 164 |
" |
165 |
! ! |
|
166 |
||
167 |
!FillingWrapper methodsFor:'displaying'! |
|
168 |
||
169 |
displayOn:aGC |
|
246 | 170 |
"display myself - here, display the geometric object asFilled" |
171 |
||
282 | 172 |
|prevFg prevBg| |
245 | 173 |
|
174 |
prevFg := aGC paint. |
|
282 | 175 |
prevBg := aGC backgroundPaint. |
245 | 176 |
|
405
4acab6da7d82
fgColor/bgColor -> foregroundColor/backgroundColor
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
177 |
aGC paint:foregroundColor on:backgroundColor. |
245 | 178 |
|
179 |
component displayFilledOn:aGC. |
|
180 |
||
282 | 181 |
aGC paint:prevFg on:prevBg. |
245 | 182 |
|
183 |
"Created: 8.5.1996 / 23:54:06 / cg" |
|
405
4acab6da7d82
fgColor/bgColor -> foregroundColor/backgroundColor
Claus Gittinger <cg@exept.de>
parents:
365
diff
changeset
|
184 |
"Modified: 10.2.1997 / 14:21:41 / cg" |
245 | 185 |
! ! |
186 |
||
187 |
!FillingWrapper class methodsFor:'documentation'! |
|
188 |
||
189 |
version |
|
1789 | 190 |
^ '$Header: /cvs/stx/stx/libview2/FillingWrapper.st,v 1.11 2003-08-18 12:12:49 cg Exp $' |
245 | 191 |
! ! |