Bitmap, Pixmap, Image and Pixbuf madness



Consider these classes:

GdkPixmap	extends GdkDrawable
GdkBitmap	extends GdkDrawable
GdkPixbuf	extends GObject
GdkImage	extends GObject
GtkPixmap	extends GtkMisc
GtkImage	extends GtkMisc
GnomePixmap	?

And the wealth (or overflow) of instantiation methods:

GdkPixmap+GdkBitmap <= GdkPixbuf                gdk_pixbuf_render_pixmap_and_mask
GdkBitmap <= raw (?) data			gdk_bitmap_create_from_data
GdkPixmap <= raw (?) data			gdk_pixmap_create_from_data
GdkPixmap+GdkBitmap <= xpm file 		gdk_pixmap_create_from_xpm
GdkPixmap+GdkBitmap <= xpm data 		gdk_pixmap_create_from_xpm_d
GtkPixmap <= GdkPixmap+GdkBitmap		gtk_pixmap_new
GtkImage <= GdkPixmap+GdkBitmap 		gtk_image_new_from_pixmap
GtkImage <= GdkImage+GdkBitmap			gtk_image_new_from_image
GtkImage <= file (?)				gtk_image_new_from_file
GtkImage <= GdkPixbuf				gtk_image_new_from_pixbuf
GdkPixbuf <= file				gdk_pixbuf_new_from_file
GdkPixbuf <= specified data			gdk_pixbuf_new_from_data
GdkPixbuf <= xpm data				gdk_pixbuf_new_from_xpm_data
GdkPixbuf <= inline data (?)			gdk_pixbuf_new_from_inline
GnomePixmap <= file (?)				gnome_pixmap_new_from_file
GnomePixmap <= xpm data				gnome_pixmap_new_from_xpm_d
GnomePixmap <= specified data			gnome_pixmap_new_from_rgb_d
GnomePixmap <= GnomePixmap (!)			gnome_pixmap_new_from_gnome_pixmap
GnomePixmap <= GdkImlibImage			gnome_pixmap_new_from_imlib

Apart from the apparent mess, there are some problems with these
classes (please correct me if I'm wrong):

 1) It is not clear what a bitmap or a pixmap is.
    At least not if you consider the names.

    A bit is either 0 or 1. In many systems, an n-color
    image is stored using 2log(n) bitmaps. A pixmap
    is AFAIK an X concept only. An X pixmap is used
    both internally in X and external (XPM format).
    The same can be said about an X bitmap (and the
    XBM format). A GtkPixmap is a pixmap with a bitmap
    in a widget. This is all confusing to those not
    familiar with the X11 internals...

    If you add the concept 'Image' you'll make things
    even more complicated.

 2) Is there a reason to *represent* 2-color image data
    differently from n-color image data?

 3) Is there a reason to *represent* image data
    loaded in the X server's memory differently
    from image data not loaded that way?

    "Represent" is here in respect to programming
    interfaces (classes and functions).

My point is that some of the classes mentioned above *could* probably
be merged. And getting rid of GtkPixmap and GnomePixmap would be nice...

Oskar Liljeblad (osk hem passagen se)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]