Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
n7 version 24.04.14 released
#1
You can now use 'pixeli(x, y)' or 'pixeli(image_id, x, y)' to get the color of an image's pixel as a single number. You can also use 'set colori' to set the current drawing color using such a number.

If you need to convert RGB or RGBA values to a single number color, you can use functions like these:

Code:
function ToRGB(r, g, b)
    return 255*16777216 + r*65536 + g*256 + b
endfunc

function ToRGBA(r, g, b, a)
    return a*16777216 + r*65536 + g*256 + b
endfunc
 
And to get the RGBA components of a single number color:

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

2024-04-14
Added the 'pixeli' function and 'set colori' command to get and set colors as single numbers
Reply


Messages In This Thread
n7 version 24.04.14 released - by Marcus - 04-14-2024, 10:28 AM
RE: n7 version 24.04.14 released - by Marcus - 04-15-2024, 04:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)