| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | #include "mywin_inc.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | u32 WIN_SetLcdColor(u32 color) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   u32 co = ewin->lcd->getLcdColor(); | 
					
						
							|  |  |  |  |   u32 ret = COLOR565TO888(co); | 
					
						
							|  |  |  |  |   ewin->lcd->setLcdColor(COLOR888TO565(color)); | 
					
						
							|  |  |  |  |   return ret; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | u32 WIN_SetLcdBkColor(u32 color) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   u32 co = ewin->lcd->getLcdBkColor(); | 
					
						
							|  |  |  |  |   u32 ret = COLOR565TO888(co); | 
					
						
							|  |  |  |  |   ewin->lcd->setLcdBkColor(COLOR888TO565(color)); | 
					
						
							|  |  |  |  |   return ret; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | u16 WIN_GetLcdColor16(void) { return WIN_GetWinStruct()->lcd->getLcdColor(); } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void WIN_DrawPointSafe(int x, int y, int mode) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   if (POS_InRect(ewin->Invalid_x, ewin->Invalid_y, ewin->Invalid_x_size, | 
					
						
							|  |  |  |  |                  ewin->Invalid_y_size, x, y)) { | 
					
						
							|  |  |  |  |     //		if (mode)
 | 
					
						
							|  |  |  |  |     //			LCD_DrawPointSafe (x,y,1);
 | 
					
						
							|  |  |  |  |     //		else
 | 
					
						
							|  |  |  |  |     //			LCD_DrawPointSafe (x,y,0);
 | 
					
						
							|  |  |  |  |     ewin->lcd->drawPoint(x, y, mode); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | void WIN_DrawPointNormal(int x, int y, int mode) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   ewin->lcd->drawPoint(x, y, mode); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | void WIN_DrawPointColorSafe(int x, int y, u32 color) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   if (POS_InRect(ewin->Invalid_x, ewin->Invalid_y, ewin->Invalid_x_size, | 
					
						
							|  |  |  |  |                  ewin->Invalid_y_size, x, y)) { | 
					
						
							|  |  |  |  |     ewin->lcd->drawPointColor(x, y, color); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | void WIN_DrawPointColorNormal(int x, int y, u32 color) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   ewin->lcd->drawPointColor(x, y, color); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | void WIN_DrawPointSafeColorAlpha(int x, int y, u16 color, u8 alpha) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   if (POS_InRect(ewin->Invalid_x, ewin->Invalid_y, ewin->Invalid_x_size, | 
					
						
							|  |  |  |  |                  ewin->Invalid_y_size, x, y)) { | 
					
						
							|  |  |  |  |     ewin->lcd->drawPointColorAlpha(x, y, color, alpha); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Ӣ<EFBFBD><D3A2><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ŀ<EFBFBD><C4BF><EFBFBD>
 | 
					
						
							|  |  |  |  | static u32 WIN_DrawCharAt(char c, int x, int y) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   if (ewin->font.drawChar) | 
					
						
							|  |  |  |  |     return ewin->font.drawChar(c, x, y); | 
					
						
							|  |  |  |  |   else | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ʾһ<CABE><D2BB><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>غ<EFBFBD><D8BA>ֵĿ<D6B5><C4BF><EFBFBD>
 | 
					
						
							|  |  |  |  | static u32 WIN_DrawWordAt(char *c, int x, int y) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   if (ewin->font.drawWord) | 
					
						
							|  |  |  |  |     return ewin->font.drawWord(c, x, y); | 
					
						
							|  |  |  |  |   else | 
					
						
							|  |  |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawTxtAt(char *txt, int x, int y) { | 
					
						
							|  |  |  |  |   if (txt == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   while (*txt) { | 
					
						
							|  |  |  |  |     if ((*txt & 0x80) == 0) { | 
					
						
							|  |  |  |  |       x += WIN_DrawCharAt(*txt, x, y); | 
					
						
							|  |  |  |  |       txt++; | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       x += WIN_DrawWordAt(txt, x, y); | 
					
						
							|  |  |  |  |       txt += 2; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>,֧<>ֻ<EFBFBD><D6BB>з<EFBFBD>\n
 | 
					
						
							|  |  |  |  | void WIN_DrawTxtAtRect(char *txt, int x, int y, int x_size, int y_size) { | 
					
						
							|  |  |  |  |   int x_s = x; | 
					
						
							|  |  |  |  |   int y_s = y; | 
					
						
							|  |  |  |  |   if (txt == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   while (*txt) { | 
					
						
							|  |  |  |  |     if ((*txt & 0x80) == 0) { | 
					
						
							|  |  |  |  |       if ((x_s - x > x_size - 1 - WIN_GetFontWidth() / 2) || (*txt == '\n')) { | 
					
						
							|  |  |  |  |         x_s = x; | 
					
						
							|  |  |  |  |         y_s += WIN_GetFontHight(); | 
					
						
							|  |  |  |  |         if (*txt == '\n') { | 
					
						
							|  |  |  |  |           txt++; | 
					
						
							|  |  |  |  |           continue; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       x_s += WIN_DrawCharAt(*txt, x_s, y_s); | 
					
						
							|  |  |  |  |       txt++; | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       if (x_s - x > x_size - 1 - WIN_GetFontWidth()) { | 
					
						
							|  |  |  |  |         x_s = x; | 
					
						
							|  |  |  |  |         y_s += WIN_GetFontHight(); | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       x_s += WIN_DrawWordAt(txt, x_s, y_s); | 
					
						
							|  |  |  |  |       txt += 2; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     if (y_s - y > y_size - 1 - WIN_GetFontHight()) | 
					
						
							|  |  |  |  |       return; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>,֧<>ֻ<EFBFBD><D6BB>з<EFBFBD>\n
 | 
					
						
							|  |  |  |  | void WIN_DrawTxtCenterAtRect(char *txt, int x, int y, int x_size, int y_size) { | 
					
						
							|  |  |  |  |   int line_max = y_size / WIN_GetFontHight(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   int char_max = x_size / (WIN_GetFontWidth() / 2); // <20><><EFBFBD><EFBFBD>ÿ<EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ٸ<EFBFBD><D9B8>ַ<EFBFBD>
 | 
					
						
							|  |  |  |  |   int x_s = x; | 
					
						
							|  |  |  |  |   int line_i = 0; | 
					
						
							|  |  |  |  |   char *txtbuff = mymalloc(line_max * (char_max + 1)); | 
					
						
							|  |  |  |  |   char *txt_ptr = txtbuff; | 
					
						
							|  |  |  |  |   while (*txt) { | 
					
						
							|  |  |  |  |     if (line_i >= line_max) { | 
					
						
							|  |  |  |  |       line_i--; | 
					
						
							|  |  |  |  |       break; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     if ((*txt & 0x80) == 0) { | 
					
						
							|  |  |  |  |       if ((x_s - x > x_size - WIN_GetFontWidth() / 2) || (*txt == '\n')) { | 
					
						
							|  |  |  |  |         *txt_ptr = 0; | 
					
						
							|  |  |  |  |         line_i++; | 
					
						
							|  |  |  |  |         txt_ptr = txtbuff + (char_max + 1) * line_i; | 
					
						
							|  |  |  |  |         x_s = x; | 
					
						
							|  |  |  |  |         if (*txt == '\n') { | 
					
						
							|  |  |  |  |           txt++; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         continue; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       x_s += WIN_GetFontWidth() / 2; | 
					
						
							|  |  |  |  |       *txt_ptr = *txt; | 
					
						
							|  |  |  |  |       txt_ptr++; | 
					
						
							|  |  |  |  |       txt++; | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       if (x_s - x > x_size - WIN_GetFontWidth()) { | 
					
						
							|  |  |  |  |         *txt_ptr = 0; | 
					
						
							|  |  |  |  |         line_i++; | 
					
						
							|  |  |  |  |         txt_ptr = txtbuff + (char_max + 1) * line_i; | 
					
						
							|  |  |  |  |         x_s = x; | 
					
						
							|  |  |  |  |         continue; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       x_s += WIN_GetFontWidth(); | 
					
						
							|  |  |  |  |       *txt_ptr = *txt; | 
					
						
							|  |  |  |  |       txt_ptr++; | 
					
						
							|  |  |  |  |       txt++; | 
					
						
							|  |  |  |  |       *txt_ptr = *txt; | 
					
						
							|  |  |  |  |       txt_ptr++; | 
					
						
							|  |  |  |  |       txt++; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   *txt_ptr = 0; // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD>β
 | 
					
						
							|  |  |  |  |   int y_s = y + (y_size - (line_i + 1) * WIN_GetFontHight()) / 2; // y<><79><EFBFBD><EFBFBD><EFBFBD>Ͼ<EFBFBD><CFBE><EFBFBD>
 | 
					
						
							|  |  |  |  |   txt_ptr = txtbuff; | 
					
						
							|  |  |  |  |   for (int i = 0; i < line_i + 1; i++) { | 
					
						
							|  |  |  |  |     WIN_DrawTxtHCenterAt(txt_ptr, x + x_size / 2, y_s); | 
					
						
							|  |  |  |  |     y_s += WIN_GetFontHight(); | 
					
						
							|  |  |  |  |     txt_ptr += char_max + 1; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   myfree(txtbuff); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ָ<EFBFBD><D6B8>λ<EFBFBD>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawTxtHCenterAt(char *txt, int x, int y) { | 
					
						
							|  |  |  |  |   int str_len = strlen(txt); | 
					
						
							|  |  |  |  |   int str_x_size = WIN_GetWinStruct()->font.TxtW / 2 * str_len; | 
					
						
							|  |  |  |  |   WIN_DrawTxtAt(txt, x - str_x_size / 2, y); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | void WIN_DrawHLine(int x_s, int y, int x_e) { | 
					
						
							|  |  |  |  |   for (int i = x_s; i <= x_e; i++) { | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(i, y, 1); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><CDB8><EFBFBD>ȵĻ<C8B5><C4BB>ߣ<EFBFBD>dis=0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dis=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawHLineAlpha(int x_s, int y, int x_e, u16 color, u8 dis) { | 
					
						
							|  |  |  |  |   u8 step = (x_e - x_s + 1); | 
					
						
							|  |  |  |  |   if (dis) { | 
					
						
							|  |  |  |  |     for (int i = x_s; i <= x_e; i++) { | 
					
						
							|  |  |  |  |       WIN_DrawPointSafeColorAlpha(i, y, color, (i - x_s) * 32 / step); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } else { | 
					
						
							|  |  |  |  |     for (int i = x_s; i <= x_e; i++) { | 
					
						
							|  |  |  |  |       WIN_DrawPointSafeColorAlpha(i, y, color, (x_e - i) * 32 / step); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | void WIN_DrawVLine(int x, int y_s, int y_e) { | 
					
						
							|  |  |  |  |   for (int i = y_s; i <= y_e; i++) { | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(x, i, 1); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD> x1,y1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> x2,y2:<3A>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawLine(int x1, int y1, int x2, int y2) { | 
					
						
							|  |  |  |  |   int t; | 
					
						
							|  |  |  |  |   int xerr = 0, yerr = 0, delta_x, delta_y, distance; | 
					
						
							|  |  |  |  |   int incx, incy, uRow, uCol; | 
					
						
							|  |  |  |  |   delta_x = x2 - x1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   delta_y = y2 - y1; | 
					
						
							|  |  |  |  |   uRow = x1; | 
					
						
							|  |  |  |  |   uCol = y1; | 
					
						
							|  |  |  |  |   if (delta_x > 0) | 
					
						
							|  |  |  |  |     incx = 1; // <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   else if (delta_x == 0) | 
					
						
							|  |  |  |  |     incx = 0; // <20><>ֱ<EFBFBD><D6B1>
 | 
					
						
							|  |  |  |  |   else { | 
					
						
							|  |  |  |  |     incx = -1; | 
					
						
							|  |  |  |  |     delta_x = -delta_x; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (delta_y > 0) | 
					
						
							|  |  |  |  |     incy = 1; | 
					
						
							|  |  |  |  |   else if (delta_y == 0) | 
					
						
							|  |  |  |  |     incy = 0; // ˮƽ<CBAE><C6BD>
 | 
					
						
							|  |  |  |  |   else { | 
					
						
							|  |  |  |  |     incy = -1; | 
					
						
							|  |  |  |  |     delta_y = -delta_y; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (delta_x > delta_y) | 
					
						
							|  |  |  |  |     distance = delta_x; // ѡȡ<D1A1><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   else | 
					
						
							|  |  |  |  |     distance = delta_y; | 
					
						
							|  |  |  |  |   for (t = 0; t <= distance + 1; t++) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   { | 
					
						
							|  |  |  |  |     // WIN_GetWinStruct()->drawPoint (uRow,uCol,1);
 | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(uRow, uCol, 1); | 
					
						
							|  |  |  |  |     xerr += delta_x; | 
					
						
							|  |  |  |  |     yerr += delta_y; | 
					
						
							|  |  |  |  |     if (xerr > distance) { | 
					
						
							|  |  |  |  |       xerr -= distance; | 
					
						
							|  |  |  |  |       uRow += incx; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     if (yerr > distance) { | 
					
						
							|  |  |  |  |       yerr -= distance; | 
					
						
							|  |  |  |  |       uCol += incy; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-05 19:05:35 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ָ<EFBFBD><D6B8>λ<EFBFBD>û<EFBFBD>һ<EFBFBD><D2BB>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>С<EFBFBD><D0A1>Բ (x,y):<3A><><EFBFBD>ĵ<EFBFBD> r    :<3A>뾶
 | 
					
						
							|  |  |  |  | void WIN_DrawCircle(int x0, int y0, int r) { | 
					
						
							|  |  |  |  |   int a, b; | 
					
						
							|  |  |  |  |   int di; | 
					
						
							|  |  |  |  |   int c_x = 0; | 
					
						
							|  |  |  |  |   int c_y = 0; | 
					
						
							|  |  |  |  |   a = 0; | 
					
						
							|  |  |  |  |   b = r; | 
					
						
							|  |  |  |  |   di = 3 - (r << 1); // <20>ж<EFBFBD><D0B6>¸<EFBFBD><C2B8><EFBFBD>λ<EFBFBD>õı<C3B5>־
 | 
					
						
							|  |  |  |  |   while (a <= b) { | 
					
						
							|  |  |  |  |     // ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>Ļ
 | 
					
						
							|  |  |  |  |     c_x = x0 + a; | 
					
						
							|  |  |  |  |     c_y = y0 - b; | 
					
						
							|  |  |  |  |     // WIN_GetWinStruct()->drawPoint (c_x,c_y,1);
 | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 + b; | 
					
						
							|  |  |  |  |     c_y = y0 - a; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 + b; | 
					
						
							|  |  |  |  |     c_y = y0 + a; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 + a; | 
					
						
							|  |  |  |  |     c_y = y0 + b; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 - a; | 
					
						
							|  |  |  |  |     c_y = y0 + b; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 - b; | 
					
						
							|  |  |  |  |     c_y = y0 + a; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 - a; | 
					
						
							|  |  |  |  |     c_y = y0 - b; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     c_x = x0 - b; | 
					
						
							|  |  |  |  |     c_y = y0 - a; | 
					
						
							|  |  |  |  |     WIN_DrawPointSafe(c_x, c_y, 1); | 
					
						
							|  |  |  |  |     a++; | 
					
						
							|  |  |  |  |     // ʹ<><CAB9>Bresenham<61>㷨<EFBFBD><E3B7A8>Բ
 | 
					
						
							|  |  |  |  |     if (di < 0) | 
					
						
							|  |  |  |  |       di += 4 * a + 6; | 
					
						
							|  |  |  |  |     else { | 
					
						
							|  |  |  |  |       di += 10 + 4 * (a - b); | 
					
						
							|  |  |  |  |       b--; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-05 19:05:35 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawLines(POINT_Struct *Points, int PointCount) { | 
					
						
							|  |  |  |  |   for (int i = 0; i < PointCount - 1; i++) { | 
					
						
							|  |  |  |  |     WIN_DrawLine(Points[i].x, Points[i].y, Points[i + 1].x, Points[i + 1].y); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawPolygon(POINT_Struct *Points, int PointCount) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   int16_t X = 0, Y = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (PointCount < 2) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     return; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   WIN_DrawLine(Points->x, Points->y, (Points + PointCount - 1)->x, | 
					
						
							|  |  |  |  |                (Points + PointCount - 1)->y); | 
					
						
							|  |  |  |  |   while (--PointCount) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     X = Points->x; | 
					
						
							|  |  |  |  |     Y = Points->y; | 
					
						
							|  |  |  |  |     Points++; | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     WIN_DrawLine(X, Y, Points->x, Points->y); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD>ƿ<EFBFBD><C6BF>ľ<EFBFBD><C4BE><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawRect(int x, int y, int x_size, int y_size) { | 
					
						
							|  |  |  |  |   WIN_DrawHLine(x, y, x + x_size - 1); | 
					
						
							|  |  |  |  |   WIN_DrawHLine(x, y + y_size - 1, x + x_size - 1); | 
					
						
							|  |  |  |  |   WIN_DrawVLine(x, y, y + y_size - 1); | 
					
						
							|  |  |  |  |   WIN_DrawVLine(x + x_size - 1, y, y + y_size - 1); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ͼƽ<CDBC><C6BD>
 | 
					
						
							|  |  |  |  | WIN_PlaneAAStruct *WIN_CreatPlaneAA(int x, int y, int x_size, int y_size, | 
					
						
							|  |  |  |  |                                     int accuracy) { | 
					
						
							|  |  |  |  |   WIN_PlaneAAStruct *ret = | 
					
						
							|  |  |  |  |       mymalloc(sizeof(WIN_PlaneAAStruct) + x_size * y_size); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (ret) { | 
					
						
							|  |  |  |  |     ret->x = x; | 
					
						
							|  |  |  |  |     ret->y = y; | 
					
						
							|  |  |  |  |     ret->x_size = x_size; | 
					
						
							|  |  |  |  |     ret->y_size = y_size; | 
					
						
							|  |  |  |  |     ret->accuracy = accuracy; | 
					
						
							|  |  |  |  |     ret->avr = ret->accuracy * ret->accuracy; | 
					
						
							|  |  |  |  |     mymemset(ret->alpha, 0, x_size * y_size); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   return ret; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // ɾ<><C9BE>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>
 | 
					
						
							|  |  |  |  | void WIN_DeletePlaneAA(WIN_PlaneAAStruct *p) { | 
					
						
							|  |  |  |  |   if (p == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   myfree(p); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ͼƽ<CDBC><C6BD>
 | 
					
						
							|  |  |  |  | void WIN_DrawPlaneAA(WIN_PlaneAAStruct *p) { | 
					
						
							|  |  |  |  |   if (p == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   u16 color = WIN_GetLcdColor16(); | 
					
						
							|  |  |  |  |   u8 *alpha = 0; | 
					
						
							|  |  |  |  |   for (int y = 0; y < p->y_size; y++) { | 
					
						
							|  |  |  |  |     alpha = &p->alpha[y * p->x_size]; | 
					
						
							|  |  |  |  |     for (int x = 0; x < p->x_size; x++) { | 
					
						
							|  |  |  |  |       if (*alpha > 0x7) | 
					
						
							|  |  |  |  |         WIN_DrawPointSafeColorAlpha(x + p->x, y + p->y, color, *alpha >> 3); | 
					
						
							|  |  |  |  |       alpha++; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ƽ<EFBFBD><C6BD><EFBFBD>ڻ<EFBFBD><DABB>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD>ݵ<EFBFBD>
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><78>y<EFBFBD><79>ʵ<EFBFBD><CAB5>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>p->accuracy<63><79>ֵ
 | 
					
						
							|  |  |  |  | void WIN_DrawPointAA(WIN_PlaneAAStruct *p, int x, int y) { | 
					
						
							|  |  |  |  |   if (p == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   if (p->alpha == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   int x_s = x / p->accuracy; | 
					
						
							|  |  |  |  |   int y_s = y / p->accuracy; | 
					
						
							|  |  |  |  |   int x_e = x_s + 1; | 
					
						
							|  |  |  |  |   int y_e = y_s + 1; | 
					
						
							|  |  |  |  |   if (x_s < p->x || x_s > p->x + p->x_size - 1) | 
					
						
							|  |  |  |  |     return; | 
					
						
							|  |  |  |  |   if (y_s < p->y || y_s > p->y + p->y_size - 1) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ϸ<EFBFBD>̶ֳ<D6B3>,<2C><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>p->accuracy<63><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
 | 
					
						
							|  |  |  |  |   // <20>ٳ<EFBFBD><D9B3><EFBFBD>һ<EFBFBD><D2BB>p->accuracy<63><79><EFBFBD><EFBFBD>Ϊ<EFBFBD>ϲ㲽<CFB2><E3B2BD>ֵ
 | 
					
						
							|  |  |  |  |   int accuracy = p->accuracy; //*p->accuracy;
 | 
					
						
							|  |  |  |  |   int alpha_x = 16 - (x % p->accuracy) * 16 / p->accuracy; | 
					
						
							|  |  |  |  |   int alpha_y = 16 - (y % p->accuracy) * 16 / p->accuracy; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   u8 *point = 0; | 
					
						
							|  |  |  |  |   int point_ = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   point = &p->alpha[p->x_size * (y_s - p->y) + (x_s - p->x)]; | 
					
						
							|  |  |  |  |   point_ = *point + alpha_x * alpha_y / accuracy; | 
					
						
							|  |  |  |  |   if (point_ > 0xff) | 
					
						
							|  |  |  |  |     point_ = 0xff; | 
					
						
							|  |  |  |  |   *point = point_; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (x_e < p->x + p->x_size) { | 
					
						
							|  |  |  |  |     point = &p->alpha[p->x_size * (y_s - p->y) + (x_e - p->x)]; | 
					
						
							|  |  |  |  |     point_ = *point + (16 - alpha_x) * alpha_y / accuracy; | 
					
						
							|  |  |  |  |     if (point_ > 0xff) | 
					
						
							|  |  |  |  |       point_ = 0xff; | 
					
						
							|  |  |  |  |     *point = point_; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if ((y_e < p->y + p->y_size) && (x_e < p->x + p->x_size)) { | 
					
						
							|  |  |  |  |     point = &p->alpha[p->x_size * (y_e - p->y) + (x_e - p->x)]; | 
					
						
							|  |  |  |  |     point_ = *point + (16 - alpha_x) * (16 - alpha_y) / accuracy; | 
					
						
							|  |  |  |  |     if (point_ > 0xff) | 
					
						
							|  |  |  |  |       point_ = 0xff; | 
					
						
							|  |  |  |  |     *point = point_; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (y_e < p->y + p->y_size) { | 
					
						
							|  |  |  |  |     point = &p->alpha[p->x_size * (y_e - p->y) + (x_s - p->x)]; | 
					
						
							|  |  |  |  |     point_ = *point + alpha_x * (16 - alpha_y) / accuracy; | 
					
						
							|  |  |  |  |     if (point_ > 0xff) | 
					
						
							|  |  |  |  |       point_ = 0xff; | 
					
						
							|  |  |  |  |     *point = point_; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><>ƽ<EFBFBD><C6BD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD> x1,y1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> x2,y2:<3A>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | static void WIN_PlaneDrawLine(WIN_PlaneAAStruct *p, int x1, int y1, int x2, | 
					
						
							|  |  |  |  |                               int y2) { | 
					
						
							|  |  |  |  |   if (p == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   int t; | 
					
						
							|  |  |  |  |   int xerr = 0, yerr = 0, delta_x, delta_y, distance; | 
					
						
							|  |  |  |  |   int incx, incy, uRow, uCol; | 
					
						
							|  |  |  |  |   delta_x = x2 - x1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   delta_y = y2 - y1; | 
					
						
							|  |  |  |  |   uRow = x1; | 
					
						
							|  |  |  |  |   uCol = y1; | 
					
						
							|  |  |  |  |   if (delta_x > 0) | 
					
						
							|  |  |  |  |     incx = 1; // <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   else if (delta_x == 0) | 
					
						
							|  |  |  |  |     incx = 0; // <20><>ֱ<EFBFBD><D6B1>
 | 
					
						
							|  |  |  |  |   else { | 
					
						
							|  |  |  |  |     incx = -1; | 
					
						
							|  |  |  |  |     delta_x = -delta_x; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (delta_y > 0) | 
					
						
							|  |  |  |  |     incy = 1; | 
					
						
							|  |  |  |  |   else if (delta_y == 0) | 
					
						
							|  |  |  |  |     incy = 0; // ˮƽ<CBAE><C6BD>
 | 
					
						
							|  |  |  |  |   else { | 
					
						
							|  |  |  |  |     incy = -1; | 
					
						
							|  |  |  |  |     delta_y = -delta_y; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (delta_x > delta_y) | 
					
						
							|  |  |  |  |     distance = delta_x; // ѡȡ<D1A1><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   else | 
					
						
							|  |  |  |  |     distance = delta_y; | 
					
						
							|  |  |  |  |   for (t = 0; t <= distance + 1; t++) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |   { | 
					
						
							|  |  |  |  |     WIN_DrawPointAA(p, uRow, uCol); | 
					
						
							|  |  |  |  |     xerr += delta_x; | 
					
						
							|  |  |  |  |     yerr += delta_y; | 
					
						
							|  |  |  |  |     if (xerr > distance) { | 
					
						
							|  |  |  |  |       xerr -= distance; | 
					
						
							|  |  |  |  |       uRow += incx; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     if (yerr > distance) { | 
					
						
							|  |  |  |  |       yerr -= distance; | 
					
						
							|  |  |  |  |       uCol += incy; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-05 19:05:35 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_DrawLineAA(int x1, int y1, int x2, int y2, int accuracy) { | 
					
						
							|  |  |  |  |   int x = x1; | 
					
						
							|  |  |  |  |   if (x > x2) | 
					
						
							|  |  |  |  |     x = x2; | 
					
						
							|  |  |  |  |   int y = y1; | 
					
						
							|  |  |  |  |   if (y > y2) | 
					
						
							|  |  |  |  |     y = y2; | 
					
						
							|  |  |  |  |   int x_size = x1 - x2; | 
					
						
							|  |  |  |  |   if (x_size < 0) | 
					
						
							|  |  |  |  |     x_size = -x_size; | 
					
						
							|  |  |  |  |   int y_size = y1 - y2; | 
					
						
							|  |  |  |  |   if (y_size < 0) | 
					
						
							|  |  |  |  |     y_size = -y_size; | 
					
						
							|  |  |  |  |   x_size++; | 
					
						
							|  |  |  |  |   y_size++; | 
					
						
							|  |  |  |  |   WIN_PlaneAAStruct *p = WIN_CreatPlaneAA(x, y, x_size, y_size, 4); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (p) { | 
					
						
							|  |  |  |  |     x1 *= p->accuracy; | 
					
						
							|  |  |  |  |     y1 *= p->accuracy; | 
					
						
							|  |  |  |  |     x2 *= p->accuracy; | 
					
						
							|  |  |  |  |     y2 *= p->accuracy; | 
					
						
							|  |  |  |  |     WIN_PlaneDrawLine(p, x1, y1, x2, y2); | 
					
						
							|  |  |  |  |     WIN_DrawPlaneAA(p); | 
					
						
							|  |  |  |  |     WIN_DeletePlaneAA(p); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20>ô<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_FillRectByColor(int x, int y, int x_size, int y_size) { | 
					
						
							|  |  |  |  |   RECT_Struct r1; | 
					
						
							|  |  |  |  |   RECT_Struct r2; | 
					
						
							|  |  |  |  |   RECT_Struct ret; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   r1.x = x; | 
					
						
							|  |  |  |  |   r1.x_size = x_size; | 
					
						
							|  |  |  |  |   r1.y = y; | 
					
						
							|  |  |  |  |   r1.y_size = y_size; | 
					
						
							|  |  |  |  |   r2.x = WIN_GetWinStruct()->Invalid_x; | 
					
						
							|  |  |  |  |   r2.x_size = WIN_GetWinStruct()->Invalid_x_size; | 
					
						
							|  |  |  |  |   r2.y = WIN_GetWinStruct()->Invalid_y; | 
					
						
							|  |  |  |  |   r2.y_size = WIN_GetWinStruct()->Invalid_y_size; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
 | 
					
						
							|  |  |  |  |   if (POS_RectIntersection(&ret, &r1, &r2)) { | 
					
						
							|  |  |  |  |     // LCD_FillRectByColor (ret.x,ret.y,ret.x_size,ret.y_size);
 | 
					
						
							|  |  |  |  |     WIN_GetWinStruct()->lcd->fillRectByColor(ret.x, ret.y, ret.x_size, | 
					
						
							|  |  |  |  |                                              ret.y_size); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20>ô<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_FillRectByColorAlpha(int x, int y, int x_size, int y_size, u8 alpha) { | 
					
						
							|  |  |  |  |   RECT_Struct r1; | 
					
						
							|  |  |  |  |   RECT_Struct r2; | 
					
						
							|  |  |  |  |   RECT_Struct ret; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   r1.x = x; | 
					
						
							|  |  |  |  |   r1.x_size = x_size; | 
					
						
							|  |  |  |  |   r1.y = y; | 
					
						
							|  |  |  |  |   r1.y_size = y_size; | 
					
						
							|  |  |  |  |   r2.x = WIN_GetWinStruct()->Invalid_x; | 
					
						
							|  |  |  |  |   r2.x_size = WIN_GetWinStruct()->Invalid_x_size; | 
					
						
							|  |  |  |  |   r2.y = WIN_GetWinStruct()->Invalid_y; | 
					
						
							|  |  |  |  |   r2.y_size = WIN_GetWinStruct()->Invalid_y_size; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
 | 
					
						
							|  |  |  |  |   if (POS_RectIntersection(&ret, &r1, &r2)) { | 
					
						
							|  |  |  |  |     // LCD_FillRectByColorAlpha (ret.x,ret.y,ret.x_size,ret.y_size,alpha);
 | 
					
						
							|  |  |  |  |     WIN_GetWinStruct()->lcd->fillRectByColorAlpha(ret.x, ret.y, ret.x_size, | 
					
						
							|  |  |  |  |                                                   ret.y_size, alpha); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20>ñ<EFBFBD><C3B1><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_FillRect(int x, int y, int x_size, int y_size, u16 *buff, u16 pic_x, | 
					
						
							|  |  |  |  |                   u16 pic_y, u16 pic_xsize, u16 pic_ysize) { | 
					
						
							|  |  |  |  |   RECT_Struct r1; | 
					
						
							|  |  |  |  |   RECT_Struct r2; | 
					
						
							|  |  |  |  |   RECT_Struct ret; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   r1.x = x; | 
					
						
							|  |  |  |  |   r1.x_size = x_size; | 
					
						
							|  |  |  |  |   r1.y = y; | 
					
						
							|  |  |  |  |   r1.y_size = y_size; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   r2.x = WIN_GetWinStruct()->Invalid_x; | 
					
						
							|  |  |  |  |   r2.x_size = WIN_GetWinStruct()->Invalid_x_size; | 
					
						
							|  |  |  |  |   r2.y = WIN_GetWinStruct()->Invalid_y; | 
					
						
							|  |  |  |  |   r2.y_size = WIN_GetWinStruct()->Invalid_y_size; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
 | 
					
						
							|  |  |  |  |   if (POS_RectIntersection(&ret, &r1, &r2)) { | 
					
						
							|  |  |  |  |     // <20><>ͼƬƫ<C6AC>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     pic_x += ret.x - x; | 
					
						
							|  |  |  |  |     pic_y += ret.y - y; | 
					
						
							|  |  |  |  |     WIN_GetWinStruct()->lcd->fillRectOffAt(ret.x, ret.y, ret.x_size, ret.y_size, | 
					
						
							|  |  |  |  |                                            buff, pic_x, pic_y, pic_xsize, | 
					
						
							|  |  |  |  |                                            pic_ysize); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20>ô<EFBFBD><EFBFBD><CDB8><EFBFBD>ȵ<EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | void WIN_FillRectAlpha(int x, int y, int x_size, int y_size, void *buff, | 
					
						
							|  |  |  |  |                        u16 pic_x, u16 pic_y, u16 pic_xsize, u16 pic_ysize) { | 
					
						
							|  |  |  |  |   RECT_Struct r1; | 
					
						
							|  |  |  |  |   RECT_Struct r2; | 
					
						
							|  |  |  |  |   RECT_Struct ret; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   r1.x = x; | 
					
						
							|  |  |  |  |   r1.x_size = x_size; | 
					
						
							|  |  |  |  |   r1.y = y; | 
					
						
							|  |  |  |  |   r1.y_size = y_size; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   r2.x = WIN_GetWinStruct()->Invalid_x; | 
					
						
							|  |  |  |  |   r2.x_size = WIN_GetWinStruct()->Invalid_x_size; | 
					
						
							|  |  |  |  |   r2.y = WIN_GetWinStruct()->Invalid_y; | 
					
						
							|  |  |  |  |   r2.y_size = WIN_GetWinStruct()->Invalid_y_size; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
 | 
					
						
							|  |  |  |  |   if (POS_RectIntersection(&ret, &r1, &r2)) { | 
					
						
							|  |  |  |  |     // <20><>ͼƬƫ<C6AC>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     pic_x += ret.x - x; | 
					
						
							|  |  |  |  |     pic_y += ret.y - y; | 
					
						
							|  |  |  |  |     WIN_GetWinStruct()->lcd->fillRectOffAtAlpha(ret.x, ret.y, ret.x_size, | 
					
						
							|  |  |  |  |                                                 ret.y_size, buff, pic_x, pic_y, | 
					
						
							|  |  |  |  |                                                 pic_xsize, pic_ysize); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | #define ABS(X) ((X) > 0 ? (X) : -(X))
 | 
					
						
							|  |  |  |  | void WIN_FillTriangle(int x1, int x2, int x3, int y1, int y2, int y3) { | 
					
						
							|  |  |  |  |   int deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, yinc1 = 0, | 
					
						
							|  |  |  |  |       yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, curpixel = 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   deltax = ABS(x2 - x1); /* The difference between the x's */ | 
					
						
							|  |  |  |  |   deltay = ABS(y2 - y1); /* The difference between the y's */ | 
					
						
							|  |  |  |  |   x = x1;                /* Start x off at the first pixel */ | 
					
						
							|  |  |  |  |   y = y1;                /* Start y off at the first pixel */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (x2 >= x1) /* The x-values are increasing */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   { | 
					
						
							|  |  |  |  |     xinc1 = 1; | 
					
						
							|  |  |  |  |     xinc2 = 1; | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   } else /* The x-values are decreasing */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   { | 
					
						
							|  |  |  |  |     xinc1 = -1; | 
					
						
							|  |  |  |  |     xinc2 = -1; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (y2 >= y1) /* The y-values are increasing */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   { | 
					
						
							|  |  |  |  |     yinc1 = 1; | 
					
						
							|  |  |  |  |     yinc2 = 1; | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   } else /* The y-values are decreasing */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   { | 
					
						
							|  |  |  |  |     yinc1 = -1; | 
					
						
							|  |  |  |  |     yinc2 = -1; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (deltax >= deltay) /* There is at least one x-value for every y-value */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   { | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     xinc1 = 0; /* Don't change the x when numerator >= denominator */ | 
					
						
							|  |  |  |  |     yinc2 = 0; /* Don't change the y for every iteration */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     den = deltax; | 
					
						
							|  |  |  |  |     num = deltax / 2; | 
					
						
							|  |  |  |  |     numadd = deltay; | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     numpixels = deltax; /* There are more x-values than y-values */ | 
					
						
							|  |  |  |  |   } else                /* There is at least one y-value for every x-value */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   { | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     xinc2 = 0; /* Don't change the x for every iteration */ | 
					
						
							|  |  |  |  |     yinc1 = 0; /* Don't change the y when numerator >= denominator */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     den = deltay; | 
					
						
							|  |  |  |  |     num = deltay / 2; | 
					
						
							|  |  |  |  |     numadd = deltax; | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     numpixels = deltay; /* There are more y-values than x-values */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   for (curpixel = 0; curpixel <= numpixels; curpixel++) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     WIN_DrawLine(x, y, x3, y3); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     num += numadd;  /* Increase the numerator by the top of the fraction */ | 
					
						
							|  |  |  |  |     if (num >= den) /* Check if numerator >= denominator */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |       num -= den; /* Calculate the new numerator value */ | 
					
						
							|  |  |  |  |       x += xinc1; /* Change the x as appropriate */ | 
					
						
							|  |  |  |  |       y += yinc1; /* Change the y as appropriate */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     x += xinc2; /* Change the x as appropriate */ | 
					
						
							|  |  |  |  |     y += yinc2; /* Change the y as appropriate */ | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |   } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | #define POLY_X(Z) ((int32_t)((Points + (Z))->x))
 | 
					
						
							|  |  |  |  | #define POLY_Y(Z) ((int32_t)((Points + (Z))->y))
 | 
					
						
							|  |  |  |  | void WIN_FillPolygon(POINT_Struct *Points, int PointCount) { | 
					
						
							|  |  |  |  |   int X = 0, Y = 0, X2 = 0, Y2 = 0, X_center = 0, Y_center = 0, X_first = 0, | 
					
						
							|  |  |  |  |       Y_first = 0, pixelX = 0, pixelY = 0, counter = 0; | 
					
						
							|  |  |  |  |   int IMAGE_LEFT = 0, IMAGE_RIGHT = 0, IMAGE_TOP = 0, IMAGE_BOTTOM = 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   IMAGE_LEFT = IMAGE_RIGHT = Points->x; | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   IMAGE_TOP = IMAGE_BOTTOM = Points->y; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   for (counter = 1; counter < PointCount; counter++) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     pixelX = POLY_X(counter); | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     if (pixelX < IMAGE_LEFT) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |       IMAGE_LEFT = pixelX; | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     if (pixelX > IMAGE_RIGHT) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |       IMAGE_RIGHT = pixelX; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     pixelY = POLY_Y(counter); | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     if (pixelY < IMAGE_TOP) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |       IMAGE_TOP = pixelY; | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |     if (pixelY > IMAGE_BOTTOM) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |       IMAGE_BOTTOM = pixelY; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (PointCount < 2) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     return; | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   X_center = (IMAGE_LEFT + IMAGE_RIGHT) / 2; | 
					
						
							|  |  |  |  |   Y_center = (IMAGE_BOTTOM + IMAGE_TOP) / 2; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   X_first = Points->x; | 
					
						
							|  |  |  |  |   Y_first = Points->y; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   while (--PointCount) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  |     X = Points->x; | 
					
						
							|  |  |  |  |     Y = Points->y; | 
					
						
							|  |  |  |  |     Points++; | 
					
						
							|  |  |  |  |     X2 = Points->x; | 
					
						
							|  |  |  |  |     Y2 = Points->y; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     WIN_FillTriangle(X, X2, X_center, Y, Y2, Y_center); | 
					
						
							|  |  |  |  |     WIN_FillTriangle(X, X_center, X2, Y, Y_center, Y2); | 
					
						
							|  |  |  |  |     WIN_FillTriangle(X_center, X2, X, Y_center, Y2, Y); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   WIN_FillTriangle(X_first, X2, X_center, Y_first, Y2, Y_center); | 
					
						
							|  |  |  |  |   WIN_FillTriangle(X_first, X_center, X2, Y_first, Y_center, Y2); | 
					
						
							|  |  |  |  |   WIN_FillTriangle(X_center, X2, X_first, Y_center, Y2, Y_first); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>,ͼ<><CDBC>ʹ<EFBFBD><CAB9>const<73><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD>䱾<EFBFBD><E4B1BE><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD>С<EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>
 | 
					
						
							|  |  |  |  | // <20>˺<EFBFBD><CBBA><EFBFBD>Ч<EFBFBD>ʱȽϵͣ<CFB5>ֻ<EFBFBD><D6BB><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>Сͼ<D0A1>꣬<EFBFBD><EAA3AC><EFBFBD><EFBFBD>ͼƬʹ<C6AC>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>亯<EFBFBD><E4BAAF>
 | 
					
						
							|  |  |  |  | void WIN_DrawImag(int x, int y, int xsize, int ysize, const u8 *buff) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (buff == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u8 scan = buff[0]; | 
					
						
							|  |  |  |  |   u8 gray = buff[1]; | 
					
						
							|  |  |  |  |   u16 w = *((u16 *)&buff[2]); | 
					
						
							|  |  |  |  |   u16 h = *((u16 *)&buff[4]); | 
					
						
							|  |  |  |  |   u8 is565 = buff[6]; | 
					
						
							|  |  |  |  |   u8 rgb = buff[7]; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
 | 
					
						
							|  |  |  |  |   if ((scan != 0x00) || (gray != 0x10) || (w > WIN_IMAGE_MAXSIZE) || | 
					
						
							|  |  |  |  |       (h > WIN_IMAGE_MAXSIZE) || (is565 != 0x01) || (rgb != 0x1b)) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-07-05 19:05:35 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u16 *imag = (u16 *)(buff + 8); | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (xsize > w) | 
					
						
							|  |  |  |  |     xsize = w; | 
					
						
							|  |  |  |  |   if (ysize > h) | 
					
						
							|  |  |  |  |     ysize = h; | 
					
						
							|  |  |  |  |   for (int j = y; j < y + ysize; j++) { | 
					
						
							|  |  |  |  |     for (int i = 0; i < xsize; i++) { | 
					
						
							|  |  |  |  |       // WIN_GetWinStruct()->drawPointColor(i+x,j,imag[i]);
 | 
					
						
							|  |  |  |  |       WIN_DrawPointColorSafe(i + x, j, imag[i]); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     imag += w; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD>꣬<EFBFBD><EAA3AC><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  | void WIN_DrawImagButColor(int x, int y, int xsize, int ysize, const u8 *buff, | 
					
						
							|  |  |  |  |                           u16 color) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (buff == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u8 scan = buff[0]; | 
					
						
							|  |  |  |  |   u8 gray = buff[1]; | 
					
						
							|  |  |  |  |   u16 w = *((u16 *)&buff[2]); | 
					
						
							|  |  |  |  |   u16 h = *((u16 *)&buff[4]); | 
					
						
							|  |  |  |  |   u8 is565 = buff[6]; | 
					
						
							|  |  |  |  |   u8 rgb = buff[7]; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
 | 
					
						
							|  |  |  |  |   if ((scan != 0x00) || (gray != 0x10) || (w > WIN_IMAGE_MAXSIZE) || | 
					
						
							|  |  |  |  |       (h > WIN_IMAGE_MAXSIZE) || (is565 != 0x01) || (rgb != 0x1b)) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-07-05 19:05:35 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u16 *imag = (u16 *)(buff + 8); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (xsize > w) | 
					
						
							|  |  |  |  |     xsize = w; | 
					
						
							|  |  |  |  |   if (ysize > h) | 
					
						
							|  |  |  |  |     ysize = h; | 
					
						
							|  |  |  |  |   for (int j = y; j < y + ysize; j++) { | 
					
						
							|  |  |  |  |     for (int i = 0; i < xsize; i++) { | 
					
						
							|  |  |  |  |       if (imag[i] != color) | 
					
						
							|  |  |  |  |         // WIN_GetWinStruct()->drawPointColor (i+x,j,imag[i]);
 | 
					
						
							|  |  |  |  |         WIN_DrawPointColorSafe(i + x, j, imag[i]); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     imag += w; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>,<2C><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>Ϊָ<CEAA><D6B8><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  | // <20>˺<EFBFBD><CBBA><EFBFBD>Ч<EFBFBD>ʱȽϵͣ<CFB5>ֻ<EFBFBD><D6BB><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>Сͼ<D0A1>꣬<EFBFBD><EAA3AC><EFBFBD><EFBFBD>ͼƬʹ<C6AC>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>亯<EFBFBD><E4BAAF>
 | 
					
						
							|  |  |  |  | void WIN_DrawImagByColor(int x, int y, int xsize, int ysize, const u8 *buff, | 
					
						
							|  |  |  |  |                          u16 color) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (buff == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u8 scan = buff[0]; | 
					
						
							|  |  |  |  |   u8 gray = buff[1]; | 
					
						
							|  |  |  |  |   u16 w = *((u16 *)&buff[2]); | 
					
						
							|  |  |  |  |   u16 h = *((u16 *)&buff[4]); | 
					
						
							|  |  |  |  |   u8 is565 = buff[6]; | 
					
						
							|  |  |  |  |   u8 rgb = buff[7]; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
 | 
					
						
							|  |  |  |  |   if ((scan != 0x00) || (gray != 0x10) || (w > WIN_IMAGE_MAXSIZE) || | 
					
						
							|  |  |  |  |       (h > WIN_IMAGE_MAXSIZE) || (is565 != 0x01) || (rgb != 0x1b)) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u16 *imag = (u16 *)(buff + 8); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   if (xsize > w) | 
					
						
							|  |  |  |  |     xsize = w; | 
					
						
							|  |  |  |  |   if (ysize > h) | 
					
						
							|  |  |  |  |     ysize = h; | 
					
						
							|  |  |  |  |   for (int j = y; j < y + ysize; j++) { | 
					
						
							|  |  |  |  |     for (int i = 0; i < xsize; i++) { | 
					
						
							|  |  |  |  |       if ((imag[i] != 0x0000) && (imag[i] != 0xffff)) | 
					
						
							|  |  |  |  |         // WIN_GetWinStruct()->drawPointColor  (i+x,j,color);
 | 
					
						
							|  |  |  |  |         WIN_DrawPointColorSafe(i + x, j, color); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     imag += w; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>,<2C><>ԭͼ<D4AD><CDBC>ת<EFBFBD><D7AA>Ϊ<CEAA><CDB8><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | // <20>˺<EFBFBD><CBBA><EFBFBD>Ч<EFBFBD>ʱȽϵͣ<CFB5>ֻ<EFBFBD><D6BB><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>Сͼ<D0A1>꣬<EFBFBD><EAA3AC><EFBFBD><EFBFBD>ͼƬʹ<C6AC>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>亯<EFBFBD><E4BAAF>
 | 
					
						
							|  |  |  |  | void WIN_DrawImagByAlpha(int x, int y, int xsize, int ysize, const u8 *buff, | 
					
						
							|  |  |  |  |                          u16 color) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (buff == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u8 scan = buff[0]; | 
					
						
							|  |  |  |  |   u8 gray = buff[1]; | 
					
						
							|  |  |  |  |   u16 w = *((u16 *)&buff[2]); | 
					
						
							|  |  |  |  |   u16 h = *((u16 *)&buff[4]); | 
					
						
							|  |  |  |  |   u8 is565 = buff[6]; | 
					
						
							|  |  |  |  |   u8 rgb = buff[7]; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
 | 
					
						
							|  |  |  |  |   if ((scan != 0x00) || (gray != 0x10) || (w > WIN_IMAGE_MAXSIZE) || | 
					
						
							|  |  |  |  |       (h > WIN_IMAGE_MAXSIZE) || (is565 != 0x01) || (rgb != 0x1b)) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u16 *imag = (u16 *)(buff + 8); | 
					
						
							|  |  |  |  |   u8 r, g, b; | 
					
						
							|  |  |  |  |   u8 alpha = 0; | 
					
						
							|  |  |  |  |   if (xsize > w) | 
					
						
							|  |  |  |  |     xsize = w; | 
					
						
							|  |  |  |  |   if (ysize > h) | 
					
						
							|  |  |  |  |     ysize = h; | 
					
						
							|  |  |  |  |   for (int j = y; j < y + ysize; j++) { | 
					
						
							|  |  |  |  |     for (int i = 0; i < xsize; i++) { | 
					
						
							|  |  |  |  |       // ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>Ļ
 | 
					
						
							|  |  |  |  |       WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |       if (POS_InRect(ewin->Invalid_x, ewin->Invalid_y, ewin->Invalid_x_size, | 
					
						
							|  |  |  |  |                      ewin->Invalid_y_size, i + x, j)) { | 
					
						
							|  |  |  |  |         // <20><>ɫȫ<C8AB><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3>ӿ<EFBFBD><D3BF>ٶ<EFBFBD>
 | 
					
						
							|  |  |  |  |         if ((imag[i] != 0x0000) && (imag[i] != 0xffff)) { | 
					
						
							|  |  |  |  |           // WIN_GetWinStruct()->drawPointColorAlpha
 | 
					
						
							|  |  |  |  |           // (i+x,j,color,31-(imag[i]>>11));
 | 
					
						
							|  |  |  |  |           WIN_DrawPointSafeColorAlpha(i + x, j, color, 31 - (imag[i] >> 11)); | 
					
						
							|  |  |  |  |         } else if (imag[i] == 0x0000) { | 
					
						
							|  |  |  |  |           // <20><><EFBFBD><CDB8>ֱ<EFBFBD>ӻ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |           // WIN_GetWinStruct()->drawPointColor (i+x,j,color);
 | 
					
						
							|  |  |  |  |           WIN_DrawPointColorSafe(i + x, j, color); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     imag += w; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>,<2C><>ԭͼ<D4AD><CDBC>ת<EFBFBD><D7AA>Ϊ<CEAA><CDB8><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | // <20>˺<EFBFBD><CBBA><EFBFBD>Ч<EFBFBD>ʱȽϵͣ<CFB5>ֻ<EFBFBD><D6BB><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>Сͼ<D0A1>꣬<EFBFBD><EAA3AC><EFBFBD><EFBFBD>ͼƬʹ<C6AC>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>亯<EFBFBD><E4BAAF>
 | 
					
						
							|  |  |  |  | void WIN_DrawImagByAlphaAnti(int x, int y, int xsize, int ysize, const u8 *buff, | 
					
						
							|  |  |  |  |                              u16 color) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (buff == 0) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u8 scan = buff[0]; | 
					
						
							|  |  |  |  |   u8 gray = buff[1]; | 
					
						
							|  |  |  |  |   u16 w = *((u16 *)&buff[2]); | 
					
						
							|  |  |  |  |   u16 h = *((u16 *)&buff[4]); | 
					
						
							|  |  |  |  |   u8 is565 = buff[6]; | 
					
						
							|  |  |  |  |   u8 rgb = buff[7]; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
 | 
					
						
							|  |  |  |  |   if ((scan != 0x00) || (gray != 0x10) || (w > WIN_IMAGE_MAXSIZE) || | 
					
						
							|  |  |  |  |       (h > WIN_IMAGE_MAXSIZE) || (is565 != 0x01) || (rgb != 0x1b)) | 
					
						
							|  |  |  |  |     return; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   u16 *imag = (u16 *)(buff + 8); | 
					
						
							|  |  |  |  |   u8 r, g, b; | 
					
						
							|  |  |  |  |   u8 alpha = 0; | 
					
						
							|  |  |  |  |   if (xsize > w) | 
					
						
							|  |  |  |  |     xsize = w; | 
					
						
							|  |  |  |  |   if (ysize > h) | 
					
						
							|  |  |  |  |     ysize = h; | 
					
						
							|  |  |  |  |   for (int j = y; j < y + ysize; j++) { | 
					
						
							|  |  |  |  |     for (int i = 0; i < xsize; i++) { | 
					
						
							|  |  |  |  |       // ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>Ļ
 | 
					
						
							|  |  |  |  |       WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |       if (POS_InRect(ewin->Invalid_x, ewin->Invalid_y, ewin->Invalid_x_size, | 
					
						
							|  |  |  |  |                      ewin->Invalid_y_size, i + x, j)) { | 
					
						
							|  |  |  |  |         // <20><>ɫȫ<C8AB><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3>ӿ<EFBFBD><D3BF>ٶ<EFBFBD>
 | 
					
						
							|  |  |  |  |         if ((imag[i] != 0x0000) && (imag[i] != 0xffff)) { | 
					
						
							|  |  |  |  |           // WIN_GetWinStruct()->drawPointColorAlpha
 | 
					
						
							|  |  |  |  |           // (i+x,j,color,31-(imag[i]>>11));
 | 
					
						
							|  |  |  |  |           WIN_DrawPointSafeColorAlpha(i + x, j, color, (imag[i] >> 11)); | 
					
						
							|  |  |  |  |         } else if (imag[i] == 0xffff) { | 
					
						
							|  |  |  |  |           // <20><><EFBFBD><CDB8>ֱ<EFBFBD>ӻ<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |           // WIN_GetWinStruct()->drawPointColor (i+x,j,color);
 | 
					
						
							|  |  |  |  |           WIN_DrawPointColorSafe(i + x, j, color); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     imag += w; | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
 | 
					
						
							|  |  |  |  | void WIN_Clear(void) { | 
					
						
							|  |  |  |  |   WIN_Struct *ewin = WIN_GetWinStruct(); | 
					
						
							|  |  |  |  |   // LCD_ClearRect
 | 
					
						
							|  |  |  |  |   // (ewin->Invalid_x,ewin->Invalid_y,ewin->Invalid_x_size,ewin->Invalid_y_size);
 | 
					
						
							|  |  |  |  |   ewin->lcd->clearRect(ewin->Invalid_x, ewin->Invalid_y, ewin->Invalid_x_size, | 
					
						
							|  |  |  |  |                        ewin->Invalid_y_size); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵľ<D6B5><C4BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | void WIN_GetTxtRectSize(char *txt, int *x_size, int *y_size) { | 
					
						
							|  |  |  |  |   int font_h = WIN_GetFontHight(); | 
					
						
							|  |  |  |  |   int font_w = WIN_GetFontWidth() / 2; | 
					
						
							|  |  |  |  |   int max_num = 0; | 
					
						
							|  |  |  |  |   int now_num = 0; | 
					
						
							|  |  |  |  |   int line = 1; | 
					
						
							|  |  |  |  |   // <20><><EFBFBD><EFBFBD>û<EFBFBD>ж<EFBFBD><D0B6><EFBFBD>i=0;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ż<EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD> 2020.2.26
 | 
					
						
							|  |  |  |  |   for (int i = 0; txt[i]; i++) { | 
					
						
							|  |  |  |  |     if (txt[i] != '\n') { | 
					
						
							|  |  |  |  |       now_num++; | 
					
						
							|  |  |  |  |     } else { | 
					
						
							|  |  |  |  |       if (now_num > max_num) { | 
					
						
							|  |  |  |  |         max_num = now_num; | 
					
						
							|  |  |  |  |         now_num = 0; | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |       line++; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  |   if (max_num < now_num + 1) | 
					
						
							|  |  |  |  |     max_num = now_num + 1; // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
 | 
					
						
							|  |  |  |  |   *x_size = max_num * font_w; | 
					
						
							|  |  |  |  |   *y_size = line * font_h; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  | // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ݵijߴ<C4B3>,<2C><><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>ʧ<EFBFBD><CAA7>
 | 
					
						
							|  |  |  |  | int WIN_GetImageSize(u8 *buff, int *xsize, int *ysize) { | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   if (buff == 0) | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							|  |  |  |  |   u8 scan = buff[0]; | 
					
						
							|  |  |  |  |   u8 gray = buff[1]; | 
					
						
							|  |  |  |  |   u16 w = *((u16 *)&buff[2]); | 
					
						
							|  |  |  |  |   u16 h = *((u16 *)&buff[4]); | 
					
						
							|  |  |  |  |   u8 is565 = buff[6]; | 
					
						
							|  |  |  |  |   u8 rgb = buff[7]; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
 | 
					
						
							|  |  |  |  |   if ((scan != 0x00) || (gray != 0x10) || (is565 != 0x01) || (rgb != 0x1b)) | 
					
						
							|  |  |  |  |     return -1; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-06 18:46:13 +08:00
										 |  |  |  |   *xsize = w; | 
					
						
							|  |  |  |  |   *ysize = h; | 
					
						
							|  |  |  |  |   return 0; | 
					
						
							| 
									
										
										
										
											2025-06-27 00:32:57 +08:00
										 |  |  |  | } |