Message: 10
I’m assuming it is. When working with Color Keys the color format for a 24bit BMP was in RGB format like HTML, so I could do “0xRRGGBB” to knock out the background color when blitting.
Uint8 Red = pixel<<16; // I can’t use an Uint8? a single color have only
8 bits? with this shift is Red==000000000000000011111111 ?I understand?
You would think so, but all the variables need to be the same type. If you bit shift an 8 bit number over 16 bits you’ll be left with 00000000 since the data will be stored in 8 bits when its all said and done. What you want to do is store the 8 bits of info within 24 bit blocks. To get the RGB values from Uint24 C == 0xFF8844 for example:
Uint24 R = C>>16; //R=00000000 00000000 11111111;
Uint24 G = (C<<8)>>16; //G=00000000 00000000 10001000;
Uint24 B = (C<<16)>>16; //B=00000000 00000000 01000100;
But I can’t declare it:
a.c: In function int main()': a.c:6:
Uint24’ undeclared (first use this function)
a.c:6: (Each undeclared identifier is reported only once for each
function it appears in.)
a.c:6: parse error before =' token a.c:9:
color’ undeclared (first use this function)
a.c is:
#include
using namespace std;
#include <SDL.h>
int main(){
Uint24 color = 0xFF8844;
for (int j=1; j<=24; j++)
cout << j << ": " << (color << j) << "\n";
}
(P.s.: how work an Uint32 color?)
Then when you put them back together, after you found the new color you need to fill with, you just shift them over again and bit AND them together:
R<<16 == 11111111 00000000 00000000;
G<<8 == 00000000 10001000 00000000;
B == 00000000 00000000 01000100;New C = (R<<16) & (G<<8) & B; //C=11111111 10001000 01000100
I understand:
00100000100101110 &
0000100011110101 => Date: Wed, 29 Jan 2003 17:35:29 -0800
From: “Joby Bednar”
To:
Subject: Re: [SDL] Re: Simple font resize with blend
Reply-To: sdl at libsdl.org
0010100111111111
If you tried to bit AND a 24 bit and an 8 bit, theoretically you are trying to do:
00000000 00000000 11111111
& 11111111Which won’t work too well. Hopefully that helps… and hopefully I got it right. I personally wouldn’t trust me, so try it out and see what happens.
- Joby
http://jobybednar.com
Give someone a program - frustrate them for a day.
Teach them how to program - frustrate them for a lifetime.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030130/37687c0b/attachment.pgp