2.21 : Point() return 0

Just starting out? Need help? Post your questions and find answers here.
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

2.21 : Point() return 0

Post 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()
munfraid
Posts: 104
Joined: Sat Mar 24, 2018 1:33 pm

Re: 2.21 : Point() return 0

Post 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.
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

Re: 2.21 : Point() return 0

Post by Arbrakaan »

:oops:

Thanks ;)
Post Reply