[FIX] Desk gradient colors

Boris Gaertner Boris.Gaertner at gmx.net
Sat Sep 7 12:08:31 UTC 2002


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixGradientFill.1.cs
Type: application/octet-stream
Size: 772 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020907/f5ba65f2/fixGradientFill.1.obj


More information about the Squeak-dev mailing list