Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sprite Editor
#1
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.
Logic is the beginning of wisdom.
Reply
#2
(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 Smile
Reply
#3
Cool... I had already figured out that I needed to use "pixeli"... the one thing that I had forgotten was the "alpha" component...

Thank you SO much for the assist... I spent most of yesterday trying to figure it out... lol

Enjoy your Christmas!

J

ps: Added the "alpha" component and "colour selection" is finally working. Thank you SO much...
Logic is the beginning of wisdom.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)