Announcement

Collapse
No announcement yet.

Hutch/SetBmpColor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hutch/SetBmpColor

    Hutch, on April 27, 1999 you posted a function SetBMPColor
    I have tried it on a 7 image 50x32 bitmap.
    In bitmap 0 and 1 backgroundcolor is correctly changed to BTNFACE-color
    In bitmap 2 to 6 backgroundcolor is not changed.
    Have you (or someone else) any idea why?

    Code:
    FUNCTION SetBmpColor(hBitmap&) as LONG
    
    ' Call function as follows to set bmp colour
    ' background to the system set %COLOR_BTNFACE
    
    '   hBitmap&=SetBmpColor(hBitmap&)
    '   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        LOCAL mDC as LONG
    
        mDC=CreateCompatibleDC(%NULL)
        hOldBmp&=SelectObject(mDC,hBitmap&)
    
        hBrush&=CreateSolidBrush(GetSysColor(%COLOR_BTNFACE))
          hOldBrush&=SelectObject(mDC,hBrush&)
            rv&=ExtFloodFill(mDC,1,1,GetPixel(mDC,1,1),%FLOODFILLSURFACE)
          SelectObject mDC,hOldBrush&
        DeleteObject hBrush&
    
        hReturn&=SelectObject(mDC,hBitmap&)
        DeleteDC mDC
    
        FUNCTION = hReturn&
    
    END FUNCTION
    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected]y.se[email protected]</A>
    http://www.oxenby.se

  • #2
    Sorry, Just read the book and learn what "filling all adjacent regions containing the color"
    means.
    In other words, found the problem


    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      Fred,

      The only trick with that one is to ensure that you have a path for
      the ExtFloodFill() function so that it fills the background color
      of the bitmap. I have been caught occasionally myself if the bitmap
      has an image that completely blocks the path for the flood fill.

      It will only fill across to where the large image blocks the path
      and will not fill past it.

      Regards,

      [email protected]

      ------------------
      hutch at movsd dot com
      The MASM Forum

      www.masm32.com

      Comment

      Working...
      X