summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-04-14 08:54:45 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-04-14 08:54:45 (GMT)
commit1e7e1d6b1c7c1b754041615350d0b29732da809d (patch)
treecee83f8b2517092cc1cf2597cc947054c2bfbe95
parent3e1f9d1ca1bc599a401ee66793c5aa6885354ac0 (diff)
download5kk53-1e7e1d6b1c7c1b754041615350d0b29732da809d.zip
5kk53-1e7e1d6b1c7c1b754041615350d0b29732da809d.tar.gz
5kk53-1e7e1d6b1c7c1b754041615350d0b29732da809d.tar.bz2
Writing 8 bit grayscale image
-rw-r--r--src/bmp.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bmp.c b/src/bmp.c
index e8cdd87..4262e81 100644
--- a/src/bmp.c
+++ b/src/bmp.c
@@ -59,6 +59,19 @@ void WriteBMPHeaderInfo(unsigned char *Image,unsigned int offset,unsigned int x_
Image[36] = ByteSize >> 16;
Image[35] = ByteSize >> 8;
Image[34] = ByteSize;
- for(i = 38; i < offset; i++)
+
+ /* If it is a grayscale image of 8 bits we need to make the palette available */
+ if(depth == 8)
+ {
+ for(i = 0; i <= 0xff; i++) {
+ Image[(i*4)+54]=i;
+ Image[(i*4)+1+54]=i;
+ Image[(i*4)+2+54]=i;
+ Image[(i*4)+3+54]=00;
+ }
+
+ }
+ else
+ for(i = 38; i < offset; i++)
Image[i]=0;
}