IconView with external bitmap

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • IconView with external bitmap

    Hi there,
    I wonder if there is a suitable way of displaying an external (NAND-Flash) bitmap as icon in the iconview widget? As far as I have found in the documentation only GUI_BITMAP and streamed bitmaps are supported, correct?

    If the answer is that I have to overwrite the WM_PAINT event then the widget is out of the game. I mean writing my own widget with that functionality would be much easier than writing a OnPaint function the exisiting one, also because I have no access the to data stored using the IconView-Api functions and during configuration. Isn't there any OnPaint-Event based on the Elements of the IconView not for the whole widget?

    Any suggestions?

    Regards Dirk
  • These functions do not support streaming of bitmaps from non addressable memory. I would require something like ICONVIEW_AddStreamedBitmapItemEx() which does not exist. Another option would be a callback paint function based on items. Then I could paint each item by myself and would not have to paint the whole widget.
  • Hello,
    I saw this post and even if is related to many months ago is exactly what I need today. Someone knows if now exists a ICONVIEW_AddStreamedBitmapItemEx() or some other way to load bitmap on ICONVIEW widget coming from external not addressable memory?

    I tried an alternative solution copying at startup what is written on external flash on external SDRAM that is addressable in order to provide to ICONVIEW_AddBitmapItem a memory address but the system crashes when it tries to execute the GUI_Exec() after the ICONVIEW_AddBitmapItem.

    Best regards,

    The post was edited 1 time, last by Stefano Toselli ().

  • Hello Adrian,

    thank you for your answer. I suppose next release will take more time I have for closing my activity so I'm searching an alternative without use of ICONVIEW widget but just display BITMAPS on a windows. What it is mandatory for me is reading them from external memory without file system.

    I tryed with:



    without success.

    If I work with GUI_DrawStreamedBitmapAuto, so bitmap compiled in the source code it works but reading from external memory doesn't show any image.

    I read on details manual. All examples include use of files but it seems easy transfer this concept to a flash memory where the access is based on offset.

    I wrote call back and I'm sure that in the acBuffer and so in *ppData there are the right bitmpat information; the NumBytesRead includes the right number of bytes read.

    int APP_GetData(void * p, const U8 ** ppData, unsigned NumBytes, U32 Off) {
    ...My flash access to fill acBuffer ...
    *ppData = acBuffer;//// Return number of available bytes//return NumBytesRead;}

    The callback is called twice:
    -the first time to read first 16 bytes with size, format.. information
    - the seconds time to read the whole bitmap created as .dta file with BmpCvt.exe tool. I allocated an acBuffer bigger then bitmap size even if it shouldn't be necessary because the callback should be called more times. (Right?! In my test it seems not true.. this is the reason why I increased acBuffer)

    in debug mode I see all data in the buffers as expected.

    I don't understand why on display nothing appears..

    I don't use functions related to file (CreateFile, ReadFile..) as is done in 2DGL_DrawBMP.c example, but I fill all data as the library expected. May be this the reason of my troubles?
  • Hello all,
    I'm happy to reply with a solution. I like to share it for other users.

    My error was in the callback _GetData

    *ppData = acBuffer;

    the right solution is:

    memcpy(*ppData, _acBuffer, NumBytesRead);

    so I shouldn't move the pointer of callback but copy in the original position of the pointer the read data.

    Have a nice day.
  • Hello,

    Please note that depending on the used functionality the GetData() function has to be implemented differently. The right solution in this case is valid only for streamed bitmap and PNG data.

    For BMP, GIF and JPEG files the buffer needs to be provided by the GetData() function. Details can be found in the section 9.5 "Displaying bitmap files" -> "Getting data with the ...Ex() functions" in the emWin user manual.

    Best regards,
  • iconview widget icons from external flash

    Hi all

    I have been fighting with this problem some days, but I have just now find this thread.

    I have read that a solution was being implemented one year ago. Is already available? wich is the correct way to use BMP files loaded in a external flash as iconview items?

    Thanks in advance,