I know how to read out the raw data into an array of 2-Byte Integers. But I wanna save the texture as a 24-Bit bitmap. For that I've got to convert the 16-Bit data into 24-Bit data.
Any Ideas?
- Alhexx
Anyway, I'll still try and give you some help.
In 16-bit data the data is often stored in 5-6-5 format. IE: 5 bit red, 6 bit green, 5 bit blue. Lets assume that's what your data is. (It might not be, but the code is similar even if it's not).
Take one pixel, in a 2-byte variable called Orig.
You want to move it into a 3-byte (really 4, but there you go) variable called NewC, say.
R := (Orig and $1F);
G := (Orig shr 5) and $3F;
B := (Orig shr 11) and $1F;
Now you've got each colour component in it's separate variable, but it's only 5 or 6 bits, not 8 like you want.
R := Trunc(R * 8.25);
G := Trunc(G * 4.05);
B := Trunc(R * 8.25);
Scale 'em up. You scale G by less because it had more bits of data, so needs to be scaled up less.
Finally
NewC := R or (G shl 8) or (B shl 16);
Haven't tested this code but it's the sort of thing you need.
Questions (probably)..?
Okay, I've gotta tell u something...
I already got it. It took me the whole sunday to program this, but okay. So
THANK YOU (anyway) for your help!!!
BTW: I'm going to finish 'Texture Beast' today and perhaps upload it today. FF7 and FF8 plugins will be included.
(What's fantastic: The plugins aren't bigger than 100 Bytes (!!!))
- Alhexx
- edit -
BTW: Supported by Texture Beast are:
8-Bit Paletted
16-Bit 5-5-5 RGB
16-Bit 5-5-5 BGR
16-Bit 5-6-5 RGB
16-Bit 5-6-5 BGR
24-Bit RGB
24-Bit BGR
32-Bit RGBA
32-Bit BGRA
[This message has been edited by Alhexx (edited September 10, 2001).]