Page 1 of 1
Display image in Linux
Posted: Mon May 31, 2004 3:49 pm
by Beach
Can someone share an example of how to display a graphic image when using the linux compiler? I have tried different things but have not been successful. Thanks!
-Beach
Posted: Fri Jun 04, 2004 10:31 pm
by Brujah
Display it as a sprite.
Thats an easy way.
Posted: Sat Jun 05, 2004 9:59 am
by Christian
ImageGadget should also work, if you work without a screen. Or use the DrawImage()-function.
If you use PB under Windows as well then handle the graphic thing under Linux like you do it under Windows.
regards,
Christian
Posted: Sun Jun 06, 2004 5:11 pm
by Beach
I still am unable to get a image to work on Linux PB projects, it must be something I am doing wrong... I am using Windows to write and test the code but it will not compile on Linux. Here is the code:
Code: Select all
Enumeration 1
#Window_Form1
#image
#exit
EndEnumeration
FileName$ = "logo.bmp"
LoadImage(#image, FileName$)
Procedure.l Window_Form1()
If OpenWindow(#Window_Form1,175,0,268,187,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Linux Text")
If CreateGadgetList(WindowID(#Window_Form1))
ButtonGadget(#exit,105,145,60,20,"Exit")
HideWindow(#Window_Form1,0)
ProcedureReturn WindowID()
EndIf
EndIf
EndProcedure
If Window_Form1()
StartDrawing(WindowOutput())
imgid = UseImage(#image)
DrawImage(imgid,10,50,48,48)
StopDrawing()
quitForm1=0
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
If EventWindowID()=#Window_Form1
quitForm1=1
EndIf
Case #PB_Event_Gadget
Select EventGadgetID()
Case #exit
End
EndSelect
EndSelect
Until quitForm1
CloseWindow(#Window_Form1)
EndIf
End
And the error when attemping to compile on Linux:
******************************************
PureBasic Linux x86 v3.81
******************************************
Loading external modules...
Starting compilation...
48 lines processed.
Creating the executable.
purebasic.o(.text+0x13f): In function `main':
: undefined reference to `PB_DrawImage2'
collect2: ld returned 1 exit status
- Feel the ..PuRe.. Power -
Is there an obvious syntax error? If it helps, "logo.bmp" has 256 colors and I am using RedHat 9
-Beach
Posted: Sun Jun 06, 2004 7:18 pm
by robink
That is a PB bug, DrawImage(ImageID, x, y , [NewWidth, NewHeight])
with NewWidth and NewHeight isn't working.
Posted: Sun Jun 06, 2004 7:25 pm
by Beach
Thanks for the reply. Does this mean you can not add image graphics if you are using the LInux version? If so, what is the correct way. I just want to add a image to my form.
-Beach
Posted: Sun Jun 06, 2004 8:01 pm
by Beach
I changed the line:
to
and now it compiles, however, when I execute the app is receive this error:
Gdk-ERROR **: BadMatch (invalid parameter attributes)
serial 51 error_code 8 request_code 146 minor_code 3
Any ideas?
-Beach
Posted: Sat Jul 17, 2004 7:29 am
by Beach
I am still trying to get an image to display on my window when compiling on Linux. I have changeded distro's (Mandrake 10) since this was first posted and loaded the new version of PB (3.91) but I still do not get an image. There are no errors when compling the code - but I receieve this error on the command line when I execute the app: "DrawImage GTK not implemented"
I have both GTK 1.2 dev and SDL 1.2 dev loaded, am I missing something else?
Code: Select all
UseJPEGImageDecoder()
FileName$ = "logo.jpg"
LoadImage(1, FileName$)
OpenWindow(0,175,0,200,187,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Linux PB Image")
StartDrawing(WindowOutput())
imgid = UseImage(1)
DrawImage(imgid,45,45,99,114)
StopDrawing()
Repeat
EventID=WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow
End
Posted: Sat Jul 17, 2004 10:59 am
by Fred
This function is not implemented, I'm on it.
Posted: Thu Jul 22, 2004 5:48 am
by Beach
I'm just curious, had DrawImage worked before 3.91? :roll:
<edit>
I re-loaded 3.81 and DrawImage did not work either. It does not matter now, I was able to finally get an image to display using a ImageGadget. This had not worked on previous attempts with a different distro. I assume now that I did not have all of the required items for Linux. Who knows (who cares?)..
Code: Select all
UseJPEGImageDecoder()
FileName$ = "logo.jpg"
LoadImage(1, FileName$)
OpenWindow(0,175,0,200,187,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Linux PB Image")
CreateGadgetList(WindowID())
ImageGadget(0,0,0,200,187,UseImage(1))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow