From efc415533e5ba46c21ace29387c1d09cf69e999a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Wed, 9 Mar 2022 13:17:03 +0100 Subject: [PATCH] svg sizing and comment --- external/vkvg-svg | 2 +- include/vkvg-svg.h | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/external/vkvg-svg b/external/vkvg-svg index a949b6b..441009b 160000 --- a/external/vkvg-svg +++ b/external/vkvg-svg @@ -1 +1 @@ -Subproject commit a949b6ba735ce888126dc0fa0f9fd01f08acb211 +Subproject commit 441009b65b2e1e18b403463e9ebba17302fbefa6 diff --git a/include/vkvg-svg.h b/include/vkvg-svg.h index 4f16cc8..1c4f4de 100644 --- a/include/vkvg-svg.h +++ b/include/vkvg-svg.h @@ -36,7 +36,7 @@ typedef struct NSVGimage* VkvgSvg; * * Create a new vkvg surface by loading a SVG file. * @param dev The vkvg @ref device used for creating the surface. - * @param filePath The path of the SVG file to load. + * @param svgFilePath The path of the SVG file to load. * @param width force the rendering width, if 0 autosize from svg. * @param height force the rendering height, if 0 autosize from svg. * @return The new vkvg surface with the loaded SVG drawing as content, or null if an error occured. @@ -50,24 +50,53 @@ VkvgSurface vkvg_surface_create_from_svg(VkvgDevice dev, uint32_t width, uint32_ * @param dev The vkvg device used for creating the surface. * @param width force the rendering width, if 0 autosize from svg. * @param height force the rendering height, if 0 autosize from svg. - * @param fragment The SVG fragment to parse. + * @param svgFragment The SVG fragment to parse. * @return The new vkvg surface with the parsed SVG fragment as content, or null if an error occured. */ vkvg_public VkvgSurface vkvg_surface_create_from_svg_fragment(VkvgDevice dev, uint32_t width, uint32_t height, char* svgFragment); - +/** + * @brief get svg dimensions. + * + * retrieve dimensions from svg parsing. + * @param svg a valid VkvgSvg handle. + * @param width pointer to a valid integer to receive the svg width. + * @param height pointer to a valid integer to receive the svg height. + */ vkvg_public void vkvg_svg_get_dimensions (VkvgSvg svg, uint32_t* width, uint32_t* height); +/** + * @brief Load svg file in memory. + * + * Open a svg file and store source in memory, head is parsed to query the svg dimensions. + * @param svgFilePath a valid file path to the svg to load. + * @return a VkvgSvg pointer. + */ vkvg_public VkvgSvg vkvg_svg_load (const char* svgFilePath); +/** + * @brief Load svg from an svg source fragment. + * @param svgFragment A valid svg code fragment. + * @return a VkvgSvg pointer. + */ vkvg_public VkvgSvg vkvg_svg_load_fragment (char* svgFragment); +/** + * @brief render svg on a context. + * @param svg a valid VkvgSvg pointer. + * @param ctx a valid vkvg context. + * @param id an optional id to limit rendering to specific elemnt. + */ vkvg_public void vkvg_svg_render (VkvgSvg svg, VkvgContext ctx, const char* id); +/** + * @brief release VkvgSvg pointer resources. + * @param svg a valid VkvgSvg pointer to free. + */ vkvg_public void vkvg_svg_destroy (VkvgSvg svg); -- 2.47.3