1 /** 2 * @file lv_windows_display.h 3 * 4 */ 5 6 #ifndef LV_WINDOWS_DISPLAY_H 7 #define LV_WINDOWS_DISPLAY_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "../../display/lv_display.h" 18 #include "../../indev/lv_indev.h" 19 20 #if LV_USE_WINDOWS 21 22 #include <windows.h> 23 24 /********************* 25 * DEFINES 26 *********************/ 27 28 #define LV_WINDOWS_ZOOM_BASE_LEVEL 100 29 30 #ifndef USER_DEFAULT_SCREEN_DPI 31 #define USER_DEFAULT_SCREEN_DPI 96 32 #endif 33 34 /********************** 35 * TYPEDEFS 36 **********************/ 37 38 /********************** 39 * GLOBAL PROTOTYPES 40 **********************/ 41 42 /** 43 * @brief Create a LVGL display object. 44 * @param title The window title of LVGL display. 45 * @param hor_res The horizontal resolution value of LVGL display. 46 * @param ver_res The vertical resolution value of LVGL display. 47 * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. 48 * @param allow_dpi_override Allow DPI override if true, or follow the 49 * Windows DPI scaling setting dynamically. 50 * @param simulator_mode Create simulator mode display if true, or create 51 * application mode display. 52 * @return The created LVGL display object. 53 */ 54 lv_display_t * lv_windows_create_display( 55 const wchar_t * title, 56 int32_t hor_res, 57 int32_t ver_res, 58 int32_t zoom_level, 59 bool allow_dpi_override, 60 bool simulator_mode); 61 62 /** 63 * @brief Get the window handle from specific LVGL display object. 64 * @param display The specific LVGL display object. 65 * @return The window handle from specific LVGL display object. 66 */ 67 HWND lv_windows_get_display_window_handle(lv_display_t * display); 68 69 /** 70 * @brief Get logical pixel value from physical pixel value taken account 71 * with zoom level. 72 * @param physical The physical pixel value taken account with zoom level. 73 * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. 74 * @return The logical pixel value. 75 * @remark It uses the same calculation style as Windows OS implementation. 76 * It will be useful for integrate LVGL Windows backend to other 77 * Windows applications. 78 */ 79 int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level); 80 81 /** 82 * @brief Get physical pixel value taken account with zoom level from 83 * logical pixel value. 84 * @param logical The logical pixel value. 85 * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%. 86 * @return The physical pixel value taken account with zoom level. 87 * @remark It uses the same calculation style as Windows OS implementation. 88 * It will be useful for integrate LVGL Windows backend to other 89 * Windows applications. 90 */ 91 int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level); 92 93 /** 94 * @brief Get logical pixel value from physical pixel value taken account 95 * with DPI scaling. 96 * @param physical The physical pixel value taken account with DPI scaling. 97 * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI. 98 * @return The logical pixel value. 99 * @remark It uses the same calculation style as Windows OS implementation. 100 * It will be useful for integrate LVGL Windows backend to other 101 * Windows applications. 102 */ 103 int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi); 104 105 /** 106 * @brief Get physical pixel value taken account with DPI scaling from 107 * logical pixel value. 108 * @param logical The logical pixel value. 109 * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI. 110 * @return The physical pixel value taken account with DPI scaling. 111 * @remark It uses the same calculation style as Windows OS implementation. 112 * It will be useful for integrate LVGL Windows backend to other 113 * Windows applications. 114 */ 115 int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi); 116 117 /********************** 118 * MACROS 119 **********************/ 120 121 #endif // LV_USE_WINDOWS 122 123 #ifdef __cplusplus 124 } /*extern "C"*/ 125 #endif 126 127 #endif /*LV_WINDOWS_DISPLAY_H*/ 128