Index: kit/CHANGELOG
diff -u kit/CHANGELOG:1.9 kit/CHANGELOG:removed
--- kit/CHANGELOG:1.9	Sat Sep  5 00:11:21 1998
+++ kit/CHANGELOG	Mon Feb 16 05:10:01 2009
@@ -1,51 +0,0 @@
-CHANGELOG for magicpoint
-$Id: CHANGELOG,v 1.9 1998/09/04 15:11:21 onoe Exp $
-
-Fri Sep  5 1998  onoe@sm.sony.co.jp
-	* handle key inputs from invoked terminal as pressed on Xserver,
-	  even if the Xserver is running on a remote host.
-
-Mon Aug 26 1998  itojun@iijlab.net
-	* new copyright. (BSDish copyright without clause 3)
-
-Mon Aug 25 1998  itojun@iijlab.net
-	* print.c: better x11/freetype/vflib -> postscript font mapping.
-
-Mon Aug 23 1998  kato@wide.ad.jp
-	* embedded image support (added mgpembed.pl and embed.c)
-
-Mon Aug 22 1998  itojun@iijlab.net
-	* added contrib/xmindpath, MindPath PocketPoint user-level driver.
-
-Fri Jul 10 11:57:59 JST 1998  itojun@iijlab.net
-	* cache gs-generated image file.
-	  Suggested by: luigi@FreeBSD.org
-
-Mon Jul  6 11:38:32 JST 1998  itojun@iijlab.net
-	* capable of handling GB2312 and KSC5601 encoding.
-	  they must be encoded by using iso-2022 like escape sequences.
-	  EUC-cn or EUC-kr does not work.
-	* -x option is added.
-
-Thu Jul  2 18:04:16 JST 1998  itojun@iijlab.net
-	* eliminate gsview.
-	* revamp "xfont" directive. (see SYNTAX for detail)
-
-Thu Jun 25 13:10:28 JST 1998  itojun@iijlab.net
-	* print.c: color postscript support by "mgp2ps -c".
-
-changes between 1.02a and 1.03a:
-	* To allow color name that has space inbetween ("dark blue"), 
-	  color name after directives SHOULD come with doublequote.
-	  Therefore,
-		%fore blue
-	  should be
-		%fore "blue"
-	  At this moment, doublequote can be ommitted for backward
-	  compatibility.  We may require to have doublequote in the future.
-	  Font names and other string parameter obeys the same rule.
-	* %image is now capable of rendering encapsulated postscript files
-	  (*.eps).
-		%image foo.eps
-	  should work fine.
-	  By using -X option, you can specify device name for ghostscript.
Index: kit/configure
diff -u kit/configure:1.106 kit/configure:1.107
--- kit/configure:1.106	Sat Dec 29 05:31:26 2007
+++ kit/configure	Sun Feb 15 20:35:19 2009
@@ -1285,7 +1285,7 @@
   --enable-freetype-charset16         use freetype for chaset16.
   --disable-xft2           DON'T use xft2 libraries.
   --enable-gif            compile gif support in (need libungif).
-  --enable-imlib          use imlib exclusively to load images.
+  --enable-imlib          use imlib2 exclusively to load images.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -7147,9 +7147,9 @@
 echo "${ECHO_T}$mgp_imlib" >&6; }
 if test $mgp_imlib = "yes"; then
   if type pkg-config > /dev/null 2>&1; then
-     if pkg-config imlib; then
-        LIBS="$LIBS `pkg-config --libs imlib`"
-        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
+     if pkg-config imlib2; then
+        LIBS="$LIBS `pkg-config --libs imlib2`"
+        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib2`"
 	cat >>confdefs.h <<\_ACEOF
 #define USE_IMLIB 1
 _ACEOF
@@ -7157,13 +7157,13 @@
 	USE_IMLIB=1
      fi
   else
-	{ echo "$as_me:$LINENO: checking for Imlib_init in -lImlib" >&5
-echo $ECHO_N "checking for Imlib_init in -lImlib... $ECHO_C" >&6; }
-if test "${ac_cv_lib_Imlib_Imlib_init+set}" = set; then
+	{ echo "$as_me:$LINENO: checking for imlib_load_image in -lImlib2" >&5
+echo $ECHO_N "checking for imlib_load_image in -lImlib2... $ECHO_C" >&6; }
+if test "${ac_cv_lib_Imlib2_imlib_load_image+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lImlib -L$x_libraries -lX11 -lXext $LIBS"
+LIBS="-lImlib2 -L$x_libraries -lX11 -lXext $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7177,11 +7177,11 @@
 #ifdef __cplusplus
 extern "C"
 #endif
-char Imlib_init ();
+char imlib_load_image ();
 int
 main ()
 {
-return Imlib_init ();
+return imlib_load_image ();
   ;
   return 0;
 }
@@ -7204,23 +7204,23 @@
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext &&
        $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_Imlib_Imlib_init=yes
+  ac_cv_lib_Imlib2_imlib_load_image=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_Imlib_Imlib_init=no
+	ac_cv_lib_Imlib2_imlib_load_image=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_Imlib_Imlib_init" >&5
-echo "${ECHO_T}$ac_cv_lib_Imlib_Imlib_init" >&6; }
-if test $ac_cv_lib_Imlib_Imlib_init = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_Imlib2_imlib_load_image" >&5
+echo "${ECHO_T}$ac_cv_lib_Imlib2_imlib_load_image" >&6; }
+if test $ac_cv_lib_Imlib2_imlib_load_image = yes; then
   imlib_ok=yes
-		LIBS="$LIBS -lImlib"
+		LIBS="$LIBS -lImlib2"
 		cat >>confdefs.h <<\_ACEOF
 #define USE_IMLIB 1
 _ACEOF
@@ -7229,32 +7229,32 @@
 fi
 
 	if test "x$imlib_ok" != "xyes"; then
-		echo 'FATAL: You need libImlib to use Imlib loading.  pass proper LIBS to configure.'
+		echo 'FATAL: You need libImlib2 to use Imlib loading.  pass proper LIBS to configure.'
 		exit 1
 	fi
 	for i in /usr/pkg /usr/local; do
-		if test -f $i/include/Imlib.h; then
+		if test -f $i/include/Imlib2.h; then
 			imlib_h_ok=yes
 			OPTFLAGS="$OPTFLAGS -I$i/include"
 			break
 		fi
 	done
-	if test -f /usr/include/Imlib.h; then
+	if test -f /usr/include/Imlib2.h; then
 		imlib_h_ok=yes
 	fi
 	if test "x$gif_h_ok" != "xyes"; then
-		if test "${ac_cv_header_Imlib_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for Imlib.h" >&5
-echo $ECHO_N "checking for Imlib.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_Imlib_h+set}" = set; then
+		if test "${ac_cv_header_Imlib2_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for Imlib2.h" >&5
+echo $ECHO_N "checking for Imlib2.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_Imlib2_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_Imlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_Imlib_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_Imlib2_h" >&5
+echo "${ECHO_T}$ac_cv_header_Imlib2_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking Imlib.h usability" >&5
-echo $ECHO_N "checking Imlib.h usability... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking Imlib2.h usability" >&5
+echo $ECHO_N "checking Imlib2.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7262,7 +7262,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-#include <Imlib.h>
+#include <Imlib2.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (ac_try="$ac_compile"
@@ -7294,15 +7294,15 @@
 echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking Imlib.h presence" >&5
-echo $ECHO_N "checking Imlib.h presence... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: checking Imlib2.h presence" >&5
+echo $ECHO_N "checking Imlib2.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <Imlib.h>
+#include <Imlib2.h>
 _ACEOF
 if { (ac_try="$ac_cpp conftest.$ac_ext"
 case "(($ac_try" in
@@ -7335,47 +7335,47 @@
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: Imlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: Imlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Imlib.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: Imlib.h: proceeding with the compiler's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: Imlib2.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: Imlib2.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: Imlib.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: Imlib.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Imlib.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: Imlib.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Imlib.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: Imlib.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Imlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: Imlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Imlib.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: Imlib.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: Imlib.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: Imlib.h: in the future, the compiler will take precedence" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: Imlib2.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: Imlib2.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: Imlib2.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: Imlib2.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: Imlib2.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: Imlib2.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: Imlib2.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for Imlib.h" >&5
-echo $ECHO_N "checking for Imlib.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_Imlib_h+set}" = set; then
+{ echo "$as_me:$LINENO: checking for Imlib2.h" >&5
+echo $ECHO_N "checking for Imlib2.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_Imlib2_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_header_Imlib_h=$ac_header_preproc
+  ac_cv_header_Imlib2_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_Imlib_h" >&5
-echo "${ECHO_T}$ac_cv_header_Imlib_h" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_Imlib2_h" >&5
+echo "${ECHO_T}$ac_cv_header_Imlib2_h" >&6; }
 
 fi
-if test $ac_cv_header_Imlib_h = yes; then
+if test $ac_cv_header_Imlib2_h = yes; then
   imlib_h_ok=yes
 fi
 
 
 	fi
 	if test "x$imlib_h_ok" != "xyes"; then
-		echo 'FATAL: cannot find Imlib.h.  pass proper CPPFLAGS to configure.'
+		echo 'FATAL: cannot find Imlib2.h.  pass proper CPPFLAGS to configure.'
 		exit 1
 	fi
   fi
Index: kit/configure.in
diff -u kit/configure.in:1.104 kit/configure.in:1.105
--- kit/configure.in:1.104	Sat Dec 29 05:31:26 2007
+++ kit/configure.in	Sun Feb 15 20:35:19 2009
@@ -3,7 +3,7 @@
 dnl independent (using srcdir), however, xmkmf and Imake.tmpl do not
 dnl allow us to switch compilation directory.
 dnl
-dnl $Id: configure.in,v 1.104 2007/12/28 20:31:26 nishida Exp $
+dnl $Id: configure.in,v 1.105 2009/02/15 11:35:19 nishida Exp $
 AC_INIT(image/imagetypes.c)
 
 dnl Checks for programs.
@@ -448,44 +448,44 @@
 AC_SUBST(USE_IMLIB)
 AC_MSG_CHECKING(if imlib is used)
 AC_ARG_ENABLE(imlib,
-	[  --enable-imlib          use imlib exclusively to load images.],
+	[  --enable-imlib          use imlib2 exclusively to load images.],
 	[mgp_imlib="$enableval"],
 	[mgp_imlib="yes"])
 AC_MSG_RESULT($mgp_imlib)
 if test $mgp_imlib = "yes"; then
   if type pkg-config > /dev/null 2>&1; then
-     if pkg-config imlib; then
-        LIBS="$LIBS `pkg-config --libs imlib`"
-        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
+     if pkg-config imlib2; then
+        LIBS="$LIBS `pkg-config --libs imlib2`"
+        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib2`"
 	AC_DEFINE(USE_IMLIB)
 	USE_IMLIB=1
      fi
   else
-	AC_CHECK_LIB(Imlib, Imlib_init,
+	AC_CHECK_LIB(Imlib2, imlib_load_image,
 		[imlib_ok=yes
-		LIBS="$LIBS -lImlib"
+		LIBS="$LIBS -lImlib2"
 		AC_DEFINE(USE_IMLIB)
 		USE_IMLIB=1],
 		[], [-L$x_libraries -lX11 -lXext])
 	if test "x$imlib_ok" != "xyes"; then
-		echo 'FATAL: You need libImlib to use Imlib loading.  pass proper LIBS to configure.'
+		echo 'FATAL: You need libImlib2 to use Imlib loading.  pass proper LIBS to configure.'
 		exit 1
 	fi
 	for i in /usr/pkg /usr/local; do
-		if test -f $i/include/Imlib.h; then
+		if test -f $i/include/Imlib2.h; then
 			imlib_h_ok=yes
 			OPTFLAGS="$OPTFLAGS -I$i/include"
 			break
 		fi
 	done
-	if test -f /usr/include/Imlib.h; then
+	if test -f /usr/include/Imlib2.h; then
 		imlib_h_ok=yes
 	fi
 	if test "x$gif_h_ok" != "xyes"; then
-		AC_CHECK_HEADER(Imlib.h, imlib_h_ok=yes)
+		AC_CHECK_HEADER(Imlib2.h, imlib_h_ok=yes)
 	fi
 	if test "x$imlib_h_ok" != "xyes"; then
-		echo 'FATAL: cannot find Imlib.h.  pass proper CPPFLAGS to configure.'
+		echo 'FATAL: cannot find Imlib2.h.  pass proper CPPFLAGS to configure.'
 		exit 1
 	fi
   fi
Index: kit/ctlwords.pl
diff -u kit/ctlwords.pl:1.2 kit/ctlwords.pl:removed
--- kit/ctlwords.pl:1.2	Sat Sep  5 06:05:08 1998
+++ kit/ctlwords.pl	Mon Feb 16 05:10:01 2009
@@ -1,12 +0,0 @@
-#! /usr/bin/perl
-$counter = 0;	# 0 origin
-print "/* generated by ctlwords.awk. do not edit by hand. */\n";
-
-while (<>) {
-	next if (!/^\/\*CTL\*\//);
-	next if ($_ !~ /(CTL_[A-Z0-9]+)/);
-
-	$word = $1;
-	print "#define $word\t$counter\n";
-	$counter++;
-}
Index: kit/draw.c
diff -u kit/draw.c:1.245 kit/draw.c:1.246
--- kit/draw.c:1.245	Fri Jan 25 00:43:17 2008
+++ kit/draw.c	Sun Feb 15 20:35:19 2009
@@ -26,12 +26,12 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.245 2008/01/24 15:43:17 nishida Exp $
+ * $Id: draw.c,v 1.246 2009/02/15 11:35:19 nishida Exp $
  */
 
 #include "mgp.h"
 #ifdef USE_IMLIB
-#include <Imlib.h>
+#include <Imlib2.h>
 #endif
 
 /* state associated with the window - how should we treat this? */
@@ -83,8 +83,8 @@
 	u_int, char *));
 static int obj_new_image __P((struct render_state *, int, int, Image *, int, int));
 #ifdef USE_IMLIB
-ImlibImage *search_imdata __P((char *));
-static int obj_new_image2 __P((struct render_state *, int, int, Image *, int, int, ImlibImage *, int));
+Imlib_Image *search_imdata __P((char *));
+static int obj_new_image2 __P((struct render_state *, int, int, Image *, int, int, Imlib_Image *, int));
 #endif
 static int obj_new_icon __P((struct render_state *, int, int, u_int, u_int, u_long, u_int, XPoint *));
 static Pixel obj_image_color __P((Image *, Image *, Pixel, int *));
@@ -168,7 +168,7 @@
 static void clear_zimage __P((int));
 static void clear_region __P((int, int, int, int));
 #define ZIMAGENUM 100
-static ImlibImage *zimage[ZIMAGENUM];
+static Imlib_Image *zimage[ZIMAGENUM];
 static int zonzoom[ZIMAGENUM];
 static int zpage[ZIMAGENUM];
 static int zx[ZIMAGENUM];
@@ -1819,7 +1819,7 @@
 	int x, y;
 	Image *image;
 	int xzoom, yzoom;
-	ImlibImage *imimage;
+	Imlib_Image *imimage;
 	int zoomonclk;
 {
 	struct render_object *obj;
@@ -3212,7 +3212,7 @@
 	static char backfile[MAXPATHLEN];
 	static int backzoom, backnumcolor, backx, backy;
 #ifdef USE_IMLIB
-	ImlibImage *imimage;
+	Imlib_Image *imimage;
 #endif
 
 	if (!caching){
Index: kit/image/gif.h
diff -u kit/image/gif.h:1.2 kit/image/gif.h:removed
--- kit/image/gif.h:1.2	Mon Dec 28 17:23:03 1998
+++ kit/image/gif.h	Mon Feb 16 05:10:02 2009
@@ -1,72 +0,0 @@
-/* gif.h:
- *
- * gifin.h
- * kirk johnson
- * november 1989
- * external interface to gifin.c
- *
- * Copyright 1989 Kirk L. Johnson (see the included file
- * "kljcpyrght.h" for complete copyright information)
- */
-
-/*
- * gifin return codes
- */
-#define GIFIN_SUCCESS       0   /* success */
-#define GIFIN_DONE          1   /* no more images */
-
-#define GIFIN_ERR_BAD_SD   -1   /* bad screen descriptor */
-#define GIFIN_ERR_BAD_SEP  -2   /* bad image separator */
-#define GIFIN_ERR_BAD_SIG  -3   /* bad signature */
-#define GIFIN_ERR_EOD      -4   /* unexpected end of raster data */
-#define GIFIN_ERR_EOF      -5   /* unexpected end of input stream */
-#define GIFIN_ERR_FAO      -6   /* file already open */
-#define GIFIN_ERR_IAO      -7   /* image already open */
-#define GIFIN_ERR_NFO      -8   /* no file open */
-#define GIFIN_ERR_NIO      -9   /* no image open */
-
-/*
- * colormap indices 
- */
-
-#define GIF_RED  0
-#define GIF_GRN  1
-#define GIF_BLU  2
-
-/*
- * typedef BYTE for convenience
- */
-
-typedef unsigned char BYTE;
-
-static int gifin_open_file();
-static int gifin_open_image();
-static int gifin_get_pixel();
-#if 0
-static int gifin_close_image();
-#endif
-static int gifin_close_file();
-static int gifin_load_cmap();
-static int gifin_skip_extension();
-static int gifin_read_data_block();
-static int gifin_push_string();
-static void gifin_add_string();
-static void gifin_fatal();
-
-/* #defines, typedefs, and such
- */
-
-#define GIF_SIG      "GIF87a"
-#define GIF_SIG_89   "GIF89a"
-#define GIF_SIG_LEN  6          /* GIF signature length */
-#define GIF_SD_SIZE  7          /* GIF screen descriptor size */
-#define GIF_ID_SIZE  9          /* GIF image descriptor size */
-
-#define GIF_SEPARATOR   ','     /* GIF image separator */
-#define GIF_EXTENSION   '!'     /* GIF extension block marker */
-#define GIF_TERMINATOR  ';'     /* GIF terminator */
-
-#define STAB_SIZE  4096         /* string table size */
-#define PSTK_SIZE  4096         /* pixel stack size */
-
-#define NULL_CODE  -1           /* string table null code */
Index: kit/image/imlib_loader.c
diff -u kit/image/imlib_loader.c:1.8 kit/image/imlib_loader.c:1.9
--- kit/image/imlib_loader.c:1.8	Wed Mar 19 10:18:12 2008
+++ kit/image/imlib_loader.c	Sun Feb 15 20:35:19 2009
@@ -6,14 +6,14 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/extensions/shape.h>
-#include <Imlib.h>
+#include <Imlib2.h>
 
 #define IMFILENUM 500
 static char imfile[IMFILENUM][1024];
-static ImlibImage *imdata[IMFILENUM];
+static Imlib_Image *imdata[IMFILENUM];
 static Image *imagedata[IMFILENUM];
 static int imnum;
-static ImlibData *id;
+static Imlib_Context *id;
 
 int imIdent(char *fullname, char *name)
 {
@@ -24,31 +24,70 @@
 {
 	static Display *disp = NULL;
 	Image *image = NULL;
-	ImlibImage *im;
-	ImlibColor shape;
-	unsigned int w,h, size;
-	ImlibImage *search_imdata();
+	Imlib_Image *im;
+	unsigned int w,h, size, i;
+	DATA32 * argb_data;
+	byte * rgb_ptr;
+	Imlib_Image *search_imdata();
 	void regist_imdata();
 
 	if (disp == NULL) {
 		disp=XOpenDisplay(NULL);
 	}
-	if (id == NULL) id=Imlib_init(disp);
+	/*    if (id == NULL) id=Imlib_init(disp); */
+	/* might needs more work */
+	if (id == NULL) {
+		/* dither for non-truecolor displays */
+		imlib_context_set_dither(1);
+		imlib_context_set_display(disp);
+		imlib_context_set_visual(DefaultVisual(display, DefaultScreen(display)));
+		imlib_context_set_colormap(DefaultColormap(display, DefaultScreen(display)));
+	}
 	if ((im = search_imdata(fullname), image) == NULL) {
-		im = Imlib_load_image(id, fullname);
+		/* im = Imlib_load_image(id, fullname); */
+		im = imlib_load_image(fullname);
 	}
 	if (im == NULL) {
 		return NULL;
 	}
-	w = im->rgb_width;
-	h = im->rgb_height;
-	size = w * h * 3;
+	imlib_context_set_image(im);
+	w = imlib_image_get_width();
+	h = imlib_image_get_height();
+	size = w * h;
 
 	if (image == NULL) image = newTrueImage(w, h);
-	memcpy(image->data, im->rgb_data, size);
-	
-	Imlib_get_image_shape(id, im, &shape);
 
+	/* Imlib2 stores images in ARGB format (32 bpp).  MagicPoint
+	 * wants RGB data (24 bpp). So we need a conversion pass. */
+	argb_data = imlib_image_get_data_for_reading_only();
+	rgb_ptr = image->data;
+	for (i = 0; i < size; ++i)
+	{
+		if ((argb_data[i] >> 24) < 128)
+		{
+			/* If this is a transparent pixel, we store #FE00FE. */
+			*rgb_ptr++ = 0xFE;
+			*rgb_ptr++ = 0x00;
+			*rgb_ptr++ = 0xFE;
+			/* Tell mgp we have transparent pixels. */
+			image->trans = 0xFE00FE;
+		}
+		else if ((argb_data[i] & 0x00FFFFFF) == 0x00FE00FE)
+		{
+		/* If that color is actually used, we substitute something close. */
+		*rgb_ptr++ = 0xFF;
+		*rgb_ptr++ = 0x00;
+		*rgb_ptr++ = 0xFE;
+		}
+		else
+		{
+			/* Otherwise, we can copy the pixel. */
+			*rgb_ptr++ = (argb_data[i] >> 16) & 0xFF; /* red */
+			*rgb_ptr++ = (argb_data[i] >> 8) & 0xFF;  /* green */
+			*rgb_ptr++ = argb_data[i] & 0xFF;         /* blue */
+	 	}
+	}
+#if 0
 	/*
 	 * bug fix for transparent gif handling
 	 * suggested by Jose Geraldo Alves Brito Neto <jgabrito@iq.usp.br>
@@ -58,6 +97,7 @@
 	    ((shape.r & 0xff) << 16) |
 	    ((shape.g & 0xff) <<  8) |
 	    ((shape.b & 0xff) <<  0);
+#endif
 
 	image->title = dupString(name);
 #if 0
@@ -69,7 +109,7 @@
 	return image;
 }
 
-ImlibImage *search_imdata(char *fullname, Image *image)
+Imlib_Image *search_imdata(char *fullname, Image *image)
 {
 	int i;
 	for (i = 0; i < imnum; i ++){
Index: kit/image/xloadimage.h
diff -u kit/image/xloadimage.h:1.2 kit/image/xloadimage.h:1.3
--- kit/image/xloadimage.h:1.2	Sat Dec 29 05:31:26 2007
+++ kit/image/xloadimage.h	Sun Feb 15 20:35:19 2009
@@ -16,7 +16,7 @@
 #include "options.h"
 
 #ifdef USE_IMLIB
-#include <Imlib.h>
+#include <Imlib2.h>
 #endif
 
 /* image name and option structure used when processing arguments
Index: kit/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/dns-jp.mgp
diff -u kit/sample/dns-jp.mgp:1.5 kit/sample/dns-jp.mgp:removed
--- kit/sample/dns-jp.mgp:1.5	Fri Sep  4 21:33:18 1998
+++ kit/sample/dns-jp.mgp	Mon Feb 16 05:10:02 2009
@@ -1,130 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%%	This file is automatically created from the file
-%%	main.pre modified at Fri Jan 23 14:31:24 1998
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%include "default.mgp"
-%% "noop" cancels definitions in default.mgp
-%default 1 left, size 7, fore "light yellow", back "blue4", font "standard", ccolor "white", vgap 35
-%default 2 noop
-%default 3 fore "white", bar "gray70", vgap 10
-%default 4 noop
-%tab 1 noop
-%tab 2 noop
-%tab 3 noop
-%%%
-%page
-%nodefault
-%fore "red", back "blue4", size 9, vgap 15
-%center, fore "yellow", font "thick"
-%ccolor "white"
-
-
-
-Root DNS `M' $B$K$D$$$F(B
-
-%size 6, fore "red", font "thick"
-$B2CF#(B   $BO/(B
-
-%size 5, fore "white", font "standard"
-$BEl5~Bg3XBg7?7W;;5!%;%s%?!<(B
-
-
-%font "typewriter"
-kato@wide.ad.jp
-%font "standard"
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (1)
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS
-%fore "white", size 5, font "standard"
-       $B!&(B $B#9Bf$G1?MQ(B
-%fore "white", size 5, font "standard"
-          $B!](B $B#8Bf$,(B US
-          $B!](B Stockholm $B$K#1Bf(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B:GBg$G#1#3Bf(B
-%fore "white", size 5, font "standard"
-          $B!](B $B%Q%1%C%HD9$N@)Ls(B
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS $B$N1?MQ4p=`(B
-%fore "white", size 5, font "standard"
-       $B!&(B RFC 2010
-       $B!&(B gTLD $B$H$N4X78(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (2)
-%fore "red", size 6, font "thick"
-   $B!y(B IEPG $B$G3HD%$r8!F$(B
-   $B!y(B $B%h!<%m%C%QCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B LINX $B$K?7@_(B : 1997 $BG/(B 4 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B RIPE/NCC $B$,4IM}(B
-          $B!](B `K'
-%fore "red", size 6, font "thick"
-   $B!y(B $B%"%8%"B@J?MNCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B NSPIXP-2 $B!'(B 1997 $BG/(B 8 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B WIDE $B$,4IM}(B
-          $B!](B `M'
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  `M'
-%fore "red", size 6, font "thick"
-   $B!y(B $B9=@.(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B#2Bf$N(B PentiumPro 200MHz
-       $B!&(B Primary/Backup$B!"(B $B<+F0@Z$jBX$((B
-%fore "red", size 6, font "thick"
-   $B!y(B Root-only $B%5!<%P(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-202.12.27.33
-%font "standard"
-       $B!&(B 400 $B!A(B 500 query/sec
-%fore "red", size 6, font "thick"
-   $B!y(B $B1?MQ4IM}(B
-%fore "white", size 5, font "standard"
-       $B!&(B WIDE $B$*$h$S(B ISP $BM-;V(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B$*4j$$(B
-%fore "red", size 6, font "thick"
-   $B!y(B $B:G?7$N(B root.cache $B$NF~$l49$((B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-1997082200
-%fore "red", size 6, font "thick"
-   $B!y(B Named $B$N99?7(B
-%fore "white", size 5, font "standard"
-       $B!&(B 4.9.6/8.8.1
-%fore "red", size 6, font "thick"
-   $B!y(B $BM7$P$J$$$G!'(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-ping/traceroute
-%font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-telnet/spray/...
-%fore "red", size 6, font "thick"
-   $B!y(B Thanks to
-%fore "white", size 5, font "standard"
-       $B!&(B $BF|K\(B Cisco/$BB?$/$N(B ISP
-       $B!&(B `M' $B4IM}%0%k!<%W(B
Index: kit/sample/mgp-old1.gif
Index: kit/sample/mgp-old2.gif
Index: kit/sample/mgp-old3.gif
Index: kit/sample/mgp1.gif
Index: kit/sample/mgp2.gif
Index: kit/sample/mgp3.gif
Index: kit/sample/v6header.gif
