Hi:
I'm developing a simple program, and i want to put a background image. I have the image in .c, and i know to show it in the display, but my problem is that the background colors aren't the same compared with the real image. There are color like orange, red and yellow.
What can I do?
Thanks!
Bye.
Edit: http://www.megaupload.com/?d=011A728B
I put this file with:
- The original image
- The EBOOT.PBP
- main.c
- foto.c
- Makefile
I have been thinking and I think that maybe, I could be that the photo is 24bit.
Problem showing images (UPDATED, please check it)
-
- Posts: 29
- Joined: Tue Aug 30, 2005 10:37 am
- Contact:
I didn't look at your code..
The image is showing up correctly, just the wrong colours?
Are you loading and parsing the palette correctly? Are you using the same palette depth as you're showing?
ie: If you're in a 444-4 type display mode (4bits for each component), then you just can't get the same colour accuracy as in a higher colour image; and if you load such an image and don't mask the palette bits right, it'd go all to hell when you shift them into a 16-bit colour value.. (depending how you determine your 16bit value, say.)
So without looking at your code, I wonder.. did you correctly parse the palette into the format needed by your display settings?
jeff
The image is showing up correctly, just the wrong colours?
Are you loading and parsing the palette correctly? Are you using the same palette depth as you're showing?
ie: If you're in a 444-4 type display mode (4bits for each component), then you just can't get the same colour accuracy as in a higher colour image; and if you load such an image and don't mask the palette bits right, it'd go all to hell when you shift them into a 16-bit colour value.. (depending how you determine your 16bit value, say.)
So without looking at your code, I wonder.. did you correctly parse the palette into the format needed by your display settings?
jeff
--
Have you played Atari today?
Have you played Atari today?
-
- Posts: 19
- Joined: Tue Jul 05, 2005 7:35 am
Here are the functions I made to convert a 16bit image to a 32bit image. It's extreamly newbie code, but it was how I played around with it.
There are a couple of good threads that explain the 16 and 32bit display modes. http://forums.ps2dev.org/viewtopic.php?t=2899
There are a couple of good threads that explain the 16 and 32bit display modes. http://forums.ps2dev.org/viewtopic.php?t=2899
Code: Select all
// Take a pixel in 16bit color format and convert it to 32bit color format
// Does not include the alpha bit
unsigned int pixel_16to32(unsigned int sourceColor)
{
unsigned int destColor;
int r, g, b;
b = (sourceColor&0x7C00)>>10 ;
g = (sourceColor&0x03E0)>>5 ;
r = (sourceColor&0x001F) ;
destColor = ((b&0x1F)<<19)|((g&0x1F)<<11)|((r&0x1F)<<3) ;
return destColor;
}
// Take the image in mypic.c which is in the array gfxconv_img
// copy it to vram and convert it to 32bit color using the function above
void drawimage(void)
{
// draw image
int x, y;
u32* vram = (u32*) (0x40000000 | 0x04000000);
for (y = 0; y < 272; y++) {
for (x = 0; x < 480; x++) {
vram[x + y * 512] = pixel_16to32(gfxconv_img[x + y*480]) ;
}
}
}