Loading...
Searching...
No Matches
music_art.h File Reference

Now playing art as the phone packs it, and the reader that checks it. More...

#include <stdbool.h>
#include <stdint.h>
#include "wire/wire_caps.g.h"

Go to the source code of this file.

Data Structures

struct  MusicArt
 Art read off the wire. It points into the bytes it was read from, so it lives only as long as they do. More...

Macros

#define MUSIC_ART_HEADER   3
 The bytes in front of the palette: the width, the height, and how many colours follow.

Functions

bool music_art_read (const uint8_t *buf, uint16_t len, MusicArt *out)
 Reads art off the wire.
void music_art_copy_rows (const MusicArt *art, uint8_t *dst, uint16_t dst_row_bytes)
 Copies the art's rows into a bitmap's own rows.

Detailed Description

Now playing art as the phone packs it, and the reader that checks it.

The phone sends the art as one run of bytes on MUSIC_ARTWORK: [width][height][colours], then the palette, one GColor8 byte per colour, then the pixels as the watch's own 4-bit palettized bitmap holds them. Two pixels go to a byte with the even x in the high nibble, and each row is padded to (width + 1) / 2 bytes. A width or a height of 0 means no art. The bytes come off a phone, so none of it is trusted, and a run whose length does not match its header is refused whole.

The packer on the other side is ts/pkjs/wire.ts, and the two have to agree exactly.