📄 msapi_osd.c
字号:
/*draw first half rectangle*/
clrBlock.width = pclrBtn->width / 2;
clrBlock.height = pclrBtn->height;
memcpy(&clrBlock.clr, &pclrBtn->b_clr, 4);
/* set gradient color */
rfmt.flag = GERECT_FLAG_COLOR_GRADIENT_X;
memcpy(&rfmt.e_clr, &pclrBtn->g_clr, 4);
/* draw rectangle */
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/*draw second half rectangle*/
clrBlock.x = clrBlock.x + clrBlock.width;
memcpy(&clrBlock.clr, &pclrBtn->g_clr, 4);
/* set gradient color */
memcpy(&rfmt.e_clr, &pclrBtn->b_clr, 4);
/* draw rectangle */
MDrv_GE_Rectangle(&clrBlock, &rfmt);
break;
case GRADIENT_Y_CENTER_COLOR:
/*draw first half rectangle*/
clrBlock.width = pclrBtn->width;
clrBlock.height = pclrBtn->height / 2;
memcpy(&clrBlock.clr, &pclrBtn->b_clr, 4);
/* set gradient color */
rfmt.flag = GERECT_FLAG_COLOR_GRADIENT_Y;
memcpy(&rfmt.e_clr, &pclrBtn->g_clr, 4);
/* draw rectangle */
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/*draw second half rectangle*/
clrBlock.y = clrBlock.y + clrBlock.height;
memcpy(&clrBlock.clr, &pclrBtn->g_clr, 4);
/* set gradient color */
memcpy(&rfmt.e_clr, &pclrBtn->b_clr, 4);
/* draw rectangle */
MDrv_GE_Rectangle(&clrBlock, &rfmt);
break;
}
/* draw rectangle frame */
if(pclrBtn->fHighLight && pclrBtn->bFrameWidth)
{
clrBlock.x = pclrBtn->x;
clrBlock.y = pclrBtn->y;
clrBlock.width = pclrBtn->width;
clrBlock.height = pclrBtn->height;
memcpy(&clrBlock.clr, &pclrBtn->f_clr, 4);
lineFmt.width = pclrBtn->bFrameWidth;
MDrv_GE_RectFrame(&clrBlock, &lineFmt);
}
#endif
}
/******************************************************************************/
/// API for MMI only draw block::
/// @param pclrBtn \b IN color
/******************************************************************************/
void msAPI_OSD_DrawMMIBlock(OSDClrBtn *pclrBtn)
{
U8 u8FrameLineWidth = 0;
/* set start point coordinate */
clrBlock.x = pclrBtn->x;
clrBlock.y = pclrBtn->y;
GELineRect.LineRectCoordinate.v0_x = pclrBtn->x;
GELineRect.LineRectCoordinate.v0_y = pclrBtn->y;
/* draw rectangle frame */
if(pclrBtn->fHighLight && pclrBtn->bFrameWidth)
{
u8FrameLineWidth = pclrBtn->bFrameWidth;
clrBlock.width = pclrBtn->width;
clrBlock.height = pclrBtn->height;
/* set gradient color */
rfmt.flag = GERECT_FLAG_COLOR_CONSTANT;
memcpy(&clrBlock.clr, &pclrBtn->f_clr, 4);
/* draw rectangle */
MDrv_GE_Rectangle(&clrBlock, &rfmt);
}
clrBlock.x = pclrBtn->x + u8FrameLineWidth;
clrBlock.y = pclrBtn->y + u8FrameLineWidth;
clrBlock.width = pclrBtn->width-(U16)(u8FrameLineWidth<<1);
clrBlock.height = pclrBtn->height-(U16)(u8FrameLineWidth<<1);
rfmt.flag = GERECT_FLAG_COLOR_CONSTANT;
memcpy(&clrBlock.clr, &pclrBtn->b_clr, 4);
/* draw rectangle */
MDrv_GE_Rectangle(&clrBlock, &rfmt);
}
#if 1 //(KEEP_UNUSED_FUNC == 1)
/******************************************************************************/
/// API for draw block::
/// @param font_handle \b IN font handle
/// @param pu8Str \b IN pointer to string
/// @param pclrBtn \b IN color
/******************************************************************************/
void msAPI_OSD_DrawButton(FONTHANDLE font_handle, U8 *pu8Str, OSDClrBtn *pclrBtn)
{
/* check range */
/*
if((pclrBtn->x + pclrBtn->width) > NEWUI_MAIN_MENU_GWIN_WIDTH)
{
return;
}
else if((pclrBtn->y + pclrBtn->height) > NEWUI_MAIN_MENU_GWIN_HEIGHT)
{
return;
}
*/
/*draw background rectangle*/
msAPI_OSD_DrawBlock(pclrBtn);
/* draw text*/
if(pclrBtn->bStringIndexWidth == CHAR_IDX_1BYTE)
{
if(*pu8Str == 0)
return;
}
else
{
if(*((U16*)pu8Str) == 0)
return;
}
msAPI_OSD_DrawText(font_handle, pu8Str, pclrBtn);
}
#endif
#if 1// kevin 071224 //(!BOOTLOADER_SYSTEM)
/*****************************************************************************************************/
static U16 angular_increment;
static U16 normalised_angle;
static U16 x, y, last_y;
static U16 u16Temp1, u16Temp2, u16Temp3, u16Temp4, u16Temp5;
static U32 u32Loop;
/******************************************************************************/
/// API for draw round frame::
/// @param pclrBtn \b IN color
/******************************************************************************/
void msAPI_OSD_DrawRoundFrame(OSDClrBtn *pclrBtn)
{
GEClrBlock clrBlock;
GERectFmt rfmt;
if ( pclrBtn->radius > pclrBtn->width / 2 || pclrBtn->radius > pclrBtn->height / 2 )
{
return;
}
memcpy( &clrBlock.clr, &pclrBtn->f_clr, 4 );
rfmt.flag = GERECT_FLAG_COLOR_CONSTANT;
if ( ( clrBlock.width = pclrBtn->width - 2 * pclrBtn->radius ) > 0 )
{
/* draw top frame */
clrBlock.x = pclrBtn->x + pclrBtn->radius;
clrBlock.y = pclrBtn->y ;
clrBlock.height = pclrBtn->bFrameWidth;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw bottom frame */
clrBlock.y = pclrBtn->y + pclrBtn->height - pclrBtn->bFrameWidth - 1;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
}
if ( ( clrBlock.height = pclrBtn->height - 2 * pclrBtn->radius ) > 0 )
{
/* draw left frame */
clrBlock.x = pclrBtn->x ;
clrBlock.y = pclrBtn->y + pclrBtn->radius - 1;
clrBlock.width = pclrBtn->bFrameWidth;
clrBlock.height += 2;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw right frame */
clrBlock.x = pclrBtn->x + pclrBtn->width - pclrBtn->bFrameWidth;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
}
u16Temp1 = pclrBtn->x + pclrBtn->radius - 1;
u16Temp2 = pclrBtn->y + pclrBtn->radius - 1;
u16Temp3 = pclrBtn->x + pclrBtn->width - pclrBtn->radius - pclrBtn->bFrameWidth + 1;
u16Temp4 = pclrBtn->y + pclrBtn->height - pclrBtn->radius - pclrBtn->bFrameWidth;
last_y = 0;
u16Temp5 = (pclrBtn->radius*pclrBtn->radius)<<2;
for (y = 1; ;y++)
{
u16Temp5 = u16Temp5 - (y<<3) - 4;
x = sqrt(u16Temp5);
x = (x - 1)>>1;
clrBlock.x = u16Temp1 - x;
clrBlock.y = u16Temp2 - y;
clrBlock.width = pclrBtn->bFrameWidth;
clrBlock.height = pclrBtn->bFrameWidth;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw left-bottom quarter */
clrBlock.y = u16Temp4 + y;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw right-bottom quarter */
clrBlock.x = u16Temp3 + x;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw right-top quarter */
clrBlock.y = u16Temp2 - y;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* symmetrical */
clrBlock.x = u16Temp1 - y;
clrBlock.y = u16Temp2 - x;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw left-bottom quarter */
clrBlock.y = u16Temp4 + x;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw right-bottom quarter */
clrBlock.x = u16Temp3 + y;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
/* draw right-top quarter */
clrBlock.y = u16Temp2 - x;
MDrv_GE_Rectangle(&clrBlock, &rfmt);
if (x <= y)
break;
}
}
/******************************************************************************/
/// API for draw round block::
/// @param pclrBtn \b IN color
/******************************************************************************/
void msAPI_OSD_DrawRoundBlock(OSDClrBtn *pclrBtn)
{
GEPESettings PESet;
GELineRectInfo GELineRect;
if ( pclrBtn->radius > pclrBtn->width / 2 || pclrBtn->radius > pclrBtn->height / 2 )
{
return;
}
GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_x = pclrBtn->x;
GELineRect.LineRectCoordinate.v1_x = pclrBtn->x + pclrBtn->width - 1;
GELineRect.LineRectCoordinate.v0_y = pclrBtn->y + pclrBtn->radius - 1;
GELineRect.LineRectCoordinate.v1_y = GELineRect.LineRectCoordinate.v0_y +pclrBtn->height - (2*pclrBtn->radius) + 1;
GELineRect.Gradient_Color_Flag = GECOLOR_FLAG_CONSTANT;
memcpy(&GELineRect.ARGBClr.ForeGroundColor.u32Num, &pclrBtn->b_clr, 4);
MDrv_GE_RectDraw(&GELineRect);
GELineRect.Gradient_Color_Flag = GECOLOR_FLAG_NONCHANGE;
/* draw top and bottom round */
u16Temp1 = pclrBtn->x + pclrBtn->radius - 1;
u16Temp2 = GELineRect.LineRectCoordinate.v0_y;
u16Temp3 = pclrBtn->width - 2 * pclrBtn->radius + 2;
u16Temp4 = pclrBtn->y + pclrBtn->height - pclrBtn->radius;
last_y = 0;
u16Temp5 = (pclrBtn->radius*pclrBtn->radius)<<2;
for ( y=1; ; y++ )
{
u16Temp5 = u16Temp5 - (y<<3) - 4;
x = sqrt(u16Temp5);
x = (x - 1)>>1;
/* draw top round */
GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_x = u16Temp1 - x;
GELineRect.LineRectCoordinate.v0_y = u16Temp2 - y;
GELineRect.LineRectCoordinate.v1_x = GELineRect.LineRectCoordinate.v0_x + u16Temp3 + (x<<1) - 1;
GELineRect.LineRectCoordinate.v1_y = GELineRect.LineRectCoordinate.v0_y + (y - last_y) ;
MDrv_GE_RectDraw(&GELineRect);
/* draw bottom round */
//GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_y = u16Temp4 + last_y;
GELineRect.LineRectCoordinate.v1_y = u16Temp4 + y - 1;
MDrv_GE_RectDraw(&GELineRect);
/* draw top round */
//GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_x = u16Temp1 - y;
GELineRect.LineRectCoordinate.v0_y = u16Temp2 - x;
GELineRect.LineRectCoordinate.v1_x = GELineRect.LineRectCoordinate.v0_x + u16Temp3 + (y<<1) - 1;
GELineRect.LineRectCoordinate.v1_y = u16Temp2 - y;
MDrv_GE_RectDraw(&GELineRect);
/* draw bottom round */
//GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_y = u16Temp4 + last_y;
GELineRect.LineRectCoordinate.v1_y = u16Temp4 + x - 1;
MDrv_GE_RectDraw(&GELineRect);
last_y = y;
if (x <= y)
break;
}
if(pclrBtn->fHighLight && pclrBtn->bFrameWidth)
{
msAPI_OSD_DrawRoundFrame( pclrBtn );
}
else
{
/* anti-alias */
last_y = 0;
PESet.PE_Enable_Flag = GE_PE_FLAG_ALPHABLENDING;
PESet.ABL.scoef = PESet.ABL.dcoef = 3;
PESet.ABL.abl_const = 0x66666666;
MDrv_GE_PixelEngine(&PESet);
//MDrv_GE_SetAlpha(1,3,3,0x55555555);
u16Temp5 = (pclrBtn->radius*pclrBtn->radius + (pclrBtn->radius>>1))<<2;
for ( y=1; ; y++ )
{
u16Temp5 = u16Temp5 - (y<<3) - 4;
x = sqrt(u16Temp5);
x = (x - 1)>>1;
/* draw top round */
GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_x = u16Temp1 - x;
GELineRect.LineRectCoordinate.v0_y = u16Temp2 - y;
GELineRect.LineRectCoordinate.v1_x = GELineRect.LineRectCoordinate.v0_x + u16Temp3 + (x<<1) - 1;
GELineRect.LineRectCoordinate.v1_y = GELineRect.LineRectCoordinate.v0_y + (y - last_y) ;
MDrv_GE_RectDraw(&GELineRect);
/* draw bottom round */
//GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_y = u16Temp4 + last_y;
GELineRect.LineRectCoordinate.v1_y = u16Temp4 + y - 1;
MDrv_GE_RectDraw(&GELineRect);
/* draw top round */
//GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_x = u16Temp1 - y;
GELineRect.LineRectCoordinate.v0_y = u16Temp2 - x;
GELineRect.LineRectCoordinate.v1_x = GELineRect.LineRectCoordinate.v0_x + u16Temp3 + (y<<1) - 1;
GELineRect.LineRectCoordinate.v1_y = u16Temp2 - y;
MDrv_GE_RectDraw(&GELineRect);
/* draw bottom round */
//GELineRect.LineRectCoordinate.direction = 0x0;
GELineRect.LineRectCoordinate.v0_y = u16Temp4 + last_y;
GELineRect.LineRectCoordinate.v1_y = u16Temp4 + x - 1;
MDrv_GE_RectDraw(&GELineRect);
last_y = y;
if (x <= y)
break;
}
PESet.PE_Enable_Flag = GE_PE_FLAG_DEFAULT;
MDrv_GE_PixelEngine(&PESet);
/* end AA */
}
}
/******************************************************************************/
/// API for draw round button::
/// @param font_handle \b IN font handle
/// @param pu8Str \b IN pointer to string
/// @param pclrBtn \b IN color
/******************************************************************************/
void msAPI_OSD_DrawRoundButton(FONTHANDLE font_handle, U8 *pu8Str, OSDClrBtn *pclrBtn)
{
/*
GERGBColor b_clr,f_clr;
GEPoint point;
GEClrLine clrline;
GELineFmt lineFmt;
LONG32_BYTE u32clr;
U16 radius;
*/
/* check range */
/*if ( ( pclrBtn->x + pclrBtn->width ) > NEWUI_MAIN_MENU_GWIN_WIDTH )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -