1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Display a loaded bitmap in only one colour

Discussion in 'C' started by nishaj, Apr 6, 2006.

  1. nishaj

    nishaj New Member

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

    coderzone Super Moderator

    What do you mean by one color. Do you mean black and white or you mean only the RGB any one stream.
     
  3. nishaj

    nishaj New Member

    What I meant was to display in any RGB colour;for instance ,say, red.

    Thanks.
     
  4. shabbir

    shabbir Administrator Staff Member

    Just try out the following.

    Use CDC::StretchBlt
    Code:
    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:
    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.
     
  5. shabbir

    shabbir Administrator Staff Member

    Also I forgot to add that
    Code:
    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.
     
  6. nishaj

    nishaj New Member

    Thanks a lot; I will try it out and let you know.
     

Share This Page