Image saving problem | developer.brewmp.com Image saving problem | developer.brewmp.com

Developer

Image saving problem

Forums:

I am trying to save image in following way:
pSampleBitmap = ISHELL_LoadBitmap(pApplet->m_pIShell, MOTO_PICTURES"/sun.bmp" );
if (!pSampleBitmap)
{
SM_DBGPRINTF0("[TEST]ISHELL_LoadBitmap failed");
return EFAILED;

IBITMAP_QueryInterface(pSampleBitmap, AEECLSID_DIB, (void**)&pIDib);

IFile* pMyFile = IFILEMGR_OpenFile(pFileMgr, "mytest.bmp", _OFM_CREATE);

//form header - 14 bytes size
IFILE_Write(pMyFile, bHeader, sizeof(bHeader));
//form info header - 40 bytes size
IFILE_Write(pMyFile, bInfoHeader, sizeof(bInfoHeader));

if(pIDib->cntRGB > 0)
{
//in my case cntRGB=256 => I write paletter in a file
IFILE_Write(pMyFile, &pIDib->pRGB, pIDib->cntRGB);

// write pixel data
IFILE_Write(pMyFile, &pIDib->pBmp,filesize - 54 - pIDib->cntRGB);

IFILE_Release(pMyFile);
//
After the file is saved I compare it to original and I've discovered that there are differences and the newly created file is not displayed correctly.

header and infoheader in both files coincide.
But data written from pRGB and pBmp differ

What may be wrong? Any ideas?

p.s. handset - motorola, image has depth = 8, nPitch = -32, size 32x32

why are you starting a new thread?
the motorolas are 18 bit 666 RGB so that might be your issue.

why are you starting a new thread?
the motorolas are 18 bit 666 RGB so that might be your issue.

Hi ,
I want to know how you have retrieved the header information to write? as i have similar issue.

Hi ,
I want to know how you have retrieved the header information to write? as i have similar issue.

Hi,
IFILE_Write(pMyFile, &pIDib->pBmp,filesize - 54 - pIDib->cntRGB);
In your case since your source image is also bmp you are able to calculate filesize but my source is BCI image. so how should i calculate filesize?

Hi,
IFILE_Write(pMyFile, &pIDib->pBmp,filesize - 54 - pIDib->cntRGB);
In your case since your source image is also bmp you are able to calculate filesize but my source is BCI image. so how should i calculate filesize?

charliex wrote:why are you starting a new thread?
the motorolas are 18 bit 666 RGB so that might be your issue.
Thanks a lot!
Could you give a brief sample how to calculate pRGB and pBmp data or offset to them for Motorola?
I'm not sure I understand how to approach this...
p.s.
after iDib was created I read that the colorscheme is 0, i.e. IDIB_COLORSCHEME_NONE
Should I treat file as RGB666 encoded?

charliex wrote:why are you starting a new thread?
the motorolas are 18 bit 666 RGB so that might be your issue.
Thanks a lot!
Could you give a brief sample how to calculate pRGB and pBmp data or offset to them for Motorola?
I'm not sure I understand how to approach this...
p.s.
after iDib was created I read that the colorscheme is 0, i.e. IDIB_COLORSCHEME_NONE
Should I treat file as RGB666 encoded?

well 666 RGB woud be 32 bit value with 0paddedRRRRRRGGGGGGBBBBBB
it should be easy enough to test, consecutively load a bitmap thats all green, all blue and all red and look at the bit patterns., I rarely use the internal brew api stuff, our engines do all their own loading and rendering, so i can't remember if it comes out as a DIB or DDB

well 666 RGB woud be 32 bit value with 0paddedRRRRRRGGGGGGBBBBBB
it should be easy enough to test, consecutively load a bitmap thats all green, all blue and all red and look at the bit patterns., I rarely use the internal brew api stuff, our engines do all their own loading and rendering, so i can't remember if it comes out as a DIB or DDB