Skip to content

Commit

Permalink
[component/tgui] add VSF_TGUI_TILE_COLORTYPE_XXX
Browse files Browse the repository at this point in the history
  • Loading branch information
versaloon committed Nov 14, 2024
1 parent ae573eb commit e5e951e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@

#if VSF_USE_UI == ENABLED && VSF_USE_TINY_GUI == ENABLED
/*============================ MACROS ========================================*/
#define VSF_TGUI_COLORTYPE_RGB 0
#define VSF_TGUI_COLORTYPE_RGBA 1
#define VSF_TGUI_COLORTYPE_A 3

#define TILES_TEXT_LIST \
"bg1\n" /*width: 200, height: 200, RGB*/ \
Expand Down
4 changes: 2 additions & 2 deletions example/template/demo/tgui_demo/tgui_demo/tgui_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ static inline void vsf_tgui_sdl_tile_get_pixel(const char* pixelmap_ptr, vsf_tgu

VSF_TGUI_ASSERT(color_ptr != NULL);

if (type == VSF_TGUI_COLORTYPE_A) {
if (type == VSF_TGUI_TILE_COLORTYPE_A) {
argb_color = bg_color;
argb_color.alpha = *pixelmap_ptr++;
} else {
argb_color.red = *pixelmap_ptr++;
argb_color.green = *pixelmap_ptr++;
argb_color.blue = *pixelmap_ptr++;

if (type == VSF_TGUI_COLORTYPE_RGBA) {
if (type == VSF_TILE_TGUI_COLORTYPE_RGBA) {
argb_color.alpha = *pixelmap_ptr++;
} else {
argb_color.alpha = 0xFF;
Expand Down
3 changes: 0 additions & 3 deletions example/tgui/demo/tgui_demo/tgui_demo/images/demo_images.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@

#if VSF_USE_UI == ENABLED && VSF_USE_TINY_GUI == ENABLED
/*============================ MACROS ========================================*/
#define VSF_TGUI_COLORTYPE_RGB 0
#define VSF_TGUI_COLORTYPE_RGBA 1
#define VSF_TGUI_COLORTYPE_A 3

#define TILES_TEXT_LIST \
"bg1\n" /*width: 200, height: 200, RGB*/ \
Expand Down
4 changes: 2 additions & 2 deletions example/tgui/demo/tgui_demo/tgui_demo/tgui_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ static inline void vsf_tgui_sdl_tile_get_pixel(const char* pixelmap_ptr, vsf_tgu

VSF_TGUI_ASSERT(color_ptr != NULL);

if (type == VSF_TGUI_COLORTYPE_A) {
if (type == VSF_TGUI_TILE_COLORTYPE_A) {
argb_color = bg_color;
argb_color.alpha = *pixelmap_ptr++;
} else {
argb_color.red = *pixelmap_ptr++;
argb_color.green = *pixelmap_ptr++;
argb_color.blue = *pixelmap_ptr++;

if (type == VSF_TGUI_COLORTYPE_RGBA) {
if (type == VSF_TGUI_TILE_COLORTYPE_RGBA) {
argb_color.alpha = *pixelmap_ptr++;
} else {
argb_color.alpha = 0xFF;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ fsm_rt_t vsf_tgui_control_v_rendering( vsf_tgui_control_t* control_ptr,
for (int i = 0; i < dimof(__cornor_tiles_align_mode); i++) {
const vsf_tgui_tile_t* tile_ptr = vsf_tgui_control_v_get_corner_tile(control_ptr, i);
if (tile_ptr) {
vsf_tgui_control_v_draw_tile(control_ptr, dirty_region_ptr, tile_ptr, __cornor_tiles_align_mode[i], trans_rate, &regions[i], control_ptr->background_color);
vsf_tgui_control_v_draw_tile(control_ptr, dirty_region_ptr, tile_ptr, __cornor_tiles_align_mode[i], trans_rate, &regions[i],
control_ptr->background_color);
} else {
memset(&regions[i], 0, sizeof(vsf_tgui_region_t));
}
Expand Down Expand Up @@ -223,7 +224,8 @@ fsm_rt_t vsf_tgui_control_v_rendering( vsf_tgui_control_t* control_ptr,
#else
uint8_t tile_trans_rate = 0xFF;
#endif
vsf_tgui_control_v_draw_tile(control_ptr, dirty_region_ptr, ptTile, control_ptr->tBackground.tAlign, tile_trans_rate, NULL, (vsf_tgui_sv_color_t){0});
vsf_tgui_control_v_draw_tile(control_ptr, dirty_region_ptr, ptTile, control_ptr->tBackground.tAlign, tile_trans_rate, NULL,
(vsf_tgui_sv_color_t){.value = 0xFFFFFFF});
}

return fsm_rt_cpl;
Expand Down
6 changes: 5 additions & 1 deletion source/component/ui/tgui/vsf_tgui_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,14 @@ typedef struct vsf_tgui_text_info_t {

typedef VSF_TGUI_CFG_DRAM_POINTER_TYPE vsf_tgui_disp_ram_uintptr_t;

#define VSF_TGUI_TILE_COLORTYPE_RGB 0
#define VSF_TGUI_TILE_COLORTYPE_RGBA 1
#define VSF_TGUI_TILE_COLORTYPE_A 2

typedef struct vsf_tgui_tile_core_t {
struct {
uint8_t u2RootTileType : 2; /* 0: buf tile, 1: index tile, 2 and 3 undefined*/
uint8_t u2ColorType : 2; /* 0: rgb, 1: rgba, 3: alpha */
uint8_t u2ColorType : 2; /* 0: rgb, 1: rgba, 2: alpha/graysacle */
uint8_t u3ColorSize : 3; /* 0: 1bit, 2: 4bit, 3: 8bit 4: 16bit, 5: 32bit, 6: 24bit */
uint8_t bIsRootTile : 1; /* 0: Child Tile, u3ColorSize and u4RootTileType have no meaning
1: Root Tile, u3ColorSize and u4RootTileType have meaning*/
Expand Down

0 comments on commit e5e951e

Please sign in to comment.