I thought I would do some cross checking to validate we are looking at the same pixel and what we set is what we get.
'Peter's Pixel Test - SB GFX
IMPORT gfx.inc
s = gfx::Window(320, 240, "Peter's Pixel Test - SB GFX")
RANDOMIZE(gfx::Time())
gfx::ClearScreen s, 0xffffff
ts = gfx::Time()
FOR y = 0 TO 240
FOR x = 0 TO 320
r = RND() AND 255
g = RND() AND 255
b = RND() AND 255
IF x = 20 AND y = 20 THEN
PRINT "Set R: ",r,"\n"
PRINT "Set G: ",g,"\n"
PRINT "Set B: ",b,"\n"
END IF
gfx::pixelRGBA s, x, y, r, g, b, 255
NEXT
NEXT
c = gfx::GetPixel(s, 20, 20)
PRINT "Color: ",c,"\n"
r = c AND 0xff
PRINT "Get R: ",r,"\n"
g = gfx::Shift((c AND 0xFF00),-8)
PRINT "Get G: ",g,"\n"
b = gfx::Shift((c AND 0xFF0000), -16)
PRINT "Get B: ",b,"\n"
a = gfx::Shift(c, -24)
PRINT "Get A: ",a,"\n"
GOTO done
r = c AND x0FF
g = (c AND x0FF00)>>8
b = (c AND x0FF0000)>>16
a = c >>24
gfx::filledCircleRGBA s, 100, 100, 80, r, g, b, a
PRINT "Got Here\n"
GOTO done
c = gfx::GetPixel(s, 20, 20)
r = c AND x0FF
g = c AND x0FF00
b = c AND x0FF0000
a = c AND x0FF000000
gfx::boxRGBA s, 100, 20, 80, 60, r, g, b, a
gfx::Update
te = gfx::Time()
gfx::stringColor s, 20, 215,"Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
WHILE gfx::KeyName(1) <> "+escape"
WEND
done:
gfx::Close
jrs@laptop:~/sb/sb22/gfx$ scriba ppt.sb
Set R: 247
Set G: 134
Set B: 201
Color: 16221897
Get R: 201
Get G: 134
Get B: 247
Get A: 0
jrs@laptop:~/sb/sb22/gfx$