#### Archived

This topic is now archived and is closed to further replies.

This topic is 5831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Okay, I''ve been working on this for some time now and can''t find an answer so I come to you for help.. Anyhow, here''s what I''m trying to do (very simple) I''m using windows GDI and I''m just trying to set up a triple buffer-like system to eliminate the flicker associated with blitting. Anyhow, what I did was that I created an HDC to the current window then created 2 more "Compatible" DC''s (these are the other two buffers) Anyways I''ll post the code. The problem I''m having is that when I TransparentBlt to one of the DC''s and then try to TransparentBlt from one of the DC''s to the HDC nothing happens? Can someone pont out what''s wrong with my code? thx!! Here''s snippets from my code...


case WM_PAINT:

hdc = BeginPaint (hwnd, &ps) ;
hdcMem = CreateCompatibleDC (hdc) ;
hdcMem2= CreateCompatibleDC (hdc) ;

SelectObject (hdcMem2, Main_Window_handle) ;
TransparentBlt(hdcMem,0,0,800, 600, hdcMem2, 0,
0, 800, 600, (RGB(255,0,255)));

switch (ProgramState) {

case MODE_OPENINGS:

SelectObject (hdcMem2, Openings_Window_handle) ;

TransparentBlt(hdcMem,144,7,800,600,
hdcMem2,0,0,647,584,
(RGB(255,0,255)));

break;

case MODE_FLASH_CARD:

break;

case MODE_APROP:

break;

case MODE_MIDDLE_GAME:

break;

case MODE_END_GAME:

break;

case MODE_EVALUATION:

break;

case MODE_SACRIFICES:

break;

case MODE_COMBINATIONS:

break;

case MODE_SCORING:

break;

case MODE_OPTIONS:

break;

} // end switch for mode screen drawing

// now paint the torch animation

SelectObject(hdcMem2,
Torch_animation_handle[torch_animation_step]) ;

TransparentBl(hdcMem,6,96,
Torch_animation_bitmap[torch_animation_step].bmWidth,
Torch_animation_bitmap[torch_animation_step].bmHeight,
hdcMem2,0,0,
Torch_animation_bitmap[torch_animation_step].bmWidth,
Torch_animation_bitmap[torch_animation_step].bmWidth,
(RGB(255,0,255)));

SelectObject (hdcMem2, Torch_handle) ;

TransparentBlt(hdcMem,12,146,22, 32, hdcMema, 0, 0,
22, 32, (RGB(255,0,255)));

torch_animation_step++;

if (torch_animation_step > 32)
torch_animation_step = 1;

TransparentBlt(hdc,0,0,800,600,hdcMem,0,0,800,600,
(RGB(255,0,255)));

// cleanup

DeleteDC (hdcMem2);
DeleteDC (hdcMem);
DeleteDC (hdc);
EndPaint (hwnd, &ps);

return 0 ;


~Bolt "All men dream: but not equally. Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible." This I did...

##### Share on other sites
A long time ago, I did an animation squeme using BitBlt and raster operations. It was on VB and I did the following:

copied the background (SrcCopy);
Painted the image (SrcPaint)

it was all done on a backbuffer... after I was done I would then draw it to screen...

"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."

##### Share on other sites
I guess to sum it up, the problem I seem to be having is that I can''t copy a bitmap from one memoryDC to another. I should but I don''t know why I can''t. I did in one program using 8-bit BitBlt function calls..no problem..now all I''m trying to do is the same thing except with 32-bit bitmaps and TransparentBlt function calls. It''ll let me blt from a bitmap to the main HDC, but not to a memdc and then to the HDC. What could be wrong?

Thx!!

~Bolt

"All men dream: but not equally. Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity: but the dreamers of the day are dangerous men, for they may act their dreams with open eyes, to make it possible." This I did...

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013294
×