emWin screens - Resolution tolerant design

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

  • emWin screens - Resolution tolerant design

    Dear all,

    We would like to know if emWin supports design of resolution tolerant UI screens.

    Currently we are using 7" LCD, supporting resolution 800*480.

    We are curious to know the things to be taken care while designing such a UI that can be easily portable across multiple resolutions (with very minimal effort) as well as even LCD dimensions are changed (say, 10").
    Some obvious points may be:-
    1. Use relative positioning (instead of hard-coded position values) for all widgets.

    2. Use macros for the resolution (xsize/ysize) - then it can be easily modifiable.

    What about fonts, icons, other widgets?
    Could anyone please suggest some ideas on this?

    Thanking you in advance,
    Lullaby
  • Hi,

    you can design you application in a way that it will fit on diffrent displays.

    Of course you have to avoid fixed values. One thing we use quite often is to get the screen size by calling LCD_GetXSize() (or the appropriate function for Y) and use this as a base for setting window sizes and/or position.

    You can put the resolution defines X_SIZE_PHYS/X_SIZE_PHYS from the LCDConf.c in a header (e.g. LCDConf.h). This will make these defines available in application, too and you can use them in a macro.

    With bitmaps or fonts it is not that easy. But you can use preprocessor defines to distinguish which bitmaps or fonts should be linked with you application.

    Maybe like this:

    C Source Code

    1. #if XSIZE == 480
    2. extern GUI_CONST_STORAGE GUI_BITMAP bmIcon_50x50;
    3. extern GUI_CONST_STORAGE GUI_FONT GUI_FontAA4_20;
    4. extern GUI_CONST_STORAGE GUI_FONT GUI_FontAA4_20B;
    5. extern GUI_CONST_STORAGE GUI_FONT GUI_FontAA4_32B;
    6. #define BITMAP_0 &bmHeartBeat_50x50
    7. #define FONT_DEFAULT &GUI_FontAA4_20
    8. #define FONT_DEFAULT_BOLD &GUI_FontAA4_20B
    9. #define FONT_LARGE &GUI_FontAA4_32B
    10. #elif XSIZE == 800
    11. extern GUI_CONST_STORAGE GUI_BITMAP bmIcon_100x100;
    12. extern GUI_CONST_STORAGE GUI_FONT GUI_FontAA4_30;
    13. extern GUI_CONST_STORAGE GUI_FONT GUI_FontAA4_30B;
    14. extern GUI_CONST_STORAGE GUI_FONT GUI_FontAA4_40B;
    15. #define BITMAP_0 &bmHeartBeat_50x50
    16. #define FONT_DEFAULT &GUI_FontAA4_30
    17. #define FONT_DEFAULT_BOLD &GUI_FontAA4_30B
    18. #define FONT_LARGE &GUI_FontAA4_40B
    19. #endif
    Display All


    Later in your application you can call e.g. GUI_DrawBitmap(BITMAP_0, 0, 0) and depending on your screen size a diffrent bitmap gets drawn.
    The same works with the fonts.

    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.