I should be stupid !!!
I have lost four hours trying to make me an idea on how color is managed
OK, here is the problem:
I’m programming a C++ program and I use 16 bits in my adaptor with a
and I init SDL, until here works ok.
I start the video mode 800x600x16
screen = SDL_SetVideoMode(800, 600, 0, SDL_HWSURFACE); // I have 16
bits per pixel
screen = SDL_SetVideoMode(800, 600, 16, SDL_HWSURFACE);
and whatever I do, I get:
cout << "\n Bytes per pixel: " << screen->format->BytesPerPixel <<
\n Bytes per pixel : 1
- Oh, one byte per pixel so 256 colors so framebuffer is 8006008 long,
When I fill the screen with a color (say 123) I get only mid screen
// Just until the middle of the window.
I supposed that the other half is alpha chanel, but why?
And this problem happen to:
nueva_sur = SDL_CreateRGBSurface
too, only reports 1 bytes per pixel.
Someone can help me? I’m getting crazy…
I’m using ImageMagick too and Gimp to make the graphics… (png is the
graphic format used)
First, how can I force Gimp to save pictures on 16 bit per pixel, should
I force it?.
Second, My program says that my picture has 800x600x8 ( 8 !!! bits) (
really is the ImageMagick lib who(?) says that )
Then, should I do as follows:
Read the color, look in the palette the RGB components and
put those on my SDL_surface
instead of the pic colors.
( I don’t know if I can explain what I’m trying to say)
Read another and make the same until pixels ends
Thirth, Where can I find info about what is alpha chanels exactly and
how should I use it.
Fourth, Where get the people info about unix c/c++ functions on console,
io calls, and all other stuff,
because I look includes and I try to make me an idea on how
In DOS I used to work with Borland C, Watcom C but they come
with help on their functions,
how works in UNIX?
All the libs don’t explain their structures and functions, so I
am lost and don’t know where to look.
Does the UNIX programmers look into the source code to use a
library? ( If so, then I have so much to learn)