error with setPixels

前端 未结 5 1658
清歌不尽
清歌不尽 2020-12-17 08:48

i am trying to edit images. but i am getting errors with setPixels.

        picw = pic.getWidth();
        pich = pic.getHeight();
        picsize = picw*pic         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 09:20

    It's simple, just use the following command to change it to a mutable Bitmap:

    myBitmap = myBitmap.copy( Bitmap.Config.ARGB_8888 , true);
    

    Now the Bitmap myBitmap is replaced by the same Bitmap but this time is mutable

    You can also choose another way of storing Pixels (ARGB_8888 etc..): https://developer.android.com/reference/android/graphics/Bitmap.Config.html

提交回复
热议问题