PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Need A Solution (gapidraw + symbian)

hi,

it seems gapidraw fails on loading a file on a surface,
does anybody know how to solve this problem?

Code:

CGapiSurface* m_pic=new CGapiSurface();
m_pic->CreateSurface(GDSURFACE_SYSTEMMEMORY, TEXT("E:\\MyDir\\Pong.png"));
m_pic->SetColorKey(RGB(255, 0, 255));


the code crashes on CreateSurface();

there are no debuggers, i can't check the return value because my code crashes.
i am using an EXE format.

thanks.!
probably the EXE is limited so i guess than we can't do such.

is there other way on doing it?

i tried this as a start
Code:

char *bmp;
FILE *hFile;
RHeap* RomHeap;
GDBUFFERDESC buffer;
GDBLTFX bltfx;
int size;

CGapiSurface* pBackBuffer=m_GapiDisp->GetBackBuffer();
CGapiSurface* m_pic=new CGapiSurface();
m_pic->CreateSurface(GDSURFACE_SYSTEMMEMORY, 280,50);
m_pic->SetColorKey(RGB(255, 0, 255));

hFile = fopen("E:\\mydir\\pic.png","rb");
fseek( hFile, 0, SEEK_END );
size = ftell( hFile );
fseek( hFile, 0, SEEK_SET );
RomHeap = User::ChunkHeap( NULL, size, size + 64 );
bmp = (char*)RomHeap->Alloc(size);
fread( bmp, sizeof(char), size, hFile );
fclose(hFile);

m_pic->GetBuffer(&buffer;);
Mem::Copy((char*)buffer.pBuffer,bmp,size);
m_pic->ReleaseBuffer();
delete bmp;
pBackBuffer->Blt(NULL, m_pic, NULL, GDBLT_KEYSRC,&bltfx;);
m_GapiDisp->Flip();


thus the result isn't good (when blitting), probably i am doing something wrong.
any suggestions?
If you want to use EXE files on Symbian devices you have to provide image loaders yourself, as you found out.

You cannot simply read a PNG file and copy it to a surface. You need to (a) decode the RGB pixel data, and (b) transform the pixel data into the 444 or 565 pixel format used by the device. You can use CGapiSurface::SetPixels to set one row of pixels in a fast way (this also solves the RGB transformation), but you still need some way to decode the PNG image.

One advice is to use a simple bitmap format, such as TGA, and then use CreateSurface and SetPixels to set the color values.
hi,

for start i saved my pic (3 colors) to raw mode, this is just to make it simple no more.
and managed to load it into the surface.
result below.
i will try work/get a working bmp code.
Attachments:
works.jpg
Great news! Please keep us informed of your progress!
hi,

i had some time making a small animation to my boot logo.
since the n-gage size is not big gapidraw works well with the 'inside' pixel copying.

example in the file.
Attachments:
chipn.zip (82 KB)