Screen Dump/Capture Using Memory Devices

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

  • Screen Dump/Capture Using Memory Devices

    Dear emWin community,


    I have built a GUI using various widgets and windows offered by the emWin library. I am now trying to write a function to dump the screen contents from my LCD using memory devices so that I can stream it to my PC for virtual control. However, my memory devices only seem to capture the background. I can't seem to figure out why my memory devices are ignoring the widgets and windows. Am I missing a flag or making my calls to the library incorrectly?


    My code:


    void captureScreen(void) {
    GUI_MEMDEV_Handle hMem;
    U16 *pData; // pixels are 16 bits wide
    int x=80, y=60, ratio1=GUI_xSize/x, ratio2=GUI_ySize/y, rectangles=ratio1 * ratio2, coord1, coord2;

    for (int i=0; i coord1 = (i%ratio1)*x;
    coord2 = (i/ratio2)*y;
    hMem = GUI_MEMDEV_Create(coord1, coord2, x, y);
    GUI_MEMDEV_Select(hMem);
    GUI_MEMDEV_CopyFromLCD(hMem);
    pData = (U16 *)GUI_MEMDEV_GetDataPtr(hMem);
    // capture and transmit x*y 16-bit pixels here
    GUI_MEMDEV_Delete(hMem);
    }

    GUI_MEMDEV_Select(0); // activates LCD, part of clean up
    return;
    }

    Best regards,
    Vincent
  • Hi,

    In general I would do it the same way. I would leave out the GUI_MEMDEV_Select() calls, but the rest looks fine so far.

    Attached is an example which copies the content of the screen and draws it to the background each time the 'Capture Screen' button gets pressed.

    Regards,
    Sven
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • SEGGER - Schoenen wrote:

    Hi,

    In general I would do it the same way. I would leave out the GUI_MEMDEV_Select() calls, but the rest looks fine so far.

    Attached is an example which copies the content of the screen and draws it to the background each time the 'Capture Screen' button gets pressed.

    Regards,
    Sven
    Thanks a bunch Sven! I'll take a look at your code. Why are the GUI_MEMDEV_Select() calls unnecessary?
  • Hi,

    GUI_MEMDEV_CopyFromLCD() selects automatically the given memory device.

    A call of GUI_MEMDEV_Select() is only required if you want to perform drawing operations like GUI_DrawLine(), GUI_DrawBitmap(), or draw another memory device into another with GUI_MEMDEV_Write().

    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.