[w3m-dev 03830] Image size of gif animation
* w3mimg/fb/fb_gdkpixbuf.c (get_animation_size): added (get_image_size): use get_animation_size() (fb_image_load): ditto * w3mimg/x11/x11_w3mimg.c (get_animation_size): added (x11_load_image): use get_animation_size() (x11_get_image_size): ditto From: Hiroyuki Ito <hito@crl.go.jp>
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2003-03-27 Hiroyuki Ito <hito@crl.go.jp>
|
||||||
|
|
||||||
|
* [w3m-dev 03830] Image size of gif animation
|
||||||
|
* w3mimg/fb/fb_gdkpixbuf.c (get_animation_size): added
|
||||||
|
(get_image_size): use get_animation_size()
|
||||||
|
(fb_image_load): ditto
|
||||||
|
* w3mimg/x11/x11_w3mimg.c (get_animation_size): added
|
||||||
|
(x11_load_image): use get_animation_size()
|
||||||
|
(x11_get_image_size): ditto
|
||||||
|
|
||||||
2003-03-25 Hiroyuki Ito <hito@crl.go.jp>
|
2003-03-25 Hiroyuki Ito <hito@crl.go.jp>
|
||||||
|
|
||||||
* [w3m-dev 03829] w3mimgdisplay -anim
|
* [w3m-dev 03829] w3mimgdisplay -anim
|
||||||
@@ -7580,4 +7590,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-0.2.1
|
* import w3m-0.2.1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.801 2003/03/24 15:45:55 ukai Exp $
|
$Id: ChangeLog,v 1.802 2003/03/26 15:14:19 ukai Exp $
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fb_gdkpixbuf.c,v 1.10 2003/03/24 15:47:49 ukai Exp $ */
|
/* $Id: fb_gdkpixbuf.c,v 1.11 2003/03/26 15:14:23 ukai Exp $ */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
fb_gdkpixbuf.c 0.3 Copyright (C) 2002, hito
|
fb_gdkpixbuf.c 0.3 Copyright (C) 2002, hito
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -11,6 +11,33 @@ static void draw(FB_IMAGE * img, int bg, int x, int y, int w, int h,
|
|||||||
GdkPixbuf * pixbuf);
|
GdkPixbuf * pixbuf);
|
||||||
static GdkPixbuf *resize_image(GdkPixbuf * pixbuf, int width, int height);
|
static GdkPixbuf *resize_image(GdkPixbuf * pixbuf, int width, int height);
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_animation_size(GdkPixbufAnimation *animation, int *w, int *h)
|
||||||
|
{
|
||||||
|
GList *frames;
|
||||||
|
int iw, ih, n, i;
|
||||||
|
|
||||||
|
frames = gdk_pixbuf_animation_get_frames(animation);
|
||||||
|
n = gdk_pixbuf_animation_get_num_frames(animation);
|
||||||
|
*w = gdk_pixbuf_animation_get_width(animation);
|
||||||
|
*h = gdk_pixbuf_animation_get_height(animation);
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
GdkPixbufFrame *frame;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
frame = (GdkPixbufFrame *) g_list_nth_data(frames, i);
|
||||||
|
pixbuf = gdk_pixbuf_frame_get_pixbuf(frame);
|
||||||
|
iw = gdk_pixbuf_frame_get_x_offset(frame)
|
||||||
|
+gdk_pixbuf_get_width(pixbuf);
|
||||||
|
ih = gdk_pixbuf_frame_get_y_offset(frame)
|
||||||
|
+ gdk_pixbuf_get_height(pixbuf);
|
||||||
|
if (iw > *w)
|
||||||
|
*w = iw;
|
||||||
|
if (ih > *h)
|
||||||
|
*h = ih;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_image_size(char *filename, int *w, int *h)
|
get_image_size(char *filename, int *w, int *h)
|
||||||
{
|
{
|
||||||
@@ -20,8 +47,7 @@ get_image_size(char *filename, int *w, int *h)
|
|||||||
animation = gdk_pixbuf_animation_new_from_file(filename);
|
animation = gdk_pixbuf_animation_new_from_file(filename);
|
||||||
if (animation == NULL)
|
if (animation == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
*w = gdk_pixbuf_animation_get_width(animation);
|
get_animation_size(animation, w, h);
|
||||||
*h = gdk_pixbuf_animation_get_height(animation);
|
|
||||||
gdk_pixbuf_animation_unref(animation);
|
gdk_pixbuf_animation_unref(animation);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -41,8 +67,7 @@ fb_image_load(char *filename, int w, int h, int max_anim)
|
|||||||
if (animation == NULL)
|
if (animation == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
frames = gdk_pixbuf_animation_get_frames(animation);
|
frames = gdk_pixbuf_animation_get_frames(animation);
|
||||||
fw = gdk_pixbuf_animation_get_width(animation);
|
get_animation_size(animation, &fw, &fh);
|
||||||
fh = gdk_pixbuf_animation_get_height(animation);
|
|
||||||
n = gdk_pixbuf_animation_get_num_frames(animation);
|
n = gdk_pixbuf_animation_get_num_frames(animation);
|
||||||
if (max_anim > 0) {
|
if (max_anim > 0) {
|
||||||
n = (max_anim > n) ? n : max_anim;
|
n = (max_anim > n) ? n : max_anim;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: x11_w3mimg.c,v 1.14 2003/03/24 15:48:09 ukai Exp $ */
|
/* $Id: x11_w3mimg.c,v 1.15 2003/03/26 15:14:23 ukai Exp $ */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -40,6 +40,34 @@ struct x11_image {
|
|||||||
int wait;
|
int wait;
|
||||||
Pixmap *pixmap;
|
Pixmap *pixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_animation_size(GdkPixbufAnimation *animation, int *w, int *h)
|
||||||
|
{
|
||||||
|
GList *frames;
|
||||||
|
int iw, ih, n, i;
|
||||||
|
|
||||||
|
frames = gdk_pixbuf_animation_get_frames(animation);
|
||||||
|
n = gdk_pixbuf_animation_get_num_frames(animation);
|
||||||
|
*w = gdk_pixbuf_animation_get_width(animation);
|
||||||
|
*h = gdk_pixbuf_animation_get_height(animation);
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
GdkPixbufFrame *frame;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
frame = (GdkPixbufFrame *) g_list_nth_data(frames, i);
|
||||||
|
pixbuf = gdk_pixbuf_frame_get_pixbuf(frame);
|
||||||
|
iw = gdk_pixbuf_frame_get_x_offset(frame)
|
||||||
|
+gdk_pixbuf_get_width(pixbuf);
|
||||||
|
ih = gdk_pixbuf_frame_get_y_offset(frame)
|
||||||
|
+ gdk_pixbuf_get_height(pixbuf);
|
||||||
|
if (iw > *w)
|
||||||
|
*w = iw;
|
||||||
|
if (ih > *h)
|
||||||
|
*h = ih;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -291,8 +319,7 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
|
|||||||
return 0;
|
return 0;
|
||||||
frames = gdk_pixbuf_animation_get_frames(animation);
|
frames = gdk_pixbuf_animation_get_frames(animation);
|
||||||
n = gdk_pixbuf_animation_get_num_frames(animation);
|
n = gdk_pixbuf_animation_get_num_frames(animation);
|
||||||
iw = gdk_pixbuf_animation_get_width(animation);
|
get_animation_size(animation, &iw, &ih);
|
||||||
ih = gdk_pixbuf_animation_get_height(animation);
|
|
||||||
|
|
||||||
if (self->max_anim > 0) {
|
if (self->max_anim > 0) {
|
||||||
n = (self->max_anim > n) ? n : self->max_anim;
|
n = (self->max_anim > n) ? n : self->max_anim;
|
||||||
@@ -466,7 +493,7 @@ x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w,
|
|||||||
#elif defined(USE_IMLIB2)
|
#elif defined(USE_IMLIB2)
|
||||||
Imlib_Image im;
|
Imlib_Image im;
|
||||||
#elif defined(USE_GDKPIXBUF)
|
#elif defined(USE_GDKPIXBUF)
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbufAnimation *animation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
@@ -493,14 +520,12 @@ x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w,
|
|||||||
*h = imlib_image_get_height();
|
*h = imlib_image_get_height();
|
||||||
imlib_free_image();
|
imlib_free_image();
|
||||||
#elif defined(USE_GDKPIXBUF)
|
#elif defined(USE_GDKPIXBUF)
|
||||||
pixbuf = gdk_pixbuf_new_from_file(fname);
|
animation = gdk_pixbuf_animation_new_from_file(fname);
|
||||||
if (!pixbuf)
|
if (!animation)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*w = gdk_pixbuf_get_width(pixbuf);
|
get_animation_size(animation, w, h);
|
||||||
*h = gdk_pixbuf_get_height(pixbuf);
|
gdk_pixbuf_animation_unref(animation);
|
||||||
|
|
||||||
gdk_pixbuf_unref(pixbuf);
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user