On Thu, Jun 19, 2008 at 10:29:36PM -0700, Martin DeMello wrote:
> Shoes.app :width => 800, :height => 630 do
> 
>   a = stack do
>     fill "#FFF"
>     stroke "#222"
>     rect(0,0,200,200)
>     stroke "#F00"
>     rect(10,10,180,180)
>   end
> 
>   keypress {|key|
>     append {
>       stroke "#222"
>       nofill
>       rect(10,10,180,180)
>     }
>   }
> 
> end
> #----------------------------------------------------------------------

You were very, very close.

  Shoes.app :width => 800, :height => 630 do
  
    a = stack do
      fill "#FFF"
      stroke "#222"
      rect(0,0,200,200)
      stroke "#F00"
      @r = rect(10,10,180,180)
    end
  
    keypress {|key|
      @r.remove
      append {
        stroke "#222"
        nofill
        @r = rect(10,10,180,180)
      }
    }
  
  end

The trick is to remove the old rectangle and replace it with a new
one.  It's not a problem with an alpha color.  It's just that when
you pile up rectangles, the stroke appears to get thicker, since it
is antialiased.

_why

Reply via email to