Ricky
July 6th, 1999, 09:52 PM
I have a program which can in some cases paint two or more bitmaps over one another. When there is only one bitmap and is against a white background, it paints fine, however when it paints itself ontop of another bitmap then it loses its colors.
Here is my bitmap-drawing function:
void CExView::DrawBitmap(CBitmap *obj,CBitmap *msk,int x,int y,int cx,int cy)
{
CBitmap *old;
CClientDC dc(this);
CDC mem;
mem.CreateCompatibleDC(&dc);
old = mem.SelectObject(msk);
dc.BitBlt(x,y,cx,cy,&mem,0,0,SRCINVERT);
mem.SelectObject(obj);
dc.BitBlt(x,y,cx,cy,&mem,0,0,SRCAND);
mem.SelectObject(old);
ReleaseDC(&dc);
ReleaseDC(&mem);
}
The mask has the transparent bits as black and the truecolor bits as white. The actual picture's transparent bits are white.
What am I doing wrong?
Thanks in advance.
Here is my bitmap-drawing function:
void CExView::DrawBitmap(CBitmap *obj,CBitmap *msk,int x,int y,int cx,int cy)
{
CBitmap *old;
CClientDC dc(this);
CDC mem;
mem.CreateCompatibleDC(&dc);
old = mem.SelectObject(msk);
dc.BitBlt(x,y,cx,cy,&mem,0,0,SRCINVERT);
mem.SelectObject(obj);
dc.BitBlt(x,y,cx,cy,&mem,0,0,SRCAND);
mem.SelectObject(old);
ReleaseDC(&dc);
ReleaseDC(&mem);
}
The mask has the transparent bits as black and the truecolor bits as white. The actual picture's transparent bits are white.
What am I doing wrong?
Thanks in advance.