Predefined bitmap drawing methods with BREW ™ September 12, 2003 Author: Qualcomm mobile front line
Draw a predefined bitmap method strong> By using the ISHELL interface ishell_loadResimage For resources) or iShell_loadImage (for file), followed by IIMAGE_DRAW, it is easy to load and draw images from files or resources. This article demonstrates the basic steps required to load and display the bitmap using the ISHELL and IIMAGE interface. P> From the resource displayed step: p> code example: p> From the file display image: p> < OL> code example: p>
Document ID: 48 b>
#define my_res_file "myres.bar" // Load and display bitmap from the resource INT MyDisplayResimage () {type * pimage = null; aeedeviceInfo DM; // Get device information To view color depth iShell_getDeviceInfo (pshell, & dm); // If the color depth is greater than 4, load color bitmap if (DM.NCOLORDEPTH> 4) {// Load image from resources PIMAGE = ishell_loadResImage (pshell, my_res_file, IDB_MY_COLOR_BITMAP );} Else {// Load image from the resource PIMAGE = ISHELL_LOADRESIMAGE (Pshell, My_RES_FILE, IDB_MY_BW_BITMAP);} If (! Pimage) returnif; // Load failed // Draw images at coordinates (0,0) Draw images IIMAGE_DRAW PIIMAGE, 0, 0); // Update Screen iDisplay_update (PDISPLAY); // Release IIMAGE Object IIMAGE_RELEASE (PIMAGE); Return Success;} pre>
// Load and display image from the file INT MyDisplayfil EIMAGE () {iImage * pimage = null; AECHAR * PIMAGEFILE = NULL; AeedEviceInfo DM; AECHAR SZCOLORBMP [] = {'c', 'o', 'L', 'O', 'R', '.', ' B ',' M ',' P '}; AECHAR SZBWBMP [] = {' m ',' o ',' n ',' o ','. ',' b ',' m ',' p '} ; // Get setup information to view color depth iShell_getDeviceInfo (pshell, & dm); // If the color depth is greater than 4, load color bitmap if (DM.NCOLORDEPTH> 4) pimagefile = szcolorbmp;