manoj Posted August 19, 2017 Report Posted August 19, 2017 Is there a way to keep the image open, gdispImageOpenFile(&myImage, "spices.BMP"); gdispImageDraw(&myImage, 0, 0, 480, 272, 0, 0); the image will be closed after the function is completed
inmarket Posted August 19, 2017 Report Posted August 19, 2017 No, the image is not closed after drawing. You can redraw as many times as you like until either the image or the GFILE is explicitly closed. Have a look at the animated image demo which uses this to display sequential frames from a gif image.
wctltya Posted August 20, 2017 Report Posted August 20, 2017 @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?
inmarket Posted August 21, 2017 Report Posted August 21, 2017 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.
inmarket Posted August 21, 2017 Report Posted August 21, 2017 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.
wctltya Posted August 21, 2017 Report Posted August 21, 2017 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.
Joel Bodenmann Posted September 11, 2017 Report Posted September 11, 2017 @inmarket is correct. The gwinImageOpenGFile() function takes a pointer to a GFILE. You can find the corresponding API reference here: http://api.ugfx.io/group___image_box.html#gab097ccfd4e1bcb9000ad5e563ff59ef3
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now