[FIX] Desk gradient colors
Andreas Raab
squeak-dev at lists.squeakfoundation.org
Sat Sep 7 13:30:31 UTC 2002
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C25683.80B5D560
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Boris,
The fix isn't really adressing the problem. What's happening is slightly
more complex and should be fixed in two places actually. First of all,
there's Morph>>useGradientFill which dumps its original color when
applied(not good!). So what should be done here is to replace
color1 _ self color dominantColor.
by
color1 _ self color.
and now that we know we got a "good first color" for the gradient fill
we can go into PasteUps>>gradientFillColor: method and change it from
self fillStyle colorRamp: {0.0 -> color. 1.0 -> aColor}.
into
self fillStyle colorRamp: {
0.0 -> self fillStyle colorRamp first value. "original
color"
1.0 -> aColor}.
which will solve the problem entirely. Changes attached.
Cheers,
- Andreas
> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On
> Behalf Of Boris Gaertner
> Sent: Saturday, September 07, 2002 2:09 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: [FIX] Desk gradient colors
>
>
>
> Michael Grant <mwgrant2001 at yahoo.com> wrote
> >
> > With my previous version of Squeak (3.0) on a Windows
> > 98 machine I was able to set the vertical two color
> > gradient background for the desktop. However,the 3.2
> > August image and now the latest September image can
> > not make the gradient correctly.
> >
> > Basically if, in 3.2, I set the desktop color to
> > color1, I get color1. But if I then set the gradient
> > color to color2, the resulting gradient is color2 at
> > the bottom blending into a gray (~50%). Any thoughts?
> >
> > This is a bug...the question is, is it a bug in 3.2 or
> > my brain?
>
> It is a bug is 3.2.
>
> The fatal difference is in instance method asColor
> of class GradientFillStyle.
> In 3.0 we have:
>
> asColor
> ^colorRamp first value
>
> In 3.2 this was changed to:
>
> asColor
> "Guess..."
> ^colorRamp first value mixed: 0.5 with: colorRamp last value
>
> That change came with change set #4548 (BorderStyles-ar)
>
> When you go back to the method that we had in 3.0, the
> gradient coloring
> will work. I cannot say what will be the consequences to
> other features.
>
> The point is that method Morph>>fillStyle: (called from
> Morph>>useGradientFill)
> assigns a value to the instance variable color and later in
> PasteUpMorph>>gradientfillColor: that changed value is used
> of the first
> color of the gradient fill.
>
> A good solution is to add this method in PasteUpMorph:
>
> fillStyle: aFillStyle
> "Set the current fillStyle of the receiver."
> self setProperty: #fillStyle toValue: aFillStyle.
> self changed.
>
> This is copied from the instance protocol of Morph, but the assignment
> to instance variable color is removed. This is what I think is
> necessary and you can then keep the version of
> GradientFillStyle>>asColor that was introduced with the change set
> #4548. You find this fix in the attached change set.
>
> Hope that helps
>
> Boris
>
>
>
------=_NextPart_000_0008_01C25683.80B5D560
Content-Type: application/octet-stream;
name="FixWorldGradient.1.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="FixWorldGradient.1.cs"
'From Squeak3.3alpha of 24 January 2002 [latest update: #4971] on 7 =
September 2002 at 3:29:50 pm'!=0D"Change Set: FixWorldGradient=0DDate: =
7 September 2002=0DAuthor: Andreas Raab=0D=0DFixes the problem when =
trying to set the world's gradient color"!=0D=0D=0D!Morph methodsFor: =
'visual properties' stamp: 'ar 9/7/2002 15:25'!=0DuseGradientFill=0D =
"Make receiver use a solid fill style (e.g., a simple color)"=0D | fill =
color1 color2 |=0D self fillStyle isGradientFill ifTrue:[^self]. =
"Already done"=0D color1 _ self color.=0D color2 _ color1 negated.=0D =
fill _ GradientFillStyle ramp: {0.0 -> color1. 1.0 -> color2}.=0D fill =
origin: self topLeft.=0D fill direction: 0 @ self bounds extent y.=0D =
fill normal: self bounds extent x @ 0.=0D fill radial: false.=0D self =
fillStyle: fill.! !=0D=0D=0D!PasteUpMorph methodsFor: 'display' stamp: =
'ar 9/7/2002 15:24'!=0DgradientFillColor: aColor=0D "For backwards =
compatibility with GradientFillMorph"=0D=0D self flag: #fixThis.=0D self =
useGradientFill.=0D self fillStyle colorRamp: {0.0 -> self fillStyle =
colorRamp first value. 1.0 -> aColor}.=0D self changed=0D! !=0D=0D
------=_NextPart_000_0008_01C25683.80B5D560--
More information about the Squeak-dev
mailing list
|