capi: picture load data

Added 'tvg_picture_load_data' capi.
This commit is contained in:
Michal Maciola 2021-05-31 11:44:59 +02:00 committed by Hermet Park
parent 15b56a66de
commit 9453273fc8
2 changed files with 27 additions and 0 deletions

View file

@ -1661,11 +1661,31 @@ TVG_EXPORT Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path);
/*!
* \brief Loads a picture data from a memory block of a given size. (BETA version)
*
* \return Tvg_Result return value
* \retval TVG_RESULT_SUCCESS: if ok.
* \retval TVG_RESULT_INVALID_PARAMETERS: if paint is invalid
*
* \warning Please do not use it, this API is not official one. It can be modified in the next version.
*/
TVG_EXPORT Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy);
/*!
* \brief The function loads data into given paint object. (BETA version)
*
* \param[in] paint Tvg_Paint pointer
* \param[in] data raw data pointer
* \param[in] size of data
*
* \return Tvg_Result return value
* \retval TVG_RESULT_SUCCESS: if ok.
* \retval TVG_RESULT_INVALID_PARAMETERS: if paint is invalid
*
* \warning Please do not use it, this API is not official one. It can be modified in the next version.
*/
TVG_EXPORT Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size);
/*!
* \brief Gets the position and the size of the loaded picture. (BETA version)
*

View file

@ -462,6 +462,13 @@ TVG_EXPORT Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uin
}
TVG_EXPORT Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size)
{
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
return (Tvg_Result) reinterpret_cast<Picture*>(paint)->load(data, size);
}
TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h)
{
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;