mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
Merge branch 'patch-1' of https://github.com/eeshiken/lvgl into eeshiken-patch-1
This commit is contained in:
commit
3964f3b843
@ -369,16 +369,51 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)})
|
||||
static inline lv_color_t lv_color_make(int r8, int g8, int b8){
|
||||
lv_color_t color;
|
||||
color.full = (b8 >> 7 | g8 >> 7 | r8 >> 7);
|
||||
return color;
|
||||
}
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}})
|
||||
static inline lv_color_t lv_color_make(uint8_t r8, int g8, int b8){
|
||||
lv_color_t color;
|
||||
color.blue = b8 >> 6;
|
||||
color.green = g8 >> 5;
|
||||
color.red = r8 >> 5;
|
||||
return color;
|
||||
}
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
# if LV_COLOR_16_SWAP == 0
|
||||
# define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}})
|
||||
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){
|
||||
lv_color_t color;
|
||||
color.blue = (uint16_t)(b8 >> 3);
|
||||
color.green = (uint16_t)(g8 >> 2);
|
||||
color.red = (uint16_t)(r8 >> 3);
|
||||
return color;
|
||||
}
|
||||
# else
|
||||
# define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}})
|
||||
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){
|
||||
lv_color_t color;
|
||||
color.green_h = (uint16_t)(g8 >> 5);
|
||||
color.red = (uint16_t)(r8 >> 3);
|
||||
color.blue = (uint16_t)(b8 >> 3);
|
||||
color.green_l = (uint16_t)((g8 >> 2) & 0x7);
|
||||
return color;
|
||||
}
|
||||
# endif
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/
|
||||
static inline lv_color_t lv_color_make(uint8_t r8, uint8_t g8, uint8_t b8){
|
||||
lv_color_t color;
|
||||
color.blue = b8;
|
||||
color.green = g8;
|
||||
color.red = r8;
|
||||
color.alpha = 0xff;
|
||||
return color;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
@ -402,12 +437,16 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
|
||||
(uint8_t) ((uint32_t)(c & 0xF0) | ((c & 0xF0) >> 4)), \
|
||||
(uint8_t) ((uint32_t)(c & 0xF) | ((c & 0xF) << 4)))
|
||||
|
||||
static inline lv_color_t lv_color_hex(uint32_t c){
|
||||
return LV_COLOR_HEX(c);
|
||||
static inline lv_color_t lv_color_hex(uint32_t c) {
|
||||
return lv_color_make((uint8_t) ((c >> 16) & 0xFF),
|
||||
(uint8_t) ((c >> 8) & 0xFF),
|
||||
(uint8_t) (c & 0xFF));
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_color_hex3(uint32_t c){
|
||||
return LV_COLOR_HEX3(c);
|
||||
static inline lv_color_t lv_color_hex3(uint32_t c) {
|
||||
return lv_color_make((uint8_t) (((c >> 4) & 0xF0) | ((c >> 8) & 0xF)),
|
||||
(uint8_t) ((c & 0xF0) | ((c & 0xF0) >> 4)),
|
||||
(uint8_t) ((c & 0xF) | ((c & 0xF) << 4)));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user