drawing to a bitmap in memory
-
hi, for a uni project i need to write some c++ allowing a user to draw to a memory structure - like a bitmap i guess - so that the value of each individual pixel can accessed. initially this will be using the mouse and will be displayed on the screen but will later needs to work on a graphics tablet also displaying the output on the tablet. I have tried a couple of different approaches: FLTK - using mouse i can draw pictures but is not drawing to a data structure but instead to the screen so dont know how to access each pixel individually... have also tried using CBitmaps but cant work out how to draw to them... ive never programmed in c++ before so do not know what is possible. I am using .NET 2003 as an environment. please could someone suggest a way of doing this or somewhere to find information on it. Thanks in advance Andy
-
hi, for a uni project i need to write some c++ allowing a user to draw to a memory structure - like a bitmap i guess - so that the value of each individual pixel can accessed. initially this will be using the mouse and will be displayed on the screen but will later needs to work on a graphics tablet also displaying the output on the tablet. I have tried a couple of different approaches: FLTK - using mouse i can draw pictures but is not drawing to a data structure but instead to the screen so dont know how to access each pixel individually... have also tried using CBitmaps but cant work out how to draw to them... ive never programmed in c++ before so do not know what is possible. I am using .NET 2003 as an environment. please could someone suggest a way of doing this or somewhere to find information on it. Thanks in advance Andy
Do you need to access each pixel individually or just what the user draws? If it is just what is draws and you want it realtime then you can create a shadow bitmap and mirror the drawing logic both on the screen and this bitmap(or whatever device context you wish). If it is only after the user finishes and lets say selects print you could use something like the BitBlt function and copy the drawing area (most likely the client area of the window ) to whatever device context you wish. If you look on MSDN for GDI functions you will find all this information. I am not trying to be vague, I just am not exactly sure what you want to do; maybe if you would rephrase your question I could help more.