Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RGB565 and RGB888 color support to Quantum Painter #19382

Merged
merged 6 commits into from
Jan 14, 2023

Conversation

infinityis
Copy link
Contributor

This pull request adds native color support (RGB565 and RGB888) to Quantum Painter.

Description

Currently QP only provides support for images and animations with a palette of up to 256 colors. This addition provides for image generation and storage without using palettes, and instead uses the native file format of the display. For RGB565 displays, this makes images take up about 2x the memory compared to using a 256 color palette (since two bytes are used per pixel instead of one byte), and for RGB888 displays, it takes up 3x the memory (since three bytes are used per pixel instead of one byte).

An overriding goal of this implementation was to make handling of native color images no different than that of palette-based images. That is, the keyboard developer does not need to (for example) write directly to pixdata(); all image handling functions are consistent from a keyboard developer perspective. The only difference happens at the time of image generation using the python scripts, in that rgb565 or rgb888 needs to be specified (as appropriate for the target display).

This is certainly not the only way to provide such functionality, it is just one way to do it such that it plays nicely with the existing implementation and interfaces. If these changes do not happen to fit with the vision and direction for Quantum Painter, that is ok, as it can at least inspire and inform future implementation.

Potential improvements in the future:

  • Checking for compatibility between the native format and the display driver, as this is not currently enforced.
  • Whenever monochrome OLEDs get added to QP, there is potential for confusion since the "native" format for those devices is monochrome. Perhaps QUANTUM_PAINTER_SUPPORTS_NATIVE_COLORS would be better as QUANTUM_PAINTER_SUPPORTS_RGB565_COLORS and QUANTUM_PAINTER_SUPPORTS_RGB888_COLORS

These changes were tested using an ST7735. I have not tested other displays.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@tzarc tzarc self-assigned this Dec 20, 2022
@tzarc tzarc requested review from tzarc and a team December 20, 2022 00:46
quantum/painter/qp_draw_codec.c Outdated Show resolved Hide resolved
quantum/painter/qp_draw_image.c Show resolved Hide resolved
quantum/painter/qp_draw_image.c Outdated Show resolved Hide resolved
@tzarc tzarc requested a review from a team January 3, 2023 16:54
quantum/painter/qp_draw_codec.c Show resolved Hide resolved
quantum/painter/qp_draw_codec.c Outdated Show resolved Hide resolved
Copy link
Member

@KarlK90 KarlK90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great addition and fixing the bugs. LGTM from my side.

@tzarc tzarc merged commit 45851a1 into qmk:develop Jan 14, 2023
omikronik pushed a commit to omikronik/qmk_firmware that referenced this pull request Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants