Android Question Colori

AlpVir

Well-Known Member
Licensed User
Longtime User
Il seguente spezzone di codice B4A colora lo schermo di una tonalità di blu
B4X:
Dim coloreX As Long
coloreX=Colors.RGB(50,109,179)
Log(coloreX)
Activity.Color = coloreX
e stampa il numero del colore
-13472333

Quest'altro spezzone (scritto in VB6) fa la medesima cosa (stesso colore) ma stampa un altro numero (11758898)
B4X:
   Dim ColoreX As Long
   ColoreX = RGB(50, 109, 179)
   Debug.Print ColoreX
   BackColor = ColoreX

Intuisco che ci deve essere una relazione tra i 2 numeri ma non so quale. Qualcuno mi sa dare un suggerimento ?
Il tutto mi servirebbe per controllare la corretta trasposizione di codice da VB6 a B4A.
Grazie.
 

Sub7

Active Member
Licensed User
Longtime User
This is the english section of the forum not the Italian.
Try change colors.rgb into colors.ARGB(255,50,109,179) and check if this could be the reason.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
I apologize for my mistake.
However my problem is not born looking color but by the value of the number.

Colors.rgb (50,109,179) = - 13472333
Colors.argb (255,50,109,179) = - 13472333
Colors.argb (0,50,109,179) = 0
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Colors.argb (0,50,109,179) = 0
The color is fully transparent. In fact is then could not have a color. I believe this results in color = 0
 
Upvote 0

Straker

Active Member
Licensed User
Longtime User
The problem is about how B4a uses numbers (signed).
In B4a bytes ranges from-127 to 127, in VB6 from 0 to 255. So your '179' is used by b4a as a signed (negative) number.
Your VB6 11758898 means 0xB36D32 (B3=179, 6D=109, 32=50) unsigned.
The result in B4a is -13472333 which is a signed 0xFF326DB3.
 
Upvote 0
Top