Display a loaded bitmap in only one colour

nishaj's Avatar, Join Date: Apr 2006
Newbie Member
Hi,
Could someone please help me out with displaying a bitmap in only one colour?
Thanks,
Nisha.
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
What do you mean by one color. Do you mean black and white or you mean only the RGB any one stream.
0
nishaj's Avatar, Join Date: Apr 2006
Newbie Member
What I meant was to display in any RGB colour;for instance ,say, red.

Thanks.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Just try out the following.

Use CDC::StretchBlt
Code: CPP
BOOL StretchBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop );
to get such a combination that you can mask the image bits to display the requested of RGB. and then use CDC::MaskBlt
Code: CPP
BOOL MaskBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, int xSrc, int ySrc, CBitmap& maskBitmap, int xMask, int yMask, DWORD dwRop );
to mask the bitmap and display it to user.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Also I forgot to add that
Code: CPP
BOOL TransparentBlt(
  HDC hdcDest,
  int nXOriginDest,
  int nYOriginDest,
  int nWidthDest,
  int hHeightDest,
  HDC hdcSrc,
  int nXOriginSrc,
  int nYOriginSrc,
  int nWidthSrc,
  int nHeightSrc,
  UINT crTransparent
);
can also help but its for transparent output.
0
nishaj's Avatar, Join Date: Apr 2006
Newbie Member
Thanks a lot; I will try it out and let you know.