⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guicharp.c

📁 S3C44B0X在UCOSII的源码
💻 C
字号:
/***********************************************************************************************************                                                uC/GUI*                        Universal graphic software for embedded applications**                       (c) Copyright 2002, Micrium Inc., Weston, FL*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH**              礐/GUI is protected by international copyright laws. Knowledge of the*              source code may not be used to write a similar product. This file may*              only be used in accordance with a license and should not be redistributed*              in any way. We appreciate your understanding and fairness.*----------------------------------------------------------------------File        : GUICharP.CPurpose     : Implementation of Proportional fonts---------------------------END-OF-HEADER------------------------------*/#include <stddef.h>           /* needed for definition of NULL */#include "GUI_Private.H" /*      ***********************************************************      *                                                         *      *       Proprotional fonts                                *      *                                                         *      ************************************************************/static const GUI_FONT_PROP* GUIPROP_FindChar(const GUI_FONT_PROP* pProp, U16P c) {  for (; pProp; pProp=(GUI_FONT_PROP*) pProp->pNext) {    if ((c>=pProp->First) && (c<=pProp->Last))      break;  }  return pProp;}void GUIPROP_DispChar(U16P c) {  int BytesPerLine;  GUI_DRAWMODE DrawMode = GUI_Context.TextMode;  const GUI_FONT_PROP* pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c);  if (pProp) {    GUI_DRAWMODE OldDrawMode;    const GUI_CHARINFO* pCharInfo = pProp->paCharInfo+(c-pProp->First);    BytesPerLine = pCharInfo->BytesPerLine;    OldDrawMode  = LCD_SetDrawMode(DrawMode);    LCD_DrawBitmap( GUI_Context.DispPosX, GUI_Context.DispPosY,                       pCharInfo->XSize,											 GUI_Context.pAFont->YSize,                       GUI_Context.pAFont->XMag,											 GUI_Context.pAFont->YMag,                       1,     /* Bits per Pixel */                       BytesPerLine,                       (U8 const *)pCharInfo->pData,                       NULL  /* no palette means default palette */                       );    /* Fill empty pixel lines */    if (GUI_Context.pAFont->YDist > GUI_Context.pAFont->YSize) {      int YMag = GUI_Context.pAFont->YMag;      int YDist = GUI_Context.pAFont->YDist * YMag;      int YSize = GUI_Context.pAFont->YSize * YMag;      if (DrawMode != LCD_DRAWMODE_TRANS) {        LCD_COLOR OldColor = GUI_GetColor();        GUI_SetColor(GUI_GetBkColor());        LCD_FillRect(GUI_Context.DispPosX,                      GUI_Context.DispPosY + YSize,                      GUI_Context.DispPosX + pCharInfo->XSize,                      GUI_Context.DispPosY + YDist);        GUI_SetColor(OldColor);      }    }    LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */    GUI_Context.DispPosX += pCharInfo->XDist;  }}int GUIPROP_GetCharDistX(U16P c) {  const GUI_FONT_PROP* pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c);  return (pProp) ? (pProp->paCharInfo+(c-pProp->First))->XSize : 0;}void GUIPROP_GetFontInfo(void*pFont, GUI_FONTINFO* pfi) {  GUI_USE_PARA(pFont);  pfi->Flags = GUI_FONTINFO_FLAG_PROP;}char GUIPROP_IsInFont(void*pFont, U16 c) {  const GUI_FONT_PROP* pProp = GUIPROP_FindChar(((GUI_FONT*)pFont)->p.pProp, c);  return (pProp==NULL) ? 0 : 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -