capi: picture load data
authorMichal Maciola <m.maciola@samsung.com>
Mon, 31 May 2021 09:44:59 +0000 (11:44 +0200)
committerHermet Park <chuneon.park@samsung.com>
Mon, 14 Jun 2021 03:51:26 +0000 (12:51 +0900)
Added 'tvg_picture_load_data' capi.

src/bindings/capi/thorvg_capi.h
src/bindings/capi/tvgCapi.cpp

index 4eef7b8..6775640 100644 (file)
@@ -1661,12 +1661,32 @@ 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)
 *
 * \warning Please do not use it, this API is not official one. It can be modified in the next version.
index 06fbf27..cfafb8a 100644 (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;