@@ -54,19 +54,19 @@ def __init__(self,
5454 img_format: 默认显示图像时使用的模式:framebuf.MONO_HLSB(单色显示),framebuf.RGB565(彩色显示)
5555 """
5656 self .display = display
57- self ._reverse = reverse
58- self ._clear = clear
59- self ._show = show
57+ self .any_reverse = reverse
58+ self .any_clear = clear
59+ self .any_show = show
6060 if font_file :
6161 self ._font = BMFont (font_file ) # 字体显示
62- self ._font_color = font_color
63- self ._font_size = font_size
64- self ._font_half_char = font_half_char
65- self ._font_auto_wrap = font_auto_wrap
66- self ._font_alpha_bg = font_alpha_bg
67- self ._img_alpha = img_alpha
68- self ._img_color = img_color
69- self ._img_format = img_format
62+ self .font_color = font_color
63+ self .font_size = font_size
64+ self .font_half_char = font_half_char
65+ self .font_auto_wrap = font_auto_wrap
66+ self .font_alpha_bg = font_alpha_bg
67+ self .img_alpha = img_alpha
68+ self .img_color = img_color
69+ self .img_format = img_format
7070
7171 @staticmethod
7272 def rgb (r , g , b ): # 感谢 ChatGPT 对代码的性能优化,性能提升 30%
@@ -104,21 +104,21 @@ def font(self, s: str, x: int, y: int, c: int = None, size: int = None, show: bo
104104 alpha_bg: 背景透明
105105 """
106106 if c is None :
107- c = self ._font_color
107+ c = self .font_color
108108 if size is None :
109- size = self ._font_size
109+ size = self .font_size
110110 if reverse is None :
111- reverse = self ._reverse
111+ reverse = self .any_reverse
112112 if clear is None :
113- clear = self ._clear
113+ clear = self .any_clear
114114 if show is None :
115- show = self ._show
115+ show = self .any_show
116116 if half_char is None :
117- half_char = self ._font_half_char
117+ half_char = self .font_half_char
118118 if auto_wrap is None :
119- auto_wrap = self ._font_auto_wrap
119+ auto_wrap = self .font_auto_wrap
120120 if alpha_bg is None :
121- alpha_bg = self ._font_alpha_bg
121+ alpha_bg = self .font_alpha_bg
122122
123123 self ._font .text (
124124 display = self .display , # 显示对象 必要
@@ -159,17 +159,17 @@ def pbm(self, file: str, x, y, show: bool = None, clear: bool = None, color: int
159159 format: 显示图像时使用的模式:framebuf.MONO_HLSB(单色显示),framebuf.RGB565(彩色显示)
160160 """
161161 if show is None :
162- show = self ._show
162+ show = self .any_show
163163 if clear is None :
164- clear = self ._clear
164+ clear = self .any_clear
165165 if color is None :
166- color = self ._img_color
166+ color = self .img_color
167167 if alpha is None :
168- alpha = self ._img_alpha
168+ alpha = self .img_alpha
169169 if reverse is None :
170- reverse = self ._reverse
170+ reverse = self .any_reverse
171171 if format is None :
172- format = self ._img_format
172+ format = self .img_format
173173 if clear : # 清屏
174174 self .clear ()
175175 with open (file , "rb" ) as f :
@@ -245,17 +245,17 @@ def bmp(self, file: str, x, y, show: bool = None, clear: bool = None, color: int
245245 format: 显示图像时使用的模式:framebuf.MONO_HLSB(单色显示),framebuf.RGB565(彩色显示)
246246 """
247247 if show is None :
248- show = self ._show
248+ show = self .any_show
249249 if clear is None :
250- clear = self ._clear
250+ clear = self .any_clear
251251 if color is None :
252- color = self ._img_color
252+ color = self .img_color
253253 if alpha is None :
254- alpha = self ._img_alpha
254+ alpha = self .img_alpha
255255 if reverse is None :
256- reverse = self ._reverse
256+ reverse = self .any_reverse
257257 if format is None :
258- format = self ._img_format
258+ format = self .img_format
259259 with open (file , 'rb' ) as f :
260260 if f .read (2 ) == b'BM' : # 检查文件头来判断是否为支持的文件类型
261261 dummy = f .read (8 ) # 文件大小占四个字节,文件作者占四个字节,file size(4), creator bytes(4)
0 commit comments