#FEATURE
class: GradientBackground
added:
#needsFullRedrawOnChangeOfHeight
#needsFullRedrawOnChangeOfWidth
comment/format in: #examples
changed:
#asFormOn:
#direction
#fillRectangleX:y:width:height:in:
--- a/GradientBackground.st Sun Oct 04 12:11:29 2015 +0200
+++ b/GradientBackground.st Sun Oct 04 13:14:26 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2009 by eXept Software AG
All Rights Reserved
@@ -38,12 +40,34 @@
examples
"
+ [exBegin]
|bg v|
bg := GradientBackground new color1:Color red color2:Color yellow.
v := View new extent:300@300.
v viewBackground:bg.
v open.
+ [exEnd]
+
+ [exBegin]
+ |bg v|
+
+ bg := GradientBackground new color1:Color red color2:Color yellow.
+ bg usedLength:100.
+ v := View new extent:300@300.
+ v viewBackground:bg.
+ v open.
+ [exEnd]
+
+ [exBegin]
+ |bg v|
+
+ bg := GradientBackground new color1:Color red color2:Color yellow.
+ bg usedLength:#full.
+ v := View new extent:300@300.
+ v viewBackground:bg.
+ v open.
+ [exEnd]
"
! !
@@ -139,7 +163,7 @@
others are not yet supported
"
- ^ direction
+ ^ direction ? #northSouth
"Modified: / 23-01-2011 / 14:36:36 / cg"
!
@@ -173,10 +197,10 @@
asFormOn:aDevice
|h w len|
- usedLength == #full ifTrue:[
- self halt:'unsupported'.
- ^ nil
- ].
+"/ usedLength == #full ifTrue:[
+"/ self halt:'unsupported'.
+"/ ^ nil
+"/ ].
cachedForm isNil ifTrue:[
(len := usedLength) == #full ifTrue:[
@@ -215,25 +239,26 @@
rC gC bC lastR lastG lastB
minR maxR minG maxG minB maxB|
+ scaleStartX := x.
+ scaleStartY := y.
+
"/ always take the full-screen as reference
"/ (so we do not have to care for changed gradient, when view changes size)
usedLength notNil ifTrue:[
usedLength == #full ifTrue:[
hAll := aView height.
wAll := aView width.
- scaleStartX := 0.
- scaleStartY := 0.
+"/ scaleStartX := 0.
+"/ scaleStartY := 0.
] ifFalse:[
hAll := usedLength.
wAll := usedLength.
- scaleStartX := 0.
- scaleStartY := 0.
+"/ scaleStartX := 0.
+"/ scaleStartY := 0.
]
] ifFalse:[
hAll := aView device height. "/ aView height.
wAll := aView device width. "/ aView width.
- scaleStartX := x.
- scaleStartY := y.
].
r1 := color1 redByte.
@@ -335,13 +360,23 @@
"Modified: / 06-04-2011 / 21:18:07 / cg"
! !
+!GradientBackground methodsFor:'queries'!
+
+needsFullRedrawOnChangeOfHeight
+ ^ usedLength == #full and:[self direction == #northSouth]
+!
+
+needsFullRedrawOnChangeOfWidth
+ ^ usedLength == #full and:[direction == #eastWest]
+! !
+
!GradientBackground class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.18 2015-02-14 21:30:18 cg Exp $'
+ ^ '$Header$'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/GradientBackground.st,v 1.18 2015-02-14 21:30:18 cg Exp $'
+ ^ '$Header$'
! !