author | Claus Gittinger <cg@exept.de> |
Tue, 16 Jul 2019 15:06:06 +0200 | |
changeset 8732 | 2126b6c5f654 |
parent 219 | 9ff0660f447f |
child 6528 | 62c1dbef0b84 |
permissions | -rw-r--r-- |
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 class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1992 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 |
version |
|
219
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
157
diff
changeset
|
41 |
^ '$Header: /cvs/stx/stx/libview/GraphicsAttributes.st,v 1.4 1995-11-11 15:51:01 cg Exp $' |
151 | 42 |
! |
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
instances keep multiple graphics attributes as used in a graphicsContext. |
|
47 |
They can be used when multiple attributes are to be set. |
|
157 | 48 |
This class is (currently) not used by the system, but has been added |
49 |
to make porting of existing ST-80 applications easier. |
|
151 | 50 |
|
51 |
Instance variables: |
|
52 |
||
53 |
paint <Color> the paint to be used for drawing |
|
54 |
font <Font> the font to be used for drawing |
|
55 |
lineStyle <Symbol> the lineStyle (i.e. #solid, #dashed, #doubleDashed) |
|
56 |
lineWidth <SmallInteger> the lineWidth (device dependent, usually pixels) |
|
57 |
joinStyle <Symbol> the style in which lines (in polygons) |
|
58 |
are joined (i.e. #miter, #bevel, #round) |
|
59 |
capStyle <Symbol> the style in which the last point of a line is drawn |
|
60 |
(i.e. #notLast, #butt, #round, #projecting) |
|
61 |
maskOrigin <Point> the origin of the mask relative to |
|
62 |
the drawables origin |
|
63 |
||
64 |
CAVEAT: the maskOrigin is called phase in ST-80 |
|
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!GraphicsAttributes methodsFor:'installing'! |
|
69 |
||
70 |
installOn:aGC |
|
71 |
paint notNil ifTrue:[aGC paint:paint]. |
|
72 |
font notNil ifTrue:[aGC font:font]. |
|
154 | 73 |
lineWidth notNil ifTrue:[aGC lineWidth:lineWidth]. |
151 | 74 |
lineStyle notNil ifTrue:[aGC lineStyle:lineStyle]. |
75 |
joinStyle notNil ifTrue:[aGC joinStyle:joinStyle]. |
|
76 |
capStyle notNil ifTrue:[aGC capStyle:capStyle]. |
|
77 |
maskOrigin notNil ifTrue:[aGC maskOrigin:capStyle]. |
|
78 |
! ! |
|
79 |
||
80 |
!GraphicsAttributes methodsFor:'accessing'! |
|
81 |
||
82 |
paint |
|
83 |
"return the current paint drawing color" |
|
84 |
||
85 |
^ paint |
|
86 |
! |
|
87 |
||
88 |
paint:aColor |
|
89 |
"set the drawing painting color" |
|
90 |
||
91 |
paint := aColor |
|
92 |
! |
|
93 |
||
94 |
lineWidth |
|
95 |
"return the drawing linewidth" |
|
96 |
||
97 |
^ lineWidth |
|
98 |
! |
|
99 |
||
100 |
lineWidth:aNumber |
|
101 |
"set the line drawing width in pixels" |
|
102 |
||
103 |
lineWidth := aNumber |
|
104 |
! |
|
105 |
||
106 |
lineStyle |
|
107 |
"return the line-drawing-style" |
|
108 |
||
109 |
^ lineStyle |
|
110 |
! |
|
111 |
||
112 |
lineStyle:aStyleSymbol |
|
113 |
"set the line-drawing-style; |
|
114 |
possible styles are: #solid, #dashed, #doubleDashed" |
|
115 |
||
116 |
lineStyle := aStyleSymbol |
|
117 |
! |
|
118 |
||
119 |
capStyle |
|
120 |
"return the cap-style for line-drawing" |
|
121 |
||
122 |
^ capStyle |
|
123 |
! |
|
124 |
||
125 |
capStyle:aStyleSymbol |
|
126 |
"set the cap-style for line-drawing; |
|
127 |
possible styles are: #notLast, #butt, #round, #projecting" |
|
128 |
||
129 |
capStyle := aStyleSymbol |
|
130 |
! |
|
131 |
||
132 |
joinStyle |
|
133 |
"return the join-style for polygon-drawing" |
|
134 |
||
135 |
^ joinStyle |
|
136 |
! |
|
137 |
||
138 |
joinStyle:aStyleSymbol |
|
139 |
"set the join-style of lines in polygon-drawing; |
|
140 |
possible styles are: #miter, #bevel, #round" |
|
141 |
||
142 |
joinStyle := aStyleSymbol |
|
143 |
! |
|
144 |
||
145 |
font |
|
146 |
"return the drawing font" |
|
147 |
||
148 |
^ font |
|
149 |
! |
|
150 |
||
151 |
font:aFont |
|
152 |
"set the drawing font" |
|
153 |
||
154 |
font := aFont |
|
155 |
! |
|
156 |
||
157 |
maskOrigin:aPoint |
|
158 |
"set the origin within the mask (used to draw with patterns). |
|
159 |
This is an alias for ST-80's #phase" |
|
160 |
||
161 |
maskOrigin := aPoint |
|
162 |
! |
|
163 |
||
164 |
maskOriginX:x y:y |
|
165 |
"set the origin within the mask (used to draw with patterns)." |
|
166 |
||
167 |
^ maskOrigin |
|
168 |
! |
|
169 |
||
170 |
phase:aPoint |
|
171 |
"set the origin within the mask (used to draw with patterns). |
|
172 |
This is an alias for ST/X's #maskOrigin:" |
|
173 |
||
174 |
maskOrigin := aPoint |
|
175 |
! |
|
176 |
||
177 |
phase |
|
178 |
"return the origin within the mask (used to draw with patterns). |
|
179 |
This is an alias for ST/X's #maskOrigin" |
|
180 |
||
181 |
^ maskOrigin |
|
182 |
! ! |
|
183 |
||
184 |