Rubberband

  • Thread starter Thread starter Mas Fabien
  • Start date Start date
M

Mas Fabien

Hi,
I want to manage a rubberband
For that, I use the "controlPaint" class.
No problem to draw my rectangle, I use "DrawReversibleFrame()"
No problem to draw my selection, I use "DrawSelectionFrame()"
No problem to draw my hands, I use "DrawGrabHandle()"
But after, I don't know how to do to erase my selection and my hands.
And how can I manage my hands ?

Fabien :)
 
Mas Fabien said:
No problem to draw my rectangle, I use "DrawReversibleFrame()"
No problem to draw my selection, I use "DrawSelectionFrame()"
No problem to draw my hands, I use "DrawGrabHandle()"
But after, I don't know how to do to erase my selection and my hands.

There are a few main ways of doing this:

1. Redraw the underlying stuff: Redraw everything you drew underneath the
graphic objects on top of them, then draw your graphic objects in a new
position if you desire. This is a slow but common method of erasing things,
and works well if the background is simple.
2. Buffering: Variation on #1. Redraw everything, including the updated
selection, but do it in a memory-based device context the user does not see.
Then blit it quickly all at once into your window. This often gives a
smoother appearance.
3. Save the underlying stuff: Keep a memory-based device context in which
you draw your underlying image, then each time you wish to erase the
graphics on top, copy it or sections of it on top of them.
4. Use 3D acceleration: use Direct3D or OpenGL to create an isometric view
with overlapping polygons that fill the window. Make the top polygon have a
partly transparent texture with your selection graphics on it. This is a lot
more efficient than it sounds, and you can see similar samples in the
DirectX SDK.

I realise this seems complicated just to "erase" something, but effectively
you're trying to restore lost information. I hope this helps, and please
write back if you'd like any additional explanation.
 
Back
Top