8bit to 24bit conversion
I am trying to take the demo chapter 8_11 (scrolling tile demo) and make it 24 bit. I changed the globals, and made a 24 bit image. The program runs, but each image looks like 1/9 the tilesize (64 x 64). Now I assumed this was because in 24 bit there is 3 times the info of an 8 bit file, but found no where to compensate for this. I came to the conclusion that the create_bob function was making the correct size ddsurfaces, but the load_frame_bob, was not loading the 24 bit images correctly into the surface. If anyone can help me understand what the problem is I would appreciate it. Thank You
Bruno
- Free Your Mind -
- Free Your Mind -
1. nobody will know what the demo chapter 8_11 is from, nor what the functions do unless they read the things you have. case in point i have no idea what you are talking about.
2. conversion of 8bit to 24bit is quite simple. in fact so simple i will show you right here.
Edited by - a person on January 26, 2002 7:19:19 PM
Edited by - a person on January 26, 2002 7:21:06 PM
2. conversion of 8bit to 24bit is quite simple. in fact so simple i will show you right here.
// WARNING: this is PSUDEO code // it assumes thet you understand:// the 24bit format// 8bit format// how to plot/read pixels in both// if not then you porbally should learn that first.for(y=0; y<height; y++)for(x=0; x<width; x++){ colorIndex = Image8bit.pixels[x+y*pitch]; Image24bit.pixels[x+y*pitch].red = = pallete[colorIndex].red; Image24bit.pixels[x+y*pitch].grn = = pallete[colorIndex].grn; Image24bit.pixels[x+y*pitch].blu = = pallete[colorIndex].blu;}// that is the basics of going from 8bit to 24bit.
Edited by - a person on January 26, 2002 7:19:19 PM
Edited by - a person on January 26, 2002 7:21:06 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement