dnl IMLIB2
dnl
-dnl --commented out until brenden finishes it --
-dnl AC_ARG_ENABLE([imlib2],
-dnl AC_HELP_STRING([--enable-imlib2], [enable if you want Imlib2 support [[default=no]]]),
-dnl [want_imlib2="$enableval"], [want_imlib2=no])
-dnl
-dnl AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
-dnl if test x$want_imlib2 = xyes; then
-dnl PKG_CHECK_MODULES([Imlib2], [imlib2])
-dnl CFLAGS="$CFLAGS $Imlib2_CFLAGS"
-dnl LIBS="$LIBS $Imlib2_LIBS"
-dnl AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
-dnl fi
+AC_ARG_ENABLE([imlib2],
+ AC_HELP_STRING([--enable-imlib2], [enable if you want Imlib2 support [[default=no]]]),
+ [want_imlib2="$enableval"], [want_imlib2=no])
+
+AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
+if test x$want_imlib2 = xyes; then
+ PKG_CHECK_MODULES([Imlib2], [imlib2])
+ CFLAGS="$CFLAGS $Imlib2_CFLAGS"
+ LIBS="$LIBS $Imlib2_LIBS"
+ AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
+fi
dnl
nvidia: $want_nvidia
eve-online: $want_eve
config-output: $want_config_output
+ IMLIB2: $want_imlib2
EOF
#endif /* IBM */
#ifdef NVIDIA
" * nvidia\n"
-#endif
+#endif /* NVIDIA */
#ifdef EVE
" * eve-online\n"
#endif /* EVE */
#ifdef CONFIG_OUTPUT
" * config-output\n"
#endif /* CONFIG_OUTPUT */
+#ifdef IMLIB2
+ " * IMLIB2\n"
+#endif /* IMLIB2 */
);
exit(0);
Imlib_Image image, buffer;
image = imlib_load_image(obj->data.s);
- imlib_context_set_image(image);
if (image) {
int w, h;
+ imlib_context_set_image(image);
w = imlib_image_get_width();
h = imlib_image_get_height();
buffer = imlib_create_image(w, h);
- imlib_context_set_display(display);
- imlib_context_set_drawable(window.drawable);
- imlib_context_set_colormap(DefaultColormap(display,
- screen));
- imlib_context_set_visual(DefaultVisual(display,
- screen));
imlib_context_set_image(buffer);
imlib_blend_image_onto_image(image, 0, 0, 0, w, h,
text_start_x, text_start_y, w, h);
imlib_render_image_on_drawable(text_start_x,
text_start_y);
imlib_free_image();
- imlib_context_set_image(image);
- imlib_free_image();
}
}
}
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include <X11/Xutil.h>
+#ifdef IMLIB2
+#include <Imlib2.h>
+#endif /* IMLIB2 */
#ifdef XFT
#include <X11/Xft/Xft.h>
/* some basic X11 stuff */
Display *display;
+#ifdef IMLIB2
+Visual *visual;
+Colormap colourmap;
+int depth;
+#endif /* IMLIB2 */
int display_width;
int display_height;
int screen;
fflush(stderr);
XMapWindow(display, window.window);
+
} else /* if (own_window) { */
#endif
- /* root / desktop window */
+ /* root / desktop window */
{
XWindowAttributes attrs;
fprintf(stderr, PACKAGE_NAME": drawing to single buffer\n");
}
#endif
-
+#ifdef IMLIB2
+ visual = DefaultVisual(display, DefaultScreen(display));
+ depth = DefaultDepth(display, DefaultScreen(display));
+ colourmap = DefaultColormap(display, DefaultScreen(display));
+ /* set our cache to 4MiB so it doesn't have to go hit the disk as long as */
+ /* the images we use use less than 4MiB of RAM (that is uncompressed) */
+ imlib_set_cache_size(4092 * 1024);
+ /* set the font cache to 512KiB - again to avoid re-loading */
+ imlib_set_font_cache_size(512 * 1024);
+ /* set the maximum number of colors to allocate for 8bpp and less to 128 */
+ imlib_set_color_usage(128);
+ /* dither for depths < 24bpp */
+ imlib_context_set_dither(1);
+ /* set the display , visual, colormap and drawable we are using */
+ imlib_context_set_display(display);
+ imlib_context_set_visual(visual);
+ imlib_context_set_colormap(colourmap);
+ imlib_context_set_drawable(window.drawable);
+#endif /* IMLIB2 */
XFlush(display);
/* set_transparent_background(window.window);