[maemo-developers] What is the difference between GtkImage, GdkImage, GdkPixmap and GdkBitmap?

From: LIU Chun Hung hungsiu at ust.hk
Date: Fri Jan 25 11:36:43 EET 2008
Hi all,

I don't know the difference between these types(GtkImage, GdkImage,
GdkPixmap and GdkBitmap) although I have read the GTK and GDK API
Reference Manual.

Suppose I want to create a new RGB bitmap with 3 x 3 in size and I want to
set all pixel values to be 0. After clicking a button, all pixel values
will change to 255. Which one of the above types should I use? Should
GdkImage be used as I can see there are functions to change the pixel
values (gdk_image_put_pixel) in this type, but not in other types.

But when I use this type to create a bitmap, this function (gdk_image_new)
is used. There is a parameter with the type (GdkVisual*) which I don't
know how to set/initialize. When I use gdk_visual_get_system          
(void) to initialize the type of GdkVisual*, I can compile it. But when I
run it, there are some errors as below and the bitmap cannot be generated.

example_font_selector[8794]: GLIB CRITICAL ** GLib-GObject - gtype.c:2217:
initialization assertion failed, use IA__g_type_init() prior to this
function
example_font_selector[8794]: GLIB CRITICAL ** Gdk -
gdk_screen_get_system_visual: assertion `GDK_IS_SCREEN (screen)' failed
example_font_selector[8794]: GLIB CRITICAL ** GLib-GObject - gtype.c:2217:
initialization assertion failed, use IA__g_type_init() prior to this
function
example_font_selector[8794]: GLIB CRITICAL ** Gdk - gdk_visual_get_screen:
assertion `GDK_IS_VISUAL (visual)' failed
example_font_selector[8794]: GLIB CRITICAL ** Gdk -
_gdk_image_new_for_depth: assertion `visual || depth != -1' failed

Thank you for your kind attention.

Regards,
Hung



More information about the maemo-developers mailing list