30 views
in GUI Development by
Hi,

in my project I am using Charts::PieChart with SegmentImage Charts::Pie100_3.
When generating the code for my STM32 Platform Charts::Pie100_1 is generated, too.
Which is the best solution to avoid Charts::Pie100_1 taking up memory?

Thanks
Dennis Nowak

1 Answer

0 votes
by

Hello Urbaner,

When generating the code for my STM32 Platform Charts::Pie100_1 is generated, too.

your observation is correct. The usage of the bitmap resource Pie100_1 results from the implementation of the PieChart class. It is the default bitmap resource used if no other has been specified in an instance of the PieChart class. The Pie100_1 is thus not eliminated.

Which is the best solution to avoid Charts::Pie100_1 taking up memory?

Eliminating the bitmap resource Pie100_1 is not possible due to the above explained dependency in the implementation of the PieChart class. Also, modifying the original implementation of PieChart class is not possible since this class belongs to Mosaic framework and any modifications in the framework can't be stored. You can, however, override the bitmap resource Pie100_1 by a variant and specify in this variant some image file with small size (e.g. 8x8 pixel). Following are steps:

Step 1: In the Browser window look for the bitmap resource Charts::Pie100_1

Step 2: Drag&Drop the bitmap resource to one of your own project units (e.g. Application unit) while pressing the keys CTRL+SHIFT+ALT.

This operation creates a new variant of the original bitmap resource Pie100_1. This can be seen on the (V) icon. The following screenshots demonstrates the steps. See also the section Create new bitmap resource variant.

Step 3: Using your preferred graphic editor create a new image with e.g. 8x8 pixel size and store it as PNG file.

Step 4: Now, select the variant created in step 2. Thereupon its attributes are shown in Inspector.

Step 5: Change the attribute FileName to refer the new image file with small content (from step 3). The following figure demonstrates it:

Now, when you generate code, the small image is used for the Pie100_1 bitmap resource. In my test, I have used a 8x8 pixel large image file completely transparent. The bitmap resources occupies thus only few bytes.

Does it help you further?

Best regards

Paul Banach

by
Hi Paul,

yes that was the solution I was looking for. It totally fits my needs.

Thanks
Dennis Nowak

Embedded Wizard Website | Privacy Policy | Imprint

...