logo       

Re: fading Color: msg#00798

lang.smalltalk.squeak.general

Subject: Re: fading Color

Boris Gaertner wrote:

Chris Burkert <christian.burkert@xxxxxxxxxxxxxxxxxxxx> wrote:

I'm searching for a way to fill a Morph with more than one Color.
I hope 'fading Color' describes it well. The best example is the
MoviePlayer from the Widgetsflap but I didn't find how to get this
working. Can you help me ?

Chris,

have a look at MPEGMoviePlayerMorph>>moviePlayerFillStyle.
and search the senders of this method.

The point is that you have to define a GradientFillStyle. Such a thing
has an array of colors. Try this for different values of direction (100 @
0,
100@50, 100 @ 100) to get a feeling for fading coloring:

| fill bc |

fill _ GradientFillStyle ramp: {
0.0 -> (Color r: 0.05 g: 0.5 b: 1.0). "blue"
0.5 -> (Color r: 0.70 g: 0.85 b: 1.0). "almost white"
1.0 -> (Color r: 0.05 g: 0.5 b: 1.0)}. "blue again"
fill origin: (50@0);
direction: 100@0;
radial: false.
bc := BalloonCanvas extent: (200 @ 100) depth: 32.
bc fillRectangle: (0@0 extent: 200 @ 100)
fillStyle: fill.

bc form displayAt: 10@ 10

Hope this helps


Thanks a lot. That's exactly I was searching for.

Regards
Chris Burkert
--
------------------------------------------------------------------------
Student of applied Computer Science at Chemnitz University of Technology
http://www.chrisburkert.de/ chbu@xxxxxxxxxxxxxxxxxx
------------------------------------------------------------------------
"I invented the term Object-Oriented, and I can tell you I did not have
C++ in mind." - Alan Kay --> http://www.squeak.org/





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise