📄 lcd.lst
字号:
C51 COMPILER V8.05a LCD 04/11/2008 14:19:01 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE LCD
OBJECT MODULE PLACED IN LCD.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Core\LCD.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND PRINT
-(.\LCD.lst) OBJECT(LCD.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 : LCD.c
16 Purpose : Link between GUI and LCD_L0
17 Performs most of the clipping.
18 ---------------------------END-OF-HEADER------------------------------
19 */
20
21 #define LCD_C
22
23 #include <stdio.h>
24 #include "gui\Core\GUI_Private.h"
25 #include "gui\Core\LCD_Private.h"
26 #include "gui\Core\GUIDebug.h"
27
28 /*
29 *********************************************************
30 * *
31 * Macros for internal use *
32 * *
33 *********************************************************
34 */
35
36 #define RETURN_IF_Y_OUT() \
37 if (y < GUI_Context.ClipRect.y0) return; \
38 if (y > GUI_Context.ClipRect.y1) return;
39
40 #define RETURN_IF_X_OUT() \
41 if (x < GUI_Context.ClipRect.x0) return; \
42 if (x > GUI_Context.ClipRect.x1) return;
43
44 #define CLIP_X() \
45 if (x0 < GUI_Context.ClipRect.x0) { x0 = GUI_Context.ClipRect.x0; } \
46 if (x1 > GUI_Context.ClipRect.x1) { x1 = GUI_Context.ClipRect.x1; }
47
48 #define CLIP_Y() \
49 if (y0 < GUI_Context.ClipRect.y0) { y0 = GUI_Context.ClipRect.y0; } \
50 if (y1 > GUI_Context.ClipRect.y1) { y1 = GUI_Context.ClipRect.y1; }
51
52
53 /*
54 *********************************************************
C51 COMPILER V8.05a LCD 04/11/2008 14:19:01 PAGE 2
55 * *
56 * LCD_SetColorIndex *
57 * LCD_SetBkColorIndex *
58 * *
59 *********************************************************
60 */
61 static int GetColorIndex(int i) /* i is 0 or 1 */ {
62 1 return (GUI_Context.DrawMode & LCD_DRAWMODE_REV) ? i-1 : i;
63 1 }
64
65 void LCD_SetColorIndex(int Index) { LCD_ACOLORINDEX[GetColorIndex(1)] = Index; }
66 void LCD_SetBkColorIndex(int Index) { LCD_ACOLORINDEX[GetColorIndex(0)] = Index; }
67
68 /*
69 *********************************************************
70 * *
71 * LCD_SetDrawMode *
72 * *
73 *********************************************************
74
75 */
76 LCD_DRAWMODE LCD_SetDrawMode (LCD_DRAWMODE dm) {
77 1 LCD_DRAWMODE OldDM = GUI_Context.DrawMode;
78 1 if ((GUI_Context.DrawMode^dm) & LCD_DRAWMODE_REV) {
79 2 LCD_PIXELINDEX temp = LCD_BKCOLORINDEX;
80 2 LCD_BKCOLORINDEX = LCD_COLORINDEX;
81 2 LCD_COLORINDEX = temp;
82 2 }
83 1 GUI_Context.DrawMode = dm;
84 1 return OldDM;
85 1 }
86
87
88 /*
89 *********************************************************
90 * *
91 * LCD_DrawPixel *
92 * *
93 *********************************************************
94
95 Purpose: This routine is called by emWin. It writes 1 pixel into the
96 display using the current drawing mode.
97
98 */
99
100
101 void LCD_DrawPixel(int x, int y) {
102 1 RETURN_IF_Y_OUT();
103 1 RETURN_IF_X_OUT();
104 1 if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
105 2 LCDDEV_L0_XorPixel(x, y);
106 2 } else {
107 2 LCDDEV_L0_SetPixelIndex(x, y, LCD_COLORINDEX);
108 2 }
109 1 }
110
111 /*
112 *********************************************************
113 * *
114 * LCD_DrawLine vertical/horizontal *
115 * LCD_DrawRect *
116 * *
C51 COMPILER V8.05a LCD 04/11/2008 14:19:01 PAGE 3
117 *********************************************************
118 */
119
120 void LCD_DrawHLine (int x0, int y, int x1) {
121 1 /* Perform clipping and check if there is something to do */
122 1 RETURN_IF_Y_OUT();
123 1 CLIP_X();
124 1 if (x1<x0)
125 1 return;
126 1 /* Call driver to draw */
127 1 LCDDEV_L0_DrawHLine(x0, y, x1);
128 1 }
129
130 void LCD_FillRect(int x0, int y0, int x1, int y1) {
131 1 /* Perform clipping and check if there is something to do */
132 1 CLIP_X();
133 1 if (x1<x0)
134 1 return;
135 1 CLIP_Y();
136 1 if (y1<y0)
137 1 return;
138 1 /* Call driver to draw */
139 1 LCDDEV_L0_FillRect(x0,y0,x1,y1);
140 1 }
141
142
143
144
145
146
147
148 /*
149 **********************************************************************
150 * *
151 * Universal draw Bitmap routine *
152 * *
153 **********************************************************************
154 */
155 void LCD_DrawBitmap (int x0, int y0,
156 int xsize, int ysize,
157 int xMul, int yMul,
158 int BitsPerPixel,
159 int BytesPerLine,
160 const U8* pPixel,
161 const LCD_PIXELINDEX* pTrans) {
162 1 U8 Data;
163 1 int x1, y1;
164 1 // const LCD_PIXELINDEX* pTrans;
165 1 /* Handle the optional Y-magnification */
166 1 y1 = y0+ysize-1;
167 1 x1 = x0+xsize-1;
168 1 /* Handle BITMAP without magnification */
169 1 if ((xMul==1) && (yMul==1)) {
170 2 int Diff;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -