diff options
Diffstat (limited to 'w3mimg/fb/fb_w3mimg.c')
-rw-r--r-- | w3mimg/fb/fb_w3mimg.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/w3mimg/fb/fb_w3mimg.c b/w3mimg/fb/fb_w3mimg.c index 71cc001..6810888 100644 --- a/w3mimg/fb/fb_w3mimg.c +++ b/w3mimg/fb/fb_w3mimg.c @@ -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; |