aboutsummaryrefslogtreecommitdiffstats
path: root/w3mimg/fb
diff options
context:
space:
mode:
Diffstat (limited to 'w3mimg/fb')
-rw-r--r--w3mimg/fb/fb.c26
-rw-r--r--w3mimg/fb/fb.h3
-rw-r--r--w3mimg/fb/fb_img.c8
-rw-r--r--w3mimg/fb/fb_w3mimg.c12
4 files changed, 45 insertions, 4 deletions
diff --git a/w3mimg/fb/fb.c b/w3mimg/fb/fb.c
index c936784..954525a 100644
--- a/w3mimg/fb/fb.c
+++ b/w3mimg/fb/fb.c
@@ -1,4 +1,4 @@
-/* $Id: fb.c,v 1.9 2002/10/31 09:36:22 ukai Exp $ */
+/* $Id: fb.c,v 1.10 2003/07/07 15:48:17 ukai Exp $ */
/**************************************************************************
fb.c 0.3 Copyright (C) 2002, hito
**************************************************************************/
@@ -365,6 +365,30 @@ fb_height(void)
return vscinfo.yres;
}
+int
+fb_clear(int x, int y, int w, int h, int r, int g, int b)
+{
+ unsigned long bg;
+ int i, offset_fb;
+
+ if (is_open != TRUE || x > fb_width() || y > fb_height())
+ return 1;
+ if (x + w > fb_width())
+ w = fb_width() - x;
+ if (y + h > fb_height())
+ h = fb_height() - y;
+
+ offset_fb = fscinfo.line_length * y + pixel_size * x;
+ bg = ((r >> (CHAR_BIT - vscinfo.red.length)) << vscinfo.red.offset) +
+ ((g >> (CHAR_BIT - vscinfo.green.length)) << vscinfo.green.offset) +
+ ((b >> (CHAR_BIT - vscinfo.blue.length)) << vscinfo.blue.offset);
+ for (i = 0; i < h; i++) {
+ memcpy(buf + offset_fb, bg, pixel_size * w);
+ offset_fb += fscinfo.line_length;
+ }
+ return 0;
+}
+
/********* static functions **************/
static
int
diff --git a/w3mimg/fb/fb.h b/w3mimg/fb/fb.h
index bec281d..1138bb0 100644
--- a/w3mimg/fb/fb.h
+++ b/w3mimg/fb/fb.h
@@ -1,4 +1,4 @@
-/* $Id: fb.h,v 1.6 2002/10/10 16:16:03 ukai Exp $ */
+/* $Id: fb.h,v 1.7 2003/07/07 15:48:17 ukai Exp $ */
#ifndef fb_header
#define fb_header
#include <linux/fb.h>
@@ -29,5 +29,6 @@ int fb_open(void);
void fb_close(void);
int fb_width(void);
int fb_height(void);
+int fb_clear(int x, int y, int w, int h, int r, int g, int b);
#endif
diff --git a/w3mimg/fb/fb_img.c b/w3mimg/fb/fb_img.c
index aad3847..3547a00 100644
--- a/w3mimg/fb/fb_img.c
+++ b/w3mimg/fb/fb_img.c
@@ -1,4 +1,4 @@
-/* $Id: fb_img.c,v 1.5 2002/10/10 16:16:04 ukai Exp $ */
+/* $Id: fb_img.c,v 1.6 2003/07/07 15:48:17 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -24,3 +24,9 @@ fb_image_set_bg(int r, int g, int b)
bg_g = g;
bg_b = b;
}
+
+int
+fb_image_clear(int x, int y, int w, int h)
+{
+ return fb_clear(x, y, w, h, bg_r, bg_g, bg_b);
+}
diff --git a/w3mimg/fb/fb_w3mimg.c b/w3mimg/fb/fb_w3mimg.c
index 5c8fe4c..94674ed 100644
--- a/w3mimg/fb/fb_w3mimg.c
+++ b/w3mimg/fb/fb_w3mimg.c
@@ -1,4 +1,4 @@
-/* $Id: fb_w3mimg.c,v 1.11 2003/04/03 16:35:48 ukai Exp $ */
+/* $Id: fb_w3mimg.c,v 1.12 2003/07/07 15:48:17 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -61,6 +61,15 @@ w3mfb_close(w3mimg_op * self)
}
static int
+w3mfb_clear(w3mimg_op * self, int x, int y, int w, int h)
+{
+ if (self == NULL)
+ return 0;
+ fb_image_clear(x, y, w, h);
+ return 1;
+}
+
+static int
w3mfb_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
{
FB_IMAGE **im;
@@ -179,6 +188,7 @@ w3mimg_fbopen()
wop->set_background = w3mfb_set_background;
wop->sync = w3mfb_sync;
wop->close = w3mfb_close;
+ wop->clear = w3mfb_clear;
wop->load_image = w3mfb_load_image;
wop->show_image = w3mfb_show_image;