Set the FrameSize of ExternalBitmap

asked Feb 10, 2017 in GUI Development by favalcatraz

we are introducing the ExternlBitmap on our project, but we fail to set the FrameSize. The error is that the property FrameSize is ONLY READ.

How can we set the FrameSize on the ExternalBitmap?

Do we improve this on method 'EwLoadExternBitmap()'?

1 Answer

0 votes
answered Feb 10, 2017 by Paul Banach

It is not necessary to set those properties. In fact the parameters like the frame size or the number of frames are determined at the creation time of the bitmap. The properties provide only a convenient access to the information stored actually in the bitmap.

Using the external bitmap, I assume you call the GFX function EwCreateBitmap() to create the new bitmap. In such case please take a look at the declaration of this function, you can find in the header file ewgfx.h. The frame size and the number of frames are determined by the paramaters of this function only.

Best regards
commented Feb 10, 2017 by favalcatraz
I've a png image with size 300X150 px. This image is build by two image with 150X150 px

I forced, in the method, the frame size to 150x150 but the result is the image 300X150 resized to 150X150 but no a multi frame image.

If I put this image in a Resources:bitmap and I set the framesize to <150,150> all work properly.
commented Feb 10, 2017 by Paul Banach
I understood, that the original PNG image is 300x150 pixel large and you want it to be stored as two 150x150 pixel large frames, is it right?

In such case:

1.) Create a bitmap with two frames and framesize 150x150:

XBitmap* bitmap = EwCreateBitmap(  EW_PIXEL_FORMAT_NATIVE, EwNewPoint( 150, 150 ), 0, 2 )

2.) When you decompress the PNG file, you have to treat the both frames individually.

You lock the first bitmap frame and copy there the (left?) 150x150 pixel large area from the source PNG file. Then you lock the second frame and copy there the remaining (right?) part of the original PNG file.

To lock the first frame you call the function EwLockBitmap( bitmap, 0, EwNewRect( 0, 0, 150, 150 ), 0, 1 ).

To lock the second frame you call the function EwLockBitmap( bitmap, 1, EwNewRect( 0, 0, 150, 150 ), 0 , 1 )

It is important to understand, that the bitmap treats the frames individually. It is thus not possible to copy an entire PNG content in multiple frames at once. Instead, you have to lock one frame and copy there the PNG contents. Then you lock another frame and copy there there contents.

Does it hep you?

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