Images

Images are an important visual aspect of most apps. In Cascades, images are represented by the Image class. You can choose between two types of images: images that are assets (packaged with an app) and external images (generated by the app or coming from other sources). The behavior of these two types and the process for creating them differs.

Image assets
You should use image assets for any images that are used to build your UI (for example, backgrounds, icons, borders, and so on). All images (both assets and non-assets) are loaded asynchronously so that they don't block the UI thread. In some cases, images might be displayed a short time after the rest of the UI.
External images
Images that are loaded into memory are stored in a texture cache. If your app reaches a low-memory state, the app might remove images from the cache that aren't currently visible on the screen. The size and position of these images are maintained in the scene graph to minimize the impact on an app's layout. When those screens become visible again, the app might use an animation effect to display the images that were removed.

The BlackBerry 10 Native SDK also provides the Image rendering (libimg) library, which contains C APIs that you can use to work with images in your apps. This static library provides a common interface for image codecs. You can use the library to encode and decode images in various formats, such as JPG and PNG. For more information, see the Image Library API Reference.

In Cascades, you can use only the PNG, JPG, and GIF formats to create images. Other image formats are not supported.

Last modified: 2015-04-16



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus