Page 1 of 1
Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Wed Oct 21, 2015 11:34 am
by stevie1401
Error message:
purebasic.o: In Funktion `PB_EndFunctions':
(.text+0x4c2e2): Nicht definierter Verweis auf `gdk_pixbuf_render_pixmap_and_mask'
collect2: error: ld returned 1 exit status
Code: Select all
Procedure SetWindowBackgroundImage(hWnd.i, hImage.i)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
betriebssystem="linux"
Protected *Background
Protected FixedBox.i
Protected *Style.GtkStyle
;####################################################
gdk_pixbuf_render_pixmap_and_mask_(hImage, @*Background, 0, 0) ;<<------- does not work with 5.40, with 5.31 it works well
;####################################################
*Style = gtk_style_new_()
*Style\bg_pixmap[0] = *Background
FixedBox = g_list_nth_data_(gtk_container_get_children_(gtk_bin_get_child_(hWnd)), 0)
gtk_widget_set_style_(FixedBox, *Style)
CompilerCase #PB_OS_Windows
betriebssystem="windows"
Protected hBrush = CreatePatternBrush_(hImage)
If hBrush
SetClassLongPtr_(hWnd, #GCL_HBRBACKGROUND, hBrush)
InvalidateRect_(hWnd, 0, #True)
UpdateWindow_(hWnd)
EndIf
CompilerCase #PB_OS_MacOS
betriebssystem="mac"
CocoaMessage(0, hWnd, "setBackgroundColor:",
CocoaMessage(0, 0, "NSColor colorWithPatternImage:", hImage))
CompilerEndSelect
EndProcedure
Re: Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Wed Oct 21, 2015 11:49 am
by RSBasic
Hello stevie1401,
I don't have Linux and I can't confirm this, but can you use code button, please? Thank you.

Re: Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Wed Oct 21, 2015 12:34 pm
by Shardik
Your posted example works just fine with PB 5.40 and subsystem gtk2. With the default subsystem gtk3 you have to import the function gdk_pixbuf_render_pixmap_and_mask():
Code: Select all
ImportC ""
gdk_pixbuf_render_pixmap_and_mask(*GdkPixbuf, *GdkPixmap, *GdkBitmap, AlphaThreshold.I)
EndImport
EnableExplicit
InitNetwork()
UseJPEGImageDecoder()
Procedure SetWindowBackgroundImage(hWnd.i, hImage.i)
Protected *Background
Protected FixedBox.i
Protected *Style.GtkStyle
gdk_pixbuf_render_pixmap_and_mask(hImage, @*Background, 0, 0)
*Style = gtk_style_new_()
*Style\bg_pixmap[0] = *Background
FixedBox = g_list_nth_data_(gtk_container_get_children_(gtk_bin_get_child_(hWnd)), 0)
gtk_widget_set_style_(FixedBox, *Style)
EndProcedure
If ReceiveHTTPFile("http://realsource.de/images/stargate_atlantis.jpg", GetTemporaryDirectory() + "stargate_atlantis.jpg")
LoadImage(0, GetTemporaryDirectory() + "stargate_atlantis.jpg")
OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 450, "")
SetWindowBackgroundImage(WindowID(0), ImageID(0))
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
By the way it would have been nice if you would have posted a link to your source code example which was posted by ts-soft with the Mac part added by me:
http://www.purebasic.fr/german/viewtopi ... 67&start=7
Re: Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Wed Oct 21, 2015 12:48 pm
by stevie1401
No.
Code: Select all
ImportC ""
gdk_pixbuf_render_pixmap_and_mask(*GdkPixbuf, *GdkPixmap, *GdkBitmap, AlphaThreshold.I)
EndImport
does not work
I work with Mint 17.2 XFCE4. x64
You example does not work with me too.
Re: Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Wed Oct 21, 2015 3:23 pm
by Shardik
Sorry, unfortunately you seem to be right although this is not an error in PureBasic. The problem seems to be that
Gkt3 utilizes
Gdk3 and
Gdk3 doesn't have the function
gdk_pixbuf_render_pixmap_and_mask() anymore:
Pixbuf functions of Gdk2:
- gdk_pixbuf_render_threshold_alpha ()
- gdk_pixbuf_render_to_drawable ()
- gdk_pixbuf_render_to_drawable_alpha ()
- gdk_pixbuf_render_pixmap_and_mask ()
- gdk_pixbuf_render_pixmap_and_mask_for_colormap ()
- gdk_pixbuf_get_from_drawable ()
- gdk_pixbuf_get_from_image ()
Pixbuf functions of Gdk3:
- gdk_pixbuf_get_from_window ()
- gdk_pixbuf_get_from_surface ()
Have you also tried to set the subsystem to gtk2? This should work fine even in PB 5.40 and without ImportC statement...
Re: Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Wed Oct 21, 2015 3:27 pm
by pwd
Shardik wrote:Have you also tried to set the subsystem to gtk2? This should work fine even in PB 5.40 and without ImportC statement...
It does work with gtk2 (Xubuntu).
Re: Linux PB 5.40 Linux Mint 17.2 x64 GDK-Error
Posted: Sat Oct 24, 2015 12:29 pm
by Shardik
The following example works equally well with Gtk2 and Gtk3 in displaying a background image in a window (tested on Ubuntu 14.04 x64 and KDE with PB 5.31 and PB 5.40 in ASCII and Unicode mode):
Code: Select all
EnableExplicit
InitNetwork()
UseJPEGImageDecoder()
Procedure.I GetContainer(WindowID.I, ContainerName.S)
Protected Child.I
Protected ChildrenList.I
Protected *Name
Protected Widget.I = WindowID(WindowID)
Child = gtk_bin_get_child_(Widget)
Repeat
ChildrenList = gtk_container_get_children_(Widget)
Child = g_list_nth_data_(ChildrenList, 0)
If Child = 0
Break
Else
*Name = gtk_widget_get_name_(Child)
Widget = Child
EndIf
Until PeekS(*Name, -1, #PB_UTF8) = ContainerName
ProcedureReturn Child
EndProcedure
Procedure SetWindowBackgroundImage(WindowID.I, ImageID.I)
Protected Container.I
Container = GetContainer(0, "GtkFixed")
If Container
gtk_fixed_put_(Container, gtk_image_new_from_pixbuf_(ImageID(ImageID)), 0, 0)
gtk_widget_show_all_(WindowID(WindowID))
EndIf
EndProcedure
If FileSize(GetTemporaryDirectory() + "stargate_atlantis.jpg") <= 0
ReceiveHTTPFile("http://realsource.de/images/stargate_atlantis.jpg",
GetTemporaryDirectory() + "stargate_atlantis.jpg")
EndIf
If LoadImage(0, GetTemporaryDirectory() + "stargate_atlantis.jpg")
OpenWindow(0, 100, 100, ImageWidth(0), ImageHeight(0),
"Window with background image")
SetWindowBackgroundImage(0, 0)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf