author | Claus Gittinger <cg@exept.de> |
Wed, 06 Apr 2011 21:11:14 +0200 | |
changeset 5738 | b69308a38fb6 |
parent 5733 | 08e2b386abef |
child 5739 | c4fbd37a6164 |
permissions | -rw-r--r-- |
5461 | 1 |
" |
2 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
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 |
"{ Package: 'stx:libview' }" |
|
13 |
||
14 |
AbstractBackground subclass:#GradientBackground |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
15 |
instanceVariableNames:'color1 color2 direction cachedForm usedLength' |
5461 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Graphics-Support' |
|
19 |
! |
|
20 |
||
21 |
!GradientBackground class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
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 |
" |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
35 |
! |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
36 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
37 |
examples |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
38 |
" |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
39 |
|bg v| |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
40 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
41 |
bg := GradientBackground new color1:Color red color2:Color yellow. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
42 |
v := View new extent:300@300. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
43 |
v viewBackground:bg. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
44 |
v open. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
45 |
" |
5461 | 46 |
! ! |
47 |
||
5684 | 48 |
!GradientBackground methodsFor:'accessing'! |
49 |
||
50 |
color1 |
|
51 |
^ color1 |
|
52 |
||
53 |
"Created: / 23-01-2011 / 02:01:29 / cg" |
|
54 |
! |
|
55 |
||
56 |
color1:aColor |
|
57 |
color1 := aColor. |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
58 |
cachedForm := nil. |
5684 | 59 |
|
60 |
"Created: / 23-01-2011 / 02:01:50 / cg" |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
61 |
"Modified: / 03-02-2011 / 19:49:18 / cg" |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
62 |
! |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
63 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
64 |
color1:aColor1 color2:aColor2 |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
65 |
color1 := aColor1. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
66 |
color2 := aColor2. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
67 |
cachedForm := nil. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
68 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
69 |
"Created: / 03-02-2011 / 19:52:59 / cg" |
5684 | 70 |
! |
71 |
||
72 |
color2 |
|
73 |
^ color2 |
|
74 |
||
75 |
"Created: / 23-01-2011 / 02:01:32 / cg" |
|
76 |
! |
|
77 |
||
78 |
color2:aColor |
|
79 |
color2 := aColor. |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
80 |
cachedForm := nil. |
5684 | 81 |
|
82 |
"Created: / 23-01-2011 / 02:01:55 / cg" |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
83 |
"Modified: / 03-02-2011 / 19:49:23 / cg" |
5688 | 84 |
! |
85 |
||
86 |
direction |
|
87 |
"possible values: |
|
88 |
#northSouth |
|
89 |
#eastWest |
|
90 |
||
91 |
others are not yet supported |
|
92 |
" |
|
93 |
||
94 |
^ direction |
|
95 |
||
96 |
"Modified: / 23-01-2011 / 14:36:36 / cg" |
|
97 |
! |
|
98 |
||
99 |
direction:something |
|
100 |
"possible values: |
|
101 |
#northSouth |
|
102 |
#eastWest |
|
103 |
||
104 |
others are not yet supported |
|
105 |
" |
|
106 |
||
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
107 |
direction ~= something ifTrue:[ |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
108 |
direction := something. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
109 |
cachedForm := nil. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
110 |
] |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
111 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
112 |
"Modified: / 03-02-2011 / 19:49:41 / cg" |
5738 | 113 |
! |
114 |
||
115 |
usedLength |
|
116 |
^ usedLength |
|
117 |
! |
|
118 |
||
119 |
usedLength:something |
|
120 |
usedLength := something. |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
121 |
! ! |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
122 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
123 |
!GradientBackground methodsFor:'converting'! |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
124 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
125 |
asFormOn:aDevice |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
126 |
|h w| |
5688 | 127 |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
128 |
cachedForm isNil ifTrue:[ |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
129 |
(direction == #northSouth or:[direction == nil]) ifTrue:[ |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
130 |
h := usedLength ? (Display height). "/ aView height. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
131 |
w := 8. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
132 |
] ifFalse:[ |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
133 |
h := 8. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
134 |
w := usedLength ? (Display width). "/ aView width. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
135 |
]. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
136 |
cachedForm := Form width:w height:h depth:aDevice depth onDevice:aDevice. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
137 |
"/ cachedForm clear. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
138 |
self fillRectangleX:0 y:0 width:w height:h in:cachedForm |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
139 |
]. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
140 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
141 |
^ cachedForm |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
142 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
143 |
"Created: / 03-02-2011 / 20:05:30 / cg" |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
144 |
! |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
145 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
146 |
onDevice:device |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
147 |
^ self asFormOn:device. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
148 |
|
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
149 |
"Created: / 03-02-2011 / 19:56:06 / cg" |
5684 | 150 |
! ! |
151 |
||
152 |
!GradientBackground methodsFor:'drawing'! |
|
153 |
||
154 |
fillRectangleX:x y:y width:w height:h in:aView |
|
155 |
"this is a first (very inefficient) try" |
|
156 |
||
5688 | 157 |
|hAll wAll r1 r2 g1 g2 b1 b2 dR r dG g dB b |
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
158 |
yRect hRun xRect wRun |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
159 |
rC gC bC lastR lastG lastB |
5731
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
160 |
minR maxR minG maxG minB maxB| |
5687
d4ab14b6cf0a
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
161 |
|
5688 | 162 |
"/ always take the full-screen as reference |
163 |
"/ (so we do not have to care for changed gradient, when view changes size) |
|
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
164 |
hAll := usedLength ? (Display height). "/ aView height. |
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
165 |
wAll := usedLength ? (Display width). "/ aView width. |
5684 | 166 |
|
167 |
r1 := color1 redByte. |
|
168 |
r2 := color2 redByte. |
|
169 |
g1 := color1 greenByte. |
|
170 |
g2 := color2 greenByte. |
|
171 |
b1 := color1 blueByte. |
|
172 |
b2 := color2 blueByte. |
|
173 |
||
5731
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
174 |
minR := r1 min:r2. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
175 |
maxR := r1 max:r2. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
176 |
minG := g1 min:g2. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
177 |
maxG := g1 max:g2. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
178 |
minB := b1 min:b2. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
179 |
maxB := b1 max:b2. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
180 |
|
5728
c3c7f362b4c3
changed: #fillRectangleX:y:width:height:in:
Stefan Vogel <sv@exept.de>
parents:
5705
diff
changeset
|
181 |
aView lineStyle:#solid. |
c3c7f362b4c3
changed: #fillRectangleX:y:width:height:in:
Stefan Vogel <sv@exept.de>
parents:
5705
diff
changeset
|
182 |
|
5688 | 183 |
"/ individual lines; from top to bottom |
5705
56318de85b68
comment/format in: #initializeAllPluginClasses
Claus Gittinger <cg@exept.de>
parents:
5692
diff
changeset
|
184 |
(direction == #northSouth or:[direction == #vertical or:[direction == nil]]) ifTrue:[ |
5687
d4ab14b6cf0a
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
185 |
dR := (r2 - r1) / hAll. |
5684 | 186 |
r := r1 + (dR * y). |
5687
d4ab14b6cf0a
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
187 |
dG := (g2 - g1) / hAll. |
5684 | 188 |
g := g1 + (dG * y). |
5687
d4ab14b6cf0a
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5684
diff
changeset
|
189 |
dB := (b2 - b1) / hAll. |
5684 | 190 |
b := b1 + (dB * y). |
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
191 |
|
5732
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
192 |
r := (r max:minR) min:maxR. |
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
193 |
g := (g max:minG) min:maxG. |
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
194 |
b := (b max:minB) min:maxB. |
5684 | 195 |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
196 |
lastR := r asInteger. lastG := g asInteger. lastB := b asInteger. |
5732
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
197 |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
198 |
yRect := y. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
199 |
hRun := 0. |
5731
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
200 |
y to:y+h-1 do:[:yP | |
5684 | 201 |
rC := r asInteger. |
202 |
gC := g asInteger. |
|
203 |
bC := b asInteger. |
|
204 |
(rC ~~ lastR or:[gC ~~ lastG or:[bC ~~ lastB]]) ifTrue:[ |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
205 |
aView paint:(Color redByte:lastR greenByte:lastG blueByte:lastB). |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
206 |
aView fillRectangleX:x y:yRect width:w height:hRun. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
207 |
yRect := yP. hRun := 0. |
5684 | 208 |
lastR := rC. lastG := gC. lastB := bC. |
209 |
]. |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
210 |
hRun := hRun + 1. |
5731
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
211 |
r := ((r + dR) max:minR) min:maxR. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
212 |
g := ((g + dG) max:minG) min:maxG. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
213 |
b := ((b + dB) max:minB) min:maxB. |
5684 | 214 |
]. |
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
215 |
hRun ~~ 0 ifTrue:[ |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
216 |
aView paint:(Color redByte:lastR greenByte:lastG blueByte:lastB). |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
217 |
aView fillRectangleX:x y:yRect width:w height:hRun. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
218 |
]. |
5688 | 219 |
^ self. |
220 |
]. |
|
221 |
||
222 |
"/ individual lines; from left to right |
|
223 |
(direction == #eastWest or:[direction == #horizontal]) ifTrue:[ |
|
224 |
dR := (r2 - r1) / wAll. |
|
5732
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
225 |
r := r1 + (dR * x). |
5688 | 226 |
dG := (g2 - g1) / wAll. |
5732
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
227 |
g := g1 + (dG * x). |
5688 | 228 |
dB := (b2 - b1) / wAll. |
5732
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
229 |
b := b1 + (dB * x). |
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
230 |
|
5732
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
231 |
r := (r max:minR) min:maxR. |
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
232 |
g := (g max:minG) min:maxG. |
fba4327a852b
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5731
diff
changeset
|
233 |
b := (b max:minB) min:maxB. |
5688 | 234 |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
235 |
lastR := r asInteger. lastG := g asInteger. lastB := b asInteger. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
236 |
|
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
237 |
xRect := x. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
238 |
wRun := 0. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
239 |
|
5731
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
240 |
x to:x+w-1 do:[:xP | |
5688 | 241 |
rC := r asInteger. |
242 |
gC := g asInteger. |
|
243 |
bC := b asInteger. |
|
244 |
(rC ~~ lastR or:[gC ~~ lastG or:[bC ~~ lastB]]) ifTrue:[ |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
245 |
aView paint:(Color redByte:lastR greenByte:lastG blueByte:lastB). |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
246 |
aView fillRectangleX:xRect y:y width:wRun height:h. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
247 |
xRect := xP. wRun := 0. |
5688 | 248 |
lastR := rC. lastG := gC. lastB := bC. |
249 |
]. |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
250 |
wRun := wRun + 1. |
5731
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
251 |
r := ((r + dR) max:minR) min:maxR. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
252 |
g := ((g + dG) max:minG) min:maxG. |
e638acae4e19
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5730
diff
changeset
|
253 |
b := ((b + dB) max:minB) min:maxB. |
5688 | 254 |
]. |
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
255 |
wRun ~~ 0 ifTrue:[ |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
256 |
aView paint:(Color redByte:lastR greenByte:lastG blueByte:lastB). |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
257 |
aView fillRectangleX:xRect y:y width:wRun height:h. |
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
258 |
]. |
5688 | 259 |
^ self. |
5684 | 260 |
] |
261 |
||
262 |
"Created: / 23-01-2011 / 01:59:29 / cg" |
|
5733
08e2b386abef
changed: #fillRectangleX:y:width:height:in:
Claus Gittinger <cg@exept.de>
parents:
5732
diff
changeset
|
263 |
"Modified: / 24-03-2011 / 09:59:20 / cg" |
5684 | 264 |
! ! |
265 |
||
5461 | 266 |
!GradientBackground class methodsFor:'documentation'! |
267 |
||
268 |
version_CVS |
|
5738 | 269 |
^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.12 2011-04-06 19:11:14 cg Exp $' |
5461 | 270 |
! ! |