equal
deleted
inserted
replaced
63 !GradientBackground methodsFor:'drawing'! |
63 !GradientBackground methodsFor:'drawing'! |
64 |
64 |
65 fillRectangleX:x y:y width:w height:h in:aView |
65 fillRectangleX:x y:y width:w height:h in:aView |
66 "this is a first (very inefficient) try" |
66 "this is a first (very inefficient) try" |
67 |
67 |
68 |r1 r2 g1 g2 b1 b2 dR r dG g dB b xRight rC gC bC lastR lastG lastB| |
68 |hAll r1 r2 g1 g2 b1 b2 dR r dG g dB b xRight rC gC bC lastR lastG lastB| |
|
69 |
|
70 hAll := 1000. "/ aView height. |
69 |
71 |
70 r1 := color1 redByte. |
72 r1 := color1 redByte. |
71 r2 := color2 redByte. |
73 r2 := color2 redByte. |
72 g1 := color1 greenByte. |
74 g1 := color1 greenByte. |
73 g2 := color2 greenByte. |
75 g2 := color2 greenByte. |
75 b2 := color2 blueByte. |
77 b2 := color2 blueByte. |
76 |
78 |
77 direction = #horizontal ifTrue:[ |
79 direction = #horizontal ifTrue:[ |
78 self halt |
80 self halt |
79 ] ifFalse:[ |
81 ] ifFalse:[ |
80 dR := (r2 - r1) / (aView height). |
82 dR := (r2 - r1) / hAll. |
81 r := r1 + (dR * y). |
83 r := r1 + (dR * y). |
82 dG := (g2 - g1) / (aView height). |
84 dG := (g2 - g1) / hAll. |
83 g := g1 + (dG * y). |
85 g := g1 + (dG * y). |
84 dB := (b2 - b1) / (aView height). |
86 dB := (b2 - b1) / hAll. |
85 b := b1 + (dB * y). |
87 b := b1 + (dB * y). |
86 |
88 |
87 xRight := x+w-1. |
89 xRight := x+w-1. |
88 0 to:h-1 do:[:yP | |
90 0 to:h-1 do:[:yP | |
89 rC := r asInteger. |
91 rC := r asInteger. |
99 b := b + dB. |
101 b := b + dB. |
100 ]. |
102 ]. |
101 ] |
103 ] |
102 |
104 |
103 "Created: / 23-01-2011 / 01:59:29 / cg" |
105 "Created: / 23-01-2011 / 01:59:29 / cg" |
|
106 "Modified: / 23-01-2011 / 12:53:36 / cg" |
104 ! ! |
107 ! ! |
105 |
108 |
106 !GradientBackground class methodsFor:'documentation'! |
109 !GradientBackground class methodsFor:'documentation'! |
107 |
110 |
108 version_CVS |
111 version_CVS |
109 ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.2 2011-01-23 01:45:47 cg Exp $' |
112 ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.3 2011-01-23 11:53:48 cg Exp $' |
110 ! ! |
113 ! ! |