How to make stripes
Bert Freudenberg
bert at isg.cs.uni-magdeburg.de
Thu Aug 30 10:37:17 UTC 2001
On Wed, 29 Aug 2001, Ross Boylan wrote:
> I want to fill rectangles with stripes. What's a good way to do this?
>
> It looks as if I might want to use FillStyle's, but
> Morph>>fillStyle: has the comment
> "Workaround for Morphs not yet converted"
>
> This suggests fillStyle is on the way out, but I don't know what the
> conversion is from or to.
Nah, it means there might be morphs only understanding the old "color:"
protocol. Fillstyles are the way to go.
> When I try the following, I get a very mottled looking background:
> |a b c|
> a _ Form extent: 4 at 4 depth: 32.
> c _ Color red.
> a colorAt: 3 at 1 put: c;
> colorAt: 4 at 1 put: c;
> colorAt: 2 at 2 put: c;
> colorAt: 3 at 2 put: c;
> colorAt: 1 at 3 put: c;
> colorAt: 2 at 3 put: c;
> colorAt: 1 at 4 put: c;
> colorAt: 4 at 4 put: c.
> b _ RectangleMorph new.
> b color: (InfiniteForm with: a).
> b openInHand.
>
> I've also tried vertical stripes (the preceding attempts diagonal stripes),
> but I get the same irregular results. Perhaps InfiniteForm's do not line
> up as I would expect?
Your code is all correct, but colorAt: is zero-based ... :)
-- Bert
More information about the Squeak-dev
mailing list
|