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' stores a string identifing unambiguously an image file to load within this extern bitmap object. The object will thereupon represent the image content so it can be shown e.g. in an Image view. The usage of this property depends on your particular application case and it's up to you how you interpret the content of this property. For example:

Modification of this property at the runtime causes the extern bitmap object to load the specified image file replacing the previous content of the extern bitmap object.

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.