Android Question BitmapExtended

Firpas

Active Member
Licensed User
Longtime User
How to initialize as mutable a bitmap with config "RGB_565" createed with createbitmap2??

Sub Process_Globals
Dim btmpex As BitmapExtended
...

Sub Activity_Create(FirstTime AsBoolean)
If FirstTime Then btmpex.Initialize("")
...

Sub BtnConvert_Click
Dim Bmp1 AsBitmap = Img1.Bitmap
Dim Bmp2 AsBitmap = btmpex.createBitmap2(Bmp1.Width, Bmp1.Height, "RGB_565")

'This change the config from RGB_565 to ARGB_8888
Bmp2.InitializeMutable(Bmp1.Width, Bmp1.Height)

'Convert to Black and White
For y = 0 To Bmp2.Height-1
For x = 0 To Bmp2.Width-1
If btmpex.getPixel(Bmp1, x, y) >= 0xFFDCDCDC Then
btmpex.setPixel(Bmp2, x, y, Colors.White)
Else
btmpex.setPixel(Bmp2, x, y, Colors.black)
End If
Next
Next
 
Top