[Done] GrabSprite() does not work properly

Post bugreports for the Linux version here
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

[Done] GrabSprite() does not work properly

Post by heartbone »

The GrabSprite() command creates a bad sprite of zero depth, while it returns a very small positive non-zero value.

PB5.43 LTS x64 UBUNTU 16.04 LTS

Code: Select all

If InitSprite() = 0 Or InitKeyboard() = 0 : MessageRequester("PROGRAM","Could Not initialize.") : End : EndIf

; create a 800x600 window 
OpenWindow(0,0,0,800,600,"PROGRAM",#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0),0,0,800,600,#True,0,0)

; create a 300 x 200 display in top left corner
StartDrawing(ScreenOutput()) 
Circle(100,100,50,RGB(0,0,255))  ; a nice blue circle...
Box(150,20,20,20, RGB(0,255,0))  ; and a green box
FrontColor(RGB(255,0,0)) ; Finally, red lines..
For k=0 To 20 : LineXY(10,10+k*8,200, 0) : Next
DrawingMode(#PB_2DDrawing_Transparent)
BackColor(RGB(0,155,155)) ; Change the text back and front colour
FrontColor(RGB(255,255,255)) 
DrawText(10,50,"Hello, this is a test")
StopDrawing()

; convert top left corner display to 300x200 sprite
GrabSprite(1,0,0,300,200)
FlipBuffers()

; set a breakpoint here, and from the debugger's Library Viewer select sprite Library  
; sprite 1's depth=32 in Windows®, depth=0 in UBUNTU Linux 

BYEBYE= 0 : REFRESH= 1
; Draw the screen and wait for escape or exit.
Repeat
   RELEASE= ElapsedMilliseconds()+ 20
   Repeat
      X= WindowEvent() : If X = #PB_Event_CloseWindow : BYEBYE+ 1 : EndIf   
   Until X = 0 
   If REFRESH
      StartDrawing(ScreenOutput()) 
      Box(0,0,800,600,RGB(64,64,64))
      StopDrawing() 
      DisplayTransparentSprite(1,250,200)
      FlipBuffers()
      REFRESH= 0
   EndIf
   ExamineKeyboard()
   If KeyboardPushed(#PB_Key_Escape) : BYEBYE+ 1 : EndIf 
   If ElapsedMilliseconds() < RELEASE
      Repeat : Delay(2) : Until ElapsedMilliseconds() > RELEASE
   EndIf
Until BYEBYE   
Runs fine in Windows®.
Keep it BASIC.
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: GrabSprite() does not work properly

Post by Oma »

Confirmed on Xubuntu 14.04/x32 + PB5.42 / PB5.50B3.

Best regards, Charly.
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Done] GrabSprite() does not work properly

Post by Fred »

Already fixed.
Post Reply