Can not unloadImage using QML canvas
-
Hello all,
I have a problem with qml canvas. I want to read series of images in hard drive, with each image I load it into qml canvas :
@
onImageChanged : {
canvas.unload(oldUrl);canvas.load(newUrl);
canvas.isImageLoaded(newUrl); //some times false and sometimes true
}onImageLoaded: //request my canvas to paint image was loaded
@
I have a problem when showing to fast 2 different images and my canvas can not unload the old image . So my old image is still in canvas buffer .
I want to finish unload all image in canvas before drawing new one.Could you please help me?
Thank you!
-
Hi,
After unload can you check if the image is unloaded as you have tested earlier using canvas.isImageLoaded(newUrl) ?
bq. canvas.isImageLoaded(newUrl); //some times false and sometimes true
This is because the function loadImage(url image) asynchronously loads the image.
-
Thanks for your answer,
Maybe, canvas.unloadImage is also asynchronous. I hope we can have a signal unloadedImage to check if image is unloaded or not !!!!!!
I have to use a work-around solution like that:
@
canvas.load(newUrl);
if( canvas.isImageLoaded(newUrl) )
// draw newUrl image to canvas.@
Other solutions is welcome
Thank you
-
Are you sure that unloadImage is taking time ?
What does canvas.isImageLoaded(url) show after you unloadImage ? -
Hello,
I want to check that if one image is still on canvas memory I will draw that Image , if not I will draw at OnImageLoaded.
I doubt canvas.unloadImage is not synchronous because :
@
canvas.unloadImage(url);
canvas.isImageLoaed(url) //some time It is true and some time it is false
@ -
According to the source "here":https://qt.gitorious.org/qt/qtdeclarative/source/05f767f777d92f41cec1d8bb9a512b1f2e40ef5f:src/quick/items/context2d/qquickcanvasitem.cpp#L1008-1011 it seems to be synchronous unlike the loadImage function above.
-
One point to bookmark . Though, I have a work-around solution but I will investigate more.
Thank you!