@ Nullable public static Bitmap mutable ( Bitmap source ) { if ( source . isMutable ( ) ) { return source ; } Config config = source . getConfig ( ) ; Bitmap bm = source . copy ( config != null ? config : ARGB_8888 , true ) ; if ( bm != null ) { source . recycle ( ) ; } return bm ; }
If the bitmap is immutable get a mutable copy of it . After a copy is created the source bitmap will be recycled . If the bitmap is already mutable it will be returned .