|
From: Arjan v. I. <af...@cs...> - 2003-11-11 11:06:31
|
Hi Wojtek,
> when the new rectangle is
> drawn, the old one turns black.
No, it doesn't. Your computer is too fast :-) A colored rectangle is drawn
with a black *border*. Then you draw a new rectangle that is only one pixel
to the left/right and one pixel up/down. All you see of the old rectangle is
its black border. To fix this you can change your setColor function to also
change the pen color (border color) and not only the brush color (fill
color):
setColor :: Color -> SGM ()
setColor c = runDC $ \dc -> do
dcSetBrushStyle dc (BrushStyle BrushSolid c)
dcSetPenStyle dc (penColored c 1)
Or you can move your rectangles over a larger distance and then you'll see
that their inside is indeed colored:
dirToVector dir =
let (x, y) = case dir of
NW -> (-3, -3)
NE -> (3, -3)
SW -> (-3, 3)
SE -> (3, 3)
in vector x y
Good luck, Arjan
|