Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

lv_img_conv: Add CF_TRUE_COLOR output - #2458

#2458
Open
JoeStrout wants to merge 1 commit into
InfiniTimeOrg:mainInfiniTimeOrg/InfiniTime:mainfrom
JoeStrout:lv-img-conv-true-colorJoeStrout/InfiniTime:lv-img-conv-true-colorCopy head branch name to clipboard
Open

lv_img_conv: Add CF_TRUE_COLOR output#2458
JoeStrout wants to merge 1 commit into
InfiniTimeOrg:mainInfiniTimeOrg/InfiniTime:mainfrom
JoeStrout:lv-img-conv-true-colorJoeStrout/InfiniTime:lv-img-conv-true-colorCopy head branch name to clipboard

Conversation

@JoeStrout

Copy link
Copy Markdown

Only CF_INDEXED_1_BIT and CF_TRUE_COLOR_ALPHA were implemented, so a plain true-color image without alpha could not be converted into a 2-bytes-per-pixel file. (I ran into this while trying to use a full-color image as a watch background.)

This PR adds support for CF_TRUE_COLOR with binary format ARGB8565_RBSWAP, written as 2 bytes per pixel, RGB565 high byte first, matching the existing alpha path and LV_COLOR_16_SWAP=1, with cf = 4 in the header. Alpha is dropped on input, since the format does not carry it.

(You might wonder why the format is ARGB8565_RBSWAP in this case, which claims an alpha channel. That's because all the format choices claim an alpha channel; there is no plain RGB565_SWAP option. Yet some existing color_format options (see the --color-format choices list) imply no alpha, and this is the part that determines whether we actually have an alpha channel or not. When used with a format with no alpha, ARGB8565_RBSWAP would reduce to just RGB565_RBSWAP. We could add that as an alias just to reduce confusion, but it's not necessary and seemed out of scope for this PR. This also matches how CF_INDEXED_1_BIT overrides the given binary format as needed.)

Verified by using this to convert a full-color 240x240 pixel image into a 115,200-byte file (plus header) that exactly matched a hand-built one, and which displays correctly both in InfiniSim and on device.

This PR also fixes a typo on a nearby line: pritn -> print in the refuse-to-overwrite path, which raised NameError instead of printing the intended message.

Only CF_INDEXED_1_BIT and CF_TRUE_COLOR_ALPHA were implemented, so a
plain true-colour image -- the obvious choice for a full-screen watch
face background -- could not be converted at all.

Add CF_TRUE_COLOR: 2 bytes per pixel, RGB565 high byte first, matching
the existing alpha path and LV_COLOR_16_SWAP=1, with cf = 4 in the
header. Alpha is dropped on input, since the format does not carry it.

Also fix a typo on an adjacent line: pritn -> print in the
refuse-to-overwrite path, which raised NameError instead of printing the
intended message.
@github-actions

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 385232B 0B
data 944B 0B
bss 22640B 0B

Run in InfiniEmu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.