Android Question [SOLVED] Color Parameter is Float Between 0.0 and 1.0?

mmieher

Active Member
Licensed User
Longtime User
Don't want to bother @Johan Schoeman again. He has been so helpful with my project!

I don't understand how to get from something like this
B4X:
Colors.ARGB(112,181,214,255)

To a color spec like this
B4X:
GLS1.setCubeBackgroundColor(0.1f, 0.1f, 0.0f, 0.0f)   'set the background color of the cube - note that values should be between 0.0f and 0.1f <-- He means 1.0?

I have figured out that:
B4X:
GLS1.setFace_1_Color(1.0f, 1.0f, 1.0f, 1.0f)    '   Transparent
GLS1.setFace_1_Color(0.0f, 0.0f, 0.0f, 0.0f)    '   Black

Thanks.

Ref: https://www.b4x.com/android/forum/threads/3d-spinning-cube.92442/#post-869576
 

roumei

Active Member
Licensed User
You can get the float value by dividing your byte value through 255. Notice the different order (ARGB <> RGBA). Try this:
B4X:
' Colors.ARGB(112,181,214,255)                                     ' Order is ARGB
gls1.setCubeBackgroundColor(181/255, 214/255, 255/255, 112/255)    ' Order is RGBA
 
Upvote 0
Top