GP32 using images and Linux


Dimitry

Still Fresh
Joined
Dec 10, 2003
Messages
18
Location
Barcelona (spain)
Website
Visit site
My firts post, my first help wanted.... :p
I'm learning to program gp32 and by now i'm using Linux for this job.
Now i'm trying to insert images on my programs, but there is no way, i allways get different kinds of scum on the display :angry:
Using C files:

To pass from png file to .c file i've used The Gimp, first i made a conversion from png to bmp and the from bmp to .c file . I got a C structure like this :
Code:
unsigned char thin[]={
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x34, 0x34, 0x34, 0x34, ......
then on the gpmain.c i have this code:
Code:
[..]
GpGraphicModeSet(8, t); 
  for(i = 0; i < 1; i++)

	{

  GpLcdSurfaceGet(&gpDraw[i], i);

	} 
GpSurfaceSet(&gpDraw[0]); 
 GpLcdEnable(); 

	

 h_pal = GpPaletteCreate(256, (GP_PALETTEENTRY*)PicPal);

 GpPaletteSelect(h_pal);          

 GpPaletteRealize();

 h_pal = NULL;

 GpBitBlt(NULL,&gpDraw[1],0,0,320,240,(unsigned char*)thin,0, 0,320,240); 
 GpBitBlt(NULL,&gpDraw[0],0,0,320,240,(unsigned char*)thin,0, 0,320,240); 

while(1)

	{
	GpBitBlt(NULL,&gpDraw[1],0,0,320,240,(unsigned char*)thin,0, 0,320,240);
	GpBitBlt(NULL,&gpDraw[0],0,0,320,240,(unsigned char*)thin,0, 0,320,240);

        }
[..]

and allways the same , like a "magic eye" picture :p

Using gpg files:

I didn't found a program to create this kind of files, i thing i will have to use wine ...
:unsure:
I tried with a created gpg file, but i use geepee32 emulator and seems file strctucture doesn't work on the PC .. is that right ?

Thanks you in advance
 
I assume that the image you're using is 320 x 240, else that would cause a problem as they're the parameters you're passing to the GpBitBlt command.

The GP32 uses a rotated screen so when you convert the image you need to rotate it too. One quick way to check this should be to swap around the parameters (ie 240,320) in the GpBitBlt commands and see if you get a rotated picture.

Also, (and this shouldn't affect how the image is displayed) it's a bit pointless drawing the image of both surfaces as you can only see one at a time. Normally, for standard double buffering, you would draw the image on the hidden surface and then flip the surfaces.

That's all I can think of off the top of my head.
 
A bmp contains palette data at the start, and that is probably what you are trying to display. Add the offset to the actual bitmap data in GpBitBlt and you might get something looking almost like your image appearing (but possibly in the wrong colours)
 
No way, i have the same problem.
I think the error is in the data i put on thin variable , i will search for another program to trasnform pictures on C format on Linux ;)
 
The format of the data is quite straightforward is 256 colour mode.

A 320 x 240 image would be made up of 76800 bytes (funny that), 1 byte per pixel. Each byte represents which colour that pixel should be from the GP32's palette.

The order of the bytes are:
Starting from the bottom left of the image going up, then across.

ie:

239 479
238 478
... ...
... ...
... ...
2 242
1 241
0 240 etc.
 
My guess is that if you see the picture roughly but the colours are all messed up, the colour pallete your image is using is different from the gp32s default pallete. You can use bmp2bin followed by b2x bmp2bin has an option which chooses the gp32 default pallete
 
by now i arrive at the conclusion that the C file gimp created doesn't works well (wel , i created it bad :p ) . Someone know how convert to C files in Linux?
And i have another question, when i use gpg files seems that the programs try to acces to the SMC file system and doesn't access to the PC file system. Can somebody confirm me this ?
thnaks.
 
Back
Top