Click here to Skip to main content
16,005,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: file properties Pin
16-Apr-02 3:23
suss16-Apr-02 3:23 
GeneralRe: file properties Pin
Christian Graus16-Apr-02 10:27
protectorChristian Graus16-Apr-02 10:27 
Questionhow to write an eraser for layers Pin
rainfallc16-Apr-02 0:36
rainfallc16-Apr-02 0:36 
AnswerRe: how to write an eraser for layers Pin
Christian Graus16-Apr-02 2:01
protectorChristian Graus16-Apr-02 2:01 
GeneralRe: how to write an eraser for layers Pin
rainfallc16-Apr-02 4:23
rainfallc16-Apr-02 4:23 
GeneralRe: how to write an eraser for layers Pin
Christian Graus16-Apr-02 10:47
protectorChristian Graus16-Apr-02 10:47 
GeneralRe: how to write an eraser for layers Pin
rainfallc16-Apr-02 15:39
rainfallc16-Apr-02 15:39 
GeneralRe: how to write an eraser for layers Pin
Christian Graus16-Apr-02 16:55
protectorChristian Graus16-Apr-02 16:55 
So to recap:

you have an array of layers. Each layer has an array of pointers to a base class. Your WM_PAINT steps through these arrays in order and draws everything again to a CBitmap, then to the screen.

rainfallc wrote:
i used another CArray to keep track of which layer is hiding.

Why not make a layer class that has a hidden property and holds all the things you are drawing, if you're doing it that way ? You're risking fragmentation between different aspects of what should be the same data.

rainfallc wrote:
please give me more hints

OK.

1/ If you don't need W95 support, use GDI+. It's the easiest way to do layering

2/ Don't use CBitmap, because when you come to save & load images, you'll only be able to deal with images the same bit depth as your screen. Use GDI+::Bitmap, which has the advantange of letting you load and save a ton of formats as well.

3/ Don't draw everything to the screen every time, unless you want to be able to reselect items you have previously drawn to edit/move/delete them. If you're trying to write a drawing package, you're stuck with this, but I'd still impliment suggestion 4, and redraw a layer using your array only when you want to select/delete something

4/ Make a vector of layer objects, a class that encapsulates the bitmap that represents the layer ( which has it's alpha channel set so that it can be drawn on top of lower layers correctly ), the objects in the layer if you want to select them, if the layer is to be drawn or not, etc.



Christian

The tragedy of cyberspace - that so much can travel so far, and yet mean so little.

"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
GeneralRe: how to write an eraser for layers Pin
rainfallc16-Apr-02 18:28
rainfallc16-Apr-02 18:28 
GeneralRe: how to write an eraser for layers Pin
Christian Graus16-Apr-02 19:03
protectorChristian Graus16-Apr-02 19:03 
GeneralRe: how to write an eraser for layers Pin
rainfallc16-Apr-02 19:52
rainfallc16-Apr-02 19:52 
GeneralRe: how to write an eraser for layers Pin
Christian Graus16-Apr-02 19:59
protectorChristian Graus16-Apr-02 19:59 
Generalgetting a dialog's dc Pin
John Oliver16-Apr-02 0:35
John Oliver16-Apr-02 0:35 
GeneralRe: getting a dialog's dc Pin
Paul M Watt16-Apr-02 5:33
mentorPaul M Watt16-Apr-02 5:33 
GeneralMultiple Selection with drag and Drop between TreeCtrls Pin
Luis Reina16-Apr-02 0:16
Luis Reina16-Apr-02 0:16 
QuestionToolbars in Dialogs? Pin
funbag15-Apr-02 23:33
funbag15-Apr-02 23:33 
AnswerRe: Toolbars in Dialogs? Pin
Christian Graus16-Apr-02 2:02
protectorChristian Graus16-Apr-02 2:02 
GeneralDistributed compiling with VStudio 6.0 Pin
Braulio Dez15-Apr-02 23:23
Braulio Dez15-Apr-02 23:23 
GeneralBlocking Sockets - and don´t get the last byte Pin
BtK15-Apr-02 23:12
BtK15-Apr-02 23:12 
GeneralRe: Blocking Sockets - and don´t get the last byte Pin
Le centriste16-Apr-02 3:17
Le centriste16-Apr-02 3:17 
QuestionWhy I Can't get WIM_DATA message in callback function 'waveInProc' ? Pin
Cloudway15-Apr-02 22:57
Cloudway15-Apr-02 22:57 
AnswerRe: Why I Can't get WIM_DATA message in callback function 'waveInProc' ? Pin
Cloudway15-Apr-02 23:09
Cloudway15-Apr-02 23:09 
QuestionHow to set the size of a scrollbox on the scrollbar? Pin
Feng Qin15-Apr-02 22:46
Feng Qin15-Apr-02 22:46 
GeneralSystem's ImageList Pin
Flatline15-Apr-02 21:45
Flatline15-Apr-02 21:45 
GeneralGetting the whole viewport size of SCrollView Pin
Flatline15-Apr-02 21:00
Flatline15-Apr-02 21:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.