[w3m-dev 03282] Re: w3m-img for framebuffer update

* w3mimg/fb/fb.c (fb_image_new): ignore no image
				calloc multiple images
		(fb_image_fill): added
		(fb_image_draw): width, height fix
		(fb_image_rotate): fix typo
		(fb_image_copy): added
		(fb_frame_new): added
		(fb_freme_free): added
		(fb_frame_rotate): added
* w3mimg/fb/fb.h (FB_IMAGE): add num, id, delay
		(fb_frame_new): added
		(fb_frame_free): added
		(fb_frame_rotate): added
* w3mimg/fb/fb_gdkpixbuf.c (get_image_size): animation support
		(fb_image_load): animation support
		(draw): add bg, x, y, w, h args
* w3mimg/fb/fb_img.h (fb_image_load): return FB_IMAGE**
* w3mimg/fb/fb_imlib2.c (fb_image_load): return FB_IMAGE**
* w3mimg/fb/fb_w3mimg.c (w3mfb_show_image): animation support
From: Hiroyuki Ito <hito@crl.go.jp>
This commit is contained in:
Fumitoshi UKAI
2002-07-29 15:25:37 +00:00
parent f855d5410e
commit 3e1846025a
8 changed files with 294 additions and 116 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: fb_w3mimg.c,v 1.2 2002/07/22 16:17:32 ukai Exp $ */
/* $Id: fb_w3mimg.c,v 1.3 2002/07/29 15:25:37 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -58,7 +58,7 @@ w3mfb_close(w3mimg_op *self)
static int
w3mfb_load_image(w3mimg_op *self, W3MImage *img, char *fname, int w, int h)
{
FB_IMAGE *im;
FB_IMAGE **im;
if (self == NULL)
return 0;
@@ -66,8 +66,8 @@ w3mfb_load_image(w3mimg_op *self, W3MImage *img, char *fname, int w, int h)
if (!im)
return 0;
img->pixmap = im;
img->width = im->width;
img->height = im->height;
img->width = im[0]->width;
img->height = im[0]->height;
return 1;
}
@@ -76,14 +76,29 @@ w3mfb_show_image(w3mimg_op *self, W3MImage *img, int sx, int sy,
int sw, int sh,
int x, int y)
{
int i;
FB_IMAGE **frame;
#define WAIT_CNT 4
if (self == NULL)
return 0;
fb_image_draw((FB_IMAGE *)img->pixmap,
frame = (FB_IMAGE **)img->pixmap;
i = frame[0]->id;
fb_image_draw(frame[i],
x + self->offset_x, y + self->offset_y,
sx, sy,
(sw ? sw : img->width),
(sh ? sh : img->height));
(sw ? sw : img->width), (sh ? sh : img->height));
if(frame[0]->num > 1){
if(frame[1]->id > WAIT_CNT){
frame[1]->id = 0;
if(i < frame[0]->num - 1)
frame[0]->id = i + 1;
else
frame[0]->id = 0;
}
frame[1]->id += 1;
}
return 1;
}
@@ -93,7 +108,7 @@ w3mfb_free_image(w3mimg_op *self, W3MImage *img)
if (self == NULL)
return;
if (img && img->pixmap) {
fb_image_free((FB_IMAGE *)img->pixmap);
fb_frame_free((FB_IMAGE **)img->pixmap);
img->pixmap = NULL;
img->width = 0;
img->height = 0;