Display a loaded bitmap in only one colour

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

  1. nishaj

    nishaj New Member

    Joined:
    Apr 6, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    Could someone please help me out with displaying a bitmap in only one colour?
    Thanks,
    Nisha.
     
  2. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    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

    Joined:
    Apr 6, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    What I meant was to display in any RGB colour;for instance ,say, red.

    Thanks.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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

    Joined:
    Apr 6, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Thanks a lot; I will try it out and let you know.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice