GDI+ drawings on background image
-
Im trying to implement something like that: the user should be able to draw some graphical objects to a CWnd, that allready holds a Bitmap. I tried to realize this by using GDI+ ... storing the Objects as GraphicsPath in a List and draw them by using Graphics::DrawPath(...). Works fine so far. Problem: how to implement undo and clear functionallity? I tried to use Graphics::Clear(...) to 'empty the Window' and repaint all remaining Objects. But this will also reset the background-image ... but the background should _not_ be manipulated. So i thought about using some kind of layer, but really dont know how to start. Any hints / suggestions / keywords? Thanks in advance _NielsB
-
Im trying to implement something like that: the user should be able to draw some graphical objects to a CWnd, that allready holds a Bitmap. I tried to realize this by using GDI+ ... storing the Objects as GraphicsPath in a List and draw them by using Graphics::DrawPath(...). Works fine so far. Problem: how to implement undo and clear functionallity? I tried to use Graphics::Clear(...) to 'empty the Window' and repaint all remaining Objects. But this will also reset the background-image ... but the background should _not_ be manipulated. So i thought about using some kind of layer, but really dont know how to start. Any hints / suggestions / keywords? Thanks in advance _NielsB
_NielsB wrote: Problem: how to implement undo and clear functionallity? There's a few ways to do this. The easiest, and ugliest is to keep bitmaps in memory for each action. However, seeing as you're saying the background should not be manipulated, I think you should build an action list, and apply it in your paint handler. Then, undo just means taking the top item out of the list. Christian Graus - Microsoft MVP - C++
-
_NielsB wrote: Problem: how to implement undo and clear functionallity? There's a few ways to do this. The easiest, and ugliest is to keep bitmaps in memory for each action. However, seeing as you're saying the background should not be manipulated, I think you should build an action list, and apply it in your paint handler. Then, undo just means taking the top item out of the list. Christian Graus - Microsoft MVP - C++