summaryrefslogtreecommitdiff
path: root/lib/lvgl/src/drivers/windows/lv_windows_display.h
blob: b9c6f8e94d7810cd6d7bb8248a82aeb157993910 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/**
 * @file lv_windows_display.h
 *
 */

#ifndef LV_WINDOWS_DISPLAY_H
#define LV_WINDOWS_DISPLAY_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"

#if LV_USE_WINDOWS

#include <windows.h>

/*********************
 *      DEFINES
 *********************/

#define LV_WINDOWS_ZOOM_BASE_LEVEL 100

#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif

/**********************
 *      TYPEDEFS
 **********************/

/**********************
 * GLOBAL PROTOTYPES
 **********************/

/**
 * @brief Create a LVGL display object.
 * @param title The window title of LVGL display.
 * @param hor_res The horizontal resolution value of LVGL display.
 * @param ver_res The vertical resolution value of LVGL display.
 * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
 * @param allow_dpi_override Allow DPI override if true, or follow the
 *                           Windows DPI scaling setting dynamically.
 * @param simulator_mode Create simulator mode display if true, or create
 *                       application mode display.
 * @return The created LVGL display object.
*/
lv_display_t * lv_windows_create_display(
    const wchar_t * title,
    int32_t hor_res,
    int32_t ver_res,
    int32_t zoom_level,
    bool allow_dpi_override,
    bool simulator_mode);

/**
 * @brief Get the window handle from specific LVGL display object.
 * @param display The specific LVGL display object.
 * @return The window handle from specific LVGL display object.
*/
HWND lv_windows_get_display_window_handle(lv_display_t * display);

/**
 * @brief Get logical pixel value from physical pixel value taken account
 *        with zoom level.
 * @param physical The physical pixel value taken account with zoom level.
 * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
 * @return The logical pixel value.
 * @remark It uses the same calculation style as Windows OS implementation.
 *         It will be useful for integrate LVGL Windows backend to other
 *         Windows applications.
*/
int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level);

/**
 * @brief Get physical pixel value taken account with zoom level from
 *        logical pixel value.
 * @param logical The logical pixel value.
 * @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
 * @return The physical pixel value taken account with zoom level.
 * @remark It uses the same calculation style as Windows OS implementation.
 *         It will be useful for integrate LVGL Windows backend to other
 *         Windows applications.
*/
int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level);

/**
 * @brief Get logical pixel value from physical pixel value taken account
 *        with DPI scaling.
 * @param physical The physical pixel value taken account with DPI scaling.
 * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
 * @return The logical pixel value.
 * @remark It uses the same calculation style as Windows OS implementation.
 *         It will be useful for integrate LVGL Windows backend to other
 *         Windows applications.
*/
int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi);

/**
 * @brief Get physical pixel value taken account with DPI scaling from
 *        logical pixel value.
 * @param logical The logical pixel value.
 * @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
 * @return The physical pixel value taken account with DPI scaling.
 * @remark It uses the same calculation style as Windows OS implementation.
 *         It will be useful for integrate LVGL Windows backend to other
 *         Windows applications.
*/
int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi);

/**********************
 *      MACROS
 **********************/

#endif // LV_USE_WINDOWS

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*LV_WINDOWS_DISPLAY_H*/