]> Pileus Git - ~andy/gtk/commitdiff
Welcome aboard, gdk-pixbuf.
authorOwen Taylor <otaylor@redhat.com>
Wed, 21 Jun 2000 20:47:22 +0000 (20:47 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 21 Jun 2000 20:47:22 +0000 (20:47 +0000)
Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>

        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
gdk-pixbuf.

* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
fixups for GObject.

* gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of
gdk-pixbuf with GDK dependencies moved into GDK.

* gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
move gdk-pixbuf-loader here until GObject has signals.

* demos/: New directory of demos. Move demos from
gdk-pixbuf here.

* demos/pixbuf-init.c: Small bit of code to check for
loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
set GDK_PIXBUF_MODULEDIR appropriately.

* gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
define which no longer makes sense.

33 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
Makefile.am
acconfig.h
configure.in
demos/.cvsignore [new file with mode: 0644]
demos/Makefile.am [new file with mode: 0644]
demos/pixbuf-demo.c
demos/pixbuf-init.c [new file with mode: 0644]
demos/testanimation.c
demos/testpixbuf-drawable.c
demos/testpixbuf-scale.c
demos/testpixbuf.c
gdk-pixbuf/ChangeLog
gdk-pixbuf/Makefile.am
gdk-pixbuf/gdk-pixbuf-io.c
gdk-pixbuf/gdk-pixbuf-loader.c
gdk-pixbuf/gdk-pixbuf.h
gdk-pixbuf/io-xpm.c
gdk-pixbuf/pixops/pixops.c
gdk/Makefile.am
gdk/gdk.h
gdk/gdkcompat.h
gdk/gdkpixbuf-drawable.c
gdk/gdkpixbuf-render.c
gdk/gdkpixbuf.h [new file with mode: 0644]
gtk/Makefile.am
gtk/gdk-pixbuf-loader.c

index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 64fa7f684b4b58198829d8f6ef864c6cf329daf0..759b26d7426cc57f6afb67f323575075d46a358a 100644 (file)
@@ -1,3 +1,27 @@
+Wed Jun 21 16:38:13 2000  Owen Taylor  <otaylor@redhat.com>
+
+        * gdk-pixbuf/* docs/reference/gdk-pixbuf/*: Welcome aboard,
+       gdk-pixbuf.
+
+       * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
+       fixups for GObject.
+
+       * gdk/Makefile.am gdk/gdkpixbuf-render.[ch] gdk/gdkpixbuf.[ch]: Bits of 
+       gdk-pixbuf with GDK dependencies moved into GDK.
+       
+       * gtk/Makefile.am gtk/gdk-pixbuf-loader.[ch]: Temporarily
+       move gdk-pixbuf-loader here until GObject has signals.
+
+       * demos/: New directory of demos. Move demos from
+       gdk-pixbuf here.
+
+       * demos/pixbuf-init.c: Small bit of code to check for
+       loaders in ../gdk-pixbuf/.libs/gdk-pixbuf, and if found,
+       set GDK_PIXBUF_MODULEDIR appropriately.
+
+       * gdk/gdkcompat.h: Remove GDK_DRAWABLE_PIXMAP compat
+       define which no longer makes sense.
+
 2000-06-21  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtkwidget.c (gtk_widget_create_pango_context): Use
index 641ccd0869588c41859badbe5caff99ac9be5621..096a948af9a872e4fdccab9adf4fa2edefae58f8 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile.am for GTK+
 
-SRC_SUBDIRS = gdk modules gtk
+SRC_SUBDIRS = gdk-pixbuf gdk modules gtk demos
 SUBDIRS = po $(SRC_SUBDIRS) docs
 
 bin_SCRIPTS = gtk-config
index 3356fd9a970e2a06b7070750ece5ed71e60a97de..1ac89ef75e540f577ac31b3e7b71996f2c37ba51 100644 (file)
@@ -23,6 +23,7 @@
 #undef HAVE_GETTEXT
 #undef HAVE_IPC_H
 #undef HAVE_LC_MESSAGES
+#undef HAVE_PROGRESSIVE_JPEG
 #undef HAVE_PWD_H
 #undef HAVE_SHM_H
 #undef HAVE_STPCPY
 
 #undef RESOURCE_BASE
 
+#undef USE_GMODULE
+#undef USE_MMX
+
 /* Define to use X11R6 additions to XIM */
 #undef USE_X11R6_XIM
 
+
 #undef XINPUT_NONE
 #undef XINPUT_GXI
 #undef XINPUT_XFREE
index 7da8cc6c9da2554fa56f45fe805f2a0684968b26..a7db57dccc2516af6177a9f85d250ac01b7a3493 100644 (file)
@@ -646,9 +646,213 @@ AC_SUBST(GTK_DEBUG_FLAGS)
 AC_SUBST(GTK_XIM_FLAGS)
 AC_SUBST(GTK_LOCALE_FLAGS)
 
+##################################################
+# Checks for gdk-pixbuf
+##################################################
+
+AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
+
+AC_ARG_ENABLE(modules, [  --disable-modules       Disables dynamic module loading],[
+       if test x$withval = xyes; then 
+           with_modules=yes
+        else
+            with_modules=no
+       fi
+])
+
+dynworks=false
+deps=
+if test x$with_modules = xno; then
+    AC_MSG_RESULT(no)
+else
+    AC_MSG_RESULT(yes)
+    AC_MSG_CHECKING(whether dynamic modules work)
+    oLIBS="$LIBS"
+    oCFLAGS="$CFLAGS"
+    CFLAGS="$GLIB_CFLAGS"
+    LIBS="$GLIB_LIBS"
+    AC_TRY_RUN([
+    #include <glib.h>
+    #include <gmodule.h>
+    main ()
+    {
+       if (g_module_supported ())
+           exit (0);
+       else
+           exit (1);
+    }
+    ], dynworks=true)
+    LIBS="$oLIBS"
+    CFLAGS="$oCFLAGS"
+fi
+
+dnl Now we check to see if our libtool supports shared lib deps
+dnl (in a rather ugly way even)
+if $dynworks; then
+   pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} libtool --config"
+   pixbuf_deplibs_check=`$pixbuf_libtool_config | \
+      grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
+      sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
+   if test "x$pixbuf_deplibs_check" = "xnone" || \
+      test "x$pixbuf_deplibs_check" = "xunknown" || \
+      test "x$pixbuf_deplibs_check" = "x"; then
+      dynworks=false
+   fi
+fi
+
+if $dynworks; then
+   AC_DEFINE(USE_GMODULE)
+   GMODULE_LIBS="`glib-config --libs gmodule`"
+   GMODULE_FLAGS="`glib-config --cflags gmodule`"
+   AC_SUBST(GMODULE_LIBS)
+   AC_SUBST(GMODULE_FLAGS)
+   AC_MSG_RESULT(yes)
+else
+   AC_MSG_RESULT(no)
+fi
+
+dnl Test for libtiff
+  if test -z "$LIBTIFF"; then
+    AC_CHECK_LIB(tiff, TIFFReadScanline,
+      AC_CHECK_HEADER(tiffio.h,
+        TIFF='tiff'; LIBTIFF='-ltiff',
+        AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
+      AC_CHECK_LIB(tiff, TIFFWriteScanline,
+        AC_CHECK_HEADER(tiffio.h,
+          TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
+          AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
+        AC_CHECK_LIB(tiff34, TIFFFlushData,
+          AC_CHECK_HEADER(tiffio.h,
+            TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
+            AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
+        AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm), -ljpeg -lz -lm), -lm)
+  fi
+
+dnl Test for libjpeg
+  if test -z "$LIBJPEG"; then
+    AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
+      jpeg_ok=yes,
+      jpeg_ok=no
+      AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
+    if test "$jpeg_ok" = yes; then
+      AC_MSG_CHECKING([for jpeglib.h])
+      AC_TRY_CPP(
+[#include <stdio.h>
+#undef PACKAGE
+#undef VERSION
+#include <jpeglib.h>],
+        jpeg_ok=yes,
+        jpeg_ok=no)
+      AC_MSG_RESULT($jpeg_ok)
+      if test "$jpeg_ok" = yes; then
+        LIBJPEG='-ljpeg'
+        AC_CHECK_LIB(jpeg, jpeg_simple_progression,     
+          AC_DEFINE(HAVE_PROGRESSIVE_JPEG),
+          AC_MSG_WARN(JPEG library does not support progressive saving.))
+      else
+          AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
+      fi
+    fi
+  fi
+
+dnl Test for libpng
+  if test -z "$LIBPNG"; then
+    AC_CHECK_LIB(png, png_read_info,
+      AC_CHECK_HEADER(png.h,
+        png_ok=yes,
+        png_ok=no),
+      AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
+    if test "$png_ok" = yes; then
+      AC_MSG_CHECKING([for png_structp in png.h])
+      AC_TRY_COMPILE([#include <png.h>],
+        [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
+        png_ok=yes,
+        png_ok=no)
+      AC_MSG_RESULT($png_ok)
+      if test "$png_ok" = yes; then
+        PNG='png'; LIBPNG='-lpng -lz'
+      else
+        AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
+      fi
+    else
+     AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
+    fi
+  fi
+
+deps="$LIBTIFF $LIBJPEG $LIBPNG"
+
+AC_SUBST(LIBTIFF)
+AC_SUBST(LIBJPEG)
+AC_SUBST(LIBPNG)
+
+AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
+
+AC_HEADER_STDC
+AC_HEADER_DIRENT
+AC_HEADER_SYS_WAIT
+
+AC_TYPE_SIGNAL
+
+AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
+AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
+AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
+
+GDK_PIXBUF_LIBDIR='-L${libdir}'
+GDK_PIXBUF_INCLUDEDIR="-I${includedir} $GTK_CFLAGS"
+GDK_PIXBUF_LIBS="$GLIB_LIBS -lgdk_pixbuf $deps $GTK_LIBS"
+AC_SUBST(STATIC_LIB_DEPS)
+STATIC_LIB_DEPS="$deps"
+
+AC_SUBST(GDK_PIXBUF_LIBDIR)
+AC_SUBST(GDK_PIXBUF_INCLUDEDIR)
+AC_SUBST(GDK_PIXBUF_LIBS)
+
+# Checks to see if we should compile in MMX support (there will be
+# a runtime test when the code is actually run to see if it should
+# be used - this just checks if we can compile it.)
 #
-# gtk-doc checks
+# This code is partially taken from Mesa
 #
+AC_MSG_CHECKING(for x86 platform)
+case $host_cpu in
+  i386|i486|i586|i686|i786|k6|k7)
+       use_x86_asm=yes
+        ;;
+   *)
+       use_x86_asm=no
+esac
+AC_MSG_RESULT($use_x86_asm)
+
+use_mmx_asm=no
+if test $use_x86_asm = yes; then
+    save_ac_ext=$ac_ext
+    ac_ext=S
+    
+    AC_MSG_CHECKING(compiler support for MMX)
+    cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
+    if AC_TRY_EVAL(ac_compile); then
+        use_mmx_asm=yes
+    fi
+
+    ac_ext=$save_ac_ext
+    if test $use_mmx_asm = yes; then
+      AC_DEFINE(USE_MMX)
+      AC_MSG_RESULT(yes)
+    else
+      AC_MSG_RESULT(no)
+    fi
+fi
+
+AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
+
+
+##################################################
+# Checks for gtk-doc
+##################################################
+
+AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
+AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
+AC_SUBST(HAVE_GTK_DOC)
 
 dnl Let people disable the gtk-doc stuff.
 AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
@@ -657,7 +861,7 @@ if test x$enable_gtk_doc = xauto ; then
   if test x$GTKDOC = xtrue ; then
     enable_gtk_doc=yes
   else
-    enable_gtk_doc=no
+    enable_gtk_doc=no 
   fi
 fi
 
@@ -665,6 +869,14 @@ dnl NOTE: We need to use a separate automake conditional for this
 dnl       to make this work with the tarballs.
 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
 
+GDK_PIXBUF_DIR=`(cd $srcdir; pwd)`
+AC_SUBST(GDK_PIXBUF_DIR)
+
+
+##################################################
+# Output commands
+##################################################
+
 AC_OUTPUT_COMMANDS([
 
 ## Generate `gdk/gdkconfig.h' in two cases
@@ -761,11 +973,15 @@ docs/gtk-config.1
 Makefile
 gtk-config
 po/Makefile.in
+demos/Makefile
 docs/Makefile
 docs/reference/Makefile
 docs/reference/gdk-pixbuf/Makefile
-docs/tutorial/Makefile
 docs/faq/Makefile
+docs/tutorial/Makefile
+gdk-pixbuf/Makefile
+gdk-pixbuf/gdk-pixbuf-features.h
+gdk-pixbuf/pixops/Makefile
 gdk/Makefile
 gdk/x11/Makefile
 gdk/win32/Makefile
diff --git a/demos/.cvsignore b/demos/.cvsignore
new file mode 100644 (file)
index 0000000..000e5b3
--- /dev/null
@@ -0,0 +1,9 @@
+Makefile
+Makefile.in
+.libs
+.deps
+testanimation
+testpixbuf-drawable
+testpixbuf-scale
+testpixbuf
+pixbuf-demo
\ No newline at end of file
diff --git a/demos/Makefile.am b/demos/Makefile.am
new file mode 100644 (file)
index 0000000..a0fcc3d
--- /dev/null
@@ -0,0 +1,58 @@
+## Makefile.am for gtk+/demos
+
+INCLUDES = @STRIP_BEGIN@ \
+       -I$(top_srcdir)                                 \
+       -I$(top_builddir)/gdk-pixbuf                    \
+       -I$(top_builddir)/gdk                           \
+       -I$(top_builddir)/gtk                           \
+       -DGTK_DISABLE_COMPAT_H                          \
+       @GTK_DEBUG_FLAGS@                               \
+       @GTK_XIM_FLAGS@                                 \
+       @GTK_LOCALE_FLAGS@                              \
+       @PANGO_CFLAGS@                                  \
+       @GLIB_CFLAGS@                                   \
+       @more_cflags@                                   \
+@STRIP_END@
+
+DEPS = \
+       $(top_builddir)/gdk-pixbuf/libgdk_pixbuf.la     \
+       $(top_builddir)/gdk/@gdktargetlib@              \
+       $(top_builddir)/gtk/@gtktargetlib@
+
+LDADDS = @STRIP_BEGIN@                                         \
+       $(top_builddir)/gdk-pixbuf/libgdk_pixbuf.la     \
+       $(top_builddir)/gdk/@gdktargetlib@              \
+       $(top_builddir)/gtk/@gtktargetlib@              \
+       @more_ldflags@                                  \
+       @more_libs@                                     \
+       @GDK_WLIBS@                                     \
+       @PANGO_LIBS@                                    \
+       @GLIB_LIBS@                                     \
+       @GTK_LIBS_EXTRA@                                \
+       -lm                                             \
+@STRIP_END@
+
+noinst_PROGRAMS =              \
+       testpixbuf              \
+       testpixbuf-drawable     \
+       testanimation           \
+       testpixbuf-scale        \
+       pixbuf-demo
+
+testpixbuf_DEPENDENCIES = $(DEPS)
+testpixbuf_drawable_DEPENDENCIES = $(DEPS)
+testpixbuf_scale_DEPENDENCIES = $(DEPS)
+testanimation_DEPENDENCIES = $(DEPS)
+pixbuf_demo_DEPENDENCIES = $(DEPS)
+
+testpixbuf_LDADD = $(LDADDS) -lgmodule
+testpixbuf_drawable_LDADD = $(LDADDS)
+testpixbuf_scale_LDADD = $(LDADDS)
+testanimation_LDADD = $(LDADDS) -lgmodule
+pixbuf_demo_LDADD = $(LDADDS) -lgmodule
+
+testpixbuf_SOURCES = testpixbuf.c pixbuf-init.c
+testpixbuf_drawable_SOURCES = testpixbuf-drawable.c pixbuf-init.c
+testpixbuf_scale_SOURCES = testpixbuf-scale.c pixbuf-init.c
+testanimation_SOURCES = testanimation.c pixbuf-init.c
+pixbuf_demo_SOURCES = pixbuf-demo.c pixbuf-init.c
index 199ee32492bc487d4fe232d25915e286aee723bd..77e7c94058dc53d923ede370f96498d1402ce2f5 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <config.h>
 #include <stdlib.h>
-#include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "gtk.h"
+#include "gdk-pixbuf.h"
 #include <math.h>
 
 \f
@@ -190,11 +190,14 @@ destroy_cb (GtkObject *object, gpointer data)
        gtk_main_quit ();
 }
 
+extern void pixbuf_init();
+
 int
 main (int argc, char **argv)
 {
        GtkWidget *window;
 
+       pixbuf_init ();
        gtk_init (&argc, &argv);
        gdk_rgb_init ();
 
diff --git a/demos/pixbuf-init.c b/demos/pixbuf-init.c
new file mode 100644 (file)
index 0000000..3d4edee
--- /dev/null
@@ -0,0 +1,19 @@
+#include <glib.h>
+
+#include <sys/stat.h>
+#include <stdlib.h>
+
+static gboolean
+file_exists (const char *filename)
+{
+  struct stat statbuf;
+
+  return stat (filename, &statbuf) == 0;
+}
+
+void
+pixbuf_init ()
+{
+  if (file_exists ("../gdk-pixbuf/.libs/libpixbufloader-pnm.so"))
+    putenv ("GDK_PIXBUF_MODULEDIR=../gdk-pixbuf/.libs");
+}
index 66db2456568dee2a3dd74719bb7a9147132dec7f..d3aeb7f286c64d3305910d435b6539960212307a 100644 (file)
@@ -367,6 +367,8 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
 
 static int readlen = 4096;
 
+extern void pixbuf_init();
+
 int
 main (int argc, char **argv)
 {
@@ -375,6 +377,8 @@ main (int argc, char **argv)
 
        GdkPixbufAnimation *animation;
 
+       pixbuf_init ();
+
        gtk_init (&argc, &argv);
 
        gdk_rgb_set_verbose (TRUE);
index c250f2dfb3831705ff8c6cf192ac6b3439527320..e8cfeae0dc02943b3acddb0bc2c20757d403486b 100644 (file)
@@ -1,6 +1,6 @@
 #include <config.h>
 #include <gtk/gtk.h>
-#include <gdk/gdkx.h>
+#include "x11/gdkx.h"
 #include "gdk-pixbuf.h"
 
 int close_app(GtkWidget *widget, gpointer data)
@@ -67,6 +67,8 @@ int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
    return FALSE;
 }
 
+extern void pixbuf_init();
+
 int main(int argc, char **argv)
 {   
    GdkWindow     *root;
@@ -75,6 +77,8 @@ int main(int argc, char **argv)
    GtkWidget     *drawing_area;
    GdkPixbuf     *pixbuf;    
    
+   pixbuf_init ();
+
    gtk_init(&argc, &argv);   
    gdk_rgb_set_verbose(TRUE);
    gdk_rgb_init();
index a99977fbda35d4d98774be4a167716fb55ba60f5..863c076bab516744075dcac39a3c27c162a14e21 100644 (file)
@@ -52,6 +52,8 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
   return TRUE;
 }
 
+extern void pixbuf_init();
+
 int
 main(int argc, char **argv)
 {
@@ -62,6 +64,8 @@ main(int argc, char **argv)
        GtkAdjustment *adjustment;
        GtkRequisition scratch_requisition;
 
+       pixbuf_init ();
+
        gtk_init (&argc, &argv);
        gdk_rgb_init ();
 
index fe031877f62c9d46eba39cf9c910a2665b38b31d..cb1092c1aedd915b6d34e3bf7f8e2902a1cd4e77 100644 (file)
@@ -484,6 +484,8 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
 
 static int readlen = 4096;
 
+extern void pixbuf_init();
+
 int
 main (int argc, char **argv)
 {
@@ -493,6 +495,8 @@ main (int argc, char **argv)
        GdkPixbuf *pixbuf;
        GdkPixbufLoader *pixbuf_loader;
 
+       pixbuf_init ();
+       
        gtk_init (&argc, &argv);
 
        gdk_rgb_set_verbose (TRUE);
index 0b0ad0b6afc31189fb12f9c177f0917947ce1c7d..5dfaaa848f93b124f14b93c1d54bb8838fb3d430 100644 (file)
@@ -1,3 +1,9 @@
+Wed Jun 21 16:02:48 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk-pixbuf-io.c (gdk_pixbuf_load_module): Add feature to
+       support a GDK_PIXBUF_MODULEDIR env variable as a secondary
+       load location.
+
 2000-06-10  Federico Mena Quintero  <federico@helixcode.com>
 
        * demo/pixbuf-demo.c: It was cold and rainy this Saturday morning,
index 924f289f7009fc9fb283d07921f899a2e03b2c31..b66e2ef54d87ee883166c0df29e7ec84d254ec2c 100644 (file)
@@ -1,21 +1,7 @@
 SUBDIRS = pixops
 
-if BUILD_CANVAS_ITEM
-CANVAS_PIXBUF_LIB = libgnomecanvaspixbuf.la
-CANVAS_PIXBUF_HEADERFILES=gnome-canvas-pixbuf.h
-libgnomecanvaspixbuf_la_SOURCES = gnome-canvas-pixbuf.c
-EXTRA_GNOME_LIBS = $(GNOME_LIBS)
-else
-CANVAS_PIXBUF_LIB =
-CANVAS_PIXBUF_HEADERFILES =
-EXTRA_GNOME_LIBS =
-endif
-
 lib_LTLIBRARIES =              \
-       libgdk_pixbuf.la        \
-       $(CANVAS_PIXBUF_LIB)
-
-libgnomecanvaspixbuf_la_LDFLAGS = -version-info 1:0:0 $(EXTRA_GNOME_LIBS)
+       libgdk_pixbuf.la
 
 libexecdir = $(libdir)/gdk-pixbuf/loaders
 
@@ -138,34 +124,21 @@ extra_sources = $(libpixbufloader_png_la_SOURCES)         \
 builtin_libraries = 
 endif
 
-noinst_PROGRAMS = test-gdk-pixbuf testpixbuf testpixbuf-drawable testanimation testpixbuf-scale
+noinst_PROGRAMS = test-gdk-pixbuf
 TESTS = test-gdk-pixbuf
 
 DEPS = libgdk_pixbuf.la
 INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
        -I$(top_srcdir)/gdk-pixbuf \
        -I$(top_builddir)/gdk-pixbuf \
-       $(GLIB_CFLAGS) $(GTK_CFLAGS) $(GNOME_CFLAGS)
+       $(GLIB_CFLAGS)
 AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(libexecdir)\""
 
-LDADDS = libgdk_pixbuf.la $(GLIB_LIBS) $(GTK_LIBS) $(STATIC_LIB_DEPS)
+LDADDS = libgdk_pixbuf.la $(GLIB_LIBS) $(STATIC_LIB_DEPS)
 
-if INSIDE_GNOME_LIBS
 test_gdk_pixbuf_LDADD = $(LDADDS) -lgmodule
-testpixbuf_LDADD = $(LDADDS) -lgmodule
-testpixbuf_drawable_LDADD = $(LDADDS)
-testpixbuf_scale_LDADD = $(LDADDS)
-testanimation_LDADD = $(LDADDS) -lgmodule
-else
-test_gdk_pixbuf_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
-testpixbuf_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
-testpixbuf_drawable_LDADD = $(LDADDS) $(GNOME_LIBS)
-testpixbuf_scale_LDADD = $(LDADDS) $(GNOME_LIBS)
-testanimation_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
-endif
-
 
-GDK_PIXBUF_LIBS = $(GLIB_LIBS) $(GTK_LIBS)
+GDK_PIXBUF_LIBS = $(GLIB_LIBS)
 
 #
 # The GdkPixBuf library
@@ -177,22 +150,17 @@ libgdk_pixbuf_la_SOURCES =        \
        gdk-pixbuf.c            \
        gdk-pixbuf-animation.c  \
        gdk-pixbuf-data.c       \
-       gdk-pixbuf-drawable.c   \
        gdk-pixbuf-io.c         \
-       gdk-pixbuf-loader.c     \
-       gdk-pixbuf-render.c     \
        gdk-pixbuf-scale.c      \
        gdk-pixbuf-util.c       \
        $(extra_sources)
 
-libgdk_pixbuf_la_LDFLAGS = -version-info 2:0:0 $(GLIB_LIBS) $(GTK_LIBS)
+libgdk_pixbuf_la_LDFLAGS = -version-info 2:0:0 $(GLIB_LIBS)
 libgdk_pixbuf_la_LIBADD = pixops/libpixops.la
 
 libgdk_pixbufinclude_HEADERS = \
        gdk-pixbuf.h            \
-       gdk-pixbuf-loader.h     \
-       gdk-pixbuf-features.h   \
-       $(CANVAS_PIXBUF_HEADERFILES)
+       gdk-pixbuf-features.h
 
 noinst_HEADERS =               \
        gdk-pixbuf-io.h         \
index f5ba1ecd097da2e076da48ddb207a74044c0e67c..ca7f980ea25ff737d9720ec4f8f4faccabada2c5 100644 (file)
@@ -215,9 +215,13 @@ gdk_pixbuf_load_module (GdkPixbufModule *image_module)
 
        module = g_module_open (path, G_MODULE_BIND_LAZY);
        if (!module) {
-                /* Debug feature, check in present working directory */
+                /* Debug feature, check in GDK_PIXBUF_MODULEDIR, or working directory */
+               char *dir = g_getenv ("GDK_PIXBUF_MODULEDIR");
+               if (!dir)
+                       dir = "";
+         
                 g_free (path);
-                path = g_module_build_path ("", module_name);
+                path = g_module_build_path (dir, module_name);
                 module = g_module_open (path, G_MODULE_BIND_LAZY);
 
                 if (!module) {
index 63b9f1c598cecff72845f1bace351f3829fb7994..884ce4cc8996a34d3262fc8f70042751dda7a000 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#include <config.h>
-#include <gtk/gtksignal.h>
 #include "gdk-pixbuf-private.h"
 #include "gdk-pixbuf-loader.h"
 #include "gdk-pixbuf-io.h"
 
+#include "gtksignal.h"
+
 \f
 
 enum {
@@ -47,7 +47,7 @@ static GtkObjectClass *parent_class;
 static void gdk_pixbuf_loader_class_init    (GdkPixbufLoaderClass   *klass);
 static void gdk_pixbuf_loader_init          (GdkPixbufLoader        *loader);
 static void gdk_pixbuf_loader_destroy       (GtkObject              *loader);
-static void gdk_pixbuf_loader_finalize      (GtkObject              *loader);
+static void gdk_pixbuf_loader_finalize      (GObject                *loader);
 
 static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
 
@@ -125,16 +125,18 @@ gdk_pixbuf_loader_get_type (void)
 static void
 gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
 {
+       GObjectClass *gobject_class;
        GtkObjectClass *object_class;
 
        object_class = (GtkObjectClass *) class;
+       gobject_class = (GObjectClass *) class;
 
        parent_class = gtk_type_class (gtk_object_get_type ());
 
        pixbuf_loader_signals[AREA_PREPARED] =
                gtk_signal_new ("area_prepared",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared),
                                gtk_marshal_NONE__NONE,
                                GTK_TYPE_NONE, 0);
@@ -142,7 +144,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[AREA_UPDATED] =
                gtk_signal_new ("area_updated",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated),
                                gtk_marshal_NONE__INT_INT_INT_INT,
                                GTK_TYPE_NONE, 4,
@@ -154,7 +156,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[FRAME_DONE] =
                gtk_signal_new ("frame_done",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done),
                                gtk_marshal_NONE__POINTER,
                                GTK_TYPE_NONE, 1,
@@ -163,7 +165,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[ANIMATION_DONE] =
                gtk_signal_new ("animation_done",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done),
                                gtk_marshal_NONE__NONE,
                                GTK_TYPE_NONE, 0);
@@ -171,7 +173,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[CLOSED] =
                gtk_signal_new ("closed",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed),
                                gtk_marshal_NONE__NONE,
                                GTK_TYPE_NONE, 0);
@@ -179,7 +181,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL);
 
        object_class->destroy = gdk_pixbuf_loader_destroy;
-       object_class->finalize = gdk_pixbuf_loader_finalize;
+       gobject_class->finalize = gdk_pixbuf_loader_finalize;
 }
 
 static void
@@ -216,7 +218,7 @@ gdk_pixbuf_loader_destroy (GtkObject *object)
 }
 
 static void
-gdk_pixbuf_loader_finalize (GtkObject *object)
+gdk_pixbuf_loader_finalize (GObject *object)
 {
        GdkPixbufLoader *loader;
        GdkPixbufLoaderPrivate *priv = NULL;
@@ -226,8 +228,8 @@ gdk_pixbuf_loader_finalize (GtkObject *object)
 
        g_free (priv);
 
-       if (GTK_OBJECT_CLASS (parent_class)->finalize)
-               (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
+       if (G_OBJECT_CLASS (parent_class)->finalize)
+               (* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
 static void
index 70eebcf65781e7b8b43cc70977dbe0712d16057b..08087ccce6028adf053a13b570e2253523ca8116 100644 (file)
 #ifndef GDK_PIXBUF_H
 #define GDK_PIXBUF_H
 
-#include <gdk/gdk.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#include <glib.h>
 #include <gdk-pixbuf/gdk-pixbuf-features.h>
 
 \f
@@ -115,47 +114,6 @@ void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
 \f
 
 /* Rendering to a drawable */
-
-/* Alpha compositing mode */
-typedef enum {
-       GDK_PIXBUF_ALPHA_BILEVEL,
-       GDK_PIXBUF_ALPHA_FULL
-} GdkPixbufAlphaMode;
-
-void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
-                                       int src_x, int src_y,
-                                       int dest_x, int dest_y,
-                                       int width, int height,
-                                       int alpha_threshold);
-
-void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
-                                   GdkDrawable *drawable, GdkGC *gc,
-                                   int src_x, int src_y,
-                                   int dest_x, int dest_y,
-                                   int width, int height,
-                                   GdkRgbDither dither,
-                                   int x_dither, int y_dither);
-
-void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
-                                         int src_x, int src_y,
-                                         int dest_x, int dest_y,
-                                         int width, int height,
-                                         GdkPixbufAlphaMode alpha_mode,
-                                         int alpha_threshold,
-                                         GdkRgbDither dither,
-                                         int x_dither, int y_dither);
-
-void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
-                                       GdkPixmap **pixmap_return, GdkBitmap **mask_return,
-                                       int alpha_threshold);
-
-/* Fetching a region from a drawable */
-GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
-                                        GdkDrawable *src, GdkColormap *cmap,
-                                        int src_x, int src_y,
-                                        int dest_x, int dest_y,
-                                        int width, int height);
-
 \f
 
 /* Scaling */
index e6b80dab8e0ca4953ab358d74e988807eabb1959..d45ca5b390f5084c3409d631de337cad851f0a01 100644 (file)
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
-#include <gdk/gdk.h>
 #include "gdk-pixbuf-private.h"
 
 \f
@@ -47,9 +46,11 @@ enum buf_op {
 
 typedef struct {
        gchar *color_string;
-       GdkColor color;
+       guint16 red;
+       guint16 green;
+       guint16 blue;
        gint transparent;
-} _XPMColor;
+} XPMColor;
 
 struct file_handle {
        FILE *infile;
@@ -62,6 +63,914 @@ struct mem_handle {
        int offset;
 };
 
+/* The following 2 routines (parse_color, find_color) come from Tk, via the Win32
+ * port of GDK. The licensing terms on these (longer than the functions) is:
+ *
+ * This software is copyrighted by the Regents of the University of
+ * California, Sun Microsystems, Inc., and other parties.  The following
+ * terms apply to all files associated with the software unless explicitly
+ * disclaimed in individual files.
+ * 
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ * 
+ * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+ * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+ * DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+ * IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+ * NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+ * MODIFICATIONS.
+ * 
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights"
+ * in the software and related documentation as defined in the Federal 
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
+ * are acquiring the software on behalf of the Department of Defense, the
+ * software shall be classified as "Commercial Computer Software" and the
+ * Government shall have only "Restricted Rights" as defined in Clause
+ * 252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
+ * authors grant the U.S. Government and others acting in its behalf
+ * permission to use and distribute the software in accordance with the
+ * terms specified in this license.
+ */
+
+typedef struct {
+    const char *name;
+    unsigned char red;
+    unsigned char green;
+    unsigned char blue;
+} XPMColorEntry;
+
+static XPMColorEntry xColors[] = {
+    { "alice blue", 240, 248, 255 },
+    { "AliceBlue", 240, 248, 255 },
+    { "antique white", 250, 235, 215 },
+    { "AntiqueWhite", 250, 235, 215 },
+    { "AntiqueWhite1", 255, 239, 219 },
+    { "AntiqueWhite2", 238, 223, 204 },
+    { "AntiqueWhite3", 205, 192, 176 },
+    { "AntiqueWhite4", 139, 131, 120 },
+    { "aquamarine", 127, 255, 212 },
+    { "aquamarine1", 127, 255, 212 },
+    { "aquamarine2", 118, 238, 198 },
+    { "aquamarine3", 102, 205, 170 },
+    { "aquamarine4", 69, 139, 116 },
+    { "azure", 240, 255, 255 },
+    { "azure1", 240, 255, 255 },
+    { "azure2", 224, 238, 238 },
+    { "azure3", 193, 205, 205 },
+    { "azure4", 131, 139, 139 },
+    { "beige", 245, 245, 220 },
+    { "bisque", 255, 228, 196 },
+    { "bisque1", 255, 228, 196 },
+    { "bisque2", 238, 213, 183 },
+    { "bisque3", 205, 183, 158 },
+    { "bisque4", 139, 125, 107 },
+    { "black", 0, 0, 0 },
+    { "blanched almond", 255, 235, 205 },
+    { "BlanchedAlmond", 255, 235, 205 },
+    { "blue", 0, 0, 255 },
+    { "blue violet", 138, 43, 226 },
+    { "blue1", 0, 0, 255 },
+    { "blue2", 0, 0, 238 },
+    { "blue3", 0, 0, 205 },
+    { "blue4", 0, 0, 139 },
+    { "BlueViolet", 138, 43, 226 },
+    { "brown", 165, 42, 42 },
+    { "brown1", 255, 64, 64 },
+    { "brown2", 238, 59, 59 },
+    { "brown3", 205, 51, 51 },
+    { "brown4", 139, 35, 35 },
+    { "burlywood", 222, 184, 135 },
+    { "burlywood1", 255, 211, 155 },
+    { "burlywood2", 238, 197, 145 },
+    { "burlywood3", 205, 170, 125 },
+    { "burlywood4", 139, 115, 85 },
+    { "cadet blue", 95, 158, 160 },
+    { "CadetBlue", 95, 158, 160 },
+    { "CadetBlue1", 152, 245, 255 },
+    { "CadetBlue2", 142, 229, 238 },
+    { "CadetBlue3", 122, 197, 205 },
+    { "CadetBlue4", 83, 134, 139 },
+    { "chartreuse", 127, 255, 0 },
+    { "chartreuse1", 127, 255, 0 },
+    { "chartreuse2", 118, 238, 0 },
+    { "chartreuse3", 102, 205, 0 },
+    { "chartreuse4", 69, 139, 0 },
+    { "chocolate", 210, 105, 30 },
+    { "chocolate1", 255, 127, 36 },
+    { "chocolate2", 238, 118, 33 },
+    { "chocolate3", 205, 102, 29 },
+    { "chocolate4", 139, 69, 19 },
+    { "coral", 255, 127, 80 },
+    { "coral1", 255, 114, 86 },
+    { "coral2", 238, 106, 80 },
+    { "coral3", 205, 91, 69 },
+    { "coral4", 139, 62, 47 },
+    { "cornflower blue", 100, 149, 237 },
+    { "CornflowerBlue", 100, 149, 237 },
+    { "cornsilk", 255, 248, 220 },
+    { "cornsilk1", 255, 248, 220 },
+    { "cornsilk2", 238, 232, 205 },
+    { "cornsilk3", 205, 200, 177 },
+    { "cornsilk4", 139, 136, 120 },
+    { "cyan", 0, 255, 255 },
+    { "cyan1", 0, 255, 255 },
+    { "cyan2", 0, 238, 238 },
+    { "cyan3", 0, 205, 205 },
+    { "cyan4", 0, 139, 139 },
+    { "dark blue", 0, 0, 139 },
+    { "dark cyan", 0, 139, 139 },
+    { "dark goldenrod", 184, 134, 11 },
+    { "dark gray", 169, 169, 169 },
+    { "dark green", 0, 100, 0 },
+    { "dark grey", 169, 169, 169 },
+    { "dark khaki", 189, 183, 107 },
+    { "dark magenta", 139, 0, 139 },
+    { "dark olive green", 85, 107, 47 },
+    { "dark orange", 255, 140, 0 },
+    { "dark orchid", 153, 50, 204 },
+    { "dark red", 139, 0, 0 },
+    { "dark salmon", 233, 150, 122 },
+    { "dark sea green", 143, 188, 143 },
+    { "dark slate blue", 72, 61, 139 },
+    { "dark slate gray", 47, 79, 79 },
+    { "dark slate grey", 47, 79, 79 },
+    { "dark turquoise", 0, 206, 209 },
+    { "dark violet", 148, 0, 211 },
+    { "DarkBlue", 0, 0, 139 },
+    { "DarkCyan", 0, 139, 139 },
+    { "DarkGoldenrod", 184, 134, 11 },
+    { "DarkGoldenrod1", 255, 185, 15 },
+    { "DarkGoldenrod2", 238, 173, 14 },
+    { "DarkGoldenrod3", 205, 149, 12 },
+    { "DarkGoldenrod4", 139, 101, 8 },
+    { "DarkGray", 169, 169, 169 },
+    { "DarkGreen", 0, 100, 0 },
+    { "DarkGrey", 169, 169, 169 },
+    { "DarkKhaki", 189, 183, 107 },
+    { "DarkMagenta", 139, 0, 139 },
+    { "DarkOliveGreen", 85, 107, 47 },
+    { "DarkOliveGreen1", 202, 255, 112 },
+    { "DarkOliveGreen2", 188, 238, 104 },
+    { "DarkOliveGreen3", 162, 205, 90 },
+    { "DarkOliveGreen4", 110, 139, 61 },
+    { "DarkOrange", 255, 140, 0 },
+    { "DarkOrange1", 255, 127, 0 },
+    { "DarkOrange2", 238, 118, 0 },
+    { "DarkOrange3", 205, 102, 0 },
+    { "DarkOrange4", 139, 69, 0 },
+    { "DarkOrchid", 153, 50, 204 },
+    { "DarkOrchid1", 191, 62, 255 },
+    { "DarkOrchid2", 178, 58, 238 },
+    { "DarkOrchid3", 154, 50, 205 },
+    { "DarkOrchid4", 104, 34, 139 },
+    { "DarkRed", 139, 0, 0 },
+    { "DarkSalmon", 233, 150, 122 },
+    { "DarkSeaGreen", 143, 188, 143 },
+    { "DarkSeaGreen1", 193, 255, 193 },
+    { "DarkSeaGreen2", 180, 238, 180 },
+    { "DarkSeaGreen3", 155, 205, 155 },
+    { "DarkSeaGreen4", 105, 139, 105 },
+    { "DarkSlateBlue", 72, 61, 139 },
+    { "DarkSlateGray", 47, 79, 79 },
+    { "DarkSlateGray1", 151, 255, 255 },
+    { "DarkSlateGray2", 141, 238, 238 },
+    { "DarkSlateGray3", 121, 205, 205 },
+    { "DarkSlateGray4", 82, 139, 139 },
+    { "DarkSlateGrey", 47, 79, 79 },
+    { "DarkTurquoise", 0, 206, 209 },
+    { "DarkViolet", 148, 0, 211 },
+    { "deep pink", 255, 20, 147 },
+    { "deep sky blue", 0, 191, 255 },
+    { "DeepPink", 255, 20, 147 },
+    { "DeepPink1", 255, 20, 147 },
+    { "DeepPink2", 238, 18, 137 },
+    { "DeepPink3", 205, 16, 118 },
+    { "DeepPink4", 139, 10, 80 },
+    { "DeepSkyBlue", 0, 191, 255 },
+    { "DeepSkyBlue1", 0, 191, 255 },
+    { "DeepSkyBlue2", 0, 178, 238 },
+    { "DeepSkyBlue3", 0, 154, 205 },
+    { "DeepSkyBlue4", 0, 104, 139 },
+    { "dim gray", 105, 105, 105 },
+    { "dim grey", 105, 105, 105 },
+    { "DimGray", 105, 105, 105 },
+    { "DimGrey", 105, 105, 105 },
+    { "dodger blue", 30, 144, 255 },
+    { "DodgerBlue", 30, 144, 255 },
+    { "DodgerBlue1", 30, 144, 255 },
+    { "DodgerBlue2", 28, 134, 238 },
+    { "DodgerBlue3", 24, 116, 205 },
+    { "DodgerBlue4", 16, 78, 139 },
+    { "firebrick", 178, 34, 34 },
+    { "firebrick1", 255, 48, 48 },
+    { "firebrick2", 238, 44, 44 },
+    { "firebrick3", 205, 38, 38 },
+    { "firebrick4", 139, 26, 26 },
+    { "floral white", 255, 250, 240 },
+    { "FloralWhite", 255, 250, 240 },
+    { "forest green", 34, 139, 34 },
+    { "ForestGreen", 34, 139, 34 },
+    { "gainsboro", 220, 220, 220 },
+    { "ghost white", 248, 248, 255 },
+    { "GhostWhite", 248, 248, 255 },
+    { "gold", 255, 215, 0 },
+    { "gold1", 255, 215, 0 },
+    { "gold2", 238, 201, 0 },
+    { "gold3", 205, 173, 0 },
+    { "gold4", 139, 117, 0 },
+    { "goldenrod", 218, 165, 32 },
+    { "goldenrod1", 255, 193, 37 },
+    { "goldenrod2", 238, 180, 34 },
+    { "goldenrod3", 205, 155, 29 },
+    { "goldenrod4", 139, 105, 20 },
+    { "gray", 190, 190, 190 },
+    { "gray0", 0, 0, 0 },
+    { "gray1", 3, 3, 3 },
+    { "gray10", 26, 26, 26 },
+    { "gray100", 255, 255, 255 },
+    { "gray11", 28, 28, 28 },
+    { "gray12", 31, 31, 31 },
+    { "gray13", 33, 33, 33 },
+    { "gray14", 36, 36, 36 },
+    { "gray15", 38, 38, 38 },
+    { "gray16", 41, 41, 41 },
+    { "gray17", 43, 43, 43 },
+    { "gray18", 46, 46, 46 },
+    { "gray19", 48, 48, 48 },
+    { "gray2", 5, 5, 5 },
+    { "gray20", 51, 51, 51 },
+    { "gray21", 54, 54, 54 },
+    { "gray22", 56, 56, 56 },
+    { "gray23", 59, 59, 59 },
+    { "gray24", 61, 61, 61 },
+    { "gray25", 64, 64, 64 },
+    { "gray26", 66, 66, 66 },
+    { "gray27", 69, 69, 69 },
+    { "gray28", 71, 71, 71 },
+    { "gray29", 74, 74, 74 },
+    { "gray3", 8, 8, 8 },
+    { "gray30", 77, 77, 77 },
+    { "gray31", 79, 79, 79 },
+    { "gray32", 82, 82, 82 },
+    { "gray33", 84, 84, 84 },
+    { "gray34", 87, 87, 87 },
+    { "gray35", 89, 89, 89 },
+    { "gray36", 92, 92, 92 },
+    { "gray37", 94, 94, 94 },
+    { "gray38", 97, 97, 97 },
+    { "gray39", 99, 99, 99 },
+    { "gray4", 10, 10, 10 },
+    { "gray40", 102, 102, 102 },
+    { "gray41", 105, 105, 105 },
+    { "gray42", 107, 107, 107 },
+    { "gray43", 110, 110, 110 },
+    { "gray44", 112, 112, 112 },
+    { "gray45", 115, 115, 115 },
+    { "gray46", 117, 117, 117 },
+    { "gray47", 120, 120, 120 },
+    { "gray48", 122, 122, 122 },
+    { "gray49", 125, 125, 125 },
+    { "gray5", 13, 13, 13 },
+    { "gray50", 127, 127, 127 },
+    { "gray51", 130, 130, 130 },
+    { "gray52", 133, 133, 133 },
+    { "gray53", 135, 135, 135 },
+    { "gray54", 138, 138, 138 },
+    { "gray55", 140, 140, 140 },
+    { "gray56", 143, 143, 143 },
+    { "gray57", 145, 145, 145 },
+    { "gray58", 148, 148, 148 },
+    { "gray59", 150, 150, 150 },
+    { "gray6", 15, 15, 15 },
+    { "gray60", 153, 153, 153 },
+    { "gray61", 156, 156, 156 },
+    { "gray62", 158, 158, 158 },
+    { "gray63", 161, 161, 161 },
+    { "gray64", 163, 163, 163 },
+    { "gray65", 166, 166, 166 },
+    { "gray66", 168, 168, 168 },
+    { "gray67", 171, 171, 171 },
+    { "gray68", 173, 173, 173 },
+    { "gray69", 176, 176, 176 },
+    { "gray7", 18, 18, 18 },
+    { "gray70", 179, 179, 179 },
+    { "gray71", 181, 181, 181 },
+    { "gray72", 184, 184, 184 },
+    { "gray73", 186, 186, 186 },
+    { "gray74", 189, 189, 189 },
+    { "gray75", 191, 191, 191 },
+    { "gray76", 194, 194, 194 },
+    { "gray77", 196, 196, 196 },
+    { "gray78", 199, 199, 199 },
+    { "gray79", 201, 201, 201 },
+    { "gray8", 20, 20, 20 },
+    { "gray80", 204, 204, 204 },
+    { "gray81", 207, 207, 207 },
+    { "gray82", 209, 209, 209 },
+    { "gray83", 212, 212, 212 },
+    { "gray84", 214, 214, 214 },
+    { "gray85", 217, 217, 217 },
+    { "gray86", 219, 219, 219 },
+    { "gray87", 222, 222, 222 },
+    { "gray88", 224, 224, 224 },
+    { "gray89", 227, 227, 227 },
+    { "gray9", 23, 23, 23 },
+    { "gray90", 229, 229, 229 },
+    { "gray91", 232, 232, 232 },
+    { "gray92", 235, 235, 235 },
+    { "gray93", 237, 237, 237 },
+    { "gray94", 240, 240, 240 },
+    { "gray95", 242, 242, 242 },
+    { "gray96", 245, 245, 245 },
+    { "gray97", 247, 247, 247 },
+    { "gray98", 250, 250, 250 },
+    { "gray99", 252, 252, 252 },
+    { "green", 0, 255, 0 },
+    { "green yellow", 173, 255, 47 },
+    { "green1", 0, 255, 0 },
+    { "green2", 0, 238, 0 },
+    { "green3", 0, 205, 0 },
+    { "green4", 0, 139, 0 },
+    { "GreenYellow", 173, 255, 47 },
+    { "grey", 190, 190, 190 },
+    { "grey0", 0, 0, 0 },
+    { "grey1", 3, 3, 3 },
+    { "grey10", 26, 26, 26 },
+    { "grey100", 255, 255, 255 },
+    { "grey11", 28, 28, 28 },
+    { "grey12", 31, 31, 31 },
+    { "grey13", 33, 33, 33 },
+    { "grey14", 36, 36, 36 },
+    { "grey15", 38, 38, 38 },
+    { "grey16", 41, 41, 41 },
+    { "grey17", 43, 43, 43 },
+    { "grey18", 46, 46, 46 },
+    { "grey19", 48, 48, 48 },
+    { "grey2", 5, 5, 5 },
+    { "grey20", 51, 51, 51 },
+    { "grey21", 54, 54, 54 },
+    { "grey22", 56, 56, 56 },
+    { "grey23", 59, 59, 59 },
+    { "grey24", 61, 61, 61 },
+    { "grey25", 64, 64, 64 },
+    { "grey26", 66, 66, 66 },
+    { "grey27", 69, 69, 69 },
+    { "grey28", 71, 71, 71 },
+    { "grey29", 74, 74, 74 },
+    { "grey3", 8, 8, 8 },
+    { "grey30", 77, 77, 77 },
+    { "grey31", 79, 79, 79 },
+    { "grey32", 82, 82, 82 },
+    { "grey33", 84, 84, 84 },
+    { "grey34", 87, 87, 87 },
+    { "grey35", 89, 89, 89 },
+    { "grey36", 92, 92, 92 },
+    { "grey37", 94, 94, 94 },
+    { "grey38", 97, 97, 97 },
+    { "grey39", 99, 99, 99 },
+    { "grey4", 10, 10, 10 },
+    { "grey40", 102, 102, 102 },
+    { "grey41", 105, 105, 105 },
+    { "grey42", 107, 107, 107 },
+    { "grey43", 110, 110, 110 },
+    { "grey44", 112, 112, 112 },
+    { "grey45", 115, 115, 115 },
+    { "grey46", 117, 117, 117 },
+    { "grey47", 120, 120, 120 },
+    { "grey48", 122, 122, 122 },
+    { "grey49", 125, 125, 125 },
+    { "grey5", 13, 13, 13 },
+    { "grey50", 127, 127, 127 },
+    { "grey51", 130, 130, 130 },
+    { "grey52", 133, 133, 133 },
+    { "grey53", 135, 135, 135 },
+    { "grey54", 138, 138, 138 },
+    { "grey55", 140, 140, 140 },
+    { "grey56", 143, 143, 143 },
+    { "grey57", 145, 145, 145 },
+    { "grey58", 148, 148, 148 },
+    { "grey59", 150, 150, 150 },
+    { "grey6", 15, 15, 15 },
+    { "grey60", 153, 153, 153 },
+    { "grey61", 156, 156, 156 },
+    { "grey62", 158, 158, 158 },
+    { "grey63", 161, 161, 161 },
+    { "grey64", 163, 163, 163 },
+    { "grey65", 166, 166, 166 },
+    { "grey66", 168, 168, 168 },
+    { "grey67", 171, 171, 171 },
+    { "grey68", 173, 173, 173 },
+    { "grey69", 176, 176, 176 },
+    { "grey7", 18, 18, 18 },
+    { "grey70", 179, 179, 179 },
+    { "grey71", 181, 181, 181 },
+    { "grey72", 184, 184, 184 },
+    { "grey73", 186, 186, 186 },
+    { "grey74", 189, 189, 189 },
+    { "grey75", 191, 191, 191 },
+    { "grey76", 194, 194, 194 },
+    { "grey77", 196, 196, 196 },
+    { "grey78", 199, 199, 199 },
+    { "grey79", 201, 201, 201 },
+    { "grey8", 20, 20, 20 },
+    { "grey80", 204, 204, 204 },
+    { "grey81", 207, 207, 207 },
+    { "grey82", 209, 209, 209 },
+    { "grey83", 212, 212, 212 },
+    { "grey84", 214, 214, 214 },
+    { "grey85", 217, 217, 217 },
+    { "grey86", 219, 219, 219 },
+    { "grey87", 222, 222, 222 },
+    { "grey88", 224, 224, 224 },
+    { "grey89", 227, 227, 227 },
+    { "grey9", 23, 23, 23 },
+    { "grey90", 229, 229, 229 },
+    { "grey91", 232, 232, 232 },
+    { "grey92", 235, 235, 235 },
+    { "grey93", 237, 237, 237 },
+    { "grey94", 240, 240, 240 },
+    { "grey95", 242, 242, 242 },
+    { "grey96", 245, 245, 245 },
+    { "grey97", 247, 247, 247 },
+    { "grey98", 250, 250, 250 },
+    { "grey99", 252, 252, 252 },
+    { "honeydew", 240, 255, 240 },
+    { "honeydew1", 240, 255, 240 },
+    { "honeydew2", 224, 238, 224 },
+    { "honeydew3", 193, 205, 193 },
+    { "honeydew4", 131, 139, 131 },
+    { "hot pink", 255, 105, 180 },
+    { "HotPink", 255, 105, 180 },
+    { "HotPink1", 255, 110, 180 },
+    { "HotPink2", 238, 106, 167 },
+    { "HotPink3", 205, 96, 144 },
+    { "HotPink4", 139, 58, 98 },
+    { "indian red", 205, 92, 92 },
+    { "IndianRed", 205, 92, 92 },
+    { "IndianRed1", 255, 106, 106 },
+    { "IndianRed2", 238, 99, 99 },
+    { "IndianRed3", 205, 85, 85 },
+    { "IndianRed4", 139, 58, 58 },
+    { "ivory", 255, 255, 240 },
+    { "ivory1", 255, 255, 240 },
+    { "ivory2", 238, 238, 224 },
+    { "ivory3", 205, 205, 193 },
+    { "ivory4", 139, 139, 131 },
+    { "khaki", 240, 230, 140 },
+    { "khaki1", 255, 246, 143 },
+    { "khaki2", 238, 230, 133 },
+    { "khaki3", 205, 198, 115 },
+    { "khaki4", 139, 134, 78 },
+    { "lavender", 230, 230, 250 },
+    { "lavender blush", 255, 240, 245 },
+    { "LavenderBlush", 255, 240, 245 },
+    { "LavenderBlush1", 255, 240, 245 },
+    { "LavenderBlush2", 238, 224, 229 },
+    { "LavenderBlush3", 205, 193, 197 },
+    { "LavenderBlush4", 139, 131, 134 },
+    { "lawn green", 124, 252, 0 },
+    { "LawnGreen", 124, 252, 0 },
+    { "lemon chiffon", 255, 250, 205 },
+    { "LemonChiffon", 255, 250, 205 },
+    { "LemonChiffon1", 255, 250, 205 },
+    { "LemonChiffon2", 238, 233, 191 },
+    { "LemonChiffon3", 205, 201, 165 },
+    { "LemonChiffon4", 139, 137, 112 },
+    { "light blue", 173, 216, 230 },
+    { "light coral", 240, 128, 128 },
+    { "light cyan", 224, 255, 255 },
+    { "light goldenrod", 238, 221, 130 },
+    { "light goldenrod yellow", 250, 250, 210 },
+    { "light gray", 211, 211, 211 },
+    { "light green", 144, 238, 144 },
+    { "light grey", 211, 211, 211 },
+    { "light pink", 255, 182, 193 },
+    { "light salmon", 255, 160, 122 },
+    { "light sea green", 32, 178, 170 },
+    { "light sky blue", 135, 206, 250 },
+    { "light slate blue", 132, 112, 255 },
+    { "light slate gray", 119, 136, 153 },
+    { "light slate grey", 119, 136, 153 },
+    { "light steel blue", 176, 196, 222 },
+    { "light yellow", 255, 255, 224 },
+    { "LightBlue", 173, 216, 230 },
+    { "LightBlue1", 191, 239, 255 },
+    { "LightBlue2", 178, 223, 238 },
+    { "LightBlue3", 154, 192, 205 },
+    { "LightBlue4", 104, 131, 139 },
+    { "LightCoral", 240, 128, 128 },
+    { "LightCyan", 224, 255, 255 },
+    { "LightCyan1", 224, 255, 255 },
+    { "LightCyan2", 209, 238, 238 },
+    { "LightCyan3", 180, 205, 205 },
+    { "LightCyan4", 122, 139, 139 },
+    { "LightGoldenrod", 238, 221, 130 },
+    { "LightGoldenrod1", 255, 236, 139 },
+    { "LightGoldenrod2", 238, 220, 130 },
+    { "LightGoldenrod3", 205, 190, 112 },
+    { "LightGoldenrod4", 139, 129, 76 },
+    { "LightGoldenrodYellow", 250, 250, 210 },
+    { "LightGray", 211, 211, 211 },
+    { "LightGreen", 144, 238, 144 },
+    { "LightGrey", 211, 211, 211 },
+    { "LightPink", 255, 182, 193 },
+    { "LightPink1", 255, 174, 185 },
+    { "LightPink2", 238, 162, 173 },
+    { "LightPink3", 205, 140, 149 },
+    { "LightPink4", 139, 95, 101 },
+    { "LightSalmon", 255, 160, 122 },
+    { "LightSalmon1", 255, 160, 122 },
+    { "LightSalmon2", 238, 149, 114 },
+    { "LightSalmon3", 205, 129, 98 },
+    { "LightSalmon4", 139, 87, 66 },
+    { "LightSeaGreen", 32, 178, 170 },
+    { "LightSkyBlue", 135, 206, 250 },
+    { "LightSkyBlue1", 176, 226, 255 },
+    { "LightSkyBlue2", 164, 211, 238 },
+    { "LightSkyBlue3", 141, 182, 205 },
+    { "LightSkyBlue4", 96, 123, 139 },
+    { "LightSlateBlue", 132, 112, 255 },
+    { "LightSlateGray", 119, 136, 153 },
+    { "LightSlateGrey", 119, 136, 153 },
+    { "LightSteelBlue", 176, 196, 222 },
+    { "LightSteelBlue1", 202, 225, 255 },
+    { "LightSteelBlue2", 188, 210, 238 },
+    { "LightSteelBlue3", 162, 181, 205 },
+    { "LightSteelBlue4", 110, 123, 139 },
+    { "LightYellow", 255, 255, 224 },
+    { "LightYellow1", 255, 255, 224 },
+    { "LightYellow2", 238, 238, 209 },
+    { "LightYellow3", 205, 205, 180 },
+    { "LightYellow4", 139, 139, 122 },
+    { "lime green", 50, 205, 50 },
+    { "LimeGreen", 50, 205, 50 },
+    { "linen", 250, 240, 230 },
+    { "magenta", 255, 0, 255 },
+    { "magenta1", 255, 0, 255 },
+    { "magenta2", 238, 0, 238 },
+    { "magenta3", 205, 0, 205 },
+    { "magenta4", 139, 0, 139 },
+    { "maroon", 176, 48, 96 },
+    { "maroon1", 255, 52, 179 },
+    { "maroon2", 238, 48, 167 },
+    { "maroon3", 205, 41, 144 },
+    { "maroon4", 139, 28, 98 },
+    { "medium aquamarine", 102, 205, 170 },
+    { "medium blue", 0, 0, 205 },
+    { "medium orchid", 186, 85, 211 },
+    { "medium purple", 147, 112, 219 },
+    { "medium sea green", 60, 179, 113 },
+    { "medium slate blue", 123, 104, 238 },
+    { "medium spring green", 0, 250, 154 },
+    { "medium turquoise", 72, 209, 204 },
+    { "medium violet red", 199, 21, 133 },
+    { "MediumAquamarine", 102, 205, 170 },
+    { "MediumBlue", 0, 0, 205 },
+    { "MediumOrchid", 186, 85, 211 },
+    { "MediumOrchid1", 224, 102, 255 },
+    { "MediumOrchid2", 209, 95, 238 },
+    { "MediumOrchid3", 180, 82, 205 },
+    { "MediumOrchid4", 122, 55, 139 },
+    { "MediumPurple", 147, 112, 219 },
+    { "MediumPurple1", 171, 130, 255 },
+    { "MediumPurple2", 159, 121, 238 },
+    { "MediumPurple3", 137, 104, 205 },
+    { "MediumPurple4", 93, 71, 139 },
+    { "MediumSeaGreen", 60, 179, 113 },
+    { "MediumSlateBlue", 123, 104, 238 },
+    { "MediumSpringGreen", 0, 250, 154 },
+    { "MediumTurquoise", 72, 209, 204 },
+    { "MediumVioletRed", 199, 21, 133 },
+    { "midnight blue", 25, 25, 112 },
+    { "MidnightBlue", 25, 25, 112 },
+    { "mint cream", 245, 255, 250 },
+    { "MintCream", 245, 255, 250 },
+    { "misty rose", 255, 228, 225 },
+    { "MistyRose", 255, 228, 225 },
+    { "MistyRose1", 255, 228, 225 },
+    { "MistyRose2", 238, 213, 210 },
+    { "MistyRose3", 205, 183, 181 },
+    { "MistyRose4", 139, 125, 123 },
+    { "moccasin", 255, 228, 181 },
+    { "navajo white", 255, 222, 173 },
+    { "NavajoWhite", 255, 222, 173 },
+    { "NavajoWhite1", 255, 222, 173 },
+    { "NavajoWhite2", 238, 207, 161 },
+    { "NavajoWhite3", 205, 179, 139 },
+    { "NavajoWhite4", 139, 121, 94 },
+    { "navy", 0, 0, 128 },
+    { "navy blue", 0, 0, 128 },
+    { "NavyBlue", 0, 0, 128 },
+    { "old lace", 253, 245, 230 },
+    { "OldLace", 253, 245, 230 },
+    { "olive drab", 107, 142, 35 },
+    { "OliveDrab", 107, 142, 35 },
+    { "OliveDrab1", 192, 255, 62 },
+    { "OliveDrab2", 179, 238, 58 },
+    { "OliveDrab3", 154, 205, 50 },
+    { "OliveDrab4", 105, 139, 34 },
+    { "orange", 255, 165, 0 },
+    { "orange red", 255, 69, 0 },
+    { "orange1", 255, 165, 0 },
+    { "orange2", 238, 154, 0 },
+    { "orange3", 205, 133, 0 },
+    { "orange4", 139, 90, 0 },
+    { "OrangeRed", 255, 69, 0 },
+    { "OrangeRed1", 255, 69, 0 },
+    { "OrangeRed2", 238, 64, 0 },
+    { "OrangeRed3", 205, 55, 0 },
+    { "OrangeRed4", 139, 37, 0 },
+    { "orchid", 218, 112, 214 },
+    { "orchid1", 255, 131, 250 },
+    { "orchid2", 238, 122, 233 },
+    { "orchid3", 205, 105, 201 },
+    { "orchid4", 139, 71, 137 },
+    { "pale goldenrod", 238, 232, 170 },
+    { "pale green", 152, 251, 152 },
+    { "pale turquoise", 175, 238, 238 },
+    { "pale violet red", 219, 112, 147 },
+    { "PaleGoldenrod", 238, 232, 170 },
+    { "PaleGreen", 152, 251, 152 },
+    { "PaleGreen1", 154, 255, 154 },
+    { "PaleGreen2", 144, 238, 144 },
+    { "PaleGreen3", 124, 205, 124 },
+    { "PaleGreen4", 84, 139, 84 },
+    { "PaleTurquoise", 175, 238, 238 },
+    { "PaleTurquoise1", 187, 255, 255 },
+    { "PaleTurquoise2", 174, 238, 238 },
+    { "PaleTurquoise3", 150, 205, 205 },
+    { "PaleTurquoise4", 102, 139, 139 },
+    { "PaleVioletRed", 219, 112, 147 },
+    { "PaleVioletRed1", 255, 130, 171 },
+    { "PaleVioletRed2", 238, 121, 159 },
+    { "PaleVioletRed3", 205, 104, 137 },
+    { "PaleVioletRed4", 139, 71, 93 },
+    { "papaya whip", 255, 239, 213 },
+    { "PapayaWhip", 255, 239, 213 },
+    { "peach puff", 255, 218, 185 },
+    { "PeachPuff", 255, 218, 185 },
+    { "PeachPuff1", 255, 218, 185 },
+    { "PeachPuff2", 238, 203, 173 },
+    { "PeachPuff3", 205, 175, 149 },
+    { "PeachPuff4", 139, 119, 101 },
+    { "peru", 205, 133, 63 },
+    { "pink", 255, 192, 203 },
+    { "pink1", 255, 181, 197 },
+    { "pink2", 238, 169, 184 },
+    { "pink3", 205, 145, 158 },
+    { "pink4", 139, 99, 108 },
+    { "plum", 221, 160, 221 },
+    { "plum1", 255, 187, 255 },
+    { "plum2", 238, 174, 238 },
+    { "plum3", 205, 150, 205 },
+    { "plum4", 139, 102, 139 },
+    { "powder blue", 176, 224, 230 },
+    { "PowderBlue", 176, 224, 230 },
+    { "purple", 160, 32, 240 },
+    { "purple1", 155, 48, 255 },
+    { "purple2", 145, 44, 238 },
+    { "purple3", 125, 38, 205 },
+    { "purple4", 85, 26, 139 },
+    { "red", 255, 0, 0 },
+    { "red1", 255, 0, 0 },
+    { "red2", 238, 0, 0 },
+    { "red3", 205, 0, 0 },
+    { "red4", 139, 0, 0 },
+    { "rosy brown", 188, 143, 143 },
+    { "RosyBrown", 188, 143, 143 },
+    { "RosyBrown1", 255, 193, 193 },
+    { "RosyBrown2", 238, 180, 180 },
+    { "RosyBrown3", 205, 155, 155 },
+    { "RosyBrown4", 139, 105, 105 },
+    { "royal blue", 65, 105, 225 },
+    { "RoyalBlue", 65, 105, 225 },
+    { "RoyalBlue1", 72, 118, 255 },
+    { "RoyalBlue2", 67, 110, 238 },
+    { "RoyalBlue3", 58, 95, 205 },
+    { "RoyalBlue4", 39, 64, 139 },
+    { "saddle brown", 139, 69, 19 },
+    { "SaddleBrown", 139, 69, 19 },
+    { "salmon", 250, 128, 114 },
+    { "salmon1", 255, 140, 105 },
+    { "salmon2", 238, 130, 98 },
+    { "salmon3", 205, 112, 84 },
+    { "salmon4", 139, 76, 57 },
+    { "sandy brown", 244, 164, 96 },
+    { "SandyBrown", 244, 164, 96 },
+    { "sea green", 46, 139, 87 },
+    { "SeaGreen", 46, 139, 87 },
+    { "SeaGreen1", 84, 255, 159 },
+    { "SeaGreen2", 78, 238, 148 },
+    { "SeaGreen3", 67, 205, 128 },
+    { "SeaGreen4", 46, 139, 87 },
+    { "seashell", 255, 245, 238 },
+    { "seashell1", 255, 245, 238 },
+    { "seashell2", 238, 229, 222 },
+    { "seashell3", 205, 197, 191 },
+    { "seashell4", 139, 134, 130 },
+    { "sienna", 160, 82, 45 },
+    { "sienna1", 255, 130, 71 },
+    { "sienna2", 238, 121, 66 },
+    { "sienna3", 205, 104, 57 },
+    { "sienna4", 139, 71, 38 },
+    { "sky blue", 135, 206, 235 },
+    { "SkyBlue", 135, 206, 235 },
+    { "SkyBlue1", 135, 206, 255 },
+    { "SkyBlue2", 126, 192, 238 },
+    { "SkyBlue3", 108, 166, 205 },
+    { "SkyBlue4", 74, 112, 139 },
+    { "slate blue", 106, 90, 205 },
+    { "slate gray", 112, 128, 144 },
+    { "slate grey", 112, 128, 144 },
+    { "SlateBlue", 106, 90, 205 },
+    { "SlateBlue1", 131, 111, 255 },
+    { "SlateBlue2", 122, 103, 238 },
+    { "SlateBlue3", 105, 89, 205 },
+    { "SlateBlue4", 71, 60, 139 },
+    { "SlateGray", 112, 128, 144 },
+    { "SlateGray1", 198, 226, 255 },
+    { "SlateGray2", 185, 211, 238 },
+    { "SlateGray3", 159, 182, 205 },
+    { "SlateGray4", 108, 123, 139 },
+    { "SlateGrey", 112, 128, 144 },
+    { "snow", 255, 250, 250 },
+    { "snow1", 255, 250, 250 },
+    { "snow2", 238, 233, 233 },
+    { "snow3", 205, 201, 201 },
+    { "snow4", 139, 137, 137 },
+    { "spring green", 0, 255, 127 },
+    { "SpringGreen", 0, 255, 127 },
+    { "SpringGreen1", 0, 255, 127 },
+    { "SpringGreen2", 0, 238, 118 },
+    { "SpringGreen3", 0, 205, 102 },
+    { "SpringGreen4", 0, 139, 69 },
+    { "steel blue", 70, 130, 180 },
+    { "SteelBlue", 70, 130, 180 },
+    { "SteelBlue1", 99, 184, 255 },
+    { "SteelBlue2", 92, 172, 238 },
+    { "SteelBlue3", 79, 148, 205 },
+    { "SteelBlue4", 54, 100, 139 },
+    { "tan", 210, 180, 140 },
+    { "tan1", 255, 165, 79 },
+    { "tan2", 238, 154, 73 },
+    { "tan3", 205, 133, 63 },
+    { "tan4", 139, 90, 43 },
+    { "thistle", 216, 191, 216 },
+    { "thistle1", 255, 225, 255 },
+    { "thistle2", 238, 210, 238 },
+    { "thistle3", 205, 181, 205 },
+    { "thistle4", 139, 123, 139 },
+    { "tomato", 255, 99, 71 },
+    { "tomato1", 255, 99, 71 },
+    { "tomato2", 238, 92, 66 },
+    { "tomato3", 205, 79, 57 },
+    { "tomato4", 139, 54, 38 },
+    { "turquoise", 64, 224, 208 },
+    { "turquoise1", 0, 245, 255 },
+    { "turquoise2", 0, 229, 238 },
+    { "turquoise3", 0, 197, 205 },
+    { "turquoise4", 0, 134, 139 },
+    { "violet", 238, 130, 238 },
+    { "violet red", 208, 32, 144 },
+    { "VioletRed", 208, 32, 144 },
+    { "VioletRed1", 255, 62, 150 },
+    { "VioletRed2", 238, 58, 140 },
+    { "VioletRed3", 205, 50, 120 },
+    { "VioletRed4", 139, 34, 82 },
+    { "wheat", 245, 222, 179 },
+    { "wheat1", 255, 231, 186 },
+    { "wheat2", 238, 216, 174 },
+    { "wheat3", 205, 186, 150 },
+    { "wheat4", 139, 126, 102 },
+    { "white", 255, 255, 255 },
+    { "white smoke", 245, 245, 245 },
+    { "WhiteSmoke", 245, 245, 245 },
+    { "yellow", 255, 255, 0 },
+    { "yellow green", 154, 205, 50 },
+    { "yellow1", 255, 255, 0 },
+    { "yellow2", 238, 238, 0 },
+    { "yellow3", 205, 205, 0 },
+    { "yellow4", 139, 139, 0 },
+    { "YellowGreen", 154, 205, 50 }
+};
+#define numXColors (sizeof (xColors) / sizeof (*xColors))
+/*
+ *----------------------------------------------------------------------
+ *
+ * find_color --
+ *
+ *     This routine finds the color entry that corresponds to the
+ *     specified color.
+ *
+ * Results:
+ *     Returns non-zero on success.  The RGB values of the XColor
+ *     will be initialized to the proper values on success.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+compare_xcolor_entries (const void *a, const void *b)
+{
+  return strcasecmp ((const char *) a, ((const XPMColorEntry *) b)->name);
+}
+
+static gboolean
+find_color(const char *name,
+          XPMColor   *colorPtr)
+{
+       XPMColorEntry *found;
+
+       found = bsearch (name, xColors, numXColors, sizeof (XPMColorEntry),
+                        compare_xcolor_entries);
+       if (found == NULL)
+         return 0;
+       
+       colorPtr->red = (found->red * 65535) / 255;
+       colorPtr->green = (found->green * 65535) / 255;
+       colorPtr->blue = (found->blue * 65535) / 255;
+       
+       return TRUE;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * parse_color --
+ *
+ *     Partial implementation of X color name parsing interface.
+ *
+ * Results:
+ *     Returns non-zero on success.
+ *
+ * Side effects:
+ *     None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static gboolean
+parse_color (const char *spec,
+            XPMColor   *colorPtr)
+{
+       if (spec[0] == '#') {
+               char fmt[16];
+               int i, red, green, blue;
+
+               if ((i = strlen(spec+1))%3) {
+                       return FALSE;
+               }
+               i /= 3;
+
+               sprintf(fmt, "%%%dx%%%dx%%%dx", i, i, i);
+               if (sscanf(spec+1, fmt, &red, &green, &blue) != 3) {
+                       return FALSE;
+               }
+               if (i == 4) {
+                       colorPtr->red = red;
+                       colorPtr->green = green;
+                       colorPtr->blue = blue;
+               } else if (i == 1) {
+                       colorPtr->red = (red * 65535) / 15;
+                       colorPtr->green = (green * 65535) / 15;
+                       colorPtr->blue = (blue * 65535) / 15;
+               } else if (i == 2)
+               {
+                       colorPtr->red = (red * 65535) / 255;
+                       colorPtr->green = (green * 65535) / 255;
+                       colorPtr->blue = (blue * 65535) / 255;
+               } else /* if (i == 3) */ {
+                       colorPtr->red = (red * 65535) / 4095;
+                       colorPtr->green = (green * 65535) / 4095;
+                       colorPtr->blue = (blue * 65535) / 4095;
+               }
+       } else {
+               if (!find_color(spec, colorPtr))
+                       return FALSE;
+       }
+       return TRUE;
+}
+
 static gint
 xpm_seek_string (FILE *infile, const gchar *str, gint skip_comments)
 {
@@ -328,7 +1237,7 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
         gchar *name_buf;
        gchar pixel_str[32];
        GHashTable *color_hash;
-       _XPMColor *colors, *color, *fallbackcolor;
+       XPMColor *colors, *color, *fallbackcolor;
        guchar *pixels, *pixtmp;
 
        fallbackcolor = NULL;
@@ -348,7 +1257,7 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
        color_hash = g_hash_table_new (g_str_hash, g_str_equal);
 
        name_buf = g_new (gchar, n_col * (cpp + 1));
-       colors = g_new (_XPMColor, n_col);
+       colors = g_new (XPMColor, n_col);
 
        for (cnt = 0; cnt < n_col; cnt++) {
                gchar *color_name;
@@ -372,7 +1281,7 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
                color_name = xpm_extract_color (buffer);
 
                if ((color_name == NULL) || (g_strcasecmp (color_name, "None") == 0)
-                   || (gdk_color_parse (color_name, &color->color) == FALSE)) {
+                   || (parse_color (color_name, color) == FALSE)) {
                        color->transparent = TRUE;
                        is_trans = TRUE;
                }
@@ -415,9 +1324,9 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
                        if (!color)
                                color = fallbackcolor;
 
-                       *pixtmp++ = color->color.red >> 8;
-                       *pixtmp++ = color->color.green >> 8;
-                       *pixtmp++ = color->color.blue >> 8;
+                       *pixtmp++ = color->red >> 8;
+                       *pixtmp++ = color->green >> 8;
+                       *pixtmp++ = color->blue >> 8;
 
                        if (is_trans && color->transparent)
                                *pixtmp++ = 0;
index ae0ff5ee7c400496532c5a44b6a70fd0b4afb72c..6714133a975ec626e0be887de5bd31ca5583aa8d 100644 (file)
@@ -1,5 +1,4 @@
 #include <math.h>
-#include <glib.h>
 #include "config.h"
 
 #include "pixops.h"
index 7da2e99dcfa04771f6b548d84c91124c2f7199eb..a84c494e16b01b2e84b5ad12c0e2d5ba286a2177 100644 (file)
@@ -9,16 +9,17 @@ EXTRA_DIST =  \
        makefile.cygwin \
        makefile.msc
 
-common_includes = @STRIP_BEGIN@ \
-       -DG_LOG_DOMAIN=\"Gdk\"  \
-       -I$(top_srcdir)         \
-       -I$(top_builddir)/gdk   \
-       @GTK_DEBUG_FLAGS@       \
-       @GTK_XIM_FLAGS@         \
-       @GTK_LOCALE_FLAGS@      \
-       @PANGO_CFLAGS@          \
-       @GLIB_CFLAGS@           \
-       @more_cflags@           \
+common_includes = @STRIP_BEGIN@        \
+       -DG_LOG_DOMAIN=\"Gdk\"          \
+       -I$(top_srcdir)                 \
+       -I$(top_builddir)/gdk           \
+       -I$(top_srcdir)/gdk-pixbuf      \
+       @GTK_DEBUG_FLAGS@               \
+       @GTK_XIM_FLAGS@                 \
+       @GTK_LOCALE_FLAGS@              \
+       @PANGO_CFLAGS@                  \
+       @GLIB_CFLAGS@                   \
+       @more_cflags@                   \
 @STRIP_END@
 
 INCLUDES = $(common_includes)
@@ -65,6 +66,7 @@ gdk_public_h_sources = @STRIP_BEGIN@ \
        gdkimage.h      \
        gdkinput.h      \
        gdkpango.h      \
+       gdkpixbuf.h     \
        gdkpixmap.h     \
        gdkprivate.h    \
        gdkproperty.h   \
@@ -89,6 +91,8 @@ gdk_c_sources = @STRIP_BEGIN@         \
        gdkimage.c              \
        gdkinternals.h          \
        gdkpango.c              \
+       gdkpixbuf-drawable.c    \
+       gdkpixbuf-render.c      \
        gdkpixmap.c             \
        gdkpoly-generic.h       \
        gdkpolyreg-generic.c    \
index 8a76da52bf59e173a4ebe655ce51e6c14fc1ea06..a56e327f43c0e3ac9c0cdcbc742b8330ef942052 100644 (file)
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -39,6 +39,7 @@
 #include <gdk/gdkimage.h>
 #include <gdk/gdkinput.h>
 #include <gdk/gdkpango.h>
+#include <gdk/gdkpixbuf.h>
 #include <gdk/gdkpixmap.h>
 #include <gdk/gdkproperty.h>
 #include <gdk/gdkregion.h>
index 742f0082d147c5099b2f71eb94683ca52a727b74..03f692d67c03054dea37d926b6f3fb3c07d46445 100644 (file)
@@ -35,8 +35,6 @@ extern "C" {
 #define gdk_cursor_destroy             gdk_cursor_unref
 
 
-#define GDK_WINDOW_PIXMAP GDK_DRAWABLE_PIXMAP
-             
 #endif /* GDK_DISABLE_COMPAT_H */
 
 #ifdef __cplusplus
index 39a85d9a5907646619684a32b65b98c9bfae28df..955a8f5c5df855090ac28bd6af7482a0e7894e8d 100644 (file)
 #include <config.h>
 #include <stdio.h>
 #include <string.h>
+#include "gdk.h"               /* For gdk_screen_width/gdk_screen_height */
+#include "gdkcolor.h"
+#include "gdkimage.h"
+#include "gdkvisual.h"
+#include "gdkwindow.h"
+#include "gdkpixbuf.h"
 #include "gdk-pixbuf-private.h"
 
 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
@@ -1082,7 +1088,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
                              int dest_x, int dest_y,
                              int width, int height)
 {
-       GdkWindowType window_type;
        int src_width, src_height;
        GdkImage *image;
        int rowstride, bpp, alpha;
@@ -1091,9 +1096,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
 
        g_return_val_if_fail (src != NULL, NULL);
 
-       window_type = gdk_window_get_type (src);
-
-       if (window_type == GDK_WINDOW_PIXMAP)
+       if (GDK_IS_PIXMAP (src))
                g_return_val_if_fail (cmap != NULL, NULL);
        else
                /* FIXME: this is not perfect, since is_viewable() only tests
@@ -1113,7 +1116,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
 
        /* Coordinate sanity checks */
 
-       gdk_window_get_size (src, &src_width, &src_height);
+       gdk_drawable_get_size (src, &src_width, &src_height);
 
        g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL);
        g_return_val_if_fail (src_x + width <= src_width && src_y + height <= src_height, NULL);
@@ -1124,7 +1127,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
                g_return_val_if_fail (dest_y + height <= dest->height, NULL);
        }
 
-       if (window_type != GDK_WINDOW_PIXMAP) {
+       if (!GDK_IS_PIXMAP (src)) {
                int ret;
                int src_xorigin, src_yorigin;
                int screen_width, screen_height;
@@ -1158,7 +1161,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
        }
 
        /* Get the colormap if needed */
-       if (window_type != GDK_WINDOW_PIXMAP)
+       if (!GDK_IS_PIXMAP (src))
                cmap = gdk_window_get_colormap (src);
 
        alpha = dest->has_alpha;
index 706d43b5950722271f97d46749e553d247bcbddf..0d47ac0cd32868d4d6aa34ed79b3b401c4c41bc1 100644 (file)
@@ -23,6 +23,7 @@
 #include <config.h>
 #include <gdk/gdk.h>
 #include "gdk-pixbuf-private.h"
+#include "gdkpixbuf.h"
 
 \f
 
diff --git a/gdk/gdkpixbuf.h b/gdk/gdkpixbuf.h
new file mode 100644 (file)
index 0000000..271e993
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef __GDK_PIXBUF_H__
+#define __GDK_PIXBUF_H__
+
+#include <gdk/gdktypes.h>
+#include <gdk/gdkrgb.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Rendering to a drawable */
+
+/* Alpha compositing mode */
+typedef enum
+{
+  GDK_PIXBUF_ALPHA_BILEVEL,
+  GDK_PIXBUF_ALPHA_FULL
+} GdkPixbufAlphaMode;
+
+void gdk_pixbuf_render_threshold_alpha   (GdkPixbuf           *pixbuf,
+                                         GdkBitmap           *bitmap,
+                                         int                  src_x,
+                                         int                  src_y,
+                                         int                  dest_x,
+                                         int                  dest_y,
+                                         int                  width,
+                                         int                  height,
+                                         int                  alpha_threshold);
+void gdk_pixbuf_render_to_drawable       (GdkPixbuf           *pixbuf,
+                                         GdkDrawable         *drawable,
+                                         GdkGC               *gc,
+                                         int                  src_x,
+                                         int                  src_y,
+                                         int                  dest_x,
+                                         int                  dest_y,
+                                         int                  width,
+                                         int                  height,
+                                         GdkRgbDither         dither,
+                                         int                  x_dither,
+                                         int                  y_dither);
+void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf           *pixbuf,
+                                         GdkDrawable         *drawable,
+                                         int                  src_x,
+                                         int                  src_y,
+                                         int                  dest_x,
+                                         int                  dest_y,
+                                         int                  width,
+                                         int                  height,
+                                         GdkPixbufAlphaMode   alpha_mode,
+                                         int                  alpha_threshold,
+                                         GdkRgbDither         dither,
+                                         int                  x_dither,
+                                         int                  y_dither);
+void gdk_pixbuf_render_pixmap_and_mask   (GdkPixbuf           *pixbuf,
+                                         GdkPixmap          **pixmap_return,
+                                         GdkBitmap          **mask_return,
+                                         int                  alpha_threshold);
+
+/* Fetching a region from a drawable */
+GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf   *dest,
+                                        GdkDrawable *src,
+                                        GdkColormap *cmap,
+                                        int          src_x,
+                                        int          src_y,
+                                        int          dest_x,
+                                        int          dest_y,
+                                        int          width,
+                                        int          height);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif __GDK_PIXBUF_H__
index ec19afdbf9b47d2fa09258046f255209b6245e06..0719357c1048d2af067ea2f1f7c9b85c429250d4 100644 (file)
@@ -10,6 +10,7 @@ INCLUDES = @STRIP_BEGIN@ \
        -DTESTGTK_RCFILE=\"`pwd`/$(srcdir)/testgtkrc\"  \
        -I$(top_srcdir) -I../gdk                        \
        -I$(top_srcdir)/gdk                             \
+       -I$(top_srcdir)/gdk-pixbuf -I../gdk-pixbuf      \
        @GTK_DEBUG_FLAGS@                               \
        @GTK_XIM_FLAGS@                                 \
        @GTK_LOCALE_FLAGS@                              \
@@ -118,6 +119,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
        gtkoptionmenu.h         \
        gtkpacker.h             \
        gtkpaned.h              \
+       gdk-pixbuf-loader.h     \
        gtkpixmap.h             \
        gtkplug.h               \
        gtkpreview.h            \
@@ -318,6 +320,7 @@ gtk_c_sources = @STRIP_BEGIN@ \
        gtkwindow.c             \
        fnmatch.c               \
        fnmatch.h               \
+       gdk-pixbuf-loader.c     \
 @STRIP_END@
 # we use our own built_sources variable rules to avoid automake's
 # BUILT_SOURCES oddities
@@ -517,17 +520,18 @@ uninstall-local:
 # test programs, not to be installed
 #
 noinst_PROGRAMS = testgtk testcalendar testinput testselection testrgb testdnd testtext simple testtextbuffer # testthreads
-DEPS = @gtktargetlib@ $(top_builddir)/gdk/@gdktargetlib@
+DEPS = @gtktargetlib@ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf.la  $(top_builddir)/gdk/@gdktargetlib@
 LDADDS = @STRIP_BEGIN@ \
-       @gtktargetlib@                  \
-       $(top_builddir)/gdk/@gdktargetlib@ \
-       @more_ldflags@                  \
-       @more_libs@                     \
-       @GDK_WLIBS@                     \
-       @PANGO_LIBS@                    \
-       @GLIB_LIBS@                     \
-       @GTK_LIBS_EXTRA@                \
-       -lm                             \
+       @gtktargetlib@                                  \
+       $(top_builddir)/gdk-pixbuf/libgdk_pixbuf.la     \
+       $(top_builddir)/gdk/@gdktargetlib@              \
+       @more_ldflags@                                  \
+       @more_libs@                                     \
+       @GDK_WLIBS@                                     \
+       @PANGO_LIBS@                                    \
+       @GLIB_LIBS@                                     \
+       @GTK_LIBS_EXTRA@                                \
+       -lm                                             \
 @STRIP_END@
 testgtk_DEPENDENCIES = $(DEPS)
 testcalendar_DEPENDENCIES = $(DEPS)
index 63b9f1c598cecff72845f1bace351f3829fb7994..884ce4cc8996a34d3262fc8f70042751dda7a000 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#include <config.h>
-#include <gtk/gtksignal.h>
 #include "gdk-pixbuf-private.h"
 #include "gdk-pixbuf-loader.h"
 #include "gdk-pixbuf-io.h"
 
+#include "gtksignal.h"
+
 \f
 
 enum {
@@ -47,7 +47,7 @@ static GtkObjectClass *parent_class;
 static void gdk_pixbuf_loader_class_init    (GdkPixbufLoaderClass   *klass);
 static void gdk_pixbuf_loader_init          (GdkPixbufLoader        *loader);
 static void gdk_pixbuf_loader_destroy       (GtkObject              *loader);
-static void gdk_pixbuf_loader_finalize      (GtkObject              *loader);
+static void gdk_pixbuf_loader_finalize      (GObject                *loader);
 
 static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
 
@@ -125,16 +125,18 @@ gdk_pixbuf_loader_get_type (void)
 static void
 gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
 {
+       GObjectClass *gobject_class;
        GtkObjectClass *object_class;
 
        object_class = (GtkObjectClass *) class;
+       gobject_class = (GObjectClass *) class;
 
        parent_class = gtk_type_class (gtk_object_get_type ());
 
        pixbuf_loader_signals[AREA_PREPARED] =
                gtk_signal_new ("area_prepared",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_prepared),
                                gtk_marshal_NONE__NONE,
                                GTK_TYPE_NONE, 0);
@@ -142,7 +144,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[AREA_UPDATED] =
                gtk_signal_new ("area_updated",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, area_updated),
                                gtk_marshal_NONE__INT_INT_INT_INT,
                                GTK_TYPE_NONE, 4,
@@ -154,7 +156,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[FRAME_DONE] =
                gtk_signal_new ("frame_done",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done),
                                gtk_marshal_NONE__POINTER,
                                GTK_TYPE_NONE, 1,
@@ -163,7 +165,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[ANIMATION_DONE] =
                gtk_signal_new ("animation_done",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, animation_done),
                                gtk_marshal_NONE__NONE,
                                GTK_TYPE_NONE, 0);
@@ -171,7 +173,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        pixbuf_loader_signals[CLOSED] =
                gtk_signal_new ("closed",
                                GTK_RUN_LAST,
-                               parent_class->type,
+                               GTK_CLASS_TYPE (object_class),
                                GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, closed),
                                gtk_marshal_NONE__NONE,
                                GTK_TYPE_NONE, 0);
@@ -179,7 +181,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
        gtk_object_class_add_signals (object_class, pixbuf_loader_signals, LAST_SIGNAL);
 
        object_class->destroy = gdk_pixbuf_loader_destroy;
-       object_class->finalize = gdk_pixbuf_loader_finalize;
+       gobject_class->finalize = gdk_pixbuf_loader_finalize;
 }
 
 static void
@@ -216,7 +218,7 @@ gdk_pixbuf_loader_destroy (GtkObject *object)
 }
 
 static void
-gdk_pixbuf_loader_finalize (GtkObject *object)
+gdk_pixbuf_loader_finalize (GObject *object)
 {
        GdkPixbufLoader *loader;
        GdkPixbufLoaderPrivate *priv = NULL;
@@ -226,8 +228,8 @@ gdk_pixbuf_loader_finalize (GtkObject *object)
 
        g_free (priv);
 
-       if (GTK_OBJECT_CLASS (parent_class)->finalize)
-               (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
+       if (G_OBJECT_CLASS (parent_class)->finalize)
+               (* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
 static void