summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-01-28 23:12:20 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-01-28 23:12:20 +0000
commit281403a4d839924df41480fc020f401211a6e88b (patch)
treea9465e88b9f0c660f2080578d1839bd5f4d2ddc7 /firmware
parent5947e49f467cdf3cf5d2acfcc3c0bd6f97ab29f7 (diff)
downloadrockbox-281403a4d839924df41480fc020f401211a6e88b.tar.gz
rockbox-281403a4d839924df41480fc020f401211a6e88b.zip
Work-in-progress transparent bitmaps with 255,0,255 as the transparent color, not yet working on the H100 series
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8476 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-16bit.c58
-rw-r--r--firmware/export/lcd.h11
2 files changed, 69 insertions, 0 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index b13e4cee90..4a6348f9db 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -540,6 +540,64 @@ void lcd_bitmap(const fb_data *src, int x, int y, int width, int height)
540 lcd_bitmap_part(src, 0, 0, width, x, y, width, height); 540 lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
541} 541}
542 542
543/* Draw a partial native bitmap */
544void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
545 int stride, int x, int y, int width,
546 int height) ICODE_ATTR;
547void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y,
548 int stride, int x, int y, int width,
549 int height)
550{
551 fb_data *dst, *dst_end;
552
553 /* nothing to draw? */
554 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
555 || (x + width <= 0) || (y + height <= 0))
556 return;
557
558 /* clipping */
559 if (x < 0)
560 {
561 width += x;
562 src_x -= x;
563 x = 0;
564 }
565 if (y < 0)
566 {
567 height += y;
568 src_y -= y;
569 y = 0;
570 }
571 if (x + width > LCD_WIDTH)
572 width = LCD_WIDTH - x;
573 if (y + height > LCD_HEIGHT)
574 height = LCD_HEIGHT - y;
575
576 src += stride * src_y + src_x; /* move starting point */
577 dst = LCDADDR(x, y);
578 dst_end = dst + height * LCD_WIDTH;
579
580 do
581 {
582 int i;
583 for(i = 0;i < width;i++)
584 {
585 if(src[i] != TRANSPARENT_COLOR)
586 dst[i] = src[i];
587 }
588 src += stride;
589 dst += LCD_WIDTH;
590 }
591 while (dst < dst_end);
592}
593
594/* Draw a full native bitmap with a transparent color */
595void lcd_bitmap_transparent(const fb_data *src, int x, int y,
596 int width, int height)
597{
598 lcd_bitmap_transparent_part(src, 0, 0, width, x, y, width, height);
599}
600
543/* put a string at a given pixel position, skipping first ofs pixel columns */ 601/* put a string at a given pixel position, skipping first ofs pixel columns */
544static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) 602static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
545{ 603{
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 393e91f93e..f4c40fb88c 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -201,11 +201,16 @@ enum
201 FORMAT_ANY /* For passing to read_bmp_file() */ 201 FORMAT_ANY /* For passing to read_bmp_file() */
202}; 202};
203 203
204#define FORMAT_TRANSPARENT 0x40000000
205
206#define TRANSPARENT_COLOR LCD_RGBPACK(255,0,255)
207
204struct bitmap { 208struct bitmap {
205 int width; 209 int width;
206 int height; 210 int height;
207#if LCD_DEPTH > 1 211#if LCD_DEPTH > 1
208 int format; 212 int format;
213 unsigned char *maskdata;
209#endif 214#endif
210 unsigned char *data; 215 unsigned char *data;
211}; 216};
@@ -265,6 +270,12 @@ extern void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
265 int stride, int x, int y, int width, int height); 270 int stride, int x, int y, int width, int height);
266extern void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, 271extern void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width,
267 int height); 272 int height);
273extern void lcd_bitmap_transparent_part(const fb_data *src,
274 int src_x, int src_y,
275 int stride, int x, int y, int width,
276 int height);
277extern void lcd_bitmap_transparent(const fb_data *src, int x, int y,
278 int width, int height);
268#else /* LCD_DEPTH == 1 */ 279#else /* LCD_DEPTH == 1 */
269#define lcd_mono_bitmap lcd_bitmap 280#define lcd_mono_bitmap lcd_bitmap
270#define lcd_mono_bitmap_part lcd_bitmap_part 281#define lcd_mono_bitmap_part lcd_bitmap_part