I am working through the design of a disp[lay for a CAD/GIS program written in Java. (I haven't decided firmly if I will use SWT or Swing.)
This program will have to display a large number of Java 2D Shapes. I'm want to make the rendering process as quick and efficient as possible. I had a couple of questions about how I can do this. I will ask the second question in this thread:
My program will allow the user to select shapes on the display using various interactions with the mouse, and will subsequently allow them to move or modify those geometries. Is it possible to only render the portion of the canvas that needs to be repainted, instead of repainting the entire canvas everytime a single shape is modified? Would I do this by splitting my display into a grid of different images, or can I just pass the rectangular bounds of the new area that needs to be rendered?
Is this method of partial rendering possible? Any ideas or suggestions on how I can learn the techniques I need to implement it?
A Graphics object (the object that you render on) always has a clip area. If I remember correctly, there is a redraw method that takes a clip area as parameter
Typically, drawing outside the clip area is *very* fast, so you typicall don't have to care about it (unless you do a lot of computations during drawing).
Does that help?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus