2017-01-24 04:17 AM
Hi.
I'm using STM32CubeF4 1.14.0 with STemWin 5.32.
I need to draw JPEGs from file using the DrawEx functions where the user has to provide a getData function which reads chunks of data from a file.
However the ...DrawEx functions do not provide any possibilty to cancel an ongoing drawing. As decoding of JPEG files need a lot of time it is necessary to have a possibility to cancel an ongoing drawing. At the moment you always have to wait until the image is fully loaded which may take a long time depending on the size of the image.
The Segger manual states that the drawing function will return immediately if the getData function doesn't return the requested number of bytes whereas the STemWin manual says that the function always has to return at least 1 Byte.
I tried to return 0 in the getData function but this will not cancel an ongoing loading of data from the image file. Instead the function will never return even when it gets no data at all.
In my opinion this is a perfect bug and should be fixed as soon as possible. Without the possibilty to cancel loading the data the library can not be used e.g. for applications like picture frames because one has to react fast on any user input instead to wait for seconds until loading and decompression has finished.
Is there any other possibilty to SAFELY cancel these drawing functions?. This is related to :
2017-03-23 02:28 AM
Thanks for your answer, but this manual of STemWin is exactly the same as I got from segger, or at least I cannot see any difference.
And about the example, this is what I tried to avoid, to convert the image to c file. I want to store the .jpg directly into flash memory.
Thanks.
2017-03-23 02:43 AM
This is because there is no difference in emWin from Segger and STemWin except the name.
IMHO using bin2c.exe to convert your jpeg into c code is exactly what you want to achieve. It just takes the raw binary data of the jpeg and converts it to big array that is linked into your program. If you have a look into your linker map file you will see that the data size is exactly the size of the JPEG and the data resides in flash memory. This also works with BMP, GIF, JPEG and PNG.
Have a look at the function signature of GUI_JPEG_Draw and you will see that pFileData is just a pointer on the start of the raw JPEG data using bin2c is just one way to get the jpeg data into flash.