151
|
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 |
|
|
13 |
Object subclass:#GraphicsAttributes
|
|
14 |
instanceVariableNames:'paint
|
|
15 |
font
|
|
16 |
lineStyle lineWidth
|
|
17 |
joinStyle capStyle
|
|
18 |
maskOrigin'
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
category:'Graphics-Support'
|
|
22 |
!
|
|
23 |
|
|
24 |
GraphicsAttributes comment:'
|
|
25 |
COPYRIGHT (c) 1992 by Claus Gittinger
|
|
26 |
All Rights Reserved
|
|
27 |
|
154
|
28 |
$Header: /cvs/stx/stx/libview/GraphicsAttributes.st,v 1.2 1995-07-02 16:16:15 claus Exp $
|
151
|
29 |
'!
|
|
30 |
|
|
31 |
!GraphicsAttributes class methodsFor:'documentation'!
|
|
32 |
|
|
33 |
copyright
|
|
34 |
"
|
|
35 |
COPYRIGHT (c) 1992 by Claus Gittinger
|
|
36 |
All Rights Reserved
|
|
37 |
|
|
38 |
This software is furnished under a license and may be used
|
|
39 |
only in accordance with the terms of that license and with the
|
|
40 |
inclusion of the above copyright notice. This software may not
|
|
41 |
be provided or otherwise made available to, or used by, any
|
|
42 |
other person. No title to or ownership of the software is
|
|
43 |
hereby transferred.
|
|
44 |
"
|
|
45 |
!
|
|
46 |
|
|
47 |
version
|
|
48 |
"
|
154
|
49 |
$Header: /cvs/stx/stx/libview/GraphicsAttributes.st,v 1.2 1995-07-02 16:16:15 claus Exp $
|
151
|
50 |
"
|
|
51 |
!
|
|
52 |
|
|
53 |
documentation
|
|
54 |
"
|
|
55 |
instances keep multiple graphics attributes as used in a graphicsContext.
|
|
56 |
They can be used when multiple attributes are to be set.
|
|
57 |
|
|
58 |
Instance variables:
|
|
59 |
|
|
60 |
paint <Color> the paint to be used for drawing
|
|
61 |
font <Font> the font to be used for drawing
|
|
62 |
lineStyle <Symbol> the lineStyle (i.e. #solid, #dashed, #doubleDashed)
|
|
63 |
lineWidth <SmallInteger> the lineWidth (device dependent, usually pixels)
|
|
64 |
joinStyle <Symbol> the style in which lines (in polygons)
|
|
65 |
are joined (i.e. #miter, #bevel, #round)
|
|
66 |
capStyle <Symbol> the style in which the last point of a line is drawn
|
|
67 |
(i.e. #notLast, #butt, #round, #projecting)
|
|
68 |
maskOrigin <Point> the origin of the mask relative to
|
|
69 |
the drawables origin
|
|
70 |
|
|
71 |
CAVEAT: the maskOrigin is called phase in ST-80
|
|
72 |
"
|
|
73 |
! !
|
|
74 |
|
|
75 |
!GraphicsAttributes methodsFor:'installing'!
|
|
76 |
|
|
77 |
installOn:aGC
|
|
78 |
paint notNil ifTrue:[aGC paint:paint].
|
|
79 |
font notNil ifTrue:[aGC font:font].
|
154
|
80 |
lineWidth notNil ifTrue:[aGC lineWidth:lineWidth].
|
151
|
81 |
lineStyle notNil ifTrue:[aGC lineStyle:lineStyle].
|
|
82 |
joinStyle notNil ifTrue:[aGC joinStyle:joinStyle].
|
|
83 |
capStyle notNil ifTrue:[aGC capStyle:capStyle].
|
|
84 |
maskOrigin notNil ifTrue:[aGC maskOrigin:capStyle].
|
|
85 |
! !
|
|
86 |
|
|
87 |
!GraphicsAttributes methodsFor:'accessing'!
|
|
88 |
|
|
89 |
paint
|
|
90 |
"return the current paint drawing color"
|
|
91 |
|
|
92 |
^ paint
|
|
93 |
!
|
|
94 |
|
|
95 |
paint:aColor
|
|
96 |
"set the drawing painting color"
|
|
97 |
|
|
98 |
paint := aColor
|
|
99 |
!
|
|
100 |
|
|
101 |
lineWidth
|
|
102 |
"return the drawing linewidth"
|
|
103 |
|
|
104 |
^ lineWidth
|
|
105 |
!
|
|
106 |
|
|
107 |
lineWidth:aNumber
|
|
108 |
"set the line drawing width in pixels"
|
|
109 |
|
|
110 |
lineWidth := aNumber
|
|
111 |
!
|
|
112 |
|
|
113 |
lineStyle
|
|
114 |
"return the line-drawing-style"
|
|
115 |
|
|
116 |
^ lineStyle
|
|
117 |
!
|
|
118 |
|
|
119 |
lineStyle:aStyleSymbol
|
|
120 |
"set the line-drawing-style;
|
|
121 |
possible styles are: #solid, #dashed, #doubleDashed"
|
|
122 |
|
|
123 |
lineStyle := aStyleSymbol
|
|
124 |
!
|
|
125 |
|
|
126 |
capStyle
|
|
127 |
"return the cap-style for line-drawing"
|
|
128 |
|
|
129 |
^ capStyle
|
|
130 |
!
|
|
131 |
|
|
132 |
capStyle:aStyleSymbol
|
|
133 |
"set the cap-style for line-drawing;
|
|
134 |
possible styles are: #notLast, #butt, #round, #projecting"
|
|
135 |
|
|
136 |
capStyle := aStyleSymbol
|
|
137 |
!
|
|
138 |
|
|
139 |
joinStyle
|
|
140 |
"return the join-style for polygon-drawing"
|
|
141 |
|
|
142 |
^ joinStyle
|
|
143 |
!
|
|
144 |
|
|
145 |
joinStyle:aStyleSymbol
|
|
146 |
"set the join-style of lines in polygon-drawing;
|
|
147 |
possible styles are: #miter, #bevel, #round"
|
|
148 |
|
|
149 |
joinStyle := aStyleSymbol
|
|
150 |
!
|
|
151 |
|
|
152 |
font
|
|
153 |
"return the drawing font"
|
|
154 |
|
|
155 |
^ font
|
|
156 |
!
|
|
157 |
|
|
158 |
font:aFont
|
|
159 |
"set the drawing font"
|
|
160 |
|
|
161 |
font := aFont
|
|
162 |
!
|
|
163 |
|
|
164 |
maskOrigin:aPoint
|
|
165 |
"set the origin within the mask (used to draw with patterns).
|
|
166 |
This is an alias for ST-80's #phase"
|
|
167 |
|
|
168 |
maskOrigin := aPoint
|
|
169 |
!
|
|
170 |
|
|
171 |
maskOriginX:x y:y
|
|
172 |
"set the origin within the mask (used to draw with patterns)."
|
|
173 |
|
|
174 |
^ maskOrigin
|
|
175 |
!
|
|
176 |
|
|
177 |
phase:aPoint
|
|
178 |
"set the origin within the mask (used to draw with patterns).
|
|
179 |
This is an alias for ST/X's #maskOrigin:"
|
|
180 |
|
|
181 |
maskOrigin := aPoint
|
|
182 |
!
|
|
183 |
|
|
184 |
phase
|
|
185 |
"return the origin within the mask (used to draw with patterns).
|
|
186 |
This is an alias for ST/X's #maskOrigin"
|
|
187 |
|
|
188 |
^ maskOrigin
|
|
189 |
! !
|
|
190 |
|
|
191 |
|