diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-01-31 23:34:02 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-01-31 23:34:02 +0000 |
| commit | b69d59ba8e06de799f7fc13c00e9d038867c38df (patch) | |
| tree | 672f361ddf486b9970cea38fe915b112aa2e85cc | |
| parent | 62b22ba45f8a43cb95a0330c494b421c863f07d6 (diff) | |
| download | rockbox-b69d59ba8e06de799f7fc13c00e9d038867c38df.zip rockbox-b69d59ba8e06de799f7fc13c00e9d038867c38df.tar.gz rockbox-b69d59ba8e06de799f7fc13c00e9d038867c38df.tar.bz2 rockbox-b69d59ba8e06de799f7fc13c00e9d038867c38df.tar.xz | |
Handle 8-bit BMP files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8514 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/recorder/bmp.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c index 5f596ef..28e7281 100644 --- a/apps/recorder/bmp.c +++ b/apps/recorder/bmp.c @@ -297,6 +297,51 @@ int read_bmp_file(char* filename, #endif break; + + case 8: + p = bmpbuf; +#if LCD_DEPTH > 1 + if(format == FORMAT_MONO) { +#endif + /* 8-bit RGB24 palette -> mono */ + for (col = 0; col < width; col++) { + struct rgb_quad rgb = palette[*p]; + ret = brightness(rgb); + if (ret > 96) { + bitmap[width * ((height - row - 1) / 8) + col] + &= ~ 1 << ((height - row - 1) % 8); + } else { + bitmap[width * ((height - row - 1) / 8) + col] + |= 1 << ((height - row - 1) % 8); + } + p++; + } +#if LCD_DEPTH == 2 + } else { + /* 8-bit RGB24 palette -> 2gray (iriver H1xx) */ + for (col = 0; col < width; col++) { + struct rgb_quad rgb = palette[*p]; + ret = brightness(rgb); + + dest[((height - row - 1)/4) * width + col] |= + (~ret & 0xC0) >> (2 * (~(height - row - 1) & 3)); + p++; + } + } +#elif LCD_DEPTH == 16 + } else { + /* 8-bit RGB24 palette -> RGB16 */ + for (col = 0; col < width; col++) { + struct rgb_quad rgb = palette[*p]; + unsigned short rgb16 = + LCD_RGBPACK(rgb.red, rgb.green, rgb.blue); + dest[width * (height - row - 1) + col] = rgb16; + p++; + } + } +#endif + break; + case 24: p = bmpbuf; #if LCD_DEPTH > 1 |