Hi.
I want to draw a bitmap from a memory dc on a normal dc. the bitmap has a symbol, which is black and the background is COLOR_3DLIGHT. now i want to draw the symbol in white (not black) with a background of COLOR_HIGHLIGHT. how do i do this? how do i convert "black on COLOR_3DLIGHT" to "white on COLOR_HIGHLIGHT"?
I want to draw a bitmap from a memory dc on a normal dc. the bitmap has a symbol, which is black and the background is COLOR_3DLIGHT. now i want to draw the symbol in white (not black) with a background of COLOR_HIGHLIGHT. how do i do this? how do i convert "black on COLOR_3DLIGHT" to "white on COLOR_HIGHLIGHT"?
From MASM32 APPack example :
You may want to change it a bit to make it work as you wish...
SetBmpColor proc hBitmap:DWORD
LOCAL mDC :DWORD
LOCAL hBrush :DWORD
LOCAL hOldBmp :DWORD
LOCAL hReturn :DWORD
LOCAL hOldBrush :DWORD
invoke CreateCompatibleDC,NULL
mov mDC,eax
invoke SelectObject,mDC,hBitmap
mov hOldBmp,eax
invoke GetSysColor,COLOR_BTNFACE
invoke CreateSolidBrush,eax
mov hBrush,eax
invoke SelectObject,mDC,hBrush
mov hOldBrush,eax
invoke GetPixel,mDC,1,1
invoke ExtFloodFill,mDC,1,1,eax,FLOODFILLSURFACE
invoke SelectObject,mDC,hOldBrush
invoke DeleteObject,hBrush
invoke SelectObject,mDC,hBitmap
mov hReturn,eax
invoke DeleteDC,mDC
mov eax,hReturn
ret
SetBmpColor endp
You may want to change it a bit to make it work as you wish...
heh thanks a lot. i'll try that out.
well, it still doesn't work.
i don't know how to change the color of the SYMBOL.
i tried to do it with ExtFloodFill. i created a brush with the new color and i specified the color to be replaced (color of the symbol)in the call to ExtFloodFill. but the symbol didn't change. maybe the symbol isn't 100% black. maybe it's a mixture of black and grey or whatever (not RGB(0, 0, 0)).
or does ExtFloodFill not replace the colors, if the pixel it begins searching does not have the color to be replaced (i started searching at 1, 1; but i know that 1, 1 is not part of the symbol, so it doesn't have this color).
Maybe there is another possibility:
All i wanna do is painting the OBM_CHECK Bitmap in white (the check symbol should be white) instead of black with the same background color.
maybe you can now tell me how to do this.
i don't know how to change the color of the SYMBOL.
i tried to do it with ExtFloodFill. i created a brush with the new color and i specified the color to be replaced (color of the symbol)in the call to ExtFloodFill. but the symbol didn't change. maybe the symbol isn't 100% black. maybe it's a mixture of black and grey or whatever (not RGB(0, 0, 0)).
or does ExtFloodFill not replace the colors, if the pixel it begins searching does not have the color to be replaced (i started searching at 1, 1; but i know that 1, 1 is not part of the symbol, so it doesn't have this color).
Maybe there is another possibility:
All i wanna do is painting the OBM_CHECK Bitmap in white (the check symbol should be white) instead of black with the same background color.
maybe you can now tell me how to do this.
darester , done this before---
You need to do it in 2 steps---can't remember exactly,but
try 1st, SRCINVERT , then MERGEPAINT ?
or play with combination of these: ???
' Ternary raster operations
%SRCCOPY = &H00CC0020 ' (DWORD) dest = source
%SRCPAINT = &H00EE0086 ' (DWORD) dest = source OR dest
%SRCAND = &H008800C6 ' (DWORD) dest = source AND dest
%SRCINVERT = &H00660046 ' (DWORD) dest = source XOR dest
%SRCERASE = &H00440328 ' (DWORD) dest = source AND (NOT dest )
%NOTSRCCOPY = &H00330008 ' (DWORD) dest = (NOT source)
%NOTSRCERASE = &H001100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
%MERGECOPY = &H00C000CA ' (DWORD) dest = (source AND pattern)
%MERGEPAINT = &H00BB0226 ' (DWORD) dest = (NOT source) OR dest
%PATCOPY = &H00F00021 ' (DWORD) dest = pattern
%PATPAINT = &H00FB0A09 ' (DWORD) dest = DPSnoo
%PATINVERT = &H005A0049 ' (DWORD) dest = pattern XOR dest
%DSTINVERT = &H00550009 ' (DWORD) dest = (NOT dest)
%BLACKNESS = &H00000042 ' (DWORD) dest = BLACK
%WHITENESS = &H00FF0062 ' (DWORD) dest = WHITE
You need to do it in 2 steps---can't remember exactly,but
try 1st, SRCINVERT , then MERGEPAINT ?
or play with combination of these: ???
' Ternary raster operations
%SRCCOPY = &H00CC0020 ' (DWORD) dest = source
%SRCPAINT = &H00EE0086 ' (DWORD) dest = source OR dest
%SRCAND = &H008800C6 ' (DWORD) dest = source AND dest
%SRCINVERT = &H00660046 ' (DWORD) dest = source XOR dest
%SRCERASE = &H00440328 ' (DWORD) dest = source AND (NOT dest )
%NOTSRCCOPY = &H00330008 ' (DWORD) dest = (NOT source)
%NOTSRCERASE = &H001100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
%MERGECOPY = &H00C000CA ' (DWORD) dest = (source AND pattern)
%MERGEPAINT = &H00BB0226 ' (DWORD) dest = (NOT source) OR dest
%PATCOPY = &H00F00021 ' (DWORD) dest = pattern
%PATPAINT = &H00FB0A09 ' (DWORD) dest = DPSnoo
%PATINVERT = &H005A0049 ' (DWORD) dest = pattern XOR dest
%DSTINVERT = &H00550009 ' (DWORD) dest = (NOT dest)
%BLACKNESS = &H00000042 ' (DWORD) dest = BLACK
%WHITENESS = &H00FF0062 ' (DWORD) dest = WHITE
heh thanks a lot. i've just tried around and found a solution:
SetBkColor(hdc, RGB(255, 255, 255));
BitBlt(hdc, x, y, cx, cy,
hdcMem, 0, 0, MERGEPAINT);
SetBkColor(hdc, RGB(255, 255, 255));
BitBlt(hdc, x, y, cx, cy,
hdcMem, 0, 0, MERGEPAINT);