'From etoys3.0 of 24 February 2008 [latest update: #1929] on 25 March 2008 at 3:33:56 am'! "Change Set: polygonFillStyle-sw Date: 25 March 2008 Author: Scott Wallace TRAC 6379: when a PolygonMorph is 'open', errors occur when you point its Viewer at the 'fill and border' category"! !Morph methodsFor: 'visual properties' stamp: 'sw 3/25/2008 03:17'! useGradientFill "Make receiver use a solid fill style (e.g., a simple color)" | fill color1 color2 fil | ((fil := self fillStyle) notNil and: [fil isSymbol not] and: [fil isGradientFill]) ifTrue:[^self]. "Already done" color1 _ self color asColor. color2 _ color1 negated. fill _ GradientFillStyle ramp: {0.0 -> color1. 1.0 -> color2}. fill origin: self topLeft. fill direction: 0 @ self bounds extent y. fill normal: self bounds extent x @ 0. fill radial: false. self fillStyle: fill! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/25/2008 03:20'! getColor "Answer the color of my costume. If it uses a gradient fill, answer the first color." | aFillStyle aMorph | ^ ((self isFillStyle: (aFillStyle := (aMorph := self costume renderedMorph) fillStyle)) and: [aFillStyle isGradientFill] ) ifTrue: [aFillStyle colorRamp first value] ifFalse: [aMorph color]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/25/2008 03:31'! getRadialGradientFill "Getter for costume's useGradientFill" | aStyle | ^ (self isFillStyle: (aStyle := costume renderedMorph fillStyle)) and: [aStyle isGradientFill] and: [aStyle isRadialFill]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/24/2008 16:15'! getSecondColor "Getter for costume's second color, if it's using gradient fill; sonst answers white." | fil | ^ ((self isFillStyle: (fil := costume renderedMorph fillStyle)) and: [fil isGradientFill]) ifTrue: [fil colorRamp last value] ifFalse: [Color white]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/25/2008 03:26'! getUseGradientFill "Getter for costume's useGradientFill" | fil | ^ (self isFillStyle: (fil := costume renderedMorph fillStyle)) ifFalse: [false] ifTrue: [fil isGradientFill]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/24/2008 15:53'! isFillStyle: prospective "Answer whether the argument is some kind of fill-style." ^ prospective notNil and: [prospective isSymbol not] ! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/25/2008 03:23'! setRadialGradientFill: aBoolean "Setter for costume's radialGradientFill" | fil | (self isFillStyle: (fil := costume renderedMorph fillStyle)) ifTrue: [fil isGradientFill ifTrue: [fil isRadialFill ~~ aBoolean ifTrue: [fil radial: aBoolean. costume renderedMorph changed]]]! ! !Player methodsFor: 'slot getters/setters' stamp: 'sw 3/24/2008 16:11'! setUseGradientFill: aBoolean "Setter for costume's useGradientFill" | fil | ^ (self isFillStyle: (fil := costume renderedMorph fillStyle)) ifTrue: [fil isGradientFill ifTrue: [aBoolean ifFalse: [costume renderedMorph useSolidFill]] ifFalse: [aBoolean ifTrue: [costume renderedMorph useGradientFill]]]! !