On Fri, 2002-10-11 at 16:36, Lyle Johnson wrote:
> Michael Neumann wrote:
> 
> > Shouldn't the following piece of code show the complete rectangle?
> > 
> >   dc.setClipRectangle(x, y, w, h)
> >   dc.drawRectangle(x, y, w, h)
> > 
> > The bottom and right borders are missing. Is this behaviour correct?
> > 
> > In the same way
> > 
> >   dc.foreground = FXRuby::Black
> >   dc.drawRectangle(x, y, w, h)
> >   dc.foreground = FXRuby::Green
> >   dc.fillRectangle(x+1, y+1, w-2, h-2)
> > 
> > should draw a filled green rectangle with a black border, but does not
> > unless I modify "w-2" to "w-1" (same for h)!
> > 
> > Are there any reasons for this behaviour?
> 
> Yes. The FXDC methods follow their X11 counterparts very closely, such 
> that for the call:
> 
> 	dc.drawRectangle(x, y, w, h)
> 
> the actual width and height is one pixel larger than the specified 
> dimensions. In contrast, the definitions of filled rectangles and 
> clipping regions are such that their actual dimensions are consistent 
> with the specified dimensions.
> 
> So for your first example:
> 
> 	dc.setClipRectangle(x, y, w, h)
> 	dc.drawRectangle(x, y, w, h)
> 
> the clipping rectangle's upper left corner is at (x, y) and its 
> dimensions are (w, h). But the rectangle that you subsequently draw will 
> actually have dimensions (w+1, h+1), and since its bottom and right 
> edges fall outside the clip region they aren't drawn.
> 
> You already know what to do for your second example ;)
> 
> Hope this helps,

Yes, now I understand. Thanks.


Regards,

  Michael