A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: BitmapData.threshold/floodFill() problems

  1. #1
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913

    BitmapData.threshold/floodFill() problems

    Hey,

    I'm using the BitmapData.floodFill() method to fill in a region of a bitmapData object. That works fine. The problem is is that:
    a) I check the pixel where I started the floodFill method, and instead of giving me 0x11FFFF66 like I filled it, it gives me 0x11FFFF69.
    b) the threshold method doesn't work! I use it like this:
    canvas.threshold( canvas, rect, point, "!=", 0x11ffff69, dark);

    Dark is another uint, and right now the above line fills in the whole bitmapData with the dark colour! I even tried changing the threshold colour to canvas.getPixel32( x, y) of where I began the floodFill().

    Tracing out a comparison between 0x11FFFF69 and the getPixel32 of the floodFill starting point is telling me that they're both equal...WHY isn't the threshold method getting that?!

    This is really frustrating!!!

    P.
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Pixel values in a bitmapdata are stored in a normalized format. Any alpha other than full means that you may not get out exactly what you put in, so particularly for low alpha values, you may need to work around it. First thing to try is to use a mask and disregard the alpha value if that works for you. If that doesn't work, you may have to use copyChannel to extract the non-alpha channels to another bitmapdata where you can then manipulate them.

    I could also be wrong about the ultimate source of your troubles, but I ran into some really weird looking issues trying to encode files into bitmapdata, until I realized that I couldn't use the alpha channel and preserve data integrity.

  3. #3
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    Hm...that didn't seem to work.

    I set the mask to 0x00FFFFFF, but I think that for some reason the values are still being modified...
    I also switched to not using alpha at all, and it still didn't work!

    I'm still stumped...because I can getPixel() the correct colour, and when doing a == comparison, it comes back as true that it equals the colour I originally set it to!

    P.
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center