Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Scaling Images Using Qualcomm Brew

Learn how to scale images using both IImage and ITransform under Qualcomm Brew.


advertisement
erhaps the image is one in a resource file, or maybe it's one downloaded from the Web. Regardless, it's on the handset, and you want to scale it to best fit a specific handset's screen. As it turns out, Qualcomm Brew offers two means to do this, one a quick shortcut available in Brew 3.x, and a more robust interface, capable not just of scaling but rotating and shearing bitmaps that has been around since Brew 2.0. This article will show you both methods, as well as explain when you might want to choose one over the other.

Image Scaling Using IPARM_SCALE
If you have an IImage in hand and are running your application on Brew 3.x, the easiest way to scale an image is with the IPARM_SCALE option. Using this option, set prior to drawing your image, you can scale your image to any size you like:



// Prior to drawing the image, get the image data from somewhere pThis->piimage = ISHELL_LoadImage( pThis->a.m_pIShell, “image.jpg” ); IIMAGE_Notify( pThis->piimage, (PFNIMAGEINFO)DrawNotify, pThis ); // Our DrawNotify function static void DrawNotify( CApp pThis, IImage *pi, AEEImageInfo *pinfo, int nErr ) { if ( SUCCESS == nErr ) { IIMAGE_SetParm( pThis->piimage, IPARM_SCALE, pThis->imagecx, pThis->imagecy ); IIMAGE_Draw( pThis->piimage, pThis->imagex, pThis->imagey ); RELEASEIF( pThis->piimage ); } }

This is by far the easiest way to scale an image. Unfortunately, as I write this the lion's share of handsets in consumers' hands are still running variants of Brew 2.x, so this may not be practical for you, because you're stuck implementing your application for the wide variety of presently deployed handsets! What's a developer to do?





Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap