View Full Version : LoadImage from Memory?
jck2ho
04-12-2002, 12:26 AM
Does BREW provide any function to load image from memory? ISHELL_LoadImage only loads images from the resource file.
Besides, is there a fast and efficient way to display a bitmap message? I am drawing the bitmap pixel by pixel, and it's too slow for my application.
Jason
04-12-2002, 10:56 AM
Hi!
If you would like ot load an image from memory to the IImage interface, you can use the API call: IIMAGE_SetStream and put your bitmap into the IMemAStream first. This assumes you are using 1.1 of the SDK. Prior to that, you can just use IIMAGE_SetData directly with your in memory pointer.
Also, if you do not want to interface with the IImage interface, you can first call CONVERTBMP() to get a native pointer for the device, then call IDISPLAY_BitBlt.
As a personal preference, I like to work with IIMAGE interface better.
thanks!
jason.
jck2ho
04-15-2002, 04:13 PM
Is the IImage_SetData implemented in BREW v1.0? Or 1.1?
boheme
04-16-2002, 12:10 AM
I remember using it with the beta version last year. I went into problem, and it was Jason who helped me out.
The code was something like:
IImage * pIImage;
if( (ISHELL_CreateInstance(pApplet->m_pIShell, AEECLSID_WINBMP, (void **)(&pIImage))!=SUCCESS) )
return;
if( (IIMAGE_SetData(pIImage, pBmp, FALSE))==FALSE )
/* pBmp is a pointer to a BMP image in memory */
return;
IIMAGE_SetParm(pIImage,IPARM_OFFSET, 0, yOffset );
IIMAGE_Draw(pIImage, imageBounds->topLeft.x, topLeftYPos);
/* don't forget to delete the data */
IIMAGE_Release( pIImage ); /* this also released the pBmp data (and I didn't like it) */
Later on, I modified my code and used IDISPLAY_BitBlt(). I think it was because the IIMAGE_SetParm didn't provide the possibility to set the raster operation yet.
Well, the BREWAPI doc has details on this issue.
-- boheme
jck2ho
04-23-2002, 06:14 PM
The IIMAGE_SetData doesn't exist in BREW v1.01. May I know how I can use that function?
vBulletin v3.0.13, Copyright ©2000-2009, Jelsoft Enterprises Ltd.