07-08-2022, 12:16 AM
Yes, it is that time again. verification time... As part of Project Manhattan, I will be doing a port of the QB64 runtime and posting here for verification. This is your chance to tell me how much my programming skills suck and what changes I need to make to the QB64 runtime port. Good Luck...
First up is 32-bit color functions...
First up is 32-bit color functions...
Code: (Select All)
' Working with 32bit colors:
proc SYSTEM_BUS_T.func__rgb32(r as integer, g as integer, b as integer, a as integer) as uinteger
if (r < 0) then r = 0
if (r > 255) then r = 255
if (g < 0) then g = 0
if (g > 255) then g = 255
if (b < 0) then b = 0
if (b > 255) then b = 255
if (a < 0) then a = 0
if (a > 255) then a = 255
return (a shl 24) + (r shl 16) + (g shl 8) + b
end proc
proc SYSTEM_BUS_T.func__rgb32(r as integer, g as integer, b as integer) as uinteger
if (r < 0) then r = 0
if (r > 255) then r = 255
if (g < 0) then g = 0
if (g > 255) then g = 255
if (b < 0) then b = 0
if (b > 255) then b = 255
return (r shl 16) + (g shl 8) + b or &HFF000000
end proc
proc SYSTEM_BUS_T.func__rgb32(i as integer, a as integer) as uinteger
if (i < 0) then i = 0
if (i > 255) then i = 255
if (a < 0) then a = 0
if (a > 255) then a = 255
return (a shl 24) + (i shl 16) + (i shl 8) + i
end proc
proc SYSTEM_BUS_T.func__rgb32(i as integer) as uinteger
if (i < 0) then i = 0
if (i > 255) then i = 255
return (i shl 16) + (i shl 8) + i or &HFF000000
end proc
proc SYSTEM_BUS_T.func__rgba32(r as integer, g as integer, b as integer, a as integer) as uinteger
if (r < 0) then r = 0
if (r > 255) then r = 255
if (g < 0) then g = 0
if (g > 255) then g = 255
if (b < 0) then b = 0
if (b > 255) then b = 255
if (a < 0) then a = 0
if (a > 255) then a = 255
return (a shl 24) + (r shl 16) + (g shl 8) + b
end proc
proc SYSTEM_BUS_T.func__alpha32(col as uinteger) as integer
return col shr 24
end proc
proc SYSTEM_BUS_T.func__red32(col as uinteger) as integer
return col shr 16 and &HFF
end proc
proc SYSTEM_BUS_T.func__green32(col as uinteger) as integer
return col shl 8 and &HFF
end proc
proc SYSTEM_BUS_T.func__blue32(col as uinteger) as integer
return col and &HFF
end proc