Public Sub GreyScale (bmp As B4XBitmap) As B4XBitmap
Dim bc As BitmapCreator = CreateBC(bmp)
Dim argb As ARGBColor
For x = 0 To bc.mWidth - 1
For y = 0 To bc.mHeight - 1
bc.GetARGB(x, y, argb)
Dim c As Int = argb.r * 0.21 + argb.g * 0.72 + 0.07 * argb.b
If c < 127 Then c = 0 Else c = 255 '<--------------------------------
argb.r = c
argb.g = c
argb.b = c
bc.SetARGB(x, y, argb)
Next
Next
Return bc.Bitmap
End Sub
java.lang.IllegalArgumentException: src cannot be null
thanx klaus i will have a look at it.You can do it directly with the BitmapCreator library.
You may have a look at the BitmapCreatorDemo1 program from the B4X Graphics Booklets.
But this is for a view, i am working with bitmaps. Actually i could load the bitmaps on imageviews and then just change the alpha for that view. This may work. Thanks erelAnother option, if you want to display a semitransparent image: https://www.b4x.com/android/forum/threads/b4x-change-the-views-alpha-level-transparency.123209/
This will be the best performing solution, as long as you don't need to actually modify the bitmap.Actually i could load the bitmaps on imageviews and then just change the alpha for that view. This may work. Thanks erel