mirror of
https://gitee.com/Polarix/simplegui.git
synced 2025-06-17 13:37:52 +00:00
1.重新整理Bitmap接口及相关宏定义,使其支持灰度图像与定义扫描方法
2.修复DemoProc中的Device接口初始化错误 3.重新调整Font接口及相关宏定义,使其支持非等宽字体
This commit is contained in:
parent
3030207e10
commit
d66acc5506
@ -9,7 +9,7 @@
|
||||
#include "DemoResource_UTF8.h"
|
||||
#endif
|
||||
|
||||
extern const SGUI_FONT_RES GB2312_FZXS12;
|
||||
SGUI_FONT_RESOURCE_DECLARE(GB2312_FZXS12);
|
||||
|
||||
|
||||
#endif // _INCLUDE_RESOURCE_H_
|
||||
|
@ -112,8 +112,7 @@ void HMI_DemoCurve_RepaintText(SGUI_SCR_DEV* pstDeviceIF)
|
||||
SGUI_RECT stTextArea;
|
||||
SGUI_POINT stInnsrPos;
|
||||
SGUI_CHAR szNumberTextBuffer[12];
|
||||
SGUI_SIZE sTextLength;
|
||||
|
||||
SGUI_AREA_SIZE stTextAreaSize;
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
/*----------------------------------*/
|
||||
@ -126,20 +125,22 @@ void HMI_DemoCurve_RepaintText(SGUI_SCR_DEV* pstDeviceIF)
|
||||
stTextArea.iY = 1;
|
||||
stTextArea.iWidth = 48;
|
||||
stTextArea.iHeight = 8;
|
||||
SGUI_Text_DrawText(pstDeviceIF, "Focused ", &SGUI_DEFAULT_FONT_8, &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_DrawText(pstDeviceIF, "Focused ", SGUI_FONT_REF(FONT_8), &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
if(NULL != s_stCurve.stData.pstFocused)
|
||||
{
|
||||
//SGUI_Common_IntegerToString(s_stRealtimeGraph.Data->ValueArray[s_stRealtimeGraph.Data->ValueCount-1], szTextBuffer, 10, 4, ' ');
|
||||
|
||||
stTextArea.iY = pstDeviceIF->stSize.iHeight-9;
|
||||
stTextArea.iWidth = 48;
|
||||
sTextLength = SGUI_Common_IntegerToString(s_stCurve.stData.pstFocused->stPoint.iX, szNumberTextBuffer, 10, -1, ' ');
|
||||
SGUI_Text_DrawText(pstDeviceIF, szNumberTextBuffer, &SGUI_DEFAULT_FONT_8, &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
stTextArea.iX+=(SGUI_INT)(sTextLength*SGUI_DEFAULT_FONT_8.iHalfWidth);
|
||||
SGUI_Text_DrawText(pstDeviceIF, ",", &SGUI_DEFAULT_FONT_8, &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
stTextArea.iX+=SGUI_DEFAULT_FONT_8.iHalfWidth;
|
||||
sTextLength = SGUI_Common_IntegerToString(s_stCurve.stData.pstFocused->stPoint.iY, szNumberTextBuffer, 10, -1, ' ');
|
||||
SGUI_Text_DrawText(pstDeviceIF, szNumberTextBuffer, &SGUI_DEFAULT_FONT_8, &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Common_IntegerToString(s_stCurve.stData.pstFocused->stPoint.iX, szNumberTextBuffer, 10, -1, ' ');
|
||||
SGUI_Text_DrawText(pstDeviceIF, szNumberTextBuffer, SGUI_FONT_REF(FONT_8), &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_GetTextExtent(szNumberTextBuffer,SGUI_FONT_REF(FONT_8),&stTextAreaSize);
|
||||
stTextArea.iX+=stTextAreaSize.iWidth;
|
||||
SGUI_Text_DrawText(pstDeviceIF, ",", SGUI_FONT_REF(FONT_8), &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_GetTextExtent(",",SGUI_FONT_REF(FONT_8),&stTextAreaSize);
|
||||
stTextArea.iX+=stTextAreaSize.iWidth;
|
||||
SGUI_Common_IntegerToString(s_stCurve.stData.pstFocused->stPoint.iY, szNumberTextBuffer, 10, -1, ' ');
|
||||
SGUI_Text_DrawText(pstDeviceIF, szNumberTextBuffer, SGUI_FONT_REF(FONT_8), &stTextArea, &stInnsrPos, SGUI_DRAW_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ HMI_ENGINE_RESULT InitializeHMIEngineObj(void)
|
||||
/* Initialize display size. */
|
||||
g_stDeviceInterface.stSize.iWidth = PARAM_DEFAULT_PIXEL_NUM_H;
|
||||
g_stDeviceInterface.stSize.iHeight = PARAM_DEFAULT_PIXEL_NUM_V;
|
||||
g_stDeviceInterface.uiDepthBits = PARAM_DEFAULT_PIXEL_DEPTH;
|
||||
g_stDeviceInterface.uiDepthBits = PARAM_DEFAULT_PIXEL_DEPTH_BITS;
|
||||
/* Initialize interface object. */
|
||||
g_stDeviceInterface.fnSetPixel = SGUI_SDK_SetPixel;
|
||||
g_stDeviceInterface.fnGetPixel = SGUI_SDK_GetPixel;
|
||||
|
@ -69,7 +69,7 @@ HMI_ENGINE_RESULT HMI_DemoList_Initialize(SGUI_SCR_DEV* pstDeviceIF)
|
||||
s_stDemoListObject.stLayout.iHeight = pstDeviceIF->stSize.iHeight;
|
||||
s_stDemoListObject.szTitle = SCR1_TITLE;
|
||||
//Initialize list object.
|
||||
SGUI_List_Initialize(&s_stDemoListObject, &GB2312_FZXS12, s_arrstListItems, sizeof(s_arrstListItems)/sizeof(SGUI_ITEMS_ITEM));
|
||||
SGUI_List_Initialize(&s_stDemoListObject, SGUI_FONT_REF(GB2312_FZXS12), s_arrstListItems, sizeof(s_arrstListItems)/sizeof(SGUI_ITEMS_ITEM));
|
||||
return HMI_RET_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ HMI_ENGINE_RESULT HMI_DemoMenu_Initialize(SGUI_SCR_DEV* pstDeviceIF)
|
||||
// Initialize list data.
|
||||
SGUI_SystemIF_MemorySet(&s_stDemoMenuObject, 0x00, sizeof(SGUI_MENU_STRUCT));
|
||||
//Initialize list object.
|
||||
SGUI_Menu_Initialize(&s_stDemoMenuObject, &SGUI_DEFAULT_FONT_8, &stLayout, s_arrstMenuItems, sizeof(s_arrstMenuItems)/sizeof(SGUI_ITEMS_ITEM));
|
||||
SGUI_Menu_Initialize(&s_stDemoMenuObject, SGUI_FONT_REF(FONT_8), &stLayout, s_arrstMenuItems, sizeof(s_arrstMenuItems)/sizeof(SGUI_ITEMS_ITEM));
|
||||
return HMI_RET_NORMAL;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ HMI_ENGINE_RESULT HMI_DemoMenu_ProcessEvent(SGUI_SCR_DEV* pstDeviceIF, const HMI
|
||||
{
|
||||
SGUI_ItemsBase_GetItemExtent(&(s_pstActivedMenu->stItems), s_pstActivedMenu->stItems.iSelection, &stItemArea);
|
||||
s_pstActivedMenu = &s_stDemoSubMenuObject;
|
||||
SGUI_Menu_Initialize(&s_stDemoSubMenuObject, &SGUI_DEFAULT_FONT_8, &stItemArea, s_arrstSubMenuItems, sizeof(s_arrstSubMenuItems)/sizeof(SGUI_ITEMS_ITEM));
|
||||
SGUI_Menu_Initialize(&s_stDemoSubMenuObject, SGUI_FONT_REF(FONT_8), &stItemArea, s_arrstSubMenuItems, sizeof(s_arrstSubMenuItems)/sizeof(SGUI_ITEMS_ITEM));
|
||||
SGUI_Menu_PopupSubMenu(pstDeviceIF, &s_stDemoSubMenuObject, &stItemArea);
|
||||
SGUI_Menu_Repaint(pstDeviceIF, s_pstActivedMenu);
|
||||
}
|
||||
|
@ -71,13 +71,13 @@ HMI_ENGINE_RESULT HMI_DemoNotice_Prepare(SGUI_SCR_DEV* pstDeviceIF, const void*
|
||||
SGUI_SystemIF_StringLengthCopy(s_szDemoNoticeText, (SGUI_SZSTR)pstParameters, NOTICE_TEXT_BUFFER_SIZE);
|
||||
s_szDemoNoticeText[NOTICE_TEXT_BUFFER_SIZE] = '\0';
|
||||
}
|
||||
SGUI_Notice_Repaint(pstDeviceIF, &s_stDemoNoticeBox, &GB2312_FZXS12, 0);
|
||||
SGUI_Notice_Repaint(pstDeviceIF, &s_stDemoNoticeBox, SGUI_FONT_REF(GB2312_FZXS12), 0);
|
||||
return HMI_RET_NORMAL;
|
||||
}
|
||||
|
||||
HMI_ENGINE_RESULT HMI_DemoNotice_RefreshScreen(SGUI_SCR_DEV* pstDeviceIF, const void* pstParameters)
|
||||
{
|
||||
SGUI_Notice_Repaint(pstDeviceIF, &s_stDemoNoticeBox, &GB2312_FZXS12, 0);
|
||||
SGUI_Notice_Repaint(pstDeviceIF, &s_stDemoNoticeBox, SGUI_FONT_REF(GB2312_FZXS12), 0);
|
||||
return HMI_RET_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ HMI_ENGINE_RESULT HMI_DemoRealGraph_RefreshScreen(SGUI_SCR_DEV* pstDeviceIF, con
|
||||
stTextDisplayArea.iHeight = 8;
|
||||
stInnerPos.iX = 0;
|
||||
stInnerPos.iY = 0;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR5_RT_GRAPH_TITLE, &SGUI_DEFAULT_FONT_8, &stTextDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR5_RT_GRAPH_TITLE, SGUI_FONT_REF(FONT_8), &stTextDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
// Paint value.
|
||||
SGUI_Common_IntegerToString(s_stRealtimeGraph.Data->ValueArray[s_stRealtimeGraph.Data->ValueCount-1], szTextBuffer, 10, 4, ' ');
|
||||
stTextDisplayArea.iX = 1;
|
||||
@ -92,7 +92,7 @@ HMI_ENGINE_RESULT HMI_DemoRealGraph_RefreshScreen(SGUI_SCR_DEV* pstDeviceIF, con
|
||||
stTextDisplayArea.iHeight = 5;
|
||||
stInnerPos.iX = 0;
|
||||
stInnerPos.iY = 0;
|
||||
SGUI_Text_DrawText(pstDeviceIF, szTextBuffer, &SGUI_DEFAULT_FONT_MiniNum, &stTextDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_DrawText(pstDeviceIF, szTextBuffer, SGUI_FONT_REF(MiniNum), &stTextDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_RealtimeGraph_Repaint(pstDeviceIF, &s_stRealtimeGraph);
|
||||
return HMI_RET_NORMAL;
|
||||
}
|
||||
|
15422
DemoProc/src/Resource.c
15422
DemoProc/src/Resource.c
File diff suppressed because it is too large
Load Diff
@ -79,29 +79,29 @@ HMI_ENGINE_RESULT HMI_DemoText_RefreshScreen(SGUI_SCR_DEV* pstDeviceIF, const vo
|
||||
stDisplayArea.iX = 1;
|
||||
stDisplayArea.iY = 1;
|
||||
stDisplayArea.iWidth = 62;
|
||||
stDisplayArea.iHeight = SGUI_DEFAULT_FONT_MiniNum.iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_MIN_NUM, &SGUI_DEFAULT_FONT_MiniNum, &stDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
stDisplayArea.iHeight = SGUI_FONT(MiniNum).iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_MIN_NUM, SGUI_FONT_REF(MiniNum), &stDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
|
||||
stDisplayArea.iY += stDisplayArea.iHeight;
|
||||
stDisplayArea.iWidth = 62;
|
||||
stDisplayArea.iHeight = SGUI_DEFAULT_FONT_8.iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_INNER_8, &SGUI_DEFAULT_FONT_8, &stDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
stDisplayArea.iHeight = SGUI_FONT(FONT_8).iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_INNER_8, SGUI_FONT_REF(FONT_8), &stDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
|
||||
stDisplayArea.iY += stDisplayArea.iHeight;
|
||||
stDisplayArea.iWidth = 62;
|
||||
stDisplayArea.iHeight = SGUI_DEFAULT_FONT_12.iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_INNER_12, &SGUI_DEFAULT_FONT_12, &stDisplayArea, &stInnerPos, SGUI_DRAW_REVERSE);
|
||||
stDisplayArea.iHeight = SGUI_FONT(FONT_12).iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_INNER_12, SGUI_FONT_REF(FONT_12), &stDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
|
||||
stDisplayArea.iY += stDisplayArea.iHeight;
|
||||
stDisplayArea.iWidth = 62;
|
||||
stDisplayArea.iHeight = SGUI_DEFAULT_FONT_12.iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_EXTEN_12, &GB2312_FZXS12, &stDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
stDisplayArea.iHeight = SGUI_FONT(FONT_16).iHeight+1;
|
||||
SGUI_Text_DrawText(pstDeviceIF, SCR3_TEXT_EXTEN_12, SGUI_FONT_REF(GB2312_FZXS12), &stDisplayArea, &stInnerPos, SGUI_DRAW_REVERSE);
|
||||
|
||||
stDisplayArea.iX = 64;
|
||||
stDisplayArea.iY = 1;
|
||||
stDisplayArea.iWidth = 62;
|
||||
stDisplayArea.iHeight = 62;
|
||||
SGUI_Text_DrawMultipleLinesText(pstDeviceIF, SCR3_TEXT_MULTILINE_12, &GB2312_FZXS12, &stDisplayArea, 0, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_DrawMultipleLinesText(pstDeviceIF, SCR3_TEXT_MULTILINE_12, SGUI_FONT_REF(GB2312_FZXS12), &stDisplayArea, 0, SGUI_DRAW_NORMAL);
|
||||
return HMI_RET_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -86,20 +86,20 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_Initialize(SGUI_SCR_DEV* pstDeviceIF)
|
||||
stNumBoxInitParam.eAlignment = SGUI_CENTER;
|
||||
stNumBoxInitParam.iMin = -50;
|
||||
stNumBoxInitParam.iMax = 100;
|
||||
stNumBoxInitParam.pstFontRes = &SGUI_DEFAULT_FONT_8;
|
||||
stNumBoxInitParam.pstFontRes = SGUI_FONT_REF(FONT_8);
|
||||
stNumBoxInitParam.stLayout.iX = VARIABLE_BOX_POSX+2;
|
||||
stNumBoxInitParam.stLayout.iY = VARIABLE_BOX_NUMBER_POSY+2;
|
||||
stNumBoxInitParam.stLayout.iWidth = pstDeviceIF->stSize.iWidth - (VARIABLE_BOX_POSX*2)-4;
|
||||
stNumBoxInitParam.stLayout.iHeight = SGUI_DEFAULT_FONT_8.iHeight;
|
||||
stNumBoxInitParam.stLayout.iHeight = SGUI_FONT(FONT_8).iHeight;
|
||||
|
||||
SGUI_NumberVariableBox_Initialize(&s_stNumberVariableBox, &stNumBoxInitParam);
|
||||
|
||||
|
||||
stTextBoxInitParam.pstFontRes = &SGUI_DEFAULT_FONT_12;
|
||||
stTextBoxInitParam.pstFontRes = SGUI_FONT_REF(FONT_12);
|
||||
stTextBoxInitParam.stLayout.iX = VARIABLE_BOX_POSX+2;
|
||||
stTextBoxInitParam.stLayout.iY = VARIABLE_BOX_TEXT_POSY+2;
|
||||
stTextBoxInitParam.stLayout.iWidth = pstDeviceIF->stSize.iWidth-(VARIABLE_BOX_POSX*2)-4;
|
||||
stTextBoxInitParam.stLayout.iHeight = SGUI_DEFAULT_FONT_12.iHeight;
|
||||
stTextBoxInitParam.stLayout.iHeight = SGUI_FONT(FONT_12).iHeight;
|
||||
stTextBoxInitParam.sTextLengthMax = TEXT_VARIABLE_LENGTH;
|
||||
|
||||
SGUI_TextVariableBox_Initialize(&s_stTextVariableBox, &stTextBoxInitParam, s_szTextVariableBuffer);
|
||||
@ -127,7 +127,7 @@ HMI_ENGINE_RESULT HMI_DemoVariableBox_Prepare(SGUI_SCR_DEV* pstDeviceIF, const v
|
||||
HMI_DemoVariableBox_DrawFrame(pstDeviceIF, (SGUI_SZSTR)s_szFrameTitle);
|
||||
// Show notice
|
||||
SGUI_Notice_FitArea(pstDeviceIF, &(stNoticeBox.stLayout));
|
||||
SGUI_Notice_Repaint(pstDeviceIF, &stNoticeBox, &SGUI_DEFAULT_FONT_8, 0);
|
||||
SGUI_Notice_Repaint(pstDeviceIF, &stNoticeBox, SGUI_FONT_REF(FONT_8), 0);
|
||||
// Start RTC
|
||||
RTCTimerEnable(true);
|
||||
return HMI_RET_NORMAL;
|
||||
@ -350,6 +350,6 @@ void HMI_DemoVariableBox_DrawFrame(SGUI_SCR_DEV* pstDeviceIF, SGUI_SZSTR szTitle
|
||||
SGUI_Basic_DrawRectangle(pstDeviceIF, 0, 0, RECT_WIDTH(pstDeviceIF->stSize), RECT_HEIGHT(pstDeviceIF->stSize), SGUI_COLOR_FRGCLR, SGUI_COLOR_BKGCLR);
|
||||
SGUI_Basic_DrawRectangle(pstDeviceIF, 2, 2, RECT_WIDTH(pstDeviceIF->stSize)-4, RECT_HEIGHT(pstDeviceIF->stSize)-4, SGUI_COLOR_FRGCLR, SGUI_COLOR_TRANS);
|
||||
SGUI_Basic_DrawLine(pstDeviceIF, 3, 17, 124, 17, SGUI_COLOR_FRGCLR);
|
||||
SGUI_Text_DrawText(pstDeviceIF, szTitle, &GB2312_FZXS12, &stTextDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
SGUI_Text_DrawText(pstDeviceIF, szTitle, SGUI_FONT_REF(GB2312_FZXS12), &stTextDisplayArea, &stInnerPos, SGUI_DRAW_NORMAL);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,12 @@
|
||||
#define SGUI_CLR_PAGE_BIT(PAGE, Bit) ((PAGE) = (PAGE) & (~(0x01 << (Bit))))
|
||||
#define SGUI_GET_PAGE_BIT(PAGE, Bit) ((((PAGE) & (0x01 << (Bit)))>0)?1:0)
|
||||
|
||||
#define SGUI_BMP_SCAN_MODE_DHPH SGUI_Basic_BitMapScanDHPH
|
||||
#define SGUI_BMP_SCAN_MODE_DHPV SGUI_Basic_BitMapScanDHPV
|
||||
#define SGUI_BMP_SCAN_MODE_DVPH SGUI_Basic_BitMapScanDVPH
|
||||
#define SGUI_BMP_SCAN_MODE_DVPV SGUI_Basic_BitMapScanDVPV
|
||||
|
||||
|
||||
//=======================================================================//
|
||||
//= Public function declaration. =//
|
||||
//=======================================================================//
|
||||
@ -25,8 +31,14 @@ void SGUI_Basic_DrawRectangle(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX, SG
|
||||
void SGUI_Basic_DrawCircle(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiCx, SGUI_UINT uiCy, SGUI_UINT uiRadius, SGUI_COLOR eEdgeColor, SGUI_COLOR eFillColor);
|
||||
void SGUI_Basic_ReverseBlockColor(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX, SGUI_UINT uiStartY, SGUI_UINT uiWidth, SGUI_UINT uiHeight);
|
||||
void SGUI_Basic_DrawBitMap(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstDisplayArea, SGUI_POINT* pstInnerPos, const SGUI_BMP_RES* pstBitmapData, SGUI_DRAW_MODE eDrawMode);
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDHPH(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY);
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDHPV(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY);
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDVPH(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY);
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDVPV(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY);
|
||||
void SGUI_Basic_DrawPoint(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY, SGUI_COLOR eColor);
|
||||
SGUI_COLOR SGUI_Basic_GetPoint(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiCoordinateX, SGUI_UINT uiCoordinateY);
|
||||
SGUI_BOOL SGUI_Basic_PointIsInArea(const SGUI_RECT* pstArea, const SGUI_POINT* pstPoint);
|
||||
SGUI_COLOR SGUI_Basic_GetReverseColor(const SGUI_UINT8 uiDepthBits,SGUI_COLOR eOriginColor);
|
||||
SGUI_COLOR SGUI_Basic_MapColor(const SGUI_UINT8 uiOriginDepthBits,const SGUI_COLOR eOriginColor,const SGUI_UINT8 uiTargetDepthBits);
|
||||
|
||||
#endif
|
||||
|
@ -8,9 +8,9 @@
|
||||
//=======================================================================//
|
||||
//= Public variable declaration. =//
|
||||
//=======================================================================//
|
||||
extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_MiniNum;
|
||||
extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_8;
|
||||
extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_12;
|
||||
extern const SGUI_FONT_RES SGUI_DEFAULT_FONT_16;
|
||||
SGUI_FONT_RESOURCE_DECLARE(MiniNum);
|
||||
SGUI_FONT_RESOURCE_DECLARE(FONT_8);
|
||||
SGUI_FONT_RESOURCE_DECLARE(FONT_12);
|
||||
SGUI_FONT_RESOURCE_DECLARE(FONT_16);
|
||||
|
||||
#endif // _INCLUDED_SGUI_FONT_SOURCE_H_
|
||||
|
@ -15,6 +15,11 @@
|
||||
#define TEXT_PLACEHOLDER_CHARACTER ('*')
|
||||
#define SGUI_IS_VISIBLE_CHAR(C) ((C>0x1F) && (C<0x7F))
|
||||
|
||||
#define SGUI_TEXT_DECODER_ASCII SGUI_Text_StepNext_ASCII
|
||||
#define SGUI_TEXT_DECODER_GB2312 SGUI_Text_StepNext_GB2312
|
||||
|
||||
#define SGUI_TEXT_INDEXMAPPER_DIRECT SGUI_Text_IndexMapper_Direct
|
||||
|
||||
//=======================================================================//
|
||||
//= Data type definition. =//
|
||||
//=======================================================================//
|
||||
@ -31,6 +36,8 @@ void SGUI_Text_GetTextExtent(SGUI_CSZSTR cszTextBuffer, const SGUI_FONT_RES* p
|
||||
void SGUI_Text_DrawText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR cszTextBuffer, const SGUI_FONT_RES* pstFontRes, SGUI_RECT* pstDisplayArea, SGUI_POINT* pstInnerPos, SGUI_DRAW_MODE eFontMode);
|
||||
SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR szTextBuffer, const SGUI_FONT_RES* pstFontRes, SGUI_RECT* pstDisplayArea, SGUI_INT iTopOffset, SGUI_DRAW_MODE eFontMode);
|
||||
SGUI_SIZE SGUI_Text_GetMultiLineTextLines(SGUI_CSZSTR cszText, const SGUI_FONT_RES* pstFontRes, SGUI_SIZE uiDisplayAreaWidth);
|
||||
SGUI_SIZE SGUI_Text_GetCharacterData(const SGUI_FONT_RES* pstFontRes, SGUI_UINT32 uiCode, SGUI_BYTE* pDataBuffer, SGUI_SIZE sBufferSize);
|
||||
SGUI_CSZSTR SGUI_Text_StepNext_ASCII(SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode);
|
||||
SGUI_CSZSTR SGUI_Text_StepNext_GB2312(SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode);
|
||||
SGUI_UINT32 SGUI_Text_IndexMapper_Direct(SGUI_UINT32 uiCode);
|
||||
|
||||
#endif
|
||||
|
@ -26,8 +26,31 @@
|
||||
#define SGUI_BMP_DATA_BUFFER_SIZE (512)
|
||||
|
||||
#define SGUI_BMP_RESOURCE_DECLARE(NAME) extern const SGUI_BMP_RES NAME
|
||||
#define SGUI_BMP_RESOURCE_DEFINE(NAME, W, H, ...) const SGUI_BYTE NAME##DATA[] = {__VA_ARGS__};\
|
||||
const SGUI_BMP_RES NAME = {W, H, NAME##DATA}
|
||||
#define SGUI_BMP_RESOURCE_DEFINE(NAME, W, H, D, FGP, ...) const SGUI_BYTE NAME##DATA[] = {__VA_ARGS__};\
|
||||
const SGUI_BMP_RES NAME = {W, H, D, FGP, NAME##DATA}
|
||||
|
||||
#define SGUI_FONT(NAME) SGUI_FONT_##NAME
|
||||
#define SGUI_FONT_REF(NAME) &SGUI_FONT(NAME)
|
||||
#define SGUI_FONT_RESOURCE_DECLARE(NAME) extern const SGUI_FONT_RES SGUI_FONT(NAME)
|
||||
#define SGUI_INTERNAL_MONOSPACE_FONT_RESOURCE_DEFINE(NAME,WIDTH,HEIGHT,DEPTH,BLOCKSIZE,DECODER,INDEXMAPPER,SCANMODE,...) \
|
||||
static void SGUI_Resource_GetBitmap_##NAME(SGUI_BMP_RES* pBitmapData,SGUI_UINT32 uiCode,SGUI_BOOL bDryRun);\
|
||||
const SGUI_BYTE DATA_##NAME[]={__VA_ARGS__};\
|
||||
const SGUI_FONT_RES SGUI_FONT_##NAME={HEIGHT,DEPTH,SGUI_Resource_GetBitmap_##NAME,DECODER};\
|
||||
static void SGUI_Resource_GetBitmap_##NAME(SGUI_BMP_RES* pBitmapData,SGUI_UINT32 uiCode,SGUI_BOOL bDryRun)\
|
||||
{\
|
||||
SGUI_INT iCharIndex = INDEXMAPPER(uiCode);\
|
||||
if(NULL != pBitmapData) {\
|
||||
pBitmapData->iHeight = SGUI_FONT_##NAME.iHeight;\
|
||||
pBitmapData->iWidth = WIDTH;\
|
||||
pBitmapData->iDepthBits = SGUI_FONT_##NAME.iDepthBits;\
|
||||
if(!bDryRun) {\
|
||||
pBitmapData->fnGetPixel = SCANMODE;\
|
||||
pBitmapData->pData = DATA_##NAME + iCharIndex*BLOCKSIZE;\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
// end #define
|
||||
|
||||
//=======================================================================//
|
||||
//= Data type definition. =//
|
||||
//=======================================================================//
|
||||
@ -122,10 +145,6 @@ SGUI_DEVPF_IF_DEFINE(void, SGUI_FN_IF_REFRESH, (void));
|
||||
|
||||
// System function interface type declare.
|
||||
SGUI_DEVPF_IF_DEFINE(void, SGUI_FN_IF_GET_RTC, (SGUI_INT iYear, SGUI_INT iMounth, SGUI_INT iDay, SGUI_INT iWeekDay, SGUI_INT iHour, SGUI_INT iMinute, SGUI_INT iSecond));
|
||||
SGUI_DEVPF_IF_DEFINE(SGUI_INT, SGUI_FN_IF_GET_CHAR_INDEX, (SGUI_UINT32 uiCode));
|
||||
SGUI_DEVPF_IF_DEFINE(SGUI_CSZSTR, SGUI_FN_IF_STEP_NEXT, (SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode));
|
||||
SGUI_DEVPF_IF_DEFINE(SGUI_SIZE, SGUI_FN_IF_GET_DATA, (SGUI_SIZE sStartAddr, SGUI_BYTE* pDataBuffer, SGUI_SIZE sReadSize));
|
||||
SGUI_DEVPF_IF_DEFINE(SGUI_BOOL, SGUI_FN_IF_IS_FULL_WIDTH, (SGUI_UINT32 uiCode));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -146,23 +165,31 @@ typedef struct
|
||||
// Sync display buffer data to screen device.
|
||||
SGUI_FN_IF_REFRESH fnSyncBuffer;
|
||||
}SGUI_SCR_DEV;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SGUI_INT iHalfWidth;
|
||||
SGUI_INT iFullWidth;
|
||||
SGUI_INT iHeight;
|
||||
SGUI_FN_IF_GET_CHAR_INDEX fnGetIndex;
|
||||
SGUI_FN_IF_GET_DATA fnGetData;
|
||||
SGUI_FN_IF_STEP_NEXT fnStepNext;
|
||||
SGUI_FN_IF_IS_FULL_WIDTH fnIsFullWidth;
|
||||
}SGUI_FONT_RES;
|
||||
|
||||
typedef struct
|
||||
// Bitmap operation Interface type declare
|
||||
struct _bmp_res;
|
||||
SGUI_DEVPF_IF_DEFINE(SGUI_COLOR, SGUI_FN_IF_BMP_GET_PIXEL, (const struct _bmp_res* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY));
|
||||
typedef struct _bmp_res
|
||||
{
|
||||
SGUI_INT iWidth;
|
||||
SGUI_INT iHeight;
|
||||
SGUI_INT iDepthBits;
|
||||
SGUI_FN_IF_BMP_GET_PIXEL fnGetPixel;
|
||||
//SGUI_COLOR (*fnGetPixel)(const struct _bmp_res* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY);
|
||||
const SGUI_BYTE* pData;
|
||||
}SGUI_BMP_RES;
|
||||
|
||||
// Font operation Interface type declare
|
||||
struct _font_res;
|
||||
SGUI_DEVPF_IF_DEFINE(SGUI_CSZSTR, SGUI_FN_IF_STEP_NEXT, (SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode));
|
||||
SGUI_DEVPF_IF_DEFINE(void, SGUI_FN_IF_GET_BITMAP, (SGUI_BMP_RES* pBitmapData,SGUI_UINT32 uiCode,SGUI_BOOL bDryRun));
|
||||
|
||||
typedef struct _font_res
|
||||
{
|
||||
SGUI_INT iHeight;
|
||||
SGUI_INT iDepthBits;
|
||||
SGUI_FN_IF_GET_BITMAP fnGetBitmap;
|
||||
SGUI_FN_IF_STEP_NEXT fnStepNext;
|
||||
}SGUI_FONT_RES;
|
||||
|
||||
|
||||
#endif // _INCLUDE_GUI_TYPEDEF_H_
|
||||
|
@ -8,7 +8,7 @@
|
||||
//= Include files. =//
|
||||
//=======================================================================//
|
||||
#include "SGUI_Basic.h"
|
||||
|
||||
#include "math.h"
|
||||
//=======================================================================//
|
||||
//= User Macro definition. =//
|
||||
//=======================================================================//
|
||||
@ -477,8 +477,7 @@ void SGUI_Basic_ReverseBlockColor(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX,
|
||||
/* Variable Declaration */
|
||||
/*----------------------------------*/
|
||||
SGUI_UINT i_W, i_H;
|
||||
SGUI_COLOR clsOriginColor;
|
||||
SGUI_UINT16 uiDepthTotal=1<<pstDeviceIF->uiDepthBits;
|
||||
SGUI_COLOR eColor;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
@ -487,8 +486,9 @@ void SGUI_Basic_ReverseBlockColor(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX,
|
||||
{
|
||||
for(i_H=0; i_H<uiHeight; i_H++)
|
||||
{
|
||||
clsOriginColor=SGUI_Basic_GetPoint(pstDeviceIF, uiStartX+i_W, uiStartY+i_H);
|
||||
SGUI_Basic_DrawPoint(pstDeviceIF, uiStartX+i_W, uiStartY+i_H, uiDepthTotal-clsOriginColor);
|
||||
eColor=SGUI_Basic_GetPoint(pstDeviceIF, uiStartX+i_W, uiStartY+i_H);
|
||||
eColor=SGUI_Basic_GetReverseColor(pstDeviceIF->uiDepthBits,eColor);
|
||||
SGUI_Basic_DrawPoint(pstDeviceIF, uiStartX + i_W, uiStartY + i_H, eColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -500,7 +500,7 @@ void SGUI_Basic_ReverseBlockColor(SGUI_SCR_DEV* pstDeviceIF, SGUI_UINT uiStartX,
|
||||
/** @ pstDeviceIF[in]: SimpleGUI object pointer. **/
|
||||
/** @ pstDisplayArea[in]: Display area position and size. **/
|
||||
/** @ pstInnerPos[in]: Data area size and display offset. **/
|
||||
/** @ pstBitmapData[in]: Bitmap object, include size and data. **/
|
||||
/** @ pstBitmapData[in]: Bitmap object, include size, depth and data. **/
|
||||
/** @ eDrawMode[in] Bit map display mode(normal or reverse color). **/
|
||||
/** Return: None. **/
|
||||
/** Notice: None. **/
|
||||
@ -513,8 +513,7 @@ void SGUI_Basic_DrawBitMap(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstDisplayArea,
|
||||
SGUI_INT iDrawPixX, iDrawPixY;
|
||||
SGUI_INT iBmpPixX, iBmpPixY;
|
||||
SGUI_UINT uiDrawnWidthIndex, uiDrawnHeightIndex;
|
||||
SGUI_UINT uiPixIndex;
|
||||
const SGUI_BYTE* pData;
|
||||
SGUI_COLOR eColor;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
@ -549,8 +548,6 @@ void SGUI_Basic_DrawBitMap(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstDisplayArea,
|
||||
// Loop for x coordinate;
|
||||
while((uiDrawnWidthIndex<RECT_WIDTH(*pstBitmapData)) && (iDrawPixX<=RECT_X_END(*pstDisplayArea)) && (iDrawPixX<RECT_WIDTH(pstDeviceIF->stSize)))
|
||||
{
|
||||
// Redirect to data array for column.
|
||||
pData = pstBitmapData->pData+iBmpPixX;
|
||||
// Set loop start parameter of y coordinate
|
||||
iDrawPixY = RECT_Y_START(*pstDisplayArea);
|
||||
iBmpPixY = 0;
|
||||
@ -563,26 +560,28 @@ void SGUI_Basic_DrawBitMap(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstDisplayArea,
|
||||
iBmpPixY -= RECT_Y_START(*pstInnerPos);
|
||||
}
|
||||
uiDrawnHeightIndex = iBmpPixY;
|
||||
uiPixIndex = iBmpPixY % 8;
|
||||
pData += (iBmpPixY / 8) * RECT_WIDTH(*pstBitmapData);
|
||||
// Loop for y coordinate;
|
||||
while((uiDrawnHeightIndex<RECT_HEIGHT(*pstBitmapData)) && (iDrawPixY<=RECT_Y_END(*pstDisplayArea)) && (iDrawPixY<RECT_HEIGHT(pstDeviceIF->stSize)))
|
||||
{
|
||||
if(uiPixIndex == 8)
|
||||
if(pstBitmapData->fnGetPixel!=NULL)
|
||||
{
|
||||
uiPixIndex = 0;
|
||||
pData += RECT_WIDTH(*pstBitmapData);
|
||||
}
|
||||
if(SGUI_GET_PAGE_BIT(*pData, uiPixIndex) != eDrawMode)
|
||||
{
|
||||
SGUI_Basic_DrawPoint(pstDeviceIF, iDrawPixX, iDrawPixY, SGUI_COLOR_FRGCLR);
|
||||
eColor = pstBitmapData->fnGetPixel(pstBitmapData,iBmpPixX,iBmpPixY);
|
||||
}
|
||||
else
|
||||
{
|
||||
SGUI_Basic_DrawPoint(pstDeviceIF, iDrawPixX, iDrawPixY, SGUI_COLOR_BKGCLR);
|
||||
eColor = SGUI_Basic_BitMapScanDVPV(pstBitmapData,iBmpPixX,iBmpPixY);
|
||||
}
|
||||
|
||||
if(eDrawMode == SGUI_DRAW_REVERSE)
|
||||
{
|
||||
eColor = SGUI_Basic_GetReverseColor(pstBitmapData->iDepthBits,eColor);
|
||||
}
|
||||
if(pstDeviceIF->uiDepthBits != pstBitmapData->iDepthBits)
|
||||
{
|
||||
eColor = SGUI_Basic_MapColor(pstBitmapData->iDepthBits,eColor,pstDeviceIF->uiDepthBits);
|
||||
}
|
||||
SGUI_Basic_DrawPoint(pstDeviceIF,iDrawPixX,iDrawPixY,eColor);
|
||||
uiDrawnHeightIndex ++;
|
||||
uiPixIndex ++;
|
||||
iDrawPixY ++;
|
||||
iBmpPixY ++;
|
||||
}
|
||||
@ -594,6 +593,140 @@ void SGUI_Basic_DrawBitMap(SGUI_SCR_DEV* pstDeviceIF, SGUI_RECT* pstDisplayArea,
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_BitMapScanDHPH **/
|
||||
/** Purpose: Scan the BitMap data by Data Horizontally and Pixel **/
|
||||
/** Horizontally and return the Pixel Data **/
|
||||
/** Params: **/
|
||||
/** @ pDataBuffer[in]: the raw BitMap data. **/
|
||||
/** @ uiDepth[in]: the pixel depth. **/
|
||||
/** @ uiX[in]: the coordinate X of BitMap. **/
|
||||
/** @ uiY[in]: the coordinate Y of BitMap. **/
|
||||
/** Return: the Pixel Color at (uiX,uiY). **/
|
||||
/** Notice: None. **/
|
||||
/*************************************************************************/
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDHPH(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY)
|
||||
{
|
||||
// TODO
|
||||
return SGUI_COLOR_BKGCLR;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_BitMapScanDHPV **/
|
||||
/** Purpose: Scan the BitMap data by Data Horizontally and Pixel **/
|
||||
/** Vertically and return the Pixel Data **/
|
||||
/** Params: **/
|
||||
/** @ pDataBuffer[in]: the raw BitMap data. **/
|
||||
/** @ uiDepth[in]: the pixel depth. **/
|
||||
/** @ uiX[in]: the coordinate X of BitMap. **/
|
||||
/** @ uiY[in]: the coordinate Y of BitMap. **/
|
||||
/** Return: the Pixel Color at (uiX,uiY). **/
|
||||
/** Notice: None. **/
|
||||
/*************************************************************************/
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDHPV(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
/*----------------------------------*/
|
||||
SGUI_COLOR eColor;
|
||||
SGUI_UINT8 uiPixelPerByte;
|
||||
SGUI_UINT8 uiByteRow;
|
||||
SGUI_CBYTE* pData;
|
||||
SGUI_BYTE cTemp;
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
/*----------------------------------*/
|
||||
eColor = 0;
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
if( pstBitmapData->iDepthBits == 1 ||
|
||||
pstBitmapData->iDepthBits == 2 ||
|
||||
pstBitmapData->iDepthBits == 4 ||
|
||||
pstBitmapData->iDepthBits == 8 )
|
||||
{
|
||||
uiPixelPerByte = 8 / pstBitmapData->iDepthBits;
|
||||
uiByteRow = uiY / uiPixelPerByte;
|
||||
pData = pstBitmapData->pData + uiByteRow * pstBitmapData->iWidth + uiX;
|
||||
cTemp = (*pData)>>(uiY%8*pstBitmapData->iDepthBits);
|
||||
eColor |= cTemp & ((0x1<<pstBitmapData->iDepthBits)-1);
|
||||
}
|
||||
return eColor;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_BitMapScanDVPH **/
|
||||
/** Purpose: Scan the BitMap data by Data Vertically and Pixel **/
|
||||
/** Horizontally and return the Pixel Data **/
|
||||
/** Params: **/
|
||||
/** @ pDataBuffer[in]: the raw BitMap data. **/
|
||||
/** @ uiDepth[in]: the pixel depth. **/
|
||||
/** @ uiX[in]: the coordinate X of BitMap. **/
|
||||
/** @ uiY[in]: the coordinate Y of BitMap. **/
|
||||
/** Return: the Pixel Color at (uiX,uiY). **/
|
||||
/** Notice: None. **/
|
||||
/*************************************************************************/
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDVPH(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY)
|
||||
{
|
||||
// TODO
|
||||
return SGUI_COLOR_BKGCLR;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_BitMapScanDVPV **/
|
||||
/** Purpose: Scan the BitMap data by Data Vertically and Pixel **/
|
||||
/** Vertically and return the Pixel Data **/
|
||||
/** Params: **/
|
||||
/** @ pDataBuffer[in]: the raw BitMap data. **/
|
||||
/** @ uiDepth[in]: the pixel depth. **/
|
||||
/** @ uiX[in]: the coordinate X of BitMap. **/
|
||||
/** @ uiY[in]: the coordinate Y of BitMap. **/
|
||||
/** Return: the Pixel Color at (uiX,uiY). **/
|
||||
/** Notice: None. **/
|
||||
/*************************************************************************/
|
||||
SGUI_COLOR SGUI_Basic_BitMapScanDVPV(const SGUI_BMP_RES* pstBitmapData,SGUI_UINT8 uiX,SGUI_UINT8 uiY)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
/*----------------------------------*/
|
||||
SGUI_UINT8 uiBytesPerColomn;
|
||||
SGUI_UINT16 uiBitIndex;
|
||||
SGUI_UINT16 uiByteOffset;
|
||||
SGUI_COLOR eColor;
|
||||
const SGUI_BYTE* pData;
|
||||
SGUI_BYTE ucTemp;
|
||||
SGUI_UINT8 i;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
/*----------------------------------*/
|
||||
eColor = 0;
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
uiBytesPerColomn = (pstBitmapData->iDepthBits * pstBitmapData->iHeight + 7)/8;
|
||||
uiBitIndex = pstBitmapData->iDepthBits * uiY;
|
||||
uiByteOffset = uiBytesPerColomn*uiX+uiBitIndex / 8;
|
||||
uiBitIndex = uiBitIndex % 8;
|
||||
pData = pstBitmapData->pData+uiByteOffset;
|
||||
ucTemp = ((*pData) << uiBitIndex) & 0xFF;
|
||||
for(i=0; i<pstBitmapData->iDepthBits; i++)
|
||||
{
|
||||
eColor <<= 1;
|
||||
eColor |= (ucTemp & 0x80) ? 0x1 : 0x0;
|
||||
|
||||
ucTemp <<= 1;
|
||||
uiBitIndex += 1;
|
||||
if(uiBitIndex == 8 )
|
||||
{
|
||||
pData++;
|
||||
ucTemp=*pData;
|
||||
uiBitIndex = 0;
|
||||
}
|
||||
}
|
||||
return eColor;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_PointIsInArea **/
|
||||
/** Purpose: Judge point is in the specified rectangular area. **/
|
||||
@ -635,3 +768,36 @@ SGUI_BOOL SGUI_Basic_PointIsInArea(const SGUI_RECT* pstArea, const SGUI_POINT* p
|
||||
}
|
||||
return bReturn;
|
||||
}
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_GetReverseColor **/
|
||||
/** Purpose: Calculate the reverse color of eOriginColor when **/
|
||||
/** there is uiDepthBits bits is used to present depth **/
|
||||
/** Params: **/
|
||||
/** @ uiDepthBits[in]: Specified current depth bit count. **/
|
||||
/** @ eOriginColor[in]: Specified the origin color which will be **/
|
||||
/** reverted. **/
|
||||
/** Return: The revert color of eOriginColor **/
|
||||
/** Notice: Author:Jerry **/
|
||||
/*************************************************************************/
|
||||
SGUI_COLOR SGUI_Basic_GetReverseColor(const SGUI_UINT8 uiDepthBits,SGUI_COLOR eOriginColor)
|
||||
{
|
||||
return (1<<uiDepthBits)-1-eOriginColor;
|
||||
}
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Basic_MapColor **/
|
||||
/** Purpose: Calculate the mapped color in uiTargetDepthBits **/
|
||||
/** color space of eOriginColor in uiOriginDepthBits **/
|
||||
/** color space. **/
|
||||
/** Params: **/
|
||||
/** @ uiOriginDepthBits[in]: Origin color space depth bit count. **/
|
||||
/** @ eOriginColor[in]: Origin color. **/
|
||||
/** @ uiTargetDepthBits[in]: Target color space depth bit count. **/
|
||||
/** Return: The target color of eOriginColor **/
|
||||
/** Notice: Author:Jerry **/
|
||||
/*************************************************************************/
|
||||
SGUI_COLOR SGUI_Basic_MapColor(const SGUI_UINT8 uiOriginDepthBits,const SGUI_COLOR eOriginColor,const SGUI_UINT8 uiTargetDepthBits)
|
||||
{
|
||||
SGUI_UINT16 uiOriginSpace=(1<<uiOriginDepthBits)-1;
|
||||
SGUI_UINT16 uiTargetSpace=(1<<uiTargetDepthBits)-1;
|
||||
return (SGUI_COLOR)floor(eOriginColor*1.0/uiOriginSpace*uiTargetSpace);
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
//=======================================================================//
|
||||
#include "SGUI_Common.h"
|
||||
#include "SGUI_FontResource.h"
|
||||
|
||||
#include "SGUI_Basic.h"
|
||||
#include "SGUI_Text.h"
|
||||
//=======================================================================//
|
||||
//= User Macro definition. =//
|
||||
//=======================================================================//
|
||||
@ -33,67 +34,21 @@
|
||||
//=======================================================================//
|
||||
//= Static function declaration. =//
|
||||
//=======================================================================//
|
||||
static SGUI_INT SGUI_Resource_GetCharIndex_MiniNum(SGUI_UINT32 uiCode);
|
||||
static SGUI_INT SGUI_Resource_GetCharIndex_Default(SGUI_UINT32 uiCode);
|
||||
static SGUI_CSZSTR SGUI_Resource_StepNext_Default(SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode);
|
||||
static SGUI_BOOL SGUI_Resource_IsFullWidth_Default(SGUI_UINT32 uiCode);
|
||||
static SGUI_FONT_RES_DECLARE(MiniNum);
|
||||
static SGUI_FONT_RES_DECLARE(8);
|
||||
static SGUI_FONT_RES_DECLARE(12);
|
||||
static SGUI_FONT_RES_DECLARE(16);
|
||||
|
||||
//=======================================================================//
|
||||
//= Static variable declaration. =//
|
||||
//=======================================================================//
|
||||
const SGUI_FONT_RES SGUI_DEFAULT_FONT_MiniNum =
|
||||
{
|
||||
/*SGUI_INT iHalfWidth*/ 4,
|
||||
/*SGUI_INT iFullWidth*/ 0,
|
||||
/*SGUI_INT iHeight*/ 5,
|
||||
/*SGUI_FN_IF_GET_CHAR_INDEX fnGetIndex*/ SGUI_Resource_GetCharIndex_MiniNum,
|
||||
/*SGUI_FN_IF_GET_DATA fnGetData*/ SGUI_FONT_RES_DATA_FUNC_NAME(MiniNum),
|
||||
/*SGUI_FN_IF_STEP_NEXT fnStepNext*/ SGUI_Resource_StepNext_Default,
|
||||
/*SGUI_FN_IF_IS_FULL_WIDTH fnIsFullWidth*/ SGUI_Resource_IsFullWidth_Default
|
||||
};
|
||||
|
||||
const SGUI_FONT_RES SGUI_DEFAULT_FONT_8 =
|
||||
{
|
||||
/*SGUI_INT iHalfWidth*/ 6,
|
||||
/*SGUI_INT iFullWidth*/ 0,
|
||||
/*SGUI_INT iHeight*/ 8,
|
||||
/*SGUI_FN_IF_GET_CHAR_INDEX fnGetIndex*/ SGUI_Resource_GetCharIndex_Default,
|
||||
/*SGUI_FN_IF_GET_DATA fnGetData*/ SGUI_FONT_RES_DATA_FUNC_NAME(8),
|
||||
/*SGUI_FN_IF_STEP_NEXT fnStepNext*/ SGUI_Resource_StepNext_Default,
|
||||
/*SGUI_FN_IF_IS_FULL_WIDTH fnIsFullWidth*/ SGUI_Resource_IsFullWidth_Default
|
||||
};
|
||||
|
||||
const SGUI_FONT_RES SGUI_DEFAULT_FONT_12 =
|
||||
{
|
||||
/*SGUI_INT iHalfWidth*/ 6,
|
||||
/*SGUI_INT iFullWidth*/ 0,
|
||||
/*SGUI_INT iHeight*/ 12,
|
||||
/*SGUI_FN_IF_GET_CHAR_INDEX fnGetIndex*/ SGUI_Resource_GetCharIndex_Default,
|
||||
/*SGUI_FN_IF_GET_DATA fnGetData*/ SGUI_FONT_RES_DATA_FUNC_NAME(12),
|
||||
/*SGUI_FN_IF_STEP_NEXT fnStepNext*/ SGUI_Resource_StepNext_Default,
|
||||
/*SGUI_FN_IF_IS_FULL_WIDTH fnIsFullWidth*/ SGUI_Resource_IsFullWidth_Default
|
||||
};
|
||||
|
||||
const SGUI_FONT_RES SGUI_DEFAULT_FONT_16 =
|
||||
{
|
||||
/*SGUI_INT iHalfWidth*/ 8,
|
||||
/*SGUI_INT iFullWidth*/ 0,
|
||||
/*SGUI_INT iHeight*/ 16,
|
||||
/*SGUI_FN_IF_GET_CHAR_INDEX fnGetIndex*/ SGUI_Resource_GetCharIndex_Default,
|
||||
/*SGUI_FN_IF_GET_DATA fnGetData*/ SGUI_FONT_RES_DATA_FUNC_NAME(16),
|
||||
/*SGUI_FN_IF_STEP_NEXT fnStepNext*/ SGUI_Resource_StepNext_Default,
|
||||
/*SGUI_FN_IF_IS_FULL_WIDTH fnIsFullWidth*/ SGUI_Resource_IsFullWidth_Default
|
||||
};
|
||||
static SGUI_UINT32 SGUI_Resource_IndexMapper_MiniNum(SGUI_UINT32 uiCode);
|
||||
static SGUI_UINT32 SGUI_Resource_IndexMapper_Default(SGUI_UINT32 uiCode);
|
||||
|
||||
//======================================================================//
|
||||
//= 8 Pix font library. //
|
||||
//= 5 Pix mono space font library. =//
|
||||
//======================================================================//
|
||||
const SGUI_CBYTE SGUI_FONT_H6[] =
|
||||
{
|
||||
SGUI_INTERNAL_MONOSPACE_FONT_RESOURCE_DEFINE(MiniNum,4,5,1,4,
|
||||
SGUI_TEXT_DECODER_ASCII,
|
||||
SGUI_Resource_IndexMapper_MiniNum,
|
||||
SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0x1F, 0x11, 0x1F, 0x00, //0
|
||||
0x00, 0x1F, 0x00, 0x00, //1
|
||||
0x1D, 0x15, 0x17, 0x00, //2
|
||||
@ -114,12 +69,14 @@ const SGUI_CBYTE SGUI_FONT_H6[] =
|
||||
0x00, 0x00, 0x00, 0x00, //space
|
||||
0x1A, 0x04, 0x0B, 0x00, //%
|
||||
0x0A, 0x0A, 0x0A, 0x00, //=
|
||||
};
|
||||
|
||||
);
|
||||
//======================================================================//
|
||||
//= 8 Pix font library. //
|
||||
//= 8 Pix mono space font library. //
|
||||
//======================================================================//
|
||||
const SGUI_CBYTE SGUI_FONT_H8[] = {
|
||||
SGUI_INTERNAL_MONOSPACE_FONT_RESOURCE_DEFINE(FONT_8,6,8,1,6,
|
||||
SGUI_TEXT_DECODER_ASCII,
|
||||
SGUI_Resource_IndexMapper_Default,
|
||||
SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // space index 0
|
||||
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, // !
|
||||
0x00, 0x07, 0x00, 0x07, 0x00, 0x00, // "
|
||||
@ -215,11 +172,14 @@ const SGUI_CBYTE SGUI_FONT_H8[] = {
|
||||
0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, // |
|
||||
0x00, 0x41, 0x36, 0x08, 0x00, 0x00, // }
|
||||
0x00, 0x01, 0x02, 0x00, 0x00, 0x00 // ` index 94
|
||||
};
|
||||
);
|
||||
//======================================================================//
|
||||
//= 12 Pix font library. //
|
||||
//= 12 Pix mono space font library. =//
|
||||
//======================================================================//
|
||||
const SGUI_CBYTE SGUI_FONT_H12[] = {
|
||||
SGUI_INTERNAL_MONOSPACE_FONT_RESOURCE_DEFINE(FONT_12,6,12,1,12,
|
||||
SGUI_TEXT_DECODER_ASCII,
|
||||
SGUI_Resource_IndexMapper_Default,
|
||||
SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // space Index 0
|
||||
0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // !
|
||||
0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // "
|
||||
@ -315,11 +275,14 @@ const SGUI_CBYTE SGUI_FONT_H12[] = {
|
||||
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, // |
|
||||
0x00, 0x02, 0x9E, 0x60, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x00, // }
|
||||
0x04, 0x02, 0x02, 0x04, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ~ Index 94
|
||||
};
|
||||
);
|
||||
//======================================================================//
|
||||
//= 16 Pix font library. //
|
||||
//======================================================================//
|
||||
const SGUI_CBYTE SGUI_FONT_H16[] = {
|
||||
SGUI_INTERNAL_MONOSPACE_FONT_RESOURCE_DEFINE(FONT_16,8,16,1,16,
|
||||
SGUI_TEXT_DECODER_ASCII,
|
||||
SGUI_Resource_IndexMapper_Default,
|
||||
SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // space Index 0
|
||||
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00, //"!"
|
||||
0x00,0x00,0x1E,0x06,0x00,0x1E,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //"""
|
||||
@ -415,9 +378,9 @@ const SGUI_CBYTE SGUI_FONT_H16[] = {
|
||||
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, //"|"
|
||||
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00, //"}"
|
||||
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //"~" Index 94
|
||||
};
|
||||
)
|
||||
|
||||
SGUI_INT SGUI_Resource_GetCharIndex_MiniNum(SGUI_UINT32 uiCode)
|
||||
SGUI_UINT32 SGUI_Resource_IndexMapper_MiniNum(SGUI_UINT32 uiCode)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
@ -427,22 +390,14 @@ SGUI_INT SGUI_Resource_GetCharIndex_MiniNum(SGUI_UINT32 uiCode)
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
switch(uiCode)
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if('0'<=uiCode && uiCode <= '9')
|
||||
{
|
||||
iIndex = uiCode - '0';
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(uiCode)
|
||||
{
|
||||
case '.':
|
||||
{
|
||||
iIndex = 10;
|
||||
@ -499,10 +454,11 @@ SGUI_INT SGUI_Resource_GetCharIndex_MiniNum(SGUI_UINT32 uiCode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return iIndex;
|
||||
}
|
||||
|
||||
SGUI_INT SGUI_Resource_GetCharIndex_Default(SGUI_UINT32 uiCode)
|
||||
SGUI_UINT32 SGUI_Resource_IndexMapper_Default(SGUI_UINT32 uiCode)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
@ -525,36 +481,3 @@ SGUI_INT SGUI_Resource_GetCharIndex_Default(SGUI_UINT32 uiCode)
|
||||
return iIndex;
|
||||
}
|
||||
|
||||
SGUI_CSZSTR SGUI_Resource_StepNext_Default(SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
/*----------------------------------*/
|
||||
const SGUI_CHAR* pcNextChar;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
/*----------------------------------*/
|
||||
pcNextChar = cszSrc;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
if(NULL != pcNextChar)
|
||||
{
|
||||
*puiCode = *pcNextChar;
|
||||
pcNextChar++;
|
||||
}
|
||||
|
||||
return pcNextChar;
|
||||
}
|
||||
|
||||
SGUI_BOOL SGUI_Resource_IsFullWidth_Default(SGUI_UINT32 uiCode)
|
||||
{
|
||||
return SGUI_FALSE;
|
||||
}
|
||||
|
||||
SGUI_FONT_RES_DEFINE(MiniNum, SGUI_FONT_H6);
|
||||
SGUI_FONT_RES_DEFINE(8, SGUI_FONT_H8);
|
||||
SGUI_FONT_RES_DEFINE(12, SGUI_FONT_H12);
|
||||
SGUI_FONT_RES_DEFINE(16, SGUI_FONT_H16);
|
||||
|
@ -8,42 +8,43 @@
|
||||
//= Include files. =//
|
||||
//=======================================================================//
|
||||
#include "SGUI_IconResource.h"
|
||||
#include "SGUI_Basic.h"
|
||||
|
||||
//=======================================================================//
|
||||
//= Static variable define. =//
|
||||
//=======================================================================//
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_ERROR_16, 16, 16,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_ERROR_16, 16, 16,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x19,0x39,0x71,0xE1,0xC1,0xC1,0xE1,0x71,0x39,0x19,0x01,0x01,0xFF,
|
||||
0xFF,0x80,0x80,0x98,0x9C,0x8E,0x87,0x83,0x83,0x87,0x8E,0x9C,0x98,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_INFORMATION_16, 16, 16,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_INFORMATION_16, 16, 16,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0xED,0xED,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0xBF,0xBF,0x80,0x80,0x80,0x80,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_QUESTION_16, 16, 16,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_QUESTION_16, 16, 16,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x01,0x31,0x39,0x1D,0x0D,0x0D,0x9D,0xF9,0xF1,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0xB6,0xB7,0x83,0x81,0x80,0x80,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_WARNING_16, 16, 16,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_WARNING_16, 16, 16,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0xFD,0xFD,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0xB7,0xB7,0x80,0x80,0x80,0x80,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_ERROR_24, 24, 24,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_ERROR_24, 24, 24,1,SGUI_BMP_SCAN_MODE_DVPV,
|
||||
0xFF,0x01,0x01,0x01,0x71,0xF1,0xF1,0xE1,0xC1,0x81,0x01,0x01,0x01,0x01,0x81,0xC1,0xE1,0xF1,0xF1,0x71,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x00,0x00,0x00,0x00,0x00,0x81,0xC3,0xE7,0xFF,0xFF,0x7E,0x7E,0xFF,0xFF,0xE7,0xC3,0x81,0x00,0x00,0x00,0x00,0x00,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x8E,0x8F,0x8F,0x87,0x83,0x81,0x80,0x80,0x80,0x80,0x81,0x83,0x87,0x8F,0x8F,0x8E,0x80,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_INFORMATION_24, 24, 24,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_INFORMATION_24, 24, 24,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x79,0x79,0x79,0x79,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x98,0x9F,0x9F,0x9F,0x9F,0x98,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_QUESTION_24, 24, 24,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_QUESTION_24, 24, 24,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x01,0x01,0x01,0xC1,0xE1,0xF1,0xF1,0x79,0x79,0x79,0x79,0xF1,0xF1,0xE1,0xC1,0x81,0x01,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x03,0x00,0xC0,0xE0,0xF0,0xF8,0x7C,0x3F,0x1F,0x0F,0x07,0x00,0x00,0x00,0x00,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x9E,0x9E,0x9E,0x9E,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFF);
|
||||
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_WARNING_24, 24, 24,
|
||||
SGUI_BMP_RESOURCE_DEFINE(SGUI_RES_ICON_WARNING_24, 24, 24,1,SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xF1,0xF9,0xF9,0xF1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,
|
||||
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,
|
||||
0xFF,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x9E,0x9E,0x9E,0x9E,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFF);
|
||||
|
@ -13,14 +13,14 @@
|
||||
//= User Macro definition. =//
|
||||
//=======================================================================//
|
||||
#define SGUI_MENU_ICON_DECLARE(NAME) extern const SGUI_BMP_RES NAME
|
||||
#define SGUI_MENU_ICON_DEFINE(NAME, W, H, ...) const SGUI_BYTE NAME##DATA[] = {__VA_ARGS__};\
|
||||
const SGUI_BMP_RES NAME = {W, H, NAME##DATA}
|
||||
#define SGUI_MENU_ICON_DEFINE(NAME, W, H, D, FGP,...) const SGUI_BYTE NAME##DATA[] = {__VA_ARGS__};\
|
||||
const SGUI_BMP_RES NAME = {W, H, D, FGP, NAME##DATA}
|
||||
//=======================================================================//
|
||||
//= Static variable define. =//
|
||||
//=======================================================================//
|
||||
static SGUI_MENU_ICON_DEFINE(SGUI_MENU_ICON_MOVEUP, 5, 3,
|
||||
static SGUI_MENU_ICON_DEFINE(SGUI_MENU_ICON_MOVEUP, 5, 3, 1, SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0x04,0x06,0x07,0x06,0x04);
|
||||
static SGUI_MENU_ICON_DEFINE(SGUI_MENU_ICON_MOVEDOWN, 5, 3,
|
||||
static SGUI_MENU_ICON_DEFINE(SGUI_MENU_ICON_MOVEDOWN, 5, 3, 1, SGUI_BMP_SCAN_MODE_DHPV,
|
||||
0x01,0x03,0x07,0x03,0x01);
|
||||
|
||||
//=======================================================================//
|
||||
|
@ -39,6 +39,7 @@ void SGUI_Text_GetTextExtent(SGUI_CSZSTR cszText, const SGUI_FONT_RES* pstFontRe
|
||||
/*----------------------------------*/
|
||||
const SGUI_CHAR* pcChar;
|
||||
SGUI_UINT32 uiCharacterCode;
|
||||
SGUI_BMP_RES stCharBitmap;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
@ -58,7 +59,8 @@ void SGUI_Text_GetTextExtent(SGUI_CSZSTR cszText, const SGUI_FONT_RES* pstFontRe
|
||||
pcChar = pstFontRes->fnStepNext(pcChar, &uiCharacterCode);
|
||||
if('\0' !=uiCharacterCode)
|
||||
{
|
||||
pstTextExtent->iWidth+=(pstFontRes->fnIsFullWidth(uiCharacterCode)?pstFontRes->iFullWidth:pstFontRes->iHalfWidth);
|
||||
pstFontRes->fnGetBitmap(&stCharBitmap,uiCharacterCode,true);
|
||||
pstTextExtent->iWidth+=stCharBitmap.iWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -93,7 +95,7 @@ void SGUI_Text_DrawText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR cszText, const SG
|
||||
/*----------------------------------*/
|
||||
// Initialize variable.
|
||||
pcChar = (SGUI_CSZSTR)ENCODE(cszText);
|
||||
eBackColor = (eFontMode == SGUI_DRAW_NORMAL)?SGUI_COLOR_BKGCLR:SGUI_COLOR_FRGCLR;
|
||||
eBackColor = SGUI_Basic_MapColor(1,(eFontMode == SGUI_DRAW_NORMAL)?0:1,pstDeviceIF->uiDepthBits);
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
@ -110,7 +112,6 @@ void SGUI_Text_DrawText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR cszText, const SG
|
||||
RECT_X_START(stPaintPos) = RECT_X_START(*pstInnerPos);
|
||||
RECT_Y_START(stPaintPos) = RECT_Y_START(*pstInnerPos);
|
||||
RECT_HEIGHT(stCharBitmap) = pstFontRes->iHeight;
|
||||
stCharBitmap.pData = pstDeviceIF->arrBmpDataBuffer;
|
||||
|
||||
// Loop for Each char.
|
||||
while(((NULL != pcChar) && ('\0' != *pcChar)) && (RECT_X_START(stPaintPos) < RECT_WIDTH(*pstDisplayArea)))
|
||||
@ -119,10 +120,10 @@ void SGUI_Text_DrawText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR cszText, const SG
|
||||
pcChar = pstFontRes->fnStepNext(pcChar, &uiCharacterCode);
|
||||
//if(SGUI_IS_VISIBLE_CHAR(uiCharacterCode))
|
||||
{
|
||||
RECT_WIDTH(stCharBitmap) = pstFontRes->fnIsFullWidth(uiCharacterCode)?pstFontRes->iFullWidth:pstFontRes->iHalfWidth;
|
||||
stCharBitmap.pData=pstDeviceIF->arrBmpDataBuffer;
|
||||
pstFontRes->fnGetBitmap(&stCharBitmap,uiCharacterCode,false);
|
||||
if((stPaintPos.iX+stCharBitmap.iWidth-1) >= 0)
|
||||
{
|
||||
SGUI_Text_GetCharacterData(pstFontRes, uiCharacterCode, pstDeviceIF->arrBmpDataBuffer, SGUI_BMP_DATA_BUFFER_SIZE);
|
||||
SGUI_Basic_DrawBitMap(pstDeviceIF, pstDisplayArea, &stPaintPos, &stCharBitmap, eFontMode);
|
||||
}
|
||||
RECT_X_START(stPaintPos) += RECT_WIDTH(stCharBitmap);
|
||||
@ -163,7 +164,7 @@ SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR
|
||||
pcChar = (SGUI_CSZSTR)ENCODE(cszText);
|
||||
uiCharacterCode = 0;
|
||||
uiLines = 0;
|
||||
eBackColor = (eFontMode == SGUI_DRAW_NORMAL)?SGUI_COLOR_BKGCLR:SGUI_COLOR_FRGCLR;
|
||||
eBackColor = SGUI_Basic_MapColor(1,(eFontMode == SGUI_DRAW_NORMAL)?0:1,pstDeviceIF->uiDepthBits);
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
@ -200,8 +201,6 @@ SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR
|
||||
uiLines ++;
|
||||
continue;
|
||||
}
|
||||
// Get character width;
|
||||
RECT_WIDTH(stCharBitmap) = pstFontRes->fnIsFullWidth(uiCharacterCode)?pstFontRes->iFullWidth:pstFontRes->iHalfWidth;
|
||||
|
||||
// Judge change line
|
||||
if((stPaintPos.iX+stCharBitmap.iWidth-1) >= RECT_WIDTH(*pstDisplayArea))
|
||||
@ -215,7 +214,7 @@ SGUI_SIZE SGUI_Text_DrawMultipleLinesText(SGUI_SCR_DEV* pstDeviceIF, SGUI_CSZSTR
|
||||
if(((stPaintPos.iX+stCharBitmap.iWidth-1) >= 0) && (RECT_Y_START(stPaintPos) < RECT_HEIGHT(*pstDisplayArea)))
|
||||
{
|
||||
// Draw character.
|
||||
SGUI_Text_GetCharacterData(pstFontRes, uiCharacterCode, pstDeviceIF->arrBmpDataBuffer, SGUI_BMP_DATA_BUFFER_SIZE);
|
||||
pstFontRes->fnGetBitmap(&stCharBitmap,uiCharacterCode,false);
|
||||
SGUI_Basic_DrawBitMap(pstDeviceIF, pstDisplayArea, &stPaintPos, &stCharBitmap, eFontMode);
|
||||
}
|
||||
else
|
||||
@ -245,8 +244,8 @@ SGUI_SIZE SGUI_Text_GetMultiLineTextLines(SGUI_CSZSTR cszText, const SGUI_FONT_R
|
||||
/*----------------------------------*/
|
||||
SGUI_SIZE uiLineNumber, uiLineLength;
|
||||
SGUI_UINT32 uiCharacterCode;
|
||||
SGUI_UINT16 uiCharWidth;
|
||||
SGUI_CSZSTR pcChar;
|
||||
SGUI_BMP_RES stCharBitmap;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
@ -269,15 +268,15 @@ SGUI_SIZE SGUI_Text_GetMultiLineTextLines(SGUI_CSZSTR cszText, const SGUI_FONT_R
|
||||
}
|
||||
else
|
||||
{
|
||||
uiCharWidth = pstFontRes->fnIsFullWidth(uiCharacterCode)?pstFontRes->iFullWidth:pstFontRes->iHalfWidth;
|
||||
if((uiLineLength+uiCharWidth)>uiDisplayAreaWidth)
|
||||
pstFontRes->fnGetBitmap(&stCharBitmap,uiCharacterCode,true);
|
||||
if((uiLineLength+stCharBitmap.iWidth)>uiDisplayAreaWidth)
|
||||
{
|
||||
uiLineNumber++;
|
||||
uiLineLength = uiCharWidth;
|
||||
uiLineLength = stCharBitmap.iWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
uiLineLength+=uiCharWidth;
|
||||
uiLineLength += stCharBitmap.iWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,43 +284,94 @@ SGUI_SIZE SGUI_Text_GetMultiLineTextLines(SGUI_CSZSTR cszText, const SGUI_FONT_R
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Function Name: SGUI_Text_GetCharacterData **/
|
||||
/** Purpose: Get character data form font resource by char code. **/
|
||||
/** Function Name: SGUI_Text_IndexMapper_Direct **/
|
||||
/** Purpose: Directly use character code as the index while getting **/
|
||||
/** character index inside the mono space font library. **/
|
||||
/** Params: **/
|
||||
/** @ pstFontRes[in]: Font resource structure pointer. **/
|
||||
/** @ uiCode[in]: Character code. **/
|
||||
/** @ pDataBuffer[out]: Buffer for output char data. **/
|
||||
/** @ sBufferSize[in]: Output buffer size. **/
|
||||
/** Return: Number of read data, return 0 when error occurred. **/
|
||||
/** Return: The char block index inside of the library. **/
|
||||
/*****************************************************************************/
|
||||
SGUI_SIZE SGUI_Text_GetCharacterData(const SGUI_FONT_RES* pstFontRes, SGUI_UINT32 uiCode, SGUI_BYTE* pDataBuffer, SGUI_SIZE sBufferSize)
|
||||
SGUI_UINT32 SGUI_Text_IndexMapper_Direct(SGUI_UINT32 uiCode)
|
||||
{
|
||||
return uiCode;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Text_StepNext_ASCII **/
|
||||
/** Purpose: Read current character code order by input pointer **/
|
||||
/** and step to next character start pointer in ASCII. **/
|
||||
/** Resources: None. **/
|
||||
/** Params: **/
|
||||
/** @ cszSrc[in]: Current char pointer. **/
|
||||
/** @ puiCode[in]: Character code read from string(ASCII). **/
|
||||
/** Return: Next character start pointer. **/
|
||||
/*************************************************************************/
|
||||
SGUI_CSZSTR SGUI_Text_StepNext_ASCII(SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
/*----------------------------------*/
|
||||
SGUI_SIZE sGetDataSize;
|
||||
SGUI_SIZE sReadDataSize;
|
||||
SGUI_SIZE sDataBlockSize;
|
||||
SGUI_INT iCharIndex;
|
||||
const SGUI_CHAR* pcNextChar;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
/*----------------------------------*/
|
||||
sGetDataSize = 0;
|
||||
pcNextChar = cszSrc;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
if((NULL != pstFontRes) && (NULL != pDataBuffer) && (0 != sBufferSize))
|
||||
if(NULL != pcNextChar)
|
||||
{
|
||||
iCharIndex = pstFontRes->fnGetIndex(uiCode);
|
||||
if(SGUI_INVALID_INDEX != iCharIndex)
|
||||
{
|
||||
sDataBlockSize = SGUI_USED_BYTE(pstFontRes->iHeight)*(pstFontRes->iHalfWidth);
|
||||
sReadDataSize = pstFontRes->fnIsFullWidth(uiCode)?(sDataBlockSize*2):sDataBlockSize;
|
||||
sGetDataSize = pstFontRes->fnGetData(iCharIndex*sDataBlockSize, pDataBuffer, sReadDataSize>sBufferSize?sBufferSize:sReadDataSize);
|
||||
}
|
||||
*puiCode = *pcNextChar;
|
||||
pcNextChar++;
|
||||
}
|
||||
|
||||
return sGetDataSize;
|
||||
return pcNextChar;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/** Function Name: SGUI_Resource_StepNext_GB2312 **/
|
||||
/** Purpose: Read current character code order by input pointer **/
|
||||
/** and step to next character start pointer in GB2312. **/
|
||||
/** Resources: None. **/
|
||||
/** Params: **/
|
||||
/** @ cszSrc[in]: Current char pointer. **/
|
||||
/** @ puiCode[out]: Character code read from string. **/
|
||||
/** Return: Next character start pointer. **/
|
||||
/*************************************************************************/
|
||||
SGUI_CSZSTR SGUI_Text_StepNext_GB2312(SGUI_CSZSTR cszSrc, SGUI_UINT32* puiCode)
|
||||
{
|
||||
/*----------------------------------*/
|
||||
/* Variable Declaration */
|
||||
/*----------------------------------*/
|
||||
const SGUI_CHAR* pcNextChar;
|
||||
SGUI_UINT32 uiCode;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Initialize */
|
||||
/*----------------------------------*/
|
||||
pcNextChar = cszSrc;
|
||||
uiCode = 0;
|
||||
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
if(NULL != pcNextChar)
|
||||
{
|
||||
do
|
||||
{
|
||||
uiCode = (SGUI_BYTE)(*pcNextChar++);
|
||||
if(uiCode < 0x7F)
|
||||
{
|
||||
break;
|
||||
}
|
||||
uiCode = uiCode<<8;
|
||||
uiCode |= (SGUI_BYTE)(*pcNextChar++);
|
||||
}
|
||||
while(0);
|
||||
}
|
||||
*puiCode = uiCode;
|
||||
|
||||
return pcNextChar;
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ void SGUI_TextVariableBox_Repaint(SGUI_SCR_DEV* pstDeviceIF, SGUI_TEXT_VARBOX_ST
|
||||
// Clear background.
|
||||
SGUI_Basic_DrawRectangle(pstDeviceIF, LAYOUT(pstObj).iX, LAYOUT(pstObj).iY, LAYOUT(pstObj).iWidth, LAYOUT(pstObj).iHeight, eBackColor, eBackColor);
|
||||
// Get font graphics size.
|
||||
uiFontWidth = pstObj->stParam.pstFontRes->iHalfWidth;
|
||||
// TODO: Calculate which char is to be focused
|
||||
uiFontWidth = 0;//pstObj->stParam.pstFontRes->iHalfWidth;
|
||||
uiFontHeight = pstObj->stParam.pstFontRes->iHeight;
|
||||
|
||||
// Get max text length and graphics width.
|
||||
|
@ -32,7 +32,7 @@ class Application : public wxApp
|
||||
{
|
||||
private:
|
||||
LCDFrame* m_pclsMainFrame;
|
||||
|
||||
wxLogWindow* m_pLogWindow;
|
||||
public:
|
||||
bool OnInit(void);
|
||||
int OnRun(void);
|
||||
|
@ -30,6 +30,7 @@ bool Application::OnInit(void)
|
||||
/*----------------------------------*/
|
||||
/* Process */
|
||||
/*----------------------------------*/
|
||||
m_pLogWindow = new wxLogWindow(NULL,"SimpleGUI Simulator Log");
|
||||
// Register image media handle.
|
||||
wxInitAllImageHandlers();
|
||||
// Read virtual device parameter.
|
||||
|
Loading…
Reference in New Issue
Block a user