saving display contents to memory area

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

  • Hi Kerem,

    Maybe you are looking for something like the routine GUI_BMP_Serialize() (just search for it in the manual). In the manual we have a sample where we write to a file. But this should work also when writing the raw data directly to the memory. Just adapt the sample routines shown in the manual to your needs.

    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.
  • I found another way to achieve this, as serialize didn't seem to give me the result I wanted:

    create a memory device using GUI_MEMDEV_Create() - note it doesn't have to be the whole screen if you're memory constrained!
    Select it using GUI_MEMDEV_Select()
    Copy from the display into the memory device using GUI_MEMDEV_CopyFromLCD()
    Get a pointer to the memory device's data using GUI_MEMDEV_GetDataPtr() - returns a void pointer to the pixel data.
    Read out / copy the data from the memory device pointer.
    Clean up using GUI_MEMDEV_Select(0) and GUI_MEMDEV_Delete()

    I achieved a screen dump function by many iterations of this process, without ever having to store the whole screen.
  • Hi Ana,

    Try the code below. There I create a memory device and read the LCD content. Then I get a pointer to the memdev data, change the value where it points to and write back the changed memory device.

    C Source Code

    1. #include "DIALOG.h"
    2. /*********************************************************************
    3. *
    4. * Defines
    5. *
    6. **********************************************************************
    7. */
    8. /*********************************************************************
    9. *
    10. * Static data
    11. *
    12. **********************************************************************
    13. */
    14. /*********************************************************************
    15. *
    16. * Static code
    17. *
    18. **********************************************************************
    19. */
    20. /*********************************************************************
    21. *
    22. * _DrawSomething
    23. */
    24. static void _DrawSomething(void) {
    25. int xSize, ySize;
    26. int i;
    27. xSize = LCD_GetXSize();
    28. ySize = LCD_GetYSize();
    29. GUI_SetColor(GUI_RED);
    30. for (i = 0; i < ySize; i += 10) {
    31. GUI_DrawHLine(i, 0, xSize);
    32. }
    33. }
    34. /*********************************************************************
    35. *
    36. * Public code
    37. *
    38. **********************************************************************
    39. */
    40. /*********************************************************************
    41. *
    42. * MainTask
    43. */
    44. void MainTask(void) {
    45. GUI_MEMDEV_Handle hMem;
    46. U32 * pData;
    47. int x, y;
    48. int xSize, ySize;
    49. GUI_Init();
    50. //
    51. // Draw something on the screen
    52. //
    53. _DrawSomething();
    54. //
    55. // Create a memory device
    56. //
    57. hMem = GUI_MEMDEV_CreateFixed32(30, 30, 80, 80);
    58. //
    59. // Copy the LCD content correpsonding to the position and size of the memory device
    60. //
    61. GUI_MEMDEV_CopyFromLCD(hMem);
    62. //
    63. // Get a pointer to memory device data
    64. //
    65. pData = (U32 *)GUI_MEMDEV_GetDataPtr(hMem);
    66. xSize = GUI_MEMDEV_GetXSize(hMem);
    67. ySize = GUI_MEMDEV_GetYSize(hMem);
    68. for (y = 0; y < ySize; y++) {
    69. for (x = 0; x < xSize; x += 4) {
    70. //
    71. // Use the data pointer to change the content of the memory device
    72. //
    73. *(pData + x + (xSize * y)) = GUI_MAKE_COLOR(0x0000FF00);
    74. }
    75. }
    76. //
    77. // Write the changed memory device back to the screen with an offset
    78. //
    79. GUI_MEMDEV_CopyToLCDAt(hMem, 30, 5);
    80. while (1) {
    81. GUI_Delay(100);
    82. }
    83. }
    84. /*************************** End of file ****************************/
    Display All


    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.