BitBlting multiple images to buffer
Posted
by Anonymous
on Stack Overflow
See other posts from Stack Overflow
or by Anonymous
Published on 2010-05-05T11:34:33Z
Indexed on
2010/05/05
11:38 UTC
Read the original article
Hit count: 356
So I've made a class which draws a transparant image to a buffer. the buffer is a HDC which has been used blackness on. What I am trying to do is draw three images to this buffer. Which means I am using this function three times. After that's done, I output it to the screen (using SRCCOPYing the buffer). But what I get to see is just the third image and blackness.
void draw_buffer(HDC buffer, int draw_x, int draw_y) { BitBlt(this->main, draw_x, draw_y, this->img_width, this->img_height, this->image, this->mask_x, this->mask_y, SRCAND); BitBlt(this->main, draw_x, draw_y, this->img_width, this->img_height, this->image, this->img_x, this->img_y, SRCPAINT); BitBlt(buffer, 0, 0, 800, 600, this->main, 0, 0, SRCCOPY); }
At initiation, this->main becomes this:
this->main = CreateCompatibleDC(GetDC(0));
this->bitmap = CreateCompatibleBitmap(GetDC(0),800,600);
SelectObject(this->main, this->bitmap);
What is wrong with my code?
© Stack Overflow or respective owner