当前位置: 首页 > wzjs >正文

深圳网站专业建设公司无线网络优化是做什么的

深圳网站专业建设公司,无线网络优化是做什么的,网站推广方式主要通过,安全管理系统《K230 从熟悉到...》屏幕手绘板 添加功能带保存功能的手画板 《庐山派 K230 从熟悉到...》屏幕手绘板 https://wiki.lckfb.com/zh-hans/lushan-pi-k230/media/touch.html 添加功能 参考下面的格式去添加自己想要的功能 带保存功能的手画板 import time, os, gc, sys, u…

《K230 从熟悉到...》屏幕手绘板

  • 添加功能
  • 带保存功能的手画板

《庐山派 K230 从熟悉到...》屏幕手绘板

https://wiki.lckfb.com/zh-hans/lushan-pi-k230/media/touch.html
在这里插入图片描述

添加功能

参考下面的格式去添加自己想要的功能
在这里插入图片描述
在这里插入图片描述

带保存功能的手画板

import time, os, gc, sys, urandom
from media.display import *
from media.media import *
from machine import TOUCHtry:# LCDDISPLAY_MODE = "LCD"if DISPLAY_MODE == "LCD":# 3.1寸屏幕模式DISPLAY_WIDTH = 800DISPLAY_HEIGHT = 480# 根据模式初始化显示器if DISPLAY_MODE == "LCD":Display.init(Display.ST7701, width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT, to_ide=False)width = DISPLAY_WIDTHheight = DISPLAY_HEIGHT# 初始化媒体管理器MediaManager.init()# 创建绘制的图像img = image.Image(width, height, image.RGB565)img.clear()# 设置默认画笔颜色和大小current_color = (0, 255, 0)  # 默认绿色brush_size = 10  # 默认画笔大小# 定义画布中的按钮区域clear_button_area = (width - 130, 0, 130, 50)  # 清除按钮区域(右上角)color_button_area = (0, 0, 130, 50)  # 颜色选择按钮区域(左上角)save_button_area = (0, 60, 130, 50)  # 保存按钮区域(左上角下方)# 实例化 TOUCH 设备 0tp = TOUCH(0)last_point = None  # 记录上一个触摸点def draw_button(x, y, w, h, text, bg_color, text_color):"""绘制圆角矩形按钮"""# 绘制圆角矩形img.draw_rectangle(x, y, w, h, color=bg_color, fill=True)# 绘制文本img.draw_string_advanced(x + 40, y + 8, 30, text, color=text_color, scale=2)def draw_clear_button():"""绘制清除按钮"""draw_button(clear_button_area[0], clear_button_area[1], clear_button_area[2], clear_button_area[3],"清除", (255, 0, 0), (255, 255, 255))def draw_color_buttons():"""绘制颜色选择按钮"""draw_button(color_button_area[0], color_button_area[1], color_button_area[2], color_button_area[3],"随机", (255, 255, 0), (0, 0, 0))# 显示当前颜色img.draw_circle(color_button_area[0] + 170, 25, 20, color=current_color, thickness=3, fill=True)def draw_save_button():"""绘制保存按钮"""draw_button(save_button_area[0], save_button_area[1], save_button_area[2], save_button_area[3],"保存", (0, 128, 255), (255, 255, 255))def select_color(x, y):"""选择随机颜色"""global current_colorif (color_button_area[0] <= x <= color_button_area[0] + color_button_area[2] andcolor_button_area[1] <= y <= color_button_area[1] + color_button_area[3]):current_color = (urandom.getrandbits(8), urandom.getrandbits(8), urandom.getrandbits(8))print(f"select_color to {current_color}")def check_clear_button(x, y):"""检查是否点击了清除按钮"""if (clear_button_area[0] <= x <= clear_button_area[0] + clear_button_area[2] andclear_button_area[1] <= y <= clear_button_area[1] + clear_button_area[3]):img.clear()  # 清除画布def check_save_button(x, y):"""检查是否点击了保存按钮"""if (save_button_area[0] <= x <= save_button_area[0] + save_button_area[2] andsave_button_area[1] <= y <= save_button_area[1] + save_button_area[3]):save_image()  # 保存图像def save_image():"""保存当前图像到文件"""filename = f'/data/xianyujiang/1.jpg'  # 保存路径img.save(filename)print(f"Image saved to {filename}")def draw_line_between_points(last_point, current_point):"""在两个触摸点之间绘制连线,插入中间点以平滑移动"""if last_point is not None:dx = current_point.x - last_point.xdy = current_point.y - last_point.ydistance = (dx ** 2 + dy ** 2) ** 0.5if distance > 30:returnmin_distance = 10  # 插值的最小距离if distance > min_distance:steps = int(distance // min_distance)for i in range(1, steps + 1):new_x = last_point.x + i * dx / (steps + 1)new_y = last_point.y + i * dy / (steps + 1)img.draw_circle(int(new_x), int(new_y), brush_size, color=current_color, thickness=3, fill=True)img.draw_circle(current_point.x, current_point.y, brush_size, color=current_color, thickness=3, fill=True)while True:os.exitpoint()# 只读取 1 个触摸点数据p = tp.read(1)if p != ():for idx, point in enumerate(p, start=1):select_color(point.x, point.y)  # 选择颜色check_clear_button(point.x, point.y)  # 检查清除按钮check_save_button(point.x, point.y)  # 检查保存按钮draw_line_between_points(last_point, point)  # 绘制线条last_point = point# 绘制按钮和其他元素draw_clear_button()draw_color_buttons()draw_save_button()# 显示绘制结果Display.show_image(img)time.sleep_ms(1)
except KeyboardInterrupt as e:print(f"user stop")
except BaseException as e:print(f"Exception '{e}'")
finally:# 销毁 displayDisplay.deinit()os.exitpoint(os.EXITPOINT_ENABLE_SLEEP)time.sleep_ms(100)# 释放媒体缓冲区MediaManager.deinit()

在这里插入图片描述

http://www.dtcms.com/wzjs/213456.html

相关文章:

  • 温州市网站制作多少钱上海今天发生的重大新闻
  • 可以免费做会计题的网站关键词生成器在线
  • 网站建设交流会北京seo顾问外包
  • 做门户网站的好处seo优化员
  • 企业网站开发摘要北京seo包年
  • 营销型网站建设公司网络推广著名的营销成功的案例
  • 用PS怎么做网站界面站长素材音效
  • 做游戏装备网站可以吗国外网站排名 top100
  • 做网站付款方式搜索软件排行榜前十名
  • 湛江网站建设开发百度推广怎么做步骤
  • js网站登录怎么做西安seo工作室
  • 免费音效素材网站seo是什么品牌
  • 做国外家具贸易的网站aso优化注意什么
  • 17网站一起做网店白沟100个经典创意营销方案
  • 不做网站只做推广可以么深圳百度推广公司
  • 响应式网站用什么做推广团队在哪里找
  • 网站icp备案流程文娱热搜榜
  • 品牌服装网站源码seo长尾快速排名
  • 雅加达网站建设域名是什么
  • 英文版网站怎么做东莞网站制作推广公司
  • 手机网站开发流程图黑河seo
  • wordpress优化网站打开速度苏州关键词优化seo
  • 中铁建设集团有限公司招聘信息seo还有前景吗
  • 建网站的费用包括旅游网站的网页设计
  • 网站权重对应的等级seo排名平台
  • 做渠道该从哪些网站入手网站推广120种方法
  • 贵州安顺网站建设徐州seo推广优化
  • 做物流哪个网站推广好网上国网app
  • 网站建设需要多久制作网页教程
  • css样式模板网站个人网站免费域名和服务器