rcute_cozmars.screen¶
-
class
rcute_cozmars.screen.Screen(robot)¶ 显示屏
-
default_fade_speed= None¶ 设置
brightness时的默认的渐变速度,默认为 None ,表示没有渐变
-
resolution¶ 分辨率,(240, 135),只读
-
max_brightness¶ 最大亮度, 1.0 ,只读
-
min_brightness¶ 最低亮度,即黑屏, 0.0 ,只读
-
block_display(image, x, y)¶ display the image on a on the screen from (x, y)
raises AssertionError: raise error when the area to display exceeds screen
-
brightness¶ 显示屏亮度,0~1,默认是 0.05
-
display(image, stop_eyes=True)¶ 显示图像
参数: image (numpy.ndarray) – 要显示的图像(bgr 模式)
-
fill(color, x=0, y=0, w=240, h=135, stop_eyes=True)¶ 填充屏幕
参数: - color (str/tuple) – 要填充的颜色(bgr 模式)
- x (int) – 填充方块的左上角 x 坐标,默认为 0
- y (int) – 填充方块的左上角 y 坐标,默认为 0
- w (int) – 填充方块的宽,默认为屏幕宽度 240
- h (int) – 填充方块的宽,默认为屏幕高度 135
引发: ValueError – 填充区域超出屏幕范围时抛出异常
-
set_brightness(brightness, *, fade_duration=None, fade_speed=None)¶ 设置显示屏亮度
参数: - brightness (float) – 亮度,0~1
- fade_duration (float) – 渐变时间(秒) , 默认是 None,表示没有渐变
- fade_speed (float) – 渐变速度(/秒) , 默认是 None,表示没有渐变
引发: TypeError – 不能同时设置 fade_duration 和 fade_speed ,否则抛出异常
-
set_pixel(x, y, color)¶ 设置像素点的颜色
参数: - x (int) – 要设置的像素点的 x 坐标
- y (int) – 要设置的像素点的 y 坐标
- color (str/tuple) – 颜色(bgr 模式)
引发: ValueError – 坐标超出屏幕范围时抛出异常
-
text(text, size=30, color='cyan', bg_color='black', font=None, stop_eyes=True)¶ 显示简单文本
参数: - text (str) – 要显示的文本
- size (int, optional) – 字体大小,默认为 30
- color (str/tuple, optional) – 文本颜色,默认为青色
- bg_color (str/tuple, optional) – 背景颜色,默认为黑色
- font (str, optional) – 字体文件,默认使用微软雅黑(支持中/英文)
-