Converting array of int to Bitmap on Android

后端 未结 3 1258
谎友^
谎友^ 2021-01-02 02:08

I have an MxN array of ints representing colors (say RGBA format, but that is easily changeable). I would like to convert them to an MxN Bitmap or something else (such as an

3条回答
  •  暖寄归人
    2021-01-02 02:38

    Yeah, sounds like you have all the info you need. If M is the width and N is the height, you can create a new bitmap with Bitmap.createBitmap, and you can fill in the ARGB values with the setPixels method which takes an int array.

    Bitmap.createBitmap

    Bitmap.setPixels

提交回复
热议问题