summaryrefslogtreecommitdiff
path: root/src/Fl_BMP_Image.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-07-16 08:38:52 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-07-16 08:38:52 +0000
commit5aa5abdff5dd3d8756de6b662af11ab55427fe16 (patch)
treeb85aefb2b18fed7ad9191d5625608d5705f8ccb3 /src/Fl_BMP_Image.cxx
parent2d5130bef801bb6338ee816b5e795232786f0249 (diff)
Added support for 32bit per pixel subformat, uncompressed, in BMP. Last 8 bit are used as Alpha channel.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4427 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_BMP_Image.cxx')
-rw-r--r--src/Fl_BMP_Image.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Fl_BMP_Image.cxx b/src/Fl_BMP_Image.cxx
index 175375237..c59504ba6 100644
--- a/src/Fl_BMP_Image.cxx
+++ b/src/Fl_BMP_Image.cxx
@@ -186,6 +186,10 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
if (depth == 16)
use_5_6_5 = (read_dword(fp) == 0xf800);
+ // Set byte depth for RGBA images
+ if (depth == 32)
+ bDepth=4;
+
// Setup image and buffers...
d(bDepth);
if (offbits) fseek(fp, offbits, SEEK_SET);
@@ -398,6 +402,15 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
getc(fp);
}
break;
+
+ case 32 : // 32-bit RGBA
+ for (x = w(); x > 0; x --, ptr += bDepth) {
+ ptr[2] = (uchar)getc(fp);
+ ptr[1] = (uchar)getc(fp);
+ ptr[0] = (uchar)getc(fp);
+ ptr[3] = (uchar)getc(fp);
+ }
+ break;
}
}