[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>
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,14 @@
|
||||
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
|
||||
@@ -6652,4 +6663,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
||||
* release-0-2-1
|
||||
* import w3m-0.2.1
|
||||
|
||||
$Id: ChangeLog,v 1.698 2003/01/21 15:33:16 ukai Exp $
|
||||
$Id: ChangeLog,v 1.699 2003/01/21 15:38:55 ukai Exp $
|
||||
|
12
configure
vendored
12
configure
vendored
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $Id: configure,v 1.92 2003/01/21 15:33:19 ukai Exp $
|
||||
# $Id: configure,v 1.93 2003/01/21 15:38:57 ukai Exp $
|
||||
# Configuration.
|
||||
#
|
||||
|
||||
@@ -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`"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: x11_w3mimg.c,v 1.11 2002/12/25 16:14:45 ukai Exp $ */
|
||||
/* $Id: x11_w3mimg.c,v 1.12 2003/01/21 15:38:59 ukai Exp $ */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
@@ -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)
|
||||
|
Reference in New Issue
Block a user