w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 548de8cde5eaac8585ff1b1d6da6ef3bfa17639b
parent f26cbb4c5b9f93b8843988146277b5de04ba0ff3
Author: ukai <ukai>
Date:   Tue, 21 Jan 2003 15:38:55 +0000

[w3m-dev 03665] imlib2 support (on X11)
* configure: X11 inline image with Imlib2
	fix typo in fb/imlib2
* w3mimg/x11/x11_w3mimg.c: USE_IMLIB2
	(x11_load_image): USE_IMLIB2
	(x11_show_image): USE_IMLIB2
	(x11_free_image): USE_IMLIB2
	(x11_get_image_size): USE_IMLIB2
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 11+++++++++++
Mconfigure | 10++++++++--
Mw3mimg/x11/x11_w3mimg.c | 42++++++++++++++++++++++++++++++++++++++++--
3 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,16 @@ 2003-01-22 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03665] imlib2 support (on X11) + * configure: X11 inline image with Imlib2 + fix typo in fb/imlib2 + * w3mimg/x11/x11_w3mimg.c: USE_IMLIB2 + (x11_load_image): USE_IMLIB2 + (x11_show_image): USE_IMLIB2 + (x11_free_image): USE_IMLIB2 + (x11_get_image_size): USE_IMLIB2 + +2003-01-22 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03664] config.param is clear when configure -help * configure: config.param created after arg parsing diff --git a/configure b/configure @@ -820,7 +820,7 @@ ask_param "Inline image support" use_image n if [ "$use_image" = y ]; then def_use_image="#define USE_IMAGE" imgtarget='$(IMGDISPLAY)' - ask_param "X11 inline image support (you need Imlib1 or GdkPixbuf library)" use_w3mimg_x11 y + ask_param "X11 inline image support (you need Imlib, Imlib2 or GdkPixbuf library)" use_w3mimg_x11 y d_w3mimg_fb=n case $sysname in Linux|linux|LINUX) @@ -2177,6 +2177,12 @@ if [ "$use_image" = y ]; then imgobjs="$imgobjs w3mimg/x11/x11_w3mimg.o" imgx11cflags="`${IMLIB_CONFIG} --cflags`" imgx11ldflags="`${IMLIB_CONFIG} --libs`" + elif find_imlib2; then + def_use_w3mimg_x11="#define USE_W3MIMG_X11" + def_use_imlib2='#define USE_IMLIB2' + imgobjs="$imgobjs w3mimg/x11/x11_w3mimg.o" + imgx11cflags="`${IMLIB2_CONFIG} --cflags`" + imgx11ldflags="`${IMLIB2_CONFIG} --libs`" else use_w3mimg_x11=n echo "Disable X11 inline image" @@ -2190,7 +2196,7 @@ if [ "$use_image" = y ]; then imgfbcflags="`${GDKPIXBUF_CONFIG} --cflags`" imgfbldflags="`${GDKPIXBUF_CONFIG} --libs`" elif find_imlib2; then - def_use_imlib2='#define USE_IMLIB2' + def_use_w3mimg_fb='#define USE_W3MIMG_FB' imgobjs="$imgobjs w3mimg/fb/fb_w3mimg.o w3mimg/fb/fb.o w3mimg/fb/fb_img.o" def_use_imlib2='#define USE_IMLIB2' imgfbcflags="`${IMLIB2_CONFIG} --cflags`" diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c @@ -6,6 +6,10 @@ #if defined(USE_IMLIB) #include <Imlib.h> +#elif defined(USE_IMLIB2) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <Imlib2.h> #elif defined(USE_GDKPIXBUF) #include <gdk-pixbuf/gdk-pixbuf-xlib.h> #else @@ -227,6 +231,8 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h) struct x11_info *xi; #if defined(USE_IMLIB) ImlibImage *im; +#elif defined(USE_IMLIB2) + Imlib_Image im; #elif defined(USE_GDKPIXBUF) GdkPixbufAnimation *animation; GList *frames; @@ -258,6 +264,27 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h) XFillRectangle(xi->display, (Pixmap) img->pixmap, xi->imageGC, 0, 0, w, h); Imlib_paste_image(xi->id, im, (Pixmap) img->pixmap, 0, 0, w, h); Imlib_kill_image(xi->id, im); +#elif defined(USE_IMLIB2) + im = imlib_load_image(fname); + if (!im) + return 0; + imlib_context_set_image(im); + if (w <= 0) + w = imlib_image_get_width(); + if (h <= 0) + h = imlib_image_get_height(); + img->pixmap = (void *)XCreatePixmap(xi->display, xi->parent, w, h, + DefaultDepth(xi->display, 0)); + if (!img->pixmap) + return 0; + XSetForeground(xi->display, xi->imageGC, xi->background_pixel); + XFillRectangle(xi->display, (Pixmap) img->pixmap, xi->imageGC, 0, 0, w, h); + imlib_context_set_display(xi->display); + imlib_context_set_visual(DefaultVisual(xi->display, 0)); + imlib_context_set_colormap(DefaultColormap(xi->display, 0)); + imlib_context_set_drawable((Drawable)img->pixmap); + imlib_render_image_on_drawable_at_size(0, 0, w, h); + imlib_free_image(); #elif defined(USE_GDKPIXBUF) animation = gdk_pixbuf_animation_new_from_file(fname); if (!animation) @@ -363,7 +390,7 @@ x11_show_image(w3mimg_op * self, W3MImage * img, int sx, int sy, int sw, if (xi == NULL) return 0; -#if defined(USE_IMLIB) +#if defined(USE_IMLIB) || defined(USE_IMLIB2) XCopyArea(xi->display, (Pixmap) img->pixmap, xi->window, xi->imageGC, sx, sy, (sw ? sw : img->width), @@ -398,7 +425,7 @@ x11_free_image(w3mimg_op * self, W3MImage * img) xi = (struct x11_info *)self->priv; if (xi == NULL) return; -#if defined(USE_IMLIB) +#if defined(USE_IMLIB) || defined(USE_IMLIB2) if (img && img->pixmap) { XFreePixmap(xi->display, (Pixmap) img->pixmap); img->pixmap = NULL; @@ -432,6 +459,8 @@ x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w, struct x11_info *xi; #if defined(USE_IMLIB) ImlibImage *im; +#elif defined(USE_IMLIB2) + Imlib_Image im; #elif defined(USE_GDKPIXBUF) GdkPixbuf *pixbuf; #endif @@ -450,6 +479,15 @@ x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w, *w = im->rgb_width; *h = im->rgb_height; Imlib_kill_image(xi->id, im); +#elif defined(USE_IMLIB2) + im = imlib_load_image(fname); + if (im == NULL) + return 0; + + imlib_context_set_image(im); + *w = imlib_image_get_width(); + *h = imlib_image_get_height(); + imlib_free_image(); #elif defined(USE_GDKPIXBUF) pixbuf = gdk_pixbuf_new_from_file(fname); if (!pixbuf)