Prev: Native Streams
Native Icons
Another special class of native objects are native icons. These are instances of
class NativeIcon, declared in
NativeIcon.h. Native icons are created and used by module
graph.
Native icons are simply containers for images stored in memory. A native icon owns one or two associated bitmaps (pixel maps) of type CFbsBitmap, one for the image and an optional one for the mask. If present, the mask must have the same size as the image, and display mode EGray2.
If you write image processing software, it should ideally operate on NativeIcon instances, so it can be used directly by module graph.
For instance, to access the image map of a native icon stored in an m value:
Runtime::Value v = ...
CFbsBitmap *bitmap =
((NativeIcon*)v.GetNativeObjL(NativeIcon::TYPE))->GetImageMap();
|
To create a native icon from a bitmap:
CFbsBitmap *bitmap = ...
CleanupStack::PushL(bitmap);
NativeIcon *icon = new(ELeave) NativeIcon(bitmap);
CleanupStack::Pop(); // bitmap
// NewNativeL() destroys the object if it leaves, so it must not
// be on the cleanup stack
Runtime::Value v = runtime->NewNativeL(icon, NativeIcon::TYPE);
|
Next: Memory Allocation© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-NMI-887