BitmapCreator has several optimization strategies. Therefore the following code produces results that are not what I need for my project.
Are there settings that will produce what I need. If not, are there any other ways of getting the exact ARGB pixel color from a B4XBitmap?
Are there settings that will produce what I need. If not, are there any other ways of getting the exact ARGB pixel color from a B4XBitmap?
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Dim rx As B4XRect
rx.Initialize(0, 0, Root.Width, Root.Height)
Dim cv As B4XCanvas
cv.Initialize(Root)
Dim testCol() As Int = Array As Int(0, 5, 10, 15, 20, 25, 26, 45, 254, 255)
For i = 0 To testCol.Length - 1
cv.ClearRect(rx)
cv.drawRect(rx, xui.Color_ARGB(testCol(i), 0, 0, 100), True, 0)
Dim bc As BitmapCreator
bc.Initialize(rx.Width, rx.height)
bc.CopyPixelsFromBitmap(cv.CreateBitmap)
Dim argb As ARGBColor
bc.GetARGB(200, 200, argb)
Log(argb.a & TAB & argb.r & TAB & argb.g & TAB & argb.b)
Next
'Log output
'0 0 0 0 'need: 0 0 0 100
'5 0 0 50 'need: 5 0 0 100
'10 0 0 76 'need: 10 0 0 100
'15 0 0 84 'need: 15 0 0 100
'20 0 0 89 'need: 20 0 0 100
'25 0 0 91 'need: 25 0 0 100
'26 0 0 98 'need: 26 0 0 100
'45 0 0 96 'need: 45 0 0 100
'254 0 0 99 'need: 254 0 0 100
'255 0 0 100 'correct
End Sub