12-25-2024, 09:48 AM
(12-24-2024, 08:55 AM)johnno56 Wrote: I have a listing (N5 or N6 ?) for a sprite editor that I am trying to convert to N7.
There is a command that is used in converting the colour detected by the mouse into an RGB format... That command is 'SHR' (SHift register Right).
Reason: Using pixeli(x, y), to detect the colour, produces a number like:
black = 4278190080
white = 4294967295
red = 4294901760
green = 4278255360
blue = 4278190335
To convert to RGB three functions were used: n_c is the colour detected
rem ---------------------------------------------------
rem Convert to RGB format
rem ---------------------------------------------------
function getB(n_c)
return n_c AND 255
endfunc
function getG(n_c)
return (n_c SHR 8) AND 255
endfunc
function getR(n_c)
return (n_c SHR 16) AND 255
endfunc
I need to know if there is a method to replace SHR.
I believe these functions should do it:
Code:
function Alpha(c)
return int(c/16777216)
endfunc
function Red(c)
return int((c/65536))%256
endfunc
function Green(c)
return int((c/256))%256
endfunc
function Blue(c)
return c%256
endfunc
The parameter sent to these functions should be a value returned by pixeli