Hi,
when I read one pixel of a sprite with this system:
LOADSPRITEMEM("1.png", w2%, h2%, pixels[])
FOREACH pix IN pixels[]
FOR x% = 0 TO value_palette
IF pix = memo[x][0]
pix = memo[x][1]
BREAK
ENDIF
NEXT
NEXT
the var pix return this value: -5462343
I have to convert in Hex (Exmple: #000301), it's possible?
This is one way of doing it:
http://www.glbasic.com/forum/index.php?topic=9975.msg87520#msg87520
exactly! I havenĀ“t implemented it yet though. :-[
Quote from: Moru on 2014-Oct-30
This is one way of doing it:
http://www.glbasic.com/forum/index.php?topic=9975.msg87520#msg87520
I have to use the command GETPIXEL/SETPIXEL or it's possible with this system?
LOADSPRITEMEM("1.png", w2%, h2%, pixels[])
FOREACH pix IN pixels[]
FOR x% = 0 TO value_palette
-------------------------
I tried some tests, but I could not get anybody can help me?
First i read from a txt file a sequence of color value:
#000301
#160000
#0e0300
#270000
after I compare with those in sprite on memory, and I have to replace them if they are equal, but when i read the pixel of the sprite in memory, he gives me these values:
9474192
-5462343
-4605498
-3158058
The commands I posted above helps you convert the
9474192
-5462343
-4605498
-3158058
to rgb components
Quote from: Moru on 2014-Oct-31
The commands I posted above helps you convert the
9474192
-5462343
-4605498
-3158058
to rgb components
ok and for this?
#000301
#160000
#0e0300
#270000
How should we know how you created/calculated that values? If you got them from someone else, ask him whats his formula.
I export this value:
#000301
#160000
#0e0300
#270000
with gimp (Export Palette .TXT)
Since this are 6 digits, I guess its simply a hex number so 0x0e0300 = RGB(0x0e,0x03,0x00) = 918272 = RGB(14,3,0). But thats just a guess, I would recommend that you simply try it yourself. Of cause this would work perfectly together with SPRITE2MEM: 9474192 = 0x909090 = RGB(0x90,0x90,0x90) = RGB(144,144,144).
Quote from: kanonet on 2014-Nov-01
Since this are 6 digits, I guess its simply a hex number so 0x0e0300 = RGB(0x0e,0x03,0x00) = 918272 = RGB(14,3,0). But thats just a guess, I would recommend that you simply try it yourself. Of cause this would work perfectly together with SPRITE2MEM: 9474192 = 0x909090 = RGB(0x90,0x90,0x90) = RGB(144,144,144).
OK Thanks :good: