Can anyone suggest a way to create a small solid colored bitmap image from a hex value?
Alternatively, you can use Bitmap.eraseColor() to set a solid color for your bitmap.
Example:
import android.graphics.Bitmap; ... Bitmap image = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); image.eraseColor(android.graphics.Color.GREEN);
I think I may have the answer. Technically I believe it is much easier on Android than on a "pc". The last time I searched to create a bitmap (.bmp), I only found some Android functions and the BitmapFactory
for non-android, which didn't work for me.
Please look at this site: http://developer.android.com/reference/android/graphics/Bitmap.html
This point could fit for you:
static Bitmap createBitmap(int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)
Returns a immutable bitmap with the specified width and height, with each pixel value set to the corresponding value in the colors array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With