saxbophone/libsxbp

Implement serialisation / deserialisation functions

Closed this issue · 0 comments

Prototypes:

libsxbp/sxbp/sxbp.h

Lines 318 to 329 in b93d58f

/**
* @brief Serialises the given figure to data, stored in the given buffer
* @details The buffer is populated with bytes which represent the figure and
* from whch compatible versions of SXBP can load figures from again
* @note The buffer is erased before being populated
* @param figure The figure to serialise
* @param[out] buffer The buffer to store the serialised data in
* @returns `true` if the figure could be successfully serialised
* @returns `false` if the figure could not be successfully serialised
* @since v0.54.0
*/
bool sxbp_dump_figure(const sxbp_figure_t* figure, sxbp_bitmap_t* buffer);

libsxbp/sxbp/sxbp.h

Lines 333 to 343 in b93d58f

* @details A serialised SXBP figure is extracted from the buffer's data to the
* given figure, if the buffer data is valid, containing an SXBP figure in the
* data format this version of SXBP understands
* @note The figure is overwritten in this process
* @param buffer The buffer to load the SXBP figure from
* @param[out] figure The figure to store the deserialised SXBP figure in
* @returns `true` if the figure could be successfully deserialised
* @returns `false` if the figure could not be successfully deserialised
* @since v0.54.0
*/
bool sxbp_load_figure(const sxbp_bitmap_t* buffer, sxbp_figure_t* figure);