📄 apiosdrender.c
字号:
MDrv_GE_PE_SetSrcColorKey(FALSE, CK_OP_NOT_EQUQL, GEfmt, (void *)srcColorKey.u32AllColorValue, (void *)srcColorKey.u32AllColorValue);
MApi_Osd_EndDraw (pDstGC);*/
static GEBitBltInfo BitbltInfo;
static GEPitBaseInfo PitBaseInfo;
Gwin_FB_Attr fbAttr;
BitbltInfo.BitbltCoordinate.v0_x = r_dst->left;
BitbltInfo.BitbltCoordinate.v0_y = r_dst->top;
BitbltInfo.BitbltCoordinate.v2_x = r_src->left;
BitbltInfo.BitbltCoordinate.v2_y = r_src->top;
BitbltInfo.BitbltCoordinate.height = r_src->height;
BitbltInfo.BitbltCoordinate.width = r_src->width;
BitbltInfo.BitBltTypeFlag = GEBitbltType_Normal;
BitbltInfo.src_height = r_src->height;
BitbltInfo.src_width = r_src->width;
MDrv_GOP_GWIN_GetFBInfo(pSrcGC->u8FBID, &fbAttr);
BitbltInfo.src_fm = fbAttr.fbFmt;
PitBaseInfo.sb_base = fbAttr.addr;
PitBaseInfo.sb_pit = fbAttr.pitch;
MDrv_GOP_GWIN_GetFBInfo(pDstGC->u8FBID, &fbAttr);
BitbltInfo.dst_fm = fbAttr.fbFmt;
PitBaseInfo.db_base = fbAttr.addr;
PitBaseInfo.db_pit = fbAttr.pitch;
MDrv_GE_BitBlt(&BitbltInfo, &PitBaseInfo);
return TRUE;
}
/*
//-------------------------------------------------------------------------------------------------
/// BitBlitROP : memory copy from source buffer to destination buffer w/ ROP
/// @param r_src \b IN: the source rectangle
/// r_dst \b IN: the destination rectangle
/// rop \b IN: the ROP
/// @return none
//-------------------------------------------------------------------------------------------------
void BitBlitROP(Rect *r_src, Rect *r_dst, GE_ROP2_OP rop)
{
GE_DRAW_RECT blk;
GE_BLOCK *geblk1, *geblk2;
U32 drawflag = GEDRAW_FLAG_DUPLICAPE;
//ToDo:: currently follow pe driver, need to modify
// DrvGE_PE_SetSrcBufferInfo(src, 0);
// DrvGE_PE_SetDstBufferInfo(dst, 0);
MDrv_GE_BLT_SetROP2(true,(GE_ROP2_OP)rop);
if(r_src->width != r_dst->width && r_src->height != r_dst->height)
drawflag = GEDRAW_FLAG_SCALE;
geblk1 = (GE_BLOCK *) &blk.srcblk;
geblk2 = (GE_BLOCK *) &blk.dstblk;
geblk1->x = r_src->left;
geblk1->y = r_src->top;
geblk1->width = r_src->width;
geblk1->height = r_src->height;
geblk2->x = r_dst->left;
geblk2->y = r_dst->top;
geblk2->width = r_dst->width;
geblk2->height = r_dst->height;
// DrvGE_BLT_BeginDraw();
MDrv_GE_PE_BitBlt(&blk, drawflag);
MDrv_GE_BLT_SetROP2(false,(GE_ROP2_OP)rop);
}
*/
// angle is 0 to 360
//-------------------------------------------------------------------------------------------------
/// MApi_Osd_DrawArc : draw arc from degree 0 to degree 360 on buffer
/// MApi_Osd_BitBlit : memory copy from source buffer to destination buffer w/ specified rectangle
/// @param pGC \b IN: the GC
/// @param eOSD_COLOR_FMT \b IN: OSD color format
/// @param orig \b IN: origional point
/// @param angleFrom \b IN: the start angle of arc
/// @param angleTo \b IN: the end angle of arc (angleFrom must greater than angleTo)
/// @param color \b IN: the arc color
/// @param pAlpha_Blending \b IN: Alpha Blending input parameter
/// @return TRUE/FALSE : Sucess/Fail
//-------------------------------------------------------------------------------------------------
/*void MApi_Osd_DrawArc( OsdGC *pGC,
OSD_COLOR_FMT eOSD_COLOR_FMT,
Pos *orig,
U32 radius,
S32 angleFrom,
S32 angleTo,
OSD_COLOR color,
OSD_ALPHA_BLENDING *pAlpha_Blending)
{
S32 angle;
Pos Pt, Prev;
S32 inc = 180/(radius*3)+1;
Prev = arcxy(orig, radius, angleFrom);
for(angle=angleFrom; angle<=angleTo; angle+=inc)
{
Pt = arcxy(orig, radius, angle);
if(Pt.x != Prev.x || Pt.y != Prev.y)
{
if(Pt.x <= Prev.x)
MApi_Osd_DrawLine(pGC, &Pt, &Prev, eOSD_COLOR_FMT, color, color, GERECT_FLAG_COLOR_CONSTANT, 1, eSolidLine, pAlpha_Blending);
else
MApi_Osd_DrawLine(pGC, &Prev, &Pt, eOSD_COLOR_FMT, color, color, GERECT_FLAG_COLOR_CONSTANT, 1, eSolidLine, pAlpha_Blending);
Prev = Pt;
}
}
}*/
//-------------------------------------------------------------------------------------------------
/// Generate_Pattern : Generate round border mask pattern
/// @return none
//-------------------------------------------------------------------------------------------------
/*void Generate_Pattern(void)
{
int i, j, k, step;
Pos orig;
Pos Pt, Prev;
//memset(maskNorthWest, 0x1, sizeof(maskNorthWest));
POS(orig, ROUND_RADIUS-1, ROUND_RADIUS-1);
POS(Prev, ROUND_RADIUS-1, -1);
for(i=0; i<ROUND_RADIUS; i++)
maskNorthWest[i][0] = 0;
step = 180/(ROUND_RADIUS*3)+1; // 90/(1.5*radius)
for(i=90 ;; i+=step)
{
i = i > 180 ? 180 : i;
Pt = arcxy(&orig, ROUND_RADIUS-1, i);
if(Pt.y != Prev.y)
{
for(j=Pt.y; j>Prev.y; j--)
{
for(k=Pt.x; k>=0; k--)
maskNorthWest[k][j] = 0;
}
Prev = Pt;
#if (REDUCED_BUFFER == 2)
maskNorthWestPos[Pt.y] = Pt.x+1;
#endif
}
if(i >= 180)
break;
}
// NE
for(i=0; i<ROUND_RADIUS; i++)
{
for(j=0; j<ROUND_RADIUS; j++)
{
maskNorthEast[i][j] = maskNorthWest[i][ROUND_RADIUS-1-j];
}
}
// SW
for(i=0; i<ROUND_RADIUS; i++)
{
for(j=0; j<ROUND_RADIUS; j++)
{
maskSouthWest[i][j] = maskNorthWest[ROUND_RADIUS-1-i][j];
}
}
// SE
for(i=0; i<ROUND_RADIUS; i++)
{
for(j=0; j<ROUND_RADIUS; j++)
{
maskSouthEast[i][j] = maskNorthEast[ROUND_RADIUS-1-i][j];
}
}
#if 0
#if (REDUCED_BUFFER == 2)
maskNorthWestPos[0] = 5;
maskNorthWestPos[1] = 3;
maskNorthWestPos[2] = 2;
maskNorthWestPos[3] = 1;
maskNorthWestPos[4] = 1;
#endif
#endif
}*/
/*
static void _Mask_Rect(void *src, Pos *orig, int pitch, U8 corner, U32 colorKill, U32 colorShow, U8 op, GC_ColorFmt fmt)
{
int i, j;
U8 *mask;
switch(corner)
{
case eNorthEast:
mask = (U8 *)maskNorthEast;
break;
case eSouthEast:
mask = (U8 *)maskSouthEast;
break;
case eSouthWest:
mask = (U8 *)maskSouthWest;
break;
case eNorthWest:
mask = (U8 *)maskNorthWest;
break;
default:
mask = NULL;
break;
}
if(fmt == FMT_ARGB8888)
{
U32 *pAddr;
for(i=0; i<ROUND_RADIUS; i++)
{
pAddr = (U32 *)src + (orig->y+i) * (pitch>>2) + orig->x;
for(j=0; j<ROUND_RADIUS; j++)
{
if(mask[i*ROUND_RADIUS+j])
pAddr[j] &= colorShow;
else
{
if(op)
pAddr[j] &= colorKill;
else
pAddr[j] = colorKill;
}
}
}
}
else if(fmt == FMT_RGB565)
{
U16 *pAddr;
U16 u16ColorKill = RGB565(ARGB_R(colorKill), ARGB_G(colorKill), ARGB_B(colorKill));
U16 u16ColorShow = RGB565(ARGB_R(colorShow), ARGB_G(colorShow), ARGB_B(colorShow));
for(i=0; i<ROUND_RADIUS; i++)
{
pAddr = (U16 *)src + (orig->y+i) * (pitch>>1) + orig->x;
for(j=0; j<ROUND_RADIUS; j++)
{
if(mask[i*ROUND_RADIUS+j])
pAddr[j] &= u16ColorShow;
else
{
if(op)
pAddr[j] &= u16ColorKill;
else
pAddr[j] = u16ColorKill;
}
}
}
}
}
*/
#define TEXT_SHADOW 1
//-------------------------------------------------------------------------------------------------
// MApi_Osd_SetFontInfo : Get the font information about output rectangle
// @param pGC \b IN: the GC
// @param eSystemFont \b IN: GE sys Font
// @param rect \b IN: the output rectangle
// @param fontWidth \b OUT: Set the font width
// @param fontHeight \b OUT: Set the font height
// @param row \b OUT: the total lines of the rectangle
// @return TRUE/FALSE : Sucess/Fail
//-------------------------------------------------------------------------------------------------
/*BOOLEAN _MApi_Osd_GetFontInfo (OsdGC *pGC,
SystemFont eSystemFont,
Rect *rect,
U16 *fontWidth,
U16 *fontHeight,
U16 *row)
{
#if 0
FONTHANDLE hFont;
U32 u32FontType;
GE_FONT_INFO fontInfo;
MApi_Osd_GCGetSysFont(pGC, eSystemFont, &hFont, &u32FontType);
if (MDrv_GE_PE_GetFontInfo(hFont, &fontInfo) == GESTATUS_SUCCESS)
{
*fontWidth = fontInfo.width ;
*fontHeight = fontInfo.height;
*row = rect->height / (*fontHeight);
return TRUE;
}
else
{
PRINTE("_MApi_Osd_GetFontInfo->MDrv_GE_PE_GetFontInfo FAIL ");
return FALSE;
}
#endif
}*/
/*
//-------------------------------------------------------------------------------------------------
// MApi_Osd_GetTextInfoPerLine : Get the font information about output rectangle
// @param u32FontType \b IN: the font type
// @param u32LineWidth \b IN: the Line Width
// @param pStringIn \b IN: Input String
// @param pStringNext \b OUT: Report the next line start pointer
// @param u8CharNum \b OUT: characters number
// @param u32ActualWidth \b OUT: Actual width this line used.
// @return TRUE/FALSE : Sucess/Fail
//-------------------------------------------------------------------------------------------------
BOOLEAN MApi_Osd_GetTextInfoPerLine (OsdGC *pGC,
SystemFont eSystemFont,
U32 u32LineWidth,
U8 *pStringIn,
U8 *pStringNext,
U8 *u8CharNum,
U32 *u32ActualWidth)
{
U32 u32i;
U32 u32len = UTL_strlen(pStringIn);
U16 *pWstring;
FONTHANDLE hFontHandle;
U32 u32FontType;
U32 u32TextWidth;
MApi_Osd_GCGetSysFont(pGC, FONT_ADVANCE ,&hFontHandle, &u32FontType);
for (u32i =0; u32i < u32len; u32i++)
{
if (( (*pStringIn+u32i) == '\a') || ( (*pStringIn+u32i) == '\r'))
{
pStringNext = pStringIn+u32i+1;
break;
}
pWstring = AnsiToWStrIndex(pStringIn, u32i, u32FontType);
//MDrv_GE_PE_QueryTextDispLength(hFontHandle, (U8*)pWstring, 2, GE_TEXT_OUT_INFO * pfmt, &u32TextWidth)
}
*u8CharNum = u32i;
}
*/
//-------------------------------------------------------------------------------------------------
// MApi_Osd_TextOut: Text out string on screen
// @param pGC \b IN: the GC
// @param eOSD_COLOR_FMT \b IN: input color format
// @param TextColor \b IN: input color
// @param eSystemFont \b IN: Set Font Type
// @param r \b IN: the rectangle to textout
// @param pMsg \b IN: the output string
// @param len \b IN: the string length
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -