2 Replies Latest reply on Jun 3, 2006 7:33 PM by psykopath

    BitmapData Threshold method

    psykopath Level 1
      I've looked through every piece of information I can find on the threshold method and I still can't get it to do what I want. I've got it almost working, but it removes more colors than it should.

      All I want to do is chage the color 0xFF00CCFF to transparent (ie. 0x00000000).

      My bitmap is created like this
      var myBitmapData:BitmapData = new BitmapData(clip1._width, clip1._height, true, 0x000000FF);

      Can someone please tell me the exact parameters to pass to the threshold method to remove all the pixels that match 0xFF00CCFF please.
        • 1. Re: BitmapData Threshold method
          Juankpro Level 2
          Use:

          myBitmapData.threshold(myBitmapData, myBitmapData.rectangle, myBitmapData.rectangle.topLeft, "==", 0xFF00CCFF, 0x00000000);
          • 2. Re: BitmapData Threshold method
            psykopath Level 1
            Use:

            myBitmapData.threshold(myBitmapData, myBitmapData.rectangle, myBitmapData.rectangle.topLeft, "==", 0xFF00CCFF, 0x00000000);


            Using that doesn't work. This is what I get when using that:
            Test1
            The purple circles should become transparent, shwoing the background through.

            This is what I had before. I can't remember exactly how I decided upon what numbers to use but it kind of works.
            myBitmapData.threshold(myBitmapData, myBitmapData.rectangle, new Point(0, 0), "!=", 0xFF00CCFF, 0x00000000, 0x00FF0000, false);
            This makes: Test2
            The circles go transparent, but so do most of the other colors.

            Can anyone make this work better?