Code Monkey home page Code Monkey logo

sgl's Introduction

SGL----一个简易的图形库

一个为小屏幕设计的一个图形库,旨在使用起来开放,简单

[v0.1.0] 2022/11/19

  • sgl:负责总handle,配置屏幕,开启DEBUG各种参数,支持裁剪增加各种控件
  • sgl_core/sgl_obj:负责完成对象链表实现,可以删除,创造,设置对象
  • sgl_core/sgl_anim:负责完成动画链表的实现,负责创造动画,实现对象效果
  • sgl_core/sgl_draw:负责实现绘制函数,对绘制显存进行绘制操作
  • sgl_core/sgl_driver:负责实现图像库对底层函数对接的接口
  • sgl_core可以独立于整个系统直接使用,如果只是用sgl_core,并且使用单色屏(1k显存)的情况下,在有良好体验的情况下,推荐MCU的配置
    • RAM>=8K
      • STACK>=1K
      • HEAP>=1K
    • ROM>=15K
    • 处理器频率>=48M

[v0.1.1]2022/11/22

  • sgl中加入色深配置

  • sgl中加入SGL_FPS配置(虽然可能不准)

  • sgl_core/sgl_anim中添加动画结束回调

  • 将log_printf修改为sgl_log

  • 修改sgl_core/sgl_draw文件,绘制加入父对象坐标以及长宽参数,依然是可以独立使用的模块,当对象不在父对象显示范围内,不在的部分将不被绘制

    • 如果不希望对象被父对象限制显示范围,那么将father_x,father_y设置为0,0,father_width设置为屏幕宽度,father_height设置为屏幕高度
  • 添加sgl_core/sgl_timer模块(定时器)

  • 支持双缓冲结构(必须等大)

  • 为多色屏幕添加分块刷新算法

    • 优点:众所周知,往往像彩色LCD通常是16bit,导致如果一个屏幕所需的RAM极大,比如240*240的16bit彩色屏幕通常一个屏幕的RAM就是 240x240x2/1024 = 112.5k的字节数,一般单片机都没有这么大的RAM,所以就写出了分块刷新算法,比如说还是一个240x240的屏幕,我只需要一半,乃至的内存就可以完成屏幕的刷新,甚至可以将这个一半屏幕的内存再分成两个等大的buf,一个交给DMA搬运,一个交给CPU渲染的交替方式,效率更高
    • 缺点:给屏幕的RAM越小,帧率越低,静态显示效果大家都一样,动态显示效果奇差
    • 总结:最好的是一个屏幕缓冲分成两个等大buf,帧率最高,使用DMA,其次推荐两个1/4屏幕的缓冲(总共1/2屏幕)加上DMA,既节约了RAM,使用体验也相对不错

修复bug

  • 修复sgl_anim_create参数列表中,duration为0的情况

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.