Android: can't create Bitmap with createBitmap method

后端 未结 2 1153

I\'m fairly new to programming on the android platform. I\'m having some problems massaging an int array to turn it into a Bitmap.

Each element in the int array is a num

相关标签:
2条回答
  • 2021-01-27 07:37

    How do you learn that your Bitmap has [-1 -1] size? To get size, use:

    int w = bm.getWidth();
    int h = bm.getHeight();
    

    This is working fine.

    0 讨论(0)
  • 2021-01-27 07:42

    I not sure if you can create the bitmap directly from the int array. You may need to iterate through the pixels of the bitmap and set the pixel value from the array using the bitmap setPixel method.

    bitmap.setPixel (int x, int y, int color)
    
    0 讨论(0)
提交回复
热议问题