442 views
in GUI Development by
Hi, I have 2 questions

1) If I read an image dynamically in PNG format inside EW is it automatically read as bitmap? and can you send me reference link for the help where I can see details about how to read dynamic images?
2) After reading an image of size lets say 320 by 240 px . Can I use some inbuilt functionality by EW to scale it down to a specific pixel size keeping the aspect ratio intact?
 

P.S.
I already tried autosize but I think it just displays the whole image with the same size and autosizing the View area provided. I want something vise versa, that the view area is fixed and bitmap is rescaled to fix inside the provided view area.
I would be grateful for the help as always :)

Best Regards,
Mariam Sohail

1 Answer

+1 vote
by
 
Best answer

Hello MariamSohail,

concerning the dynamic loading of images please note that Embedded Wizard limits to provide an interface you can implement and so integrate an external image decoder. For more details let me refer to the following chapters:

Displaying dynamically loaded images

Extern Bitmap interface

Once you have an external image decoder integrated and the dynamic images can be loaded, you can display the image using an Image view. The Image view can be configured to scale the image also by taking in account the aspect ratio. See also:

Align, scale or stretch the bitmap within the Image view

I hope it helps you further.

Best regards

Paul Banach

by

Hey Paul,

Thanks for your previous help I am successful in running the Jpeg lib and i can see the external image now. But i have few further questions!

 

1) How to deal if I have two different external bitmaps on one Screen! Can two different external bitmaps on a single screen access EwLoadExternBitmap() without any issues?

Like this

https://ask.embedded-wizard.de/?qa=blob&qa_blobid=6676878427017038787

2)Also what if for one of the external bitmap I don't have a file path, instead I have raw pixel data vector from a function coming! Do you have any suggestions for such a case? should I also handle the case with  raw pixel data vector (without file path) inside the  EwLoadExternBitmap()?

Thank you in advance

by

Hello MariamSohail,

Can two different external bitmaps on a single screen access EwLoadExternBitmap() without any issues?

from EW point of view there is no problem. You can use as many Extern Bitmap objects simultaneously in your project as available memory. For example, you can display several JPEGs simultaneously.

Technically, each Extern Bitmap object will invoke EwLoadExternBitmap() function asking for the desired image content. Which content should be provided is identified by the parameter aName of EwLoadExternBitmap() function. The parameter corresponds to the value you specify in the property Name of the respective Extern Bitmap object. See also Specify the content of the Extern Bitmap object.

Also what if for one of the external bitmap I don't have a file path, instead I have raw pixel data vector from a function coming! Do you have any suggestions for such a case? should I also handle the case with  raw pixel data vector (without file path) inside the  EwLoadExternBitmap()?

EwLoadExternBitmap() does not depend on a file system, file name or any particular image format. If the data source is some memory containing raw pixel data, you can implement EwLoadExtrernBitmap() to directly decode this data. If the raw pixel data is not encoded (it contains already the 'raw' pixel) you can even copy the data into the locked EW bitmap memory. Please note, that if the color format of the raw pixel data is different from the color format of the EW bitmap, you will need to apply an appropriate color conversion on the pixel RGB(A) channels as explained in the chapter Take in account the color format of the bitmap.

Now, let assume you have multiple raw pixel data arrays (each containing different image). In such case you use aName parameter of EwLoadExternBitmap() to select the right array. You could, for example, manage a list of available raw pixel data arrays (= a list of images) with each entry in the list being identified by a unique name. The EwLoadExternBitmap() function searches then within this list for the entry matching aName and, if found, processes its raw pixel data. It is like a simple file system.

I hope it helps you further.

Best regards

Paul Banach

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

...