Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set pixel bug ???
#1
Hi everyone

set pixel doesn't respond to set color 4th parameter ? set color r,g,b,a
Is this a bug[Image: bug.png] ?

With draw color it responds if you change a ,that is 125, to 255. It becomes more bright.

Do i have to use set colori with it ? don't know how to include a ...[Image: sad.png]

set colori (rnd(100) SHL 16) + (rnd(255) SHL 8) + rnd(100)  --> this is only for color rgb not for color rgba



Code:
'grass

constant:
  SCREENWIDTH 640
  SCREENHEIGHT 480

hidden:

set window 0, 0, SCREENWIDTH, SCREENHEIGHT, false, 2
set redraw off
set color 0,0,0
cls

'draw matrix to screen
for y = 0 to SCREENHEIGHT-1
  for x= 0 to SCREENWIDTH-1
    set color rnd(100),rnd(255),rnd(100),125
    rem set pixel x,y
    draw pixel x,y
  next
next
redraw

set color 255,255,255
wln "Press space key to exit ..."

redraw

wait keydown

end
Reply
#2
(06-15-2018, 11:29 PM)pedromartins Wrote: Hi everyone

set pixel doesn't respond to set color 4th parameter ? set color r,g,b,a
Is this a bug[Image: bug.png] ?

With draw color it responds if you change a ,that is 125, to 255. It becomes more bright.

Do i have to use set colori with it ? don't know how to include a ...[Image: sad.png]

set colori (rnd(100) SHL 16) + (rnd(255) SHL 8) + rnd(100)  --> this is only for color rgb not for color rgba

'set pixel' doesn't perform any blending operations (and that's why it's faster). It sets the color of the pixel in the destination image to the one set with 'set color' or 'set colori'. You can use it to generate images with transparent parts. 'draw pixel' on the other hand uses the alpha value for blending the color with the one already present on the destination image (black in your case). 
Naalaa uses signed 32 bit integers, so the sign bit would mess up the alpha value if an RGBA color was stored in an integer. But you can specify it as a second parameter to 'set colori':

set colori (rnd(100) SHL 16) + (rnd(255) SHL 8)  + rnd(100), 125 

Hope that helps Smile
Reply
#3
Hi Marcos

Thank you for your response. I am seeing the light in the end of the tunnel.[Image: smile.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)