Reference for the Mosaic class Resources::ExternBitmap



Using the Extern Bitmap object to load and display image contents dynamically at the runtime.

How to implement the interface between the Extern Bitmap object and an image provider.

The class Resources::ExternBitmap provides the functionality to handle a bitmap loaded at the runtime from an extern image file. Bitmaps loaded in this manner can be used as regular bitmap resources -> they can be shown in all adequate views like Views::Image, Views::Wallpaper, Views::Frame, Views::WarpImage and Views::AttrText.

This class depends on the bitmap loader implementation which of course is specific for each target and pixel format. It is thus up to you to provide this loader implementation for your particular target system. You will need to implement following 'C' function and to link it with the generated GUI application code:

XBitmap* EwLoadExternBitmap( XString aName );

When called the function has the job to open the image file identified by the parameter aName, to create a new GraphicsEngine bitmap object and to load the bitmap object with the content of the image file. The parameter aName corresponds to the property Name.

In the case the content of the image file has changed at the runtime, the extern bitmap object can be triggered to reload the image file by using its method Reload().

property string Name = "";

The property 'Name' identifies the image file loaded within this extern bitmap object. The usage of this property depends on your particular application case. If the image files are loaded from the file system, Name could store the path to the file. If the image files are stored in the memory, the name could be used to distinguish between several available image files. In other words, this property can store a string to identify the desired image file.

A modification of this property at the runtime causes the extern bitmap object to reload the image file.

method void Reload();

The method Reload() triggers the extern bitmap object to reload the image file identified by the property Name. This method is useful if the image file content has changed at the runtime.