43 views
in GUI Development by
Hi Gents,

On startup my EW app loads a bunch of PNGs off SD card and appears to lock up because EwLoadExternBitmap() is blocking. What call could I place within my EwLoadExternBitmap() read loop to get GUI updates serviced (as I'd like to do a progress bar)? EwProcess() ?

1 Answer

0 votes
by

Hi Mike,
for asynchoneous loading of PNGs, the GUI Services team has an external PNG decoder with binding available as a PngViewer package. Please get in contact with services@embedded-wizard.de.

This PngViewer package contains an own implementation of a PNG decoder written in ANSI C and optimized for embedded systems together with a binding to Embedded Wizard.
For the PNG decoder an own PngSource can be implemented. So it can be adapted to read the PNG data from a flash section, from a file or via network.
Any PNG can be loaded at once or incremental, so that the GUI is not blocked by a decoding job even with big PNGs.
Within the package you also get an adjusted ExternBitmap implementation which allows to handle the async/incremental loading.

by
Thanks Rudolf,

 One subsequent question. With the current setup, How can I force externBitmap/PNG resources to get loaded at boot? Rather than them being loaded when the Dialog they are implemented in is Presented. And, also, stay loaded in memory. So that they aren't re-loaded every time said Dialog is dismissed and re-presented.

/ms
ago by
Hi Mike,
If you want to load all external bitmaps at boot, you have to instantiate them and call the 'load' slot. This also can be done by assigning each of them to an ImageView. But make sure you keep the references, otherwise the garbage collector will remove them .
ago by

Can i do this purely with Chora? The following doesnt seem to keep the reference without having an Imageview dragged in. How do I call the load{} slot on this?

var Views::Image test = new Views::Image;
test.Bitmap = Application::Extern_PLC4_18mm;

ago by
The load slot is called as soon as the Image needs the related bitmap, so when it shall be shown.

An alternative way is to just add the external bitmap resources into one of your instances which stays in memory, like root.
Here you can call eg.

signal ExternBitmapAsync.load;
signal ExternBitmapTimed.load;
ago by

Hi Mike,

please check the configuration of your system within the file ewconfig.h - see EW_LAZY_LOAD_BITMAPS:

   EW_LAZY_LOAD_BITMAPS - This macro controls the loading behavior of compressed
   bitmap resources. If this macro is defined with the value 0, the resources are
   loaded immediately and completely into RAM as soon as the application accesses
   them. Thereupon the bitmaps remain in the surface cache (see above). If this
   macro is defined with the value 1, the loading of bitmaps is delayed until the
   application is about to display one frame of the bitmap. In such case this and
   only this frame is loaded into RAM.

Best regards,

Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...