Jump to content

how to keep image open


manoj

Recommended Posts

@inmarket, whether the file will be closed if the object is destroyed?

....
ghImage1 = gwinImageCreate(0, &wi.g);
gwinImageOpenFile(ghImage1, "ugfx_logo_banner.bmp");
...........

gwinDestroy(ghImage1); //Will this close the file "ugfx_logo_banner.bmp", i.e. will it release the resources?

and how to reuse the already opened image file in many image boxes widgets? For example: 

gdispImage myImage;
gdispImageOpenFile(&myImage, "myImage.gif");

then how to use it in multiple image boxes, for example ghImage1...ghImageN?

Link to comment
Share on other sites

From memory...

If you open the image using the filename in the gwin call it will automatically close the file handle when the gwinOmage object is destroyed. 

If you pass on already open GFILE to the gwin call I suspect the original file is not closed when you destroy the gwin object.

The final reference however is the source code. Once I get time later I will check if my memory is correct but have a check for yourself too.

Link to comment
Share on other sites

It looks like I got that wrong. It appears it always closes the file when the gwin object is destroyed.

This is not so nice. While it could be changed to match the behaviour above that is a change in existing behaviour so I am reluctant to do that before the next major version.

Link to comment
Share on other sites

Hi inmarket,

It's OK for me for now, as long as my app depends on that, i.e. that the all resources will be released on the image box destroying. Otherwise I'll  exceed the defined GFILE_MAX_GFILES.

But, I still don't understand how to use in an image box widget an already opened image file. Could you give me an example, please? Because, the only way I know to open an image file in an image widget is  

gwinImageOpenFile(ghImage, "image_file_name");

and really don't know how to display an already opened image in an image box widget.

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...