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