Page 1 of 1

2.21 : Point() return 0

Posted: Thu Apr 04, 2019 7:05 pm
by Arbrakaan
Hi all,

I can't get the color from Point(), it return 0.

I'm doing something wrong ?

( SpiderBasic 2.21 (Windows - x86) )

This code work well on PB btw.

Code: Select all


      OpenWindow(0, 10, 10, 256, 256, "Canvas", #PB_Window_SizeGadget)

      CanvasGadget(0,0,0,256,256)
      StartDrawing(CanvasOutput(0))
       Box(0, 0, 256, 256, RGB(255,127,254))
        For i=0 To 256
          Debug   Red(Point(i, 4))
        Next i
       StopDrawing()
        
        
        
      OpenWindow(1, 300, 10, 256, 256, "Canvas", #PB_Window_SizeGadget)

      CanvasGadget(1,0,0,256,256)
      StartDrawing(CanvasOutput(1))
      Box(0, 0, 256, 256, RGB(255,255,0))
      StopDrawing()
      StartDrawing(CanvasOutput(1))
        For i=0 To 256
          Debug   Red(Point(i, 4))
        Next i
      StopDrawing()

Re: 2.21 : Point() return 0

Posted: Fri Apr 19, 2019 1:10 pm
by munfraid
Works as expected here, but since your image is 256*256 you might want to change both loops from

Code: Select all

For i=0 To 256
to

Code: Select all

For i=0 To 255
You did 257 iterations, so the last one gave 0 because it doesn't exist.
But it's true that PureBasic shows a different result, and that's unexpected.
Maybe Fred would like to take a look.

Re: 2.21 : Point() return 0

Posted: Fri Apr 19, 2019 3:17 pm
by Arbrakaan
:oops:

Thanks ;)