IIMAGE_DrawFrame and PNG | developer.brewmp.com IIMAGE_DrawFrame and PNG | developer.brewmp.com

Developer

IIMAGE_DrawFrame and PNG

Forums:

Does anyone know of any issues with IIMAGE_DrawFrame using a PNG image. I am able to do it with a BMP but not a PNG. I've looked at the documentation and searched the forum but could not find any relevant information.

Thanks

Depends on the handset. Not all handsets can display PNG images at all. Check the Device Data Sheet for the handset your working for for the specs.

Depends on the handset. Not all handsets can display PNG images at all. Check the Device Data Sheet for the handset your working for for the specs.

The phone I'm working with does support PNG, but I can't even get this to work in the emulator. Here is some sample code of what I'm doing:
if (pFeatured->imageData)
{
clsId = ISHELL_GetHandler(pMe->a.m_pIShell, HTYPE_VIEWER, "image/png");
if (clsId)
{
if(ISHELL_CreateInstance(pMe->a.m_pIShell, clsId, (void **)(&pIImage)) != SUCCESS)
{
DBGPRINTF("No IImage interface\n");
}
}
if (ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM, (void **)(&pMemStream)) == SUCCESS)
{
IMEMASTREAM_Set(pMemStream, pFeatured->imageData, pFeatured->imageSize, 0, 0);
IIMAGE_SetStream(pIImage, (IAStream*)pMemStream);
IIMAGE_SetFrameCount(pIImage, 3);
IIMAGE_SetFrameSize(pIImage, 11);
IIMAGE_DrawFrame(pIImage, 0, 3, 32);
IDISPLAY_UpdateEx(pMe->a.m_pIDisplay, TRUE);
}

The phone I'm working with does support PNG, but I can't even get this to work in the emulator. Here is some sample code of what I'm doing:
if (pFeatured->imageData)
{
clsId = ISHELL_GetHandler(pMe->a.m_pIShell, HTYPE_VIEWER, "image/png");
if (clsId)
{
if(ISHELL_CreateInstance(pMe->a.m_pIShell, clsId, (void **)(&pIImage)) != SUCCESS)
{
DBGPRINTF("No IImage interface\n");
}
}
if (ISHELL_CreateInstance(pMe->a.m_pIShell, AEECLSID_MEMASTREAM, (void **)(&pMemStream)) == SUCCESS)
{
IMEMASTREAM_Set(pMemStream, pFeatured->imageData, pFeatured->imageSize, 0, 0);
IIMAGE_SetStream(pIImage, (IAStream*)pMemStream);
IIMAGE_SetFrameCount(pIImage, 3);
IIMAGE_SetFrameSize(pIImage, 11);
IIMAGE_DrawFrame(pIImage, 0, 3, 32);
IDISPLAY_UpdateEx(pMe->a.m_pIDisplay, TRUE);
}

I know this is 2.1 forum, but I couldn't get PNGs to display on 2.0 Win32 emu, too.
Try this on the phone, if phone supports PNGs (all 2.1 phones I know about do), it should work.

I know this is 2.1 forum, but I couldn't get PNGs to display on 2.0 Win32 emu, too.
Try this on the phone, if phone supports PNGs (all 2.1 phones I know about do), it should work.

I believe the PNG viewer decodes asynchronously, so the problem is probably that the decoding hasn't finished at the point you call DrawFrame(). What you need to do is use IIMAGE_Notify(), to register a callback that tells you when the decoding is done.
Also, you should know that the PNG viewer does not support any type of animation. Calling SetFrameCount() and SetFrameSize() has no effect.

I believe the PNG viewer decodes asynchronously, so the problem is probably that the decoding hasn't finished at the point you call DrawFrame(). What you need to do is use IIMAGE_Notify(), to register a callback that tells you when the decoding is done.
Also, you should know that the PNG viewer does not support any type of animation. Calling SetFrameCount() and SetFrameSize() has no effect.