First, note what the API doc says about setClip(Shape clip): [b]Not all objects that implement the Shape interface can be used to set the clip. The only Shape objects that are guaranteed to be supported are Shape objects that are obtained via the getClip method and via Rectangle objects.[/b]
Keeping that in mind, your render method might look as follows: [code] public void render(final Graphics2D g2d) { g2d.setColor(Color.RED); final Rectangle r = new Rectangle(0, 0, 80, 80); Stroke stroke = g2d.getStroke(); Shape clip = stroke.createStrokedShape(r); clip = clip.getBounds(); // Not getBounds2D, because we need a // plain Rectangle g2d.setClip(clip); g2d.draw(r); } [/code] However, I guess that, even if there is no guarantee, you might want to set a clip as a circle, or any other shape that you can think of. Maybe you can transform the clip shape and make it slightly wider so that in the end it occupies complete pixels, instead of parts of pixels. Of course you should take into account the transform of the Graphics object. I think this is not that easy. As an alternative, you might set a stroke witdh of 2. Then the chances that half of the stroke will be within the clip will be somewhat greater. Piet [Message sent by forum member 'pietblok' (pietblok)] http://forums.java.net/jive/thread.jspa?messageID=327009 =========================================================================== To unsubscribe, send email to lists...@java.sun.com and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to lists...@java.sun.com and include in the body of the message "help".