Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 12:53
Kiran Satish11-Oct-07 12:53 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 13:06
Mark Salsbery11-Oct-07 13:06 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 13:31
Kiran Satish11-Oct-07 13:31 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery11-Oct-07 13:41
Mark Salsbery11-Oct-07 13:41 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish11-Oct-07 13:46
Kiran Satish11-Oct-07 13:46 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish17-Oct-07 11:09
Kiran Satish17-Oct-07 11:09 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery20-Oct-07 5:31
Mark Salsbery20-Oct-07 5:31 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 8:40
Mark Salsbery2-Oct-07 8:40 
So you have a 12x12 grid of cells and you're filling each cell with pixels right?

If so, I would...

Create a memory DC - this only needs to be done for the lifetime of the drawing,
not every time a redraw is done

Make one DIBSection, 24-bit RGB. the size of the 12 cells plus any
gaps/dividers/borders.  This only needs to be (re)created if the dimensions
change.

Select the DIBSection into the memory DC.

Now you can use GDI APIs to draw any borders/dividers/etc.  You may only have to
do this once as well if you're not overwriting them with data pixels.

Use the pointer to the DIBSection's pixel bits to directly write pixel values in your loops.
The "stride" (# of bytes per row) only needs to be calculated once, or whenever the
size of the DIBSection changes.

To calculate starting offset (rowpointer) in pixel data, use y*stride+x*3
Cast this pointer to an RGBTRIPLE*
For each row
   Loop inserting row's pixel data (use rowpointer[x] to index)
   Add stride to rowpointer
You'll find this MUCH faster than SetPixel()

After all the cells have been drawn offscreen, a single BitBlt (or StretchBlt)
call can copy the entire grid to the window.

Mark
 




Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 12:59
Mark Salsbery3-Oct-07 12:59 
AnswerRe: Need a best possible alternative?? Pin
Nelek27-Sep-07 21:19
protectorNelek27-Sep-07 21:19 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish1-Oct-07 10:46
Kiran Satish1-Oct-07 10:46 
GeneralRe: Need a best possible alternative?? Pin
Nelek2-Oct-07 10:19
protectorNelek2-Oct-07 10:19 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 6:04
Mark Salsbery9-Oct-07 6:04 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish18-Jun-08 17:55
Kiran Satish18-Jun-08 17:55 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery19-Jun-08 6:40
Mark Salsbery19-Jun-08 6:40 
QuestionCString to char* leads to an exception Pin
Mike Borozdin27-Sep-07 6:41
Mike Borozdin27-Sep-07 6:41 
QuestionRe: CString to char* leads to an exception Pin
David Crow27-Sep-07 7:20
David Crow27-Sep-07 7:20 
AnswerRe: CString to char* leads to an exception Pin
Mike Borozdin27-Sep-07 7:47
Mike Borozdin27-Sep-07 7:47 
QuestionRe: CString to char* leads to an exception Pin
David Crow27-Sep-07 7:51
David Crow27-Sep-07 7:51 
AnswerRe: CString to char* leads to an exception Pin
Mike Borozdin27-Sep-07 8:09
Mike Borozdin27-Sep-07 8:09 
QuestionRe: CString to char* leads to an exception Pin
David Crow27-Sep-07 8:14
David Crow27-Sep-07 8:14 
AnswerRe: CString to char* leads to an exception Pin
Mike Borozdin27-Sep-07 8:43
Mike Borozdin27-Sep-07 8:43 
QuestionRe: CString to char* leads to an exception Pin
David Crow27-Sep-07 8:46
David Crow27-Sep-07 8:46 
AnswerRe: CString to char* leads to an exception Pin
Mike Borozdin27-Sep-07 9:10
Mike Borozdin27-Sep-07 9:10 
GeneralRe: CString to char* leads to an exception Pin
David Crow27-Sep-07 9:16
David Crow27-Sep-07 9:16 

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.