Fixed inverstion issue on radio
Spoiler: only some bitmaps used to be inverted. Added masks and fonts now in inverted mode to use the same functions.
This commit is contained in:
committed by
Raphael Coeffic
parent
3bf5d8e177
commit
12ede2ca62
+2
-2
@@ -30,7 +30,7 @@ macro(add_fonts_target targetname filter)
|
||||
add_custom_target(${targetname} DEPENDS ${fonts_files})
|
||||
endmacro()
|
||||
|
||||
macro(add_truetype_font_target name size subset effect)
|
||||
macro(add_truetype_font_target name size subset effect args)
|
||||
set(target font_${name})
|
||||
if(${effect} STREQUAL "bold")
|
||||
set(font ${FONT_BOLD})
|
||||
@@ -42,7 +42,7 @@ macro(add_truetype_font_target name size subset effect)
|
||||
add_custom_command(
|
||||
OUTPUT ${target}.png ${target}.specs ${target}.lbm
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${TOOLS_DIR}/build-font-bitmap.py --subset ${subset} --size ${size} --font ${font} --cjk-font ${cjk_font} --output ${target}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${LIBOPENUI_TOOLS_DIR}/encode-bitmap.py --format 8bits --rle --size-format 2 ${target}.png ${target}.lbm
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${LIBOPENUI_TOOLS_DIR}/encode-bitmap.py --format 8bits --rle --size-format 2 ${args} ${target}.png ${target}.lbm
|
||||
DEPENDS ${TOOLS_DIR}/build-font-bitmap.py ${TOOLS_DIR}/charset.py ${LIBOPENUI_TOOLS_DIR}/encode-bitmap.py ${RADIO_SRC_DIR}/translations/cn.h.txt ${RADIO_SRC_DIR}/fonts/extra_${size}px.png
|
||||
)
|
||||
add_custom_target(truetype_font_${name} DEPENDS ${target}.png ${target}.specs)
|
||||
|
||||
@@ -9,6 +9,7 @@ elseif(PCB STREQUAL X12S)
|
||||
else()
|
||||
set(BITMAP_TARGET_PREFIX x10)
|
||||
set(BITMAP_ARGS ${BITMAP_ARGS} --reverse)
|
||||
set(MASK_ARGS ${MASK_ARGS} --reverse)
|
||||
endif()
|
||||
|
||||
set(BITMAP_RLE_ARGS ${BITMAP_ARGS} --rle)
|
||||
|
||||
@@ -11,17 +11,21 @@ set(CJK_FONT_BOLD "Noto/NotoSansCJKsc-Bold")
|
||||
|
||||
string(TOLOWER ${TRANSLATIONS} subset)
|
||||
|
||||
add_truetype_font_target(9 9 ${subset} none)
|
||||
add_truetype_font_target(13 13 ${subset} none)
|
||||
add_truetype_font_target(15 15 ${subset} none)
|
||||
add_truetype_font_target(16 16 ${subset} none)
|
||||
add_truetype_font_target(16en 16 en none)
|
||||
add_truetype_font_target(bold16 16 ${subset} bold)
|
||||
add_truetype_font_target(17 17 ${subset} none)
|
||||
add_truetype_font_target(17en 17 en none)
|
||||
add_truetype_font_target(bold17 17 ${subset} bold)
|
||||
add_truetype_font_target(24 24 ${subset} none)
|
||||
add_truetype_font_target(32 32 ${subset} bold)
|
||||
add_truetype_font_target(64 64 en bold)
|
||||
if(PCB STREQUAL X10)
|
||||
set(FONT_ARGS ${FONT_ARGS} --reverse)
|
||||
endif()
|
||||
|
||||
add_truetype_font_target(9 9 ${subset} none "${FONT_ARGS}")
|
||||
add_truetype_font_target(13 13 ${subset} none "${FONT_ARGS}")
|
||||
add_truetype_font_target(15 15 ${subset} none "${FONT_ARGS}")
|
||||
add_truetype_font_target(16 16 ${subset} none "${FONT_ARGS}")
|
||||
add_truetype_font_target(16en 16 en none "${FONT_ARGS}")
|
||||
add_truetype_font_target(bold16 16 ${subset} bold "${FONT_ARGS}")
|
||||
add_truetype_font_target(17 17 ${subset} none "${FONT_ARGS}")
|
||||
add_truetype_font_target(17en 17 en none "${FONT_ARGS}")
|
||||
add_truetype_font_target(bold17 17 ${subset} bold "${FONT_ARGS}")
|
||||
add_truetype_font_target(24 24 ${subset} none "${FONT_ARGS}")
|
||||
add_truetype_font_target(32 32 ${subset} bold "${FONT_ARGS}")
|
||||
add_truetype_font_target(64 64 en bold "${FONT_ARGS}")
|
||||
|
||||
add_custom_target(truetype_fonts DEPENDS ${truetype_fonts_targets})
|
||||
|
||||
@@ -501,8 +501,8 @@ void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t
|
||||
#if defined(LCD_VERTICAL_INVERT)
|
||||
x = destw - (x + w);
|
||||
y = desth - (y + h);
|
||||
// srcx = srcw - (srcx + w);
|
||||
// srcy = srch - (srcy + h);
|
||||
srcx = srcw - (srcx + w);
|
||||
srcy = srch - (srcy + h);
|
||||
#endif
|
||||
|
||||
TRACE("++++++");
|
||||
@@ -510,7 +510,6 @@ void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t
|
||||
|
||||
DMA2D_InitTypeDef DMA2D_InitStruct;
|
||||
DMA2D_InitStruct.DMA2D_Mode = DMA2D_M2M_BLEND;
|
||||
//DMA2D_InitStruct.DMA2D_CMode = DMA2D_ARGB4444;
|
||||
DMA2D_InitStruct.DMA2D_CMode = CM_RGB565;
|
||||
DMA2D_InitStruct.DMA2D_OutputMemoryAdd = CONVERT_PTR_UINT(dest + y*destw + x);
|
||||
DMA2D_InitStruct.DMA2D_OutputBlue = 0;
|
||||
@@ -539,7 +538,6 @@ void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t
|
||||
DMA2D_BG_StructInit(&DMA2D_BG_InitStruct);
|
||||
DMA2D_BG_InitStruct.DMA2D_BGMA = CONVERT_PTR_UINT(dest + y*destw + x);
|
||||
DMA2D_BG_InitStruct.DMA2D_BGO = destw - w;
|
||||
// DMA2D_BG_InitStruct.DMA2D_BGCM = CM_ARGB4444;
|
||||
DMA2D_BG_InitStruct.DMA2D_BGCM = CM_RGB565;
|
||||
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_MODE = NO_MODIF_ALPHA_VALUE;
|
||||
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_VALUE = 0;
|
||||
|
||||
@@ -62,6 +62,8 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x,
|
||||
}
|
||||
}
|
||||
|
||||
// 'src' has ARGB4444
|
||||
// 'dest' has RGB565
|
||||
void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h)
|
||||
{
|
||||
#if defined(LCD_VERTICAL_INVERT)
|
||||
@@ -85,6 +87,29 @@ void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_
|
||||
}
|
||||
}
|
||||
|
||||
// 'src' has A8/L8?
|
||||
// 'dest' has RGB565
|
||||
void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint8_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h, uint16_t fg_color)
|
||||
{
|
||||
RGB_SPLIT(fg_color, red, green, blue);
|
||||
|
||||
for (coord_t line=0; line<h; line++) {
|
||||
uint16_t * p = dest + (y+line)*destw + x;
|
||||
const uint8_t * q = src + (srcy+line)*srcw + srcx;
|
||||
for (coord_t col=0; col<w; col++) {
|
||||
|
||||
uint16_t opacity = *q >> 4;// convert to 4 bits (stored in 8bit for DMA)
|
||||
uint8_t bgWeight = OPACITY_MAX - opacity;
|
||||
RGB_SPLIT(*p, bgRed, bgGreen, bgBlue);
|
||||
uint16_t r = (bgRed * bgWeight + red * opacity) / OPACITY_MAX;
|
||||
uint16_t g = (bgGreen * bgWeight + green * opacity) / OPACITY_MAX;
|
||||
uint16_t b = (bgBlue * bgWeight + blue * opacity) / OPACITY_MAX;
|
||||
*p = RGB_JOIN(r, g, b);
|
||||
p++; q++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format)
|
||||
{
|
||||
if (format == DMA2D_ARGB4444) {
|
||||
|
||||
Reference in New Issue
Block a user