📄 guiaachar.lst
字号:
C51 COMPILER V8.05a GUIAACHAR 04/11/2008 14:18:17 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GUIAACHAR
OBJECT MODULE PLACED IN GUIAAChar.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\AntiAlias\GUIAAChar.c LARGE BROWSE MDU_F120 DEBUG OBJECTE
-XTEND PRINT(.\GUIAAChar.lst) OBJECT(GUIAAChar.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/GUI
4 * Universal graphic software for embedded applications
5 *
6 * (c) Copyright 2002, Micrium Inc., Weston, FL
7 * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
8 *
9 * 礐/GUI is protected by international copyright laws. Knowledge of the
10 * source code may not be used to write a similar product. This file may
11 * only be used in accordance with a license and should not be redistributed
12 * in any way. We appreciate your understanding and fairness.
13 *
14 ----------------------------------------------------------------------
15 File : GUICharAA.C
16 Purpose : Display antialiased
17 ----------------------------------------------------------------------
18 Version-Date---Author-Explanation
19 ----------------------------------------------------------------------
20
21 1.00.00 990922 RS First release
22 ----------------------------------------------------------------------
23 Known problems or limitations with current version
24 ----------------------------------------------------------------------
25 Module needs cleanup and review, but is fully functional.
26 ---------------------------END-OF-HEADER------------------------------
27 */
28
29
30 #include "gui\Core\GUI_Private.h"
31
32
33 #include <stdio.h>
34 #include <string.h>
35
36 /*
37 ***********************************************************
38 * *
39 * Anti-aliased drawing *
40 * *
41 ***********************************************************
42 */
43
44 static const U8 Bit2Mask0[] = {1<<7, 1<<5, 1<<3, 1<<1};
45 static const U8 Bit2Mask1[] = {1<<6, 1<<4, 1<<2, 1<<0};
46
47 typedef void tSetPixelAA(int x, int y, U8 Intens);
48
49 static void Draw(int x0, int y0, int XSize, int YSize, int BytesPerLine, const U8*pData) {
50 1 int x, y;
51 1 tSetPixelAA* pfSetPixelAA;
52 1 pfSetPixelAA = (GUI_Context.TextMode & GUI_TM_TRANS)
53 1 ? LCD_SetPixelAA : LCD_SetPixelAA_NoTrans;
54 1 for (y=0; y<YSize; y++) {
C51 COMPILER V8.05a GUIAACHAR 04/11/2008 14:18:17 PAGE 2
55 2 const U8* pData0 = pData;
56 2 const U8* pData1 = pData+BytesPerLine;
57 2 for (x=0; x<XSize; x++) {
58 3 int PixelCnt=0;
59 3 int Mask0 = Bit2Mask0[x&3];
60 3 int Mask1 = Bit2Mask1[x&3];
61 3 if ((*pData0) & Mask0)
62 3 PixelCnt++;
63 3 if ((*pData0) & Mask1)
64 3 PixelCnt++;
65 3 if ((*pData1) & Mask0)
66 3 PixelCnt++;
67 3 if ((*pData1) & Mask1)
68 3 PixelCnt++;
69 3 if ((x&3) ==3) {
70 4 pData0++;
71 4 pData1++;
72 4 }
73 3 switch (PixelCnt) {
74 4 case 4: LCD_HL_DrawPixel(x0+x,y0+y); break;
75 4 case 3: (*pfSetPixelAA) (x0+x,y0+y, 12); break;
76 4 case 2: (*pfSetPixelAA) (x0+x,y0+y, 8); break;
77 4 case 1: (*pfSetPixelAA) (x0+x,y0+y, 4); break;
78 4 }
79 3 }
80 2 pData+=2*BytesPerLine;
81 2 }
82 1 }
83
84 /*
85 ***********************************************************
86 * *
87 * Font handling *
88 * *
89 ***********************************************************
90 */
91
92 static const GUI_FONT_PROP* GUIPROP_FindChar(const GUI_FONT_PROP* pProp, U16P c) {
93 1 for (pProp = GUI_Context.pAFont->p.pProp; pProp; pProp=(const GUI_FONT_PROP*) pProp->pNext) {
94 2 if ((c>=pProp->First) && (c<=pProp->Last))
95 2 break;
96 2 }
97 1 return pProp;
98 1 }
99
100 void GUIPROPAA_DispChar(U16P c) {
101 1 int BytesPerLine;
102 1 GUI_DRAWMODE DrawMode = GUI_Context.TextMode;
103 1 const GUI_FONT_PROP* pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c);
104 1 if (pProp) {
105 2 GUI_DRAWMODE OldDrawMode;
106 2 const GUI_CHARINFO* pCharInfo = pProp->paCharInfo+(c-pProp->First);
107 2 BytesPerLine = pCharInfo->BytesPerLine;
108 2 OldDrawMode = LCD_SetDrawMode(DrawMode);
109 2 Draw ( GUI_Context.DispPosX, GUI_Context.DispPosY,
110 2 (pCharInfo->XSize+1)/2,
111 2 GUI_Context.pAFont->YSize,
112 2 BytesPerLine,
113 2 (U8 const*) pCharInfo->pData
114 2 );
115 2 LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */
116 2 GUI_Context.DispPosX += (pCharInfo->XDist+1)/2;
C51 COMPILER V8.05a GUIAACHAR 04/11/2008 14:18:17 PAGE 3
117 2 }
118 1 }
119
120 int GUIPROPAA_GetCharDistX(U16P c) {
121 1 int r;
122 1 const GUI_FONT_PROP* pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c);
123 1 r = (pProp) ? (pProp->paCharInfo+(c-pProp->First))->XSize : 0;
124 1 return (r+1)/2;
125 1 }
126
127 void GUIPROPAA_GetFontInfo(void*pFont, GUI_FONTINFO* pfi) {
128 1 GUI_USE_PARA(pFont);
129 1 pfi->Flags = GUI_FONTINFO_FLAG_PROP | GUI_FONTINFO_FLAG_AA;
130 1 }
131
132 char GUIPROPAA_IsInFont(void*pFont, U16 c) {
133 1 const GUI_FONT_PROP* pProp = GUIPROP_FindChar(((GUI_FONT*)pFont)->p.pProp, c);
134 1 return (pProp==NULL) ? 0 : 1;
135 1 }
136
137
138 /* End of file */
139
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1244 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 8 59
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -