java - Is Graphics2D.draw performed if the Shape is offscreen? -


i'm working on rendering code, , wondered if graphics2d.draw(shape) performed exact same way onscreen offscreen. if is, there way check if shape (a line2d) onscreen?

depends on mean "exactly same way".

as far calls draw-something() code concerned, take place normally. different, somewhere in rendering chain condition shape not fall actual rendering area detected , no pixels output shape.

as detecting if "on screen", depends define screen as. reasonably define area described graphics object (that may part of screen, or off screen, heck printer!).

provided have not changed clip area of graphics instance, getclipbounds() gives rectangle graphics rendered. if graphics comes swing component, can substitute components dimensions rendering area.

once have actual rectangle, can make use of methods provided shape detect collisions (contains(), intersects() etc.).


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo