Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Display a loaded bitmap in only one colour (http://www.go4expert.com/forums/display-loaded-bitmap-colour-t692/)

nishaj 6Apr2006 19:49

Display a loaded bitmap in only one colour
 
Hi,
Could someone please help me out with displaying a bitmap in only one colour?
Thanks,
Nisha.

coderzone 6Apr2006 22:50

Re: Display a loaded bitmap in only one colour
 
What do you mean by one color. Do you mean black and white or you mean only the RGB any one stream.

nishaj 7Apr2006 02:59

Re: Display a loaded bitmap in only one colour
 
What I meant was to display in any RGB colour;for instance ,say, red.

Thanks.

shabbir 7Apr2006 14:38

Re: Display a loaded bitmap in only one colour
 
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.

shabbir 7Apr2006 14:39

Re: Display a loaded bitmap in only one colour
 
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.

nishaj 7Apr2006 16:54

Re: Display a loaded bitmap in only one colour
 
Thanks a lot; I will try it out and let you know.


All times are GMT +5.5. The time now is 15:20.