Code: Select all
Debug $FF0000FF ; 4278190335
Debug RGBA(255, 0, 0, 255) ; -16776961Code: Select all
Debug $FF0000FF ; 4278190335
Debug RGBA(255, 0, 0, 255) ; -16776961
Code: Select all
Color1.l=$FF0000FF
Color2.i=$FF0000FF
Debug Color1 ; -16776961
Debug Color2 ; 4278190335
Debug RGBA(255, 0, 0, 255) ; -16776961No:mestnyi wrote: Wed Oct 29, 2025 11:21 am The problem I think is in the return type. [.i .l]
He also tormented me a lot.
Oops I'm late it turns out
Code: Select all
color.q = RGBA(255,0,0,255)
Debug color ; -16776961Code: Select all
Debug $F0000FF ; 4278190335 = 00000000FF0000FF => Because it IS AN INTEGER
Debug RGBA(255, 0, 0, 255) ; -16776961 = FFFFFFFFFF0000FF=> Because it IS A QUAD
Define rgb.q=RGBA(255, 0, 0, 255)
Debug rgb ; -16776961
;ShowMemoryViewer(@rgb, 8)
Debug LSet(Hex(rgb, #PB_Quad), 16, "-"); FFFFFFFFFF0000FF
rgb = rgb & $FFFFFFFF ; set high dw to 0
Debug rgb ; 4278190335 <<<=======
Debug LSet(Hex(rgb, #PB_Quad), 16, "-");FF0000FF--------
; ShowMemoryViewer(@rgb, 8)
Debug (RGBA(255, 0, 0, 255) & $FFFFFFFF) ; -16776961 => something wrong with debug ?
Code: Select all
Q= $FF0000FF ; 4278190335
col= RGBA(255, 0, 0, 255) ; -16776961
Debug Q
Debug col
Code: Select all
Define cl.l
Define cq.q
For r = 0 To 255
For g = 0 To 255
For b = 0 To 255
For a = 0 To 255
cl = RGBA(r,g,b,a)
cq = RGBA(r,g,b,a)
If cl <> cq
MessageRequester("Error", "Error")
End
EndIf
Next
Next
Next
Next
So as per the manual:Result varies from 0 to 4 294 967 295 shades. It is therefore advisable to use a 'quad', (Result.q) and set unused bytes to zero.
Code: Select all
Q = $FF0000FF ; 4278190335
color.q = RGBA(255,0,0,255) & $FFFFFFFF ; 4278190335
col = RGBA(255, 0, 0, 255) ; -16776961
Debug q
Debug color
Debug col
Code: Select all
col.l = RGBA(255,0,0,255)
Debug col
Debug StrU(col, #PB_Long)