📄 guiaachar2.lst
字号:
C51 COMPILER V8.05a GUIAACHAR2 04/11/2008 14:18:16 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GUIAACHAR2
OBJECT MODULE PLACED IN GUIAAChar2.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\AntiAlias\GUIAAChar2.c LARGE BROWSE MDU_F120 DEBUG OBJECT
-EXTEND PRINT(.\GUIAAChar2.lst) OBJECT(GUIAAChar2.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 : GUICharAA2.C
16 Purpose : Display antialiased 2bpp
17 ----------------------------------------------------------------------
18 Version-Date---Author-Explanation
19 ----------------------------------------------------------------------
20 1.00.01 011031 JE a) GL_DrawBitmap called instead of GUI_DrawBitmap
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 #include <stdio.h>
32 #include <string.h>
33 /*
34 ***********************************************************
35 * *
36 * Static defines
37 * *
38 ***********************************************************
39 */
40
41 #define MAX_CHAR_SIZE 100
42
43 /*
44 ***********************************************************
45 * *
46 * Static variables
47 * *
48 ***********************************************************
49 */
50
51 /* used by transparent characters */
52 static const int aConvTable[4] = {0, 5, 10, 15};
53
54 /* used by non transparent characters */
C51 COMPILER V8.05a GUIAACHAR2 04/11/2008 14:18:16 PAGE 2
55 static LCD_COLOR aColor[4];
56 static LCD_PIXELINDEX OldColorIndex, OldBkColorIndex;
57 static GUI_LOGPALETTE Palette = {4, 0, &aColor[0]};
58 static GUI_BITMAP Bitmap = {0, 0, 0, 2, 0, &Palette, 0};
59
60 /*
61 ***********************************************************
62 * *
63 * Anti-aliased drawing *
64 * *
65 ***********************************************************
66 */
67
68 static void DrawNoTrans(int x0, int y0, int XSize, int YSize, int BytesPerLine, const U8*pData) {
69 1 if ((OldColorIndex != LCD_COLORINDEX) ||
70 1 (OldBkColorIndex != LCD_BKCOLORINDEX)) {
71 2 int i;
72 2 LCD_PIXELINDEX BkColorIndex = LCD_BKCOLORINDEX;
73 2 LCD_PIXELINDEX ColorIndex = LCD_COLORINDEX;
74 2 LCD_COLOR BkColor = LCD_Index2Color(BkColorIndex);
75 2 LCD_COLOR Color = LCD_Index2Color(ColorIndex);
76 2 aColor[0] = BkColor;
77 2 for (i = 1; i < 3; i++) {
78 3 U8 Intens;
79 3 Intens = 5 * i;
80 3 aColor[i] = LCD_AA_MixColors(Color, BkColor, Intens);
81 3 }
82 2 aColor[3] = Color;
83 2 LCD_GetpPalConvTableUncached(&Palette);
84 2 OldColorIndex = ColorIndex;
85 2 OldBkColorIndex = BkColorIndex;
86 2 }
87 1 Bitmap.XSize = XSize;
88 1 Bitmap.YSize = YSize;
89 1 Bitmap.BytesPerLine = BytesPerLine;
90 1 Bitmap.pData = pData;
91 1 GL_DrawBitmap(&Bitmap, x0, y0);
92 1 }
93
94 static void DrawTrans(int x0, int y0, int XSize, int YSize, int BytesPerLine, const U8*pData) {
95 1 int x, y;
96 1 for (y = 0; y < YSize; y++) {
97 2 const U8 *pData0 = pData;
98 2 U8 Rem = XSize & 3;
99 2 for (x = 0; x < XSize - 1; x += 4) {
100 3 LCD_SetPixelAA(x + x0 , y0 + y, aConvTable[((*pData0 ) >> 6) ]);
101 3 LCD_SetPixelAA(x + x0 + 1, y0 + y, aConvTable[((*pData0 ) >> 4) & 0x03]);
102 3 LCD_SetPixelAA(x + x0 + 2, y0 + y, aConvTable[((*pData0 ) >> 2) & 0x03]);
103 3 LCD_SetPixelAA(x + x0 + 3, y0 + y, aConvTable[((*pData0++) ) & 0x03]);
104 3 }
105 2 if (Rem) {
106 3 LCD_SetPixelAA(x + x0 , y0 + y, aConvTable[((*pData0 ) >> 6) ]);
107 3 if (Rem > 1) {
108 4 LCD_SetPixelAA(x + x0 + 1, y0 + y, aConvTable[((*pData0 ) >> 4) & 0x03]);
109 4 if (Rem > 2) {
110 5 LCD_SetPixelAA(x + x0 + 2, y0 + y, aConvTable[((*pData0 ) >> 2) & 0x03]);
111 5 }
112 4 }
113 3 }
114 2 pData += BytesPerLine;
115 2 }
116 1 }
C51 COMPILER V8.05a GUIAACHAR2 04/11/2008 14:18:16 PAGE 3
117
118 /*
119 ***********************************************************
120 * *
121 * Font handling *
122 * *
123 ***********************************************************
124 */
125
126 static const GUI_FONT_PROP* GUIPROP_FindChar(const GUI_FONT_PROP* pProp, U16P c) {
127 1 for (pProp = GUI_Context.pAFont->p.pProp; pProp; pProp=(const GUI_FONT_PROP*) pProp->pNext) {
128 2 if ((c>=pProp->First) && (c<=pProp->Last))
129 2 break;
130 2 }
131 1 return pProp;
132 1 }
133
134 void GUIPROP_AA2_DispChar(U16P c) {
135 1 int BytesPerLine;
136 1 GUI_DRAWMODE DrawMode = GUI_Context.TextMode;
137 1 const GUI_FONT_PROP* pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c);
138 1 if (pProp) {
139 2 GUI_DRAWMODE OldDrawMode;
140 2 const GUI_CHARINFO* pCharInfo = pProp->paCharInfo+(c-pProp->First);
141 2 BytesPerLine = pCharInfo->BytesPerLine;
142 2 OldDrawMode = LCD_SetDrawMode(DrawMode);
143 2 if (DrawMode && GUI_TM_TRANS) {
144 3 DrawTrans(GUI_Context.DispPosX,
145 3 GUI_Context.DispPosY,
146 3 pCharInfo->XSize,
147 3 GUI_Context.pAFont->YSize,
148 3 BytesPerLine,
149 3 (U8 const*)pCharInfo->pData
150 3 );
151 3 } else {
152 3 DrawNoTrans(GUI_Context.DispPosX,
153 3 GUI_Context.DispPosY,
154 3 pCharInfo->XSize,
155 3 GUI_Context.pAFont->YSize,
156 3 BytesPerLine,
157 3 (U8 const*)pCharInfo->pData
158 3 );
159 3 }
160 2 LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */
161 2 GUI_Context.DispPosX += pCharInfo->XDist;
162 2 }
163 1 }
164
165 int GUIPROP_AA2_GetCharDistX(U16P c) {
166 1 const GUI_FONT_PROP* pProp = GUIPROP_FindChar(GUI_Context.pAFont->p.pProp, c);
167 1 return (pProp) ? (pProp->paCharInfo+(c-pProp->First))->XSize : 0;
168 1 }
169
170 void GUIPROP_AA2_GetFontInfo(void*pFont, GUI_FONTINFO* pfi) {
171 1 GUI_USE_PARA(pFont);
172 1 pfi->Flags = GUI_FONTINFO_FLAG_PROP | GUI_FONTINFO_FLAG_AA2;
173 1 }
174
175 char GUIPROP_AA2_IsInFont(void*pFont, U16 c) {
176 1 const GUI_FONT_PROP* pProp = GUIPROP_FindChar(((GUI_FONT*)pFont)->p.pProp, c);
177 1 return (pProp==NULL) ? 0 : 1;
178 1 }
C51 COMPILER V8.05a GUIAACHAR2 04/11/2008 14:18:16 PAGE 4
179
180 /* End of file */
181
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1825 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 48 75
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 + -