qmk_firmware/assets/quantum_painter_qgf.md.DO-ewW08.js

16 lines
25 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.B9AX-CPi.js";
const __pageData = JSON.parse('{"title":"QMK Graphics Format","description":"","frontmatter":{},"headers":[],"relativePath":"quantum_painter_qgf.md","filePath":"quantum_painter_qgf.md"}');
const _sfc_main = { name: "quantum_painter_qgf.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="qmk-graphics-format" tabindex="-1">QMK Graphics Format <a class="header-anchor" href="#qmk-graphics-format" aria-label="Permalink to &quot;QMK Graphics Format {#qmk-graphics-format}&quot;"></a></h1><p>QMK uses a graphics format <em>(&quot;Quantum Graphics Format&quot; - QGF)</em> specifically for resource-constrained systems.</p><p>This format is capable of encoding 1-, 2-, 4-, and 8-bit-per-pixel greyscale- and palette-based images. It also includes RLE for pixel data for some basic compression.</p><p>All integer values are in little-endian format.</p><p>The QGF is defined in terms of <em>blocks</em> -- each <em>block</em> contains a <em>header</em> and an optional <em>blob</em> of data. The <em>header</em> contains the block&#39;s <em>typeid</em>, and the length of the <em>blob</em> that follows. Each block type is denoted by a different <em>typeid</em> has its own block definition below. All blocks are defined as packed structs, containing zero padding between fields.</p><p>The general structure of the file is:</p><ul><li><em>Graphics descriptor block</em></li><li><em>Frame offset block</em></li><li>Repeating list of frames: <ul><li><em>Frame descriptor block</em></li><li><em>Frame palette block</em> (optional, depending on frame format)</li><li><em>Frame delta block</em> (optional, depending on delta flag)</li><li><em>Frame data block</em></li></ul></li></ul><p>Different frames within the file should be considered &quot;isolated&quot; and may have their own image format and/or palette.</p><h2 id="qgf-block-header" tabindex="-1">Block Header <a class="header-anchor" href="#qgf-block-header" aria-label="Permalink to &quot;Block Header {#qgf-block-header}&quot;"></a></h2><p>This block header is present for all blocks, including the graphics descriptor.</p><p><em>Block header</em> format:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">typedef</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> struct</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> __attribute__</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">((packed)) </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">qgf_block_header_v1_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> type_id;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // See each respective block type</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> uint8_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> neg_type_id;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Negated type ID, used for detecting parsing errors</span></span>\n<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> uint24_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> length;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // 24-bit blob length, allowing for block sizes of a maximum of 16MB</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">} </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">qgf_block_header_v1_t</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span>\n<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// _Static_assert(sizeof(qgf_block_header_v1_t) == 5, &quot;qgf_block_header_v1_t must be 5 bytes in v1 of QGF&quot;);</span></span></code></pre></div><p>The <em>length</em> describes the number of octets in the data following the block header -- a block header may specify a <em>length</em> of <code>0</code> i
const _hoisted_51 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_51);
}
const quantum_painter_qgf = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
quantum_painter_qgf as default
};