/upainter

2D graphics rendering on µ-controllers and simulation in Qt with C++14 API. NOTE: This is a research project, consider using a complete solution like LVGL or similiar.

Primary LanguageC++GNU General Public License v3.0GPL-3.0

µ-painter: embedded graphics and event system

This is a playground to figure out how to do a 2D graphics and event system (GES) on µ-controllers in a schmart™ way, i.e. fast on ARMs and yet efficient on AVRs.

This will focus on all layers of the graphics and event system process:

  • memory access: either direct with FSMC, or (double-)buffered
  • memory format: color depts, axis swapping, bit mappings
  • acceleration: typical memory access operations optimized for format, like DMA2D support, fast line rendering
  • renderers: using software renderer or external graphics card like FT8XX
  • graphics context: transformations, context savings, etc.
  • graphics api: with a small subset of SVG 2d api for resolution independence
  • event system: something roughly similar to MicroUI from ESR but in C++

A full fledged GUI is not part of this playground, i.e. only GES, no Base Window System, no Window Manager, no UI Toolkit. Maybe later.

Have fun.

Implementation status

  • C++14
  • Pixel formats and colors:
    • many pixel formats with respective alpha formats. See Surfaces for renderings.
    • all operations from Porter and Duff's "Compositing Digital Images" implemented for all colors.
    • constexpr pixel color constants for compile-time casting to native color.
    • HTML 3.2 color constants.
  • Pixel Buffer wrapper class.
  • Surface class for applying pixel operations.
  • Geometry:
    • classes for Point, Line, Size, Rectangle, Circle, Ellipse.
    • collision detection for combinations (some complex cases still missing).
    • unit tests for geometry classes.
  • Math:
    • generic, constexpr and precision aware fixed_point_t class.
    • extensive unit tests for fixed_point_t.
  • Renderer:
    • primitive rendering and filling.
      • Line.
      • Rect.
      • Circle.
      • Ellipse.
    • rectangular clipping not using guard band clipping (where possible).
    • anti-aliased rendering.
    • rendering unit tests.
  • Simulation in Qt:
    • rendering into QImage with basic viewer.
    • native Qt project compiles with Qt 5.5 and statically linked xpcc library.
  • working unit test harness from xpcc
  • benchmarks of rendering
  • optimization rendering

Example rendering in simulator showing RGB332 color format with clipped primitives: