AS3:How to change a colored Bitmap's BitmapData to black and white?

前端 未结 7 954
一整个雨季
一整个雨季 2020-12-14 13:35

How can I change the bitmapdata of a coloured Bitmap to Black and White in AS3 ? I\'m developing a simple image editor tool for a CMS in f

7条回答
  •  孤城傲影
    2020-12-14 13:50

    Thanks Cookie, Copying the original bitmapdata was indeed the easiest solution to restore color.

       function clearColor() {
          colorbmd = new BitmapData(source.width, source.height);
          colorbmd = source.clone();
          //apply filter here    
        }
        function restoreColor() {
          source = colorbmd;
        }
    

    I think once you've converted the image to black and white you can't go back (You lose information during the conversion). You will have to make a copy before you apply the filter. – CookieOfFortune

提交回复
热议问题