mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
infra: specify TVG_API for both static/dynamic linking.
The previous meson script was incomplete, therefore this change requires it to be revised. To enable static linking use the next meson option. "-Ddefault_library=static" Issue: https://github.com/thorvg/thorvg/issues/1234
This commit is contained in:
parent
02bc89fc93
commit
69063d2405
10 changed files with 250 additions and 207 deletions
57
inc/thorvg.h
57
inc/thorvg.h
|
@ -19,17 +19,32 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#ifdef TVG_BUILD
|
||||
#if defined(_WIN32) && !defined(__clang__)
|
||||
#define TVG_EXPORT __declspec(dllexport)
|
||||
#define TVG_DEPRECATED __declspec(deprecated)
|
||||
#ifdef TVG_API
|
||||
#undef TVG_API
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__clang__)
|
||||
#if TVG_BUILD
|
||||
#if TVG_EXPORT
|
||||
#define TVG_API __declspec(dllexport)
|
||||
#else
|
||||
#define TVG_API
|
||||
#endif
|
||||
#else
|
||||
#define TVG_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define TVG_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#define TVG_API __declspec(dllimport)
|
||||
#endif
|
||||
#define TVG_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#define TVG_EXPORT
|
||||
#define TVG_DEPRECATED
|
||||
#if TVG_BUILD
|
||||
#if TVG_EXPORT
|
||||
#define TVG_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define TVG_API
|
||||
#endif
|
||||
#else
|
||||
#define TVG_API
|
||||
#endif
|
||||
#define TVG_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -222,7 +237,7 @@ struct Polygon
|
|||
* Paint represents such a graphical object and its behaviors such as duplication, transformation and composition.
|
||||
* TVG recommends the user to regard a paint as a set of volatile commands. They can prepare a Paint and then request a Canvas to run them.
|
||||
*/
|
||||
class TVG_EXPORT Paint
|
||||
class TVG_API Paint
|
||||
{
|
||||
public:
|
||||
virtual ~Paint();
|
||||
|
@ -390,7 +405,7 @@ public:
|
|||
* It specifies the gradient behavior in case the area defined by the gradient bounds
|
||||
* is smaller than the area to be filled.
|
||||
*/
|
||||
class TVG_EXPORT Fill
|
||||
class TVG_API Fill
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -494,7 +509,7 @@ public:
|
|||
* @note A Canvas behavior depends on the raster engine though the final content of the buffer is expected to be identical.
|
||||
* @warning The Paint objects belonging to one Canvas can't be shared among multiple Canvases.
|
||||
*/
|
||||
class TVG_EXPORT Canvas
|
||||
class TVG_API Canvas
|
||||
{
|
||||
public:
|
||||
Canvas(RenderMethod*);
|
||||
|
@ -590,7 +605,7 @@ public:
|
|||
* Besides the APIs inherited from the Fill class, it enables setting and getting the linear gradient bounds.
|
||||
* The behavior outside the gradient bounds depends on the value specified in the spread API.
|
||||
*/
|
||||
class TVG_EXPORT LinearGradient final : public Fill
|
||||
class TVG_API LinearGradient final : public Fill
|
||||
{
|
||||
public:
|
||||
~LinearGradient();
|
||||
|
@ -655,7 +670,7 @@ public:
|
|||
* @brief A class representing the radial gradient fill of the Shape object.
|
||||
*
|
||||
*/
|
||||
class TVG_EXPORT RadialGradient final : public Fill
|
||||
class TVG_API RadialGradient final : public Fill
|
||||
{
|
||||
public:
|
||||
~RadialGradient();
|
||||
|
@ -718,7 +733,7 @@ public:
|
|||
* The stroke of Shape is an optional property in case the Shape needs to be represented with/without the outline borders.
|
||||
* It's efficient since the shape path and the stroking path can be shared with each other. It's also convenient when controlling both in one context.
|
||||
*/
|
||||
class TVG_EXPORT Shape final : public Paint
|
||||
class TVG_API Shape final : public Paint
|
||||
{
|
||||
public:
|
||||
~Shape();
|
||||
|
@ -1110,7 +1125,7 @@ public:
|
|||
*
|
||||
* @note Supported formats are depended on the available TVG loaders.
|
||||
*/
|
||||
class TVG_EXPORT Picture final : public Paint
|
||||
class TVG_API Picture final : public Paint
|
||||
{
|
||||
public:
|
||||
~Picture();
|
||||
|
@ -1288,7 +1303,7 @@ public:
|
|||
* As a group, the scene can be transformed, made translucent and composited with other target paints,
|
||||
* its children will be affected by the scene world.
|
||||
*/
|
||||
class TVG_EXPORT Scene final : public Paint
|
||||
class TVG_API Scene final : public Paint
|
||||
{
|
||||
public:
|
||||
~Scene();
|
||||
|
@ -1360,7 +1375,7 @@ public:
|
|||
*
|
||||
* @brief A class for the rendering graphical elements with a software raster engine.
|
||||
*/
|
||||
class TVG_EXPORT SwCanvas final : public Canvas
|
||||
class TVG_API SwCanvas final : public Canvas
|
||||
{
|
||||
public:
|
||||
~SwCanvas();
|
||||
|
@ -1451,7 +1466,7 @@ public:
|
|||
*
|
||||
* @BETA_API
|
||||
*/
|
||||
class TVG_EXPORT GlCanvas final : public Canvas
|
||||
class TVG_API GlCanvas final : public Canvas
|
||||
{
|
||||
public:
|
||||
~GlCanvas();
|
||||
|
@ -1483,7 +1498,7 @@ public:
|
|||
*
|
||||
* @brief A class that enables initialization and termination of the TVG engines.
|
||||
*/
|
||||
class TVG_EXPORT Initializer final
|
||||
class TVG_API Initializer final
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -1545,7 +1560,7 @@ public:
|
|||
*
|
||||
* @since 0.5
|
||||
*/
|
||||
class TVG_EXPORT Saver final
|
||||
class TVG_API Saver final
|
||||
{
|
||||
public:
|
||||
~Saver();
|
||||
|
@ -1615,7 +1630,7 @@ public:
|
|||
*
|
||||
* @BETA_API
|
||||
*/
|
||||
class TVG_EXPORT Accessor final
|
||||
class TVG_API Accessor final
|
||||
{
|
||||
public:
|
||||
~Accessor();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
compiler_flags = ['-DTVG_BUILD']
|
||||
|
||||
if all_tools or get_option('tools').contains('svg2png') == true
|
||||
subdir('svg2png')
|
||||
endif
|
||||
|
|
|
@ -3,4 +3,5 @@ svg2png_src = files('svg2png.cpp', 'lodepng.cpp')
|
|||
executable('svg2png',
|
||||
svg2png_src,
|
||||
include_directories : headers,
|
||||
cpp_args: compiler_flags,
|
||||
link_with : thorvg_lib)
|
||||
|
|
|
@ -3,4 +3,5 @@ svg2tvg_src = files('svg2tvg.cpp')
|
|||
executable('svg2tvg',
|
||||
svg2tvg_src,
|
||||
include_directories : headers,
|
||||
cpp_args: compiler_flags,
|
||||
link_with : thorvg_lib)
|
||||
|
|
|
@ -21,18 +21,32 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef TVG_EXPORT
|
||||
#undef TVG_EXPORT
|
||||
#ifdef TVG_API
|
||||
#undef TVG_API
|
||||
#endif
|
||||
|
||||
#ifdef TVG_BUILD
|
||||
#ifdef _WIN32
|
||||
#define TVG_EXPORT __declspec(dllexport)
|
||||
#if defined(_WIN32) && !defined(__clang__)
|
||||
#if TVG_BUILD
|
||||
#if TVG_EXPORT
|
||||
#define TVG_API __declspec(dllexport)
|
||||
#else
|
||||
#define TVG_API
|
||||
#endif
|
||||
#else
|
||||
#define TVG_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define TVG_API __declspec(dllimport)
|
||||
#endif
|
||||
#define TVG_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
#define TVG_EXPORT
|
||||
#if TVG_BUILD
|
||||
#if TVG_EXPORT
|
||||
#define TVG_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define TVG_API
|
||||
#endif
|
||||
#else
|
||||
#define TVG_API
|
||||
#endif
|
||||
#define TVG_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -255,7 +269,7 @@ typedef struct
|
|||
* \see tvg_engine_term()
|
||||
* \see Tvg_Engine
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads);
|
||||
TVG_API Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -283,7 +297,7 @@ TVG_EXPORT Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads
|
|||
* \see tvg_engine_init()
|
||||
* \see Tvg_Engine
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_engine_term(Tvg_Engine engine_method);
|
||||
TVG_API Tvg_Result tvg_engine_term(Tvg_Engine engine_method);
|
||||
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Initializer
|
||||
|
@ -357,7 +371,7 @@ typedef enum {
|
|||
*
|
||||
* \return A new Tvg_Canvas object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Canvas* tvg_swcanvas_create();
|
||||
TVG_API Tvg_Canvas* tvg_swcanvas_create();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -385,7 +399,7 @@ TVG_EXPORT Tvg_Canvas* tvg_swcanvas_create();
|
|||
*
|
||||
* \see Tvg_Colorspace
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Tvg_Colorspace cs);
|
||||
TVG_API Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Tvg_Colorspace cs);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -412,7 +426,7 @@ TVG_EXPORT Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buff
|
|||
*
|
||||
* \warning It's not allowed after pushing any paints.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas* canvas, Tvg_Mempool_Policy policy);
|
||||
TVG_API Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas* canvas, Tvg_Mempool_Policy policy);
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_SwCanvas
|
||||
|
||||
|
@ -481,7 +495,7 @@ TVG_EXPORT Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas* canvas, Tvg_Mempool_P
|
|||
*
|
||||
* \see tvg_paint_del(), tvg_canvas_clear()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas);
|
||||
TVG_API Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -502,7 +516,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas);
|
|||
* \note The rendering order of the paints is the same as the order as they were pushed. Consider sorting the paints before pushing them if you intend to use layering.
|
||||
* \see tvg_canvas_reserve(), tvg_canvas_clear()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
||||
TVG_API Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -536,7 +550,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Canvas pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n);
|
||||
TVG_API Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -556,7 +570,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n);
|
|||
*
|
||||
* \see tvg_canvas_destroy()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
|
||||
TVG_API Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -616,7 +630,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free);
|
|||
*
|
||||
* \see tvg_canvas_update_paint()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_update(Tvg_Canvas* canvas);
|
||||
TVG_API Tvg_Result tvg_canvas_update(Tvg_Canvas* canvas);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -634,7 +648,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_update(Tvg_Canvas* canvas);
|
|||
*
|
||||
* \see tvg_canvas_update()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_update_paint(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
||||
TVG_API Tvg_Result tvg_canvas_update_paint(Tvg_Canvas* canvas, Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -652,7 +666,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_update_paint(Tvg_Canvas* canvas, Tvg_Paint* pai
|
|||
* \note Drawing can be asynchronous based on the assigned thread number. To guarantee the drawing is done, call tvg_canvas_sync() afterwards.
|
||||
* \see tvg_canvas_sync()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas);
|
||||
TVG_API Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -669,7 +683,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas);
|
|||
*
|
||||
* \see tvg_canvas_draw()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas);
|
||||
TVG_API Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas);
|
||||
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Canvas
|
||||
|
@ -715,7 +729,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas);
|
|||
*
|
||||
* \see tvg_canvas_clear(), tvg_canvas_destroy()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_del(Tvg_Paint* paint);
|
||||
TVG_API Tvg_Result tvg_paint_del(Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -729,7 +743,7 @@ TVG_EXPORT Tvg_Result tvg_paint_del(Tvg_Paint* paint);
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor);
|
||||
TVG_API Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -746,7 +760,7 @@ TVG_EXPORT Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor);
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree);
|
||||
TVG_API Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -764,7 +778,7 @@ TVG_EXPORT Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree);
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
|
||||
TVG_API Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -780,7 +794,7 @@ TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y);
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix* m);
|
||||
TVG_API Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix* m);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -795,7 +809,7 @@ TVG_EXPORT Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m);
|
||||
TVG_API Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -810,7 +824,7 @@ TVG_EXPORT Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m);
|
|||
*
|
||||
* \note Setting the opacity with this API may require multiple renderings using a composition. It is recommended to avoid changing the opacity if possible.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity);
|
||||
TVG_API Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -823,7 +837,7 @@ TVG_EXPORT Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity);
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT In case a @c nullptr is passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opacity);
|
||||
TVG_API Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opacity);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -835,7 +849,7 @@ TVG_EXPORT Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opa
|
|||
*
|
||||
* \return A copied Tvg_Paint object if succeed, @c nullptr otherwise.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint);
|
||||
TVG_API Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -855,7 +869,7 @@ TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint);
|
|||
*
|
||||
* \note The bounding box doesn't indicate the actual drawing region. It's the smallest rectangle that encloses the object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed);
|
||||
TVG_API Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -869,7 +883,7 @@ TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, flo
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid @p paint or @p target object or the @p method equal to TVG_COMPOSITE_METHOD_NONE.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(Tvg_Paint* paint, Tvg_Paint* target, Tvg_Composite_Method method);
|
||||
TVG_API Tvg_Result tvg_paint_set_composite_method(Tvg_Paint* paint, Tvg_Paint* target, Tvg_Composite_Method method);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -883,7 +897,7 @@ TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(Tvg_Paint* paint, Tvg_Paint
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint* paint, const Tvg_Paint** target, Tvg_Composite_Method* method);
|
||||
TVG_API Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint* paint, const Tvg_Paint** target, Tvg_Composite_Method* method);
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Paint
|
||||
|
||||
|
@ -911,7 +925,7 @@ TVG_EXPORT Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint* paint, con
|
|||
*
|
||||
* \return A new shape object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Paint* tvg_shape_new();
|
||||
TVG_API Tvg_Paint* tvg_shape_new();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -927,7 +941,7 @@ TVG_EXPORT Tvg_Paint* tvg_shape_new();
|
|||
*
|
||||
* \note The memory, where the path data is stored, is not deallocated at this stage for caching effect.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_reset(Tvg_Paint* paint);
|
||||
TVG_API Tvg_Result tvg_shape_reset(Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -943,7 +957,7 @@ TVG_EXPORT Tvg_Result tvg_shape_reset(Tvg_Paint* paint);
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y);
|
||||
TVG_API Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -961,7 +975,7 @@ TVG_EXPORT Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y);
|
|||
*
|
||||
* \note In case this is the first command in the path, it corresponds to the tvg_shape_move_to() call.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y);
|
||||
TVG_API Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -984,7 +998,7 @@ TVG_EXPORT Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y);
|
|||
*
|
||||
* \note In case this is the first command in the path, no data from the path are rendered.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1, float cx2, float cy2, float x, float y);
|
||||
TVG_API Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1, float cx2, float cy2, float x, float y);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1000,7 +1014,7 @@ TVG_EXPORT Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1,
|
|||
*
|
||||
* \note In case the sub-path does not contain any points, this function has no effect.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_close(Tvg_Paint* paint);
|
||||
TVG_API Tvg_Result tvg_shape_close(Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1030,7 +1044,7 @@ TVG_EXPORT Tvg_Result tvg_shape_close(Tvg_Paint* paint);
|
|||
*
|
||||
& \note For @p rx and @p ry greater than or equal to the half of @p w and the half of @p h, respectively, the shape become an ellipse.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, float w, float h, float rx, float ry);
|
||||
TVG_API Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, float w, float h, float rx, float ry);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1052,7 +1066,7 @@ TVG_EXPORT Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y,
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry);
|
||||
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1075,7 +1089,7 @@ TVG_EXPORT Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float
|
|||
*
|
||||
* \note Setting @p sweep value greater than 360 degrees, is equivalent to calling tvg_shape_append_circle(paint, cx, cy, radius, radius).
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie);
|
||||
TVG_API Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1095,7 +1109,7 @@ TVG_EXPORT Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy,
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr passed as the argument or @p cmdCnt or @p ptsCnt equal to zero.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Command* cmds, uint32_t cmdCnt, const Tvg_Point* pts, uint32_t ptsCnt);
|
||||
TVG_API Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Command* cmds, uint32_t cmdCnt, const Tvg_Point* pts, uint32_t ptsCnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1121,7 +1135,7 @@ TVG_EXPORT Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Com
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt);
|
||||
TVG_API Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1147,7 +1161,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tv
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cnt);
|
||||
TVG_API Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1161,7 +1175,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with a memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1174,7 +1188,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width);
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* width);
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* width);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1193,7 +1207,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float*
|
|||
*
|
||||
* \note Either a solid color or a gradient fill is applied, depending on what was set as last.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1210,7 +1224,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, ui
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_INSUFFICIENT_CONDITION No stroke was set.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1227,7 +1241,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t
|
|||
*
|
||||
* \note Either a solid color or a gradient fill is applied, depending on what was set as last.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1244,7 +1258,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg
|
|||
*
|
||||
* \note Either a solid color or a gradient fill is applied, depending on what was set as last.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1259,7 +1273,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_Gradient** grad);
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_Gradient** grad);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1283,7 +1297,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_
|
|||
*
|
||||
* \note To reset the stroke dash pattern, pass @c nullptr to @p dashPattern and zero to @p cnt.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1299,7 +1313,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* d
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt);
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1315,7 +1329,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const fl
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with a memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1328,7 +1342,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Stroke_Cap* cap);
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Stroke_Cap* cap);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1342,7 +1356,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Strok
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with a memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join);
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1355,7 +1369,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Joi
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stroke_Join* join);
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stroke_Join* join);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1376,7 +1390,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stro
|
|||
* \note Either a solid color or a gradient fill is applied, depending on what was set as last.
|
||||
* \see tvg_shape_set_fill_rule()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
TVG_API Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1392,7 +1406,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_fill_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
|
||||
TVG_API Tvg_Result tvg_shape_get_fill_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1405,7 +1419,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_fill_color(const Tvg_Paint* paint, uint8_t*
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule);
|
||||
TVG_API Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1418,7 +1432,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule ru
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_Rule* rule);
|
||||
TVG_API Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_Rule* rule);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1451,7 +1465,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_R
|
|||
* \note Either a solid color or a gradient fill is applied, depending on what was set as last.
|
||||
* \see tvg_shape_set_fill_rule()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
TVG_API Tvg_Result tvg_shape_set_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1484,7 +1498,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_linear_gradient(Tvg_Paint* paint, Tvg_Gradie
|
|||
* \note Either a solid color or a gradient fill is applied, depending on what was set as last.
|
||||
* \see tvg_shape_set_fill_rule()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
TVG_API Tvg_Result tvg_shape_set_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* grad);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1499,7 +1513,7 @@ TVG_EXPORT Tvg_Result tvg_shape_set_radial_gradient(Tvg_Paint* paint, Tvg_Gradie
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid pointer passed as an argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradient** grad);
|
||||
TVG_API Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradient** grad);
|
||||
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Shape
|
||||
|
@ -1538,7 +1552,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradien
|
|||
*
|
||||
* \return A new linear gradient object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Gradient* tvg_linear_gradient_new();
|
||||
TVG_API Tvg_Gradient* tvg_linear_gradient_new();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1560,7 +1574,7 @@ TVG_EXPORT Tvg_Gradient* tvg_linear_gradient_new();
|
|||
*
|
||||
* \return A new radial gradient object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Gradient* tvg_radial_gradient_new();
|
||||
TVG_API Tvg_Gradient* tvg_radial_gradient_new();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1582,7 +1596,7 @@ TVG_EXPORT Tvg_Gradient* tvg_radial_gradient_new();
|
|||
*
|
||||
* \note In case the first and the second points are equal, an object filled with such a gradient fill is not rendered.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, float y1, float x2, float y2);
|
||||
TVG_API Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, float y1, float x2, float y2);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1602,7 +1616,7 @@ TVG_EXPORT Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, floa
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float* y1, float* x2, float* y2);
|
||||
TVG_API Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float* y1, float* x2, float* y2);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1619,7 +1633,7 @@ TVG_EXPORT Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, flo
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer or the @p radius value less than zero.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, float cy, float radius);
|
||||
TVG_API Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, float cy, float radius);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1634,7 +1648,7 @@ TVG_EXPORT Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, floa
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, float* cy, float* radius);
|
||||
TVG_API Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, float* cy, float* radius);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1648,7 +1662,7 @@ TVG_EXPORT Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, flo
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop* color_stop, uint32_t cnt);
|
||||
TVG_API Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop* color_stop, uint32_t cnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1664,7 +1678,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, const Tvg_Color_Stop** color_stop, uint32_t* cnt);
|
||||
TVG_API Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, const Tvg_Color_Stop** color_stop, uint32_t* cnt);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1677,7 +1691,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, con
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_set_spread(Tvg_Gradient* grad, const Tvg_Stroke_Fill spread);
|
||||
TVG_API Tvg_Result tvg_gradient_set_spread(Tvg_Gradient* grad, const Tvg_Stroke_Fill spread);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1690,7 +1704,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_set_spread(Tvg_Gradient* grad, const Tvg_Stro
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient* grad, Tvg_Stroke_Fill* spread);
|
||||
TVG_API Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient* grad, Tvg_Stroke_Fill* spread);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1706,7 +1720,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient* grad, Tvg_Stro
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
|
||||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with a memory allocation.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_set_transform(Tvg_Gradient* grad, const Tvg_Matrix* m);
|
||||
TVG_API Tvg_Result tvg_gradient_set_transform(Tvg_Gradient* grad, const Tvg_Matrix* m);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1721,7 +1735,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_set_transform(Tvg_Gradient* grad, const Tvg_M
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT A @c nullptr is passed as the argument.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_Matrix* m);
|
||||
TVG_API Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_Matrix* m);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1733,7 +1747,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_M
|
|||
*
|
||||
* \return A copied Tvg_Gradient object if succeed, @c nullptr otherwise.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Gradient* tvg_gradient_duplicate(Tvg_Gradient* grad);
|
||||
TVG_API Tvg_Gradient* tvg_gradient_duplicate(Tvg_Gradient* grad);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1745,7 +1759,7 @@ TVG_EXPORT Tvg_Gradient* tvg_gradient_duplicate(Tvg_Gradient* grad);
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_del(Tvg_Gradient* grad);
|
||||
TVG_API Tvg_Result tvg_gradient_del(Tvg_Gradient* grad);
|
||||
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Gradient
|
||||
|
@ -1768,7 +1782,7 @@ TVG_EXPORT Tvg_Result tvg_gradient_del(Tvg_Gradient* grad);
|
|||
*
|
||||
* \return A new picture object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Paint* tvg_picture_new();
|
||||
TVG_API Tvg_Paint* tvg_picture_new();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1783,7 +1797,7 @@ TVG_EXPORT Tvg_Paint* tvg_picture_new();
|
|||
* \retval TVG_RESULT_NOT_SUPPORTED A file with an unknown extension.
|
||||
* \retval TVG_RESULT_UNKNOWN An error at a later stage.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path);
|
||||
TVG_API Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1795,7 +1809,7 @@ TVG_EXPORT Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path);
|
|||
*
|
||||
* \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);
|
||||
TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1815,7 +1829,7 @@ TVG_EXPORT Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uin
|
|||
*
|
||||
* \warning: It's the user responsibility to release the @p data memory if the @p copy is @c true.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy);
|
||||
TVG_API Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1833,7 +1847,7 @@ TVG_EXPORT Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data,
|
|||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
* \retval TVG_RESULT_INSUFFICIENT_CONDITION An internal error.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h);
|
||||
TVG_API Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1847,7 +1861,7 @@ TVG_EXPORT Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h);
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h);
|
||||
TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1855,7 +1869,7 @@ TVG_EXPORT Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, flo
|
|||
*
|
||||
* \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_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);
|
||||
TVG_API Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h);
|
||||
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Picture
|
||||
|
@ -1881,7 +1895,7 @@ TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x,
|
|||
*
|
||||
* \return A new scene object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Paint* tvg_scene_new();
|
||||
TVG_API Tvg_Paint* tvg_scene_new();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1898,7 +1912,7 @@ TVG_EXPORT Tvg_Paint* tvg_scene_new();
|
|||
* \retval TVG_RESULT_FAILED_ALLOCATION An internal error with a memory allocation.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Paint pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
|
||||
TVG_API Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1919,7 +1933,7 @@ TVG_EXPORT Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size);
|
|||
* \note The rendering order of the paints is the same as the order as they were pushed. Consider sorting the paints before pushing them if you intend to use layering.
|
||||
* \see tvg_scene_reserve()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint);
|
||||
TVG_API Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1937,7 +1951,7 @@ TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint);
|
|||
*
|
||||
* \warning Please use the @p free argument only when you know how it works, otherwise it's not recommended.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free);
|
||||
TVG_API Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free);
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Scene
|
||||
|
||||
|
@ -1960,7 +1974,7 @@ TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free);
|
|||
*
|
||||
* \return A new Tvg_Saver object.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Saver* tvg_saver_new();
|
||||
TVG_API Tvg_Saver* tvg_saver_new();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -1986,7 +2000,7 @@ TVG_EXPORT Tvg_Saver* tvg_saver_new();
|
|||
* \note Saving can be asynchronous if the assigned thread number is greater than zero. To guarantee the saving is done, call tvg_saver_sync() afterwards.
|
||||
* \see tvg_saver_sync()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress);
|
||||
TVG_API Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -2006,7 +2020,7 @@ TVG_EXPORT Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const c
|
|||
* \note The asynchronous tasking is dependent on the Saver module implementation.
|
||||
* \see tvg_saver_save()
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_saver_sync(Tvg_Saver* saver);
|
||||
TVG_API Tvg_Result tvg_saver_sync(Tvg_Saver* saver);
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -2018,7 +2032,7 @@ TVG_EXPORT Tvg_Result tvg_saver_sync(Tvg_Saver* saver);
|
|||
* \retval TVG_RESULT_SUCCESS Succeed.
|
||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Saver pointer.
|
||||
*/
|
||||
TVG_EXPORT Tvg_Result tvg_saver_del(Tvg_Saver* saver);
|
||||
TVG_API Tvg_Result tvg_saver_del(Tvg_Saver* saver);
|
||||
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Saver
|
||||
|
|
|
@ -36,13 +36,13 @@ extern "C" {
|
|||
/* Engine API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
|
||||
TVG_API Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
|
||||
{
|
||||
return (Tvg_Result) Initializer::init(CanvasEngine(engine_method), threads);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
|
||||
TVG_API Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
|
||||
{
|
||||
return (Tvg_Result) Initializer::term(CanvasEngine(engine_method));
|
||||
}
|
||||
|
@ -52,13 +52,13 @@ TVG_EXPORT Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
|
|||
/* Canvas API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Canvas* tvg_swcanvas_create()
|
||||
TVG_API Tvg_Canvas* tvg_swcanvas_create()
|
||||
{
|
||||
return (Tvg_Canvas*) SwCanvas::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas)
|
||||
TVG_API Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
delete(reinterpret_cast<Canvas*>(canvas));
|
||||
|
@ -66,63 +66,63 @@ TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas)
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas* canvas, Tvg_Mempool_Policy policy)
|
||||
TVG_API Tvg_Result tvg_swcanvas_set_mempool(Tvg_Canvas* canvas, Tvg_Mempool_Policy policy)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<SwCanvas*>(canvas)->mempool(static_cast<SwCanvas::MempoolPolicy>(policy));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Tvg_Colorspace cs)
|
||||
TVG_API Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, Tvg_Colorspace cs)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<SwCanvas*>(canvas)->target(buffer, stride, w, h, static_cast<SwCanvas::Colorspace>(cs));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint)
|
||||
TVG_API Tvg_Result tvg_canvas_push(Tvg_Canvas* canvas, Tvg_Paint* paint)
|
||||
{
|
||||
if (!canvas || !paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->push(unique_ptr<Paint>((Paint*)paint));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n)
|
||||
TVG_API Tvg_Result tvg_canvas_reserve(Tvg_Canvas* canvas, uint32_t n)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->reserve(n);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free)
|
||||
TVG_API Tvg_Result tvg_canvas_clear(Tvg_Canvas* canvas, bool free)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->clear(free);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_update(Tvg_Canvas* canvas)
|
||||
TVG_API Tvg_Result tvg_canvas_update(Tvg_Canvas* canvas)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->update(nullptr);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_update_paint(Tvg_Canvas* canvas, Tvg_Paint* paint)
|
||||
TVG_API Tvg_Result tvg_canvas_update_paint(Tvg_Canvas* canvas, Tvg_Paint* paint)
|
||||
{
|
||||
if (!canvas || !paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->update((Paint*) paint);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas)
|
||||
TVG_API Tvg_Result tvg_canvas_draw(Tvg_Canvas* canvas)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->draw();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas)
|
||||
TVG_API Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas)
|
||||
{
|
||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Canvas*>(canvas)->sync();
|
||||
|
@ -133,7 +133,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_sync(Tvg_Canvas* canvas)
|
|||
/* Paint API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_del(Tvg_Paint* paint)
|
||||
TVG_API Tvg_Result tvg_paint_del(Tvg_Paint* paint)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
delete(reinterpret_cast<Paint*>(paint));
|
||||
|
@ -141,35 +141,35 @@ TVG_EXPORT Tvg_Result tvg_paint_del(Tvg_Paint* paint)
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor)
|
||||
TVG_API Tvg_Result tvg_paint_scale(Tvg_Paint* paint, float factor)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->scale(factor);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree)
|
||||
TVG_API Tvg_Result tvg_paint_rotate(Tvg_Paint* paint, float degree)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->rotate(degree);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y)
|
||||
TVG_API Tvg_Result tvg_paint_translate(Tvg_Paint* paint, float x, float y)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->translate(x, y);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix* m)
|
||||
TVG_API Tvg_Result tvg_paint_set_transform(Tvg_Paint* paint, const Tvg_Matrix* m)
|
||||
{
|
||||
if (!paint || !m) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->transform(*(reinterpret_cast<const Matrix*>(m)));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m)
|
||||
TVG_API Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m)
|
||||
{
|
||||
if (!paint || !m) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*reinterpret_cast<Matrix*>(m) = reinterpret_cast<Paint*>(paint)->transform();
|
||||
|
@ -177,21 +177,21 @@ TVG_EXPORT Tvg_Result tvg_paint_get_transform(Tvg_Paint* paint, Tvg_Matrix* m)
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint)
|
||||
TVG_API Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint)
|
||||
{
|
||||
if (!paint) return nullptr;
|
||||
return (Tvg_Paint*) reinterpret_cast<Paint*>(paint)->duplicate();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity)
|
||||
TVG_API Tvg_Result tvg_paint_set_opacity(Tvg_Paint* paint, uint8_t opacity)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->opacity(opacity);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opacity)
|
||||
TVG_API Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opacity)
|
||||
{
|
||||
if (!paint || !opacity) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*opacity = reinterpret_cast<const Paint*>(paint)->opacity();
|
||||
|
@ -199,21 +199,21 @@ TVG_EXPORT Tvg_Result tvg_paint_get_opacity(const Tvg_Paint* paint, uint8_t* opa
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed)
|
||||
TVG_API Tvg_Result tvg_paint_get_bounds(const Tvg_Paint* paint, float* x, float* y, float* w, float* h, bool transformed)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<const Paint*>(paint)->bounds(x, y, w, h, transformed);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_set_composite_method(Tvg_Paint* paint, Tvg_Paint* target, Tvg_Composite_Method method)
|
||||
TVG_API Tvg_Result tvg_paint_set_composite_method(Tvg_Paint* paint, Tvg_Paint* target, Tvg_Composite_Method method)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Paint*>(paint)->composite(unique_ptr<Paint>((Paint*)(target)), (CompositeMethod)method);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint* paint, const Tvg_Paint** target, Tvg_Composite_Method* method)
|
||||
TVG_API Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint* paint, const Tvg_Paint** target, Tvg_Composite_Method* method)
|
||||
{
|
||||
if (!paint || !target || !method) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*reinterpret_cast<CompositeMethod*>(method) = reinterpret_cast<const Paint*>(paint)->composite(reinterpret_cast<const Paint**>(target));
|
||||
|
@ -225,76 +225,76 @@ TVG_EXPORT Tvg_Result tvg_paint_get_composite_method(const Tvg_Paint* paint, con
|
|||
/* Shape API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Paint* tvg_shape_new()
|
||||
TVG_API Tvg_Paint* tvg_shape_new()
|
||||
{
|
||||
return (Tvg_Paint*) Shape::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_reset(Tvg_Paint* paint)
|
||||
TVG_API Tvg_Result tvg_shape_reset(Tvg_Paint* paint)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->reset();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y)
|
||||
TVG_API Tvg_Result tvg_shape_move_to(Tvg_Paint* paint, float x, float y)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->moveTo(x, y);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y)
|
||||
TVG_API Tvg_Result tvg_shape_line_to(Tvg_Paint* paint, float x, float y)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->lineTo(x, y);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1, float cx2, float cy2, float x, float y)
|
||||
TVG_API Tvg_Result tvg_shape_cubic_to(Tvg_Paint* paint, float cx1, float cy1, float cx2, float cy2, float x, float y)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->cubicTo(cx1, cy1, cx2, cy2, x, y);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_close(Tvg_Paint* paint)
|
||||
TVG_API Tvg_Result tvg_shape_close(Tvg_Paint* paint)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->close();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, float w, float h, float rx, float ry)
|
||||
TVG_API Tvg_Result tvg_shape_append_rect(Tvg_Paint* paint, float x, float y, float w, float h, float rx, float ry)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendRect(x, y, w, h, rx, ry);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie)
|
||||
TVG_API Tvg_Result tvg_shape_append_arc(Tvg_Paint* paint, float cx, float cy, float radius, float startAngle, float sweep, uint8_t pie)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendArc(cx, cy, radius, startAngle, sweep, pie);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry)
|
||||
TVG_API Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float cy, float rx, float ry)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendCircle(cx, cy, rx, ry);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Command* cmds, uint32_t cmdCnt, const Tvg_Point* pts, uint32_t ptsCnt)
|
||||
TVG_API Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Command* cmds, uint32_t cmdCnt, const Tvg_Point* pts, uint32_t ptsCnt)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendPath((const PathCommand*)cmds, cmdCnt, (const Point*)pts, ptsCnt);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt)
|
||||
TVG_API Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt)
|
||||
{
|
||||
if (!paint || !pts || !cnt) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*cnt = reinterpret_cast<const Shape*>(paint)->pathCoords((const Point**)pts);
|
||||
|
@ -302,7 +302,7 @@ TVG_EXPORT Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tv
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cnt)
|
||||
TVG_API Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const Tvg_Path_Command** cmds, uint32_t* cnt)
|
||||
{
|
||||
if (!paint || !cmds || !cnt) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*cnt = reinterpret_cast<const Shape*>(paint)->pathCommands((const PathCommand**)cmds);
|
||||
|
@ -310,14 +310,14 @@ TVG_EXPORT Tvg_Result tvg_shape_get_path_commands(const Tvg_Paint* paint, const
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_width(Tvg_Paint* paint, float width)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(width);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* width)
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float* width)
|
||||
{
|
||||
if (!paint || !width) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*width = reinterpret_cast<const Shape*>(paint)->strokeWidth();
|
||||
|
@ -325,35 +325,35 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_width(const Tvg_Paint* paint, float*
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(r, g, b, a);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<const Shape*>(paint)->strokeColor(r, g, b, a);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(unique_ptr<LinearGradient>((LinearGradient*)(gradient)));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(unique_ptr<RadialGradient>((RadialGradient*)(gradient)));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_Gradient** gradient)
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_Gradient** gradient)
|
||||
{
|
||||
if (!paint || !gradient) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*gradient = (Tvg_Gradient*)(reinterpret_cast<const Shape*>(paint)->strokeFill());
|
||||
|
@ -361,14 +361,14 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_gradient(const Tvg_Paint* paint, Tvg_
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_dash(Tvg_Paint* paint, const float* dashPattern, uint32_t cnt)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke(dashPattern, cnt);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt)
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const float** dashPattern, uint32_t* cnt)
|
||||
{
|
||||
if (!paint || !cnt || !dashPattern) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*cnt = reinterpret_cast<const Shape*>(paint)->strokeDash(dashPattern);
|
||||
|
@ -376,14 +376,14 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_dash(const Tvg_Paint* paint, const fl
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_cap(Tvg_Paint* paint, Tvg_Stroke_Cap cap)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke((StrokeCap)cap);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Stroke_Cap* cap)
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Stroke_Cap* cap)
|
||||
{
|
||||
if (!paint || !cap) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*cap = (Tvg_Stroke_Cap) reinterpret_cast<const Shape*>(paint)->strokeCap();
|
||||
|
@ -391,14 +391,14 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_cap(const Tvg_Paint* paint, Tvg_Strok
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join)
|
||||
TVG_API Tvg_Result tvg_shape_set_stroke_join(Tvg_Paint* paint, Tvg_Stroke_Join join)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->stroke((StrokeJoin)join);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stroke_Join* join)
|
||||
TVG_API Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stroke_Join* join)
|
||||
{
|
||||
if (!paint || !join) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*join = (Tvg_Stroke_Join) reinterpret_cast<const Shape*>(paint)->strokeJoin();
|
||||
|
@ -406,28 +406,28 @@ TVG_EXPORT Tvg_Result tvg_shape_get_stroke_join(const Tvg_Paint* paint, Tvg_Stro
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
TVG_API Tvg_Result tvg_shape_set_fill_color(Tvg_Paint* paint, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->fill(r, g, b, a);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_fill_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
|
||||
TVG_API Tvg_Result tvg_shape_get_fill_color(const Tvg_Paint* paint, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<const Shape*>(paint)->fillColor(r, g, b, a);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule)
|
||||
TVG_API Tvg_Result tvg_shape_set_fill_rule(Tvg_Paint* paint, Tvg_Fill_Rule rule)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->fill((FillRule)rule);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_Rule* rule)
|
||||
TVG_API Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_Rule* rule)
|
||||
{
|
||||
if (!paint || !rule) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*rule = (Tvg_Fill_Rule) reinterpret_cast<const Shape*>(paint)->fillRule();
|
||||
|
@ -435,21 +435,21 @@ TVG_EXPORT Tvg_Result tvg_shape_get_fill_rule(const Tvg_Paint* paint, Tvg_Fill_R
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
TVG_API Tvg_Result tvg_shape_set_linear_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->fill(unique_ptr<LinearGradient>((LinearGradient*)(gradient)));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_set_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
TVG_API Tvg_Result tvg_shape_set_radial_gradient(Tvg_Paint* paint, Tvg_Gradient* gradient)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->fill(unique_ptr<RadialGradient>((RadialGradient*)(gradient)));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradient** gradient)
|
||||
TVG_API Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradient** gradient)
|
||||
{
|
||||
if (!paint || !gradient) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*gradient = (Tvg_Gradient*)(reinterpret_cast<const Shape*>(paint)->fill());
|
||||
|
@ -460,48 +460,48 @@ TVG_EXPORT Tvg_Result tvg_shape_get_gradient(const Tvg_Paint* paint, Tvg_Gradien
|
|||
/* Picture API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Paint* tvg_picture_new()
|
||||
TVG_API Tvg_Paint* tvg_picture_new()
|
||||
{
|
||||
return (Tvg_Paint*) Picture::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path)
|
||||
TVG_API Tvg_Result tvg_picture_load(Tvg_Paint* paint, const char* path)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Picture*>(paint)->load(path);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy)
|
||||
TVG_API Tvg_Result tvg_picture_load_raw(Tvg_Paint* paint, uint32_t *data, uint32_t w, uint32_t h, bool copy)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Picture*>(paint)->load(data, w, h, copy);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy)
|
||||
TVG_API Tvg_Result tvg_picture_load_data(Tvg_Paint* paint, const char *data, uint32_t size, const char *mimetype, bool copy)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Picture*>(paint)->load(data, size, mimetype ? mimetype : "", copy);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h)
|
||||
TVG_API Tvg_Result tvg_picture_set_size(Tvg_Paint* paint, float w, float h)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Picture*>(paint)->size(w, h);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h)
|
||||
TVG_API Tvg_Result tvg_picture_get_size(const Tvg_Paint* paint, float* w, float* h)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<const Picture*>(paint)->size(w, h);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x, float* y, float* w, float* h)
|
||||
TVG_API 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;
|
||||
return (Tvg_Result) reinterpret_cast<const Picture*>(paint)->viewbox(x, y, w, h);
|
||||
|
@ -512,26 +512,26 @@ TVG_EXPORT Tvg_Result tvg_picture_get_viewbox(const Tvg_Paint* paint, float* x,
|
|||
/* Gradient API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Gradient* tvg_linear_gradient_new()
|
||||
TVG_API Tvg_Gradient* tvg_linear_gradient_new()
|
||||
{
|
||||
return (Tvg_Gradient*)LinearGradient::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Gradient* tvg_radial_gradient_new()
|
||||
TVG_API Tvg_Gradient* tvg_radial_gradient_new()
|
||||
{
|
||||
return (Tvg_Gradient*)RadialGradient::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Gradient* tvg_gradient_duplicate(Tvg_Gradient* grad)
|
||||
TVG_API Tvg_Gradient* tvg_gradient_duplicate(Tvg_Gradient* grad)
|
||||
{
|
||||
if (!grad) return nullptr;
|
||||
return (Tvg_Gradient*) reinterpret_cast<Fill*>(grad)->duplicate();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_del(Tvg_Gradient* grad)
|
||||
TVG_API Tvg_Result tvg_gradient_del(Tvg_Gradient* grad)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
delete(reinterpret_cast<Fill*>(grad));
|
||||
|
@ -539,42 +539,42 @@ TVG_EXPORT Tvg_Result tvg_gradient_del(Tvg_Gradient* grad)
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, float y1, float x2, float y2)
|
||||
TVG_API Tvg_Result tvg_linear_gradient_set(Tvg_Gradient* grad, float x1, float y1, float x2, float y2)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<LinearGradient*>(grad)->linear(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float* y1, float* x2, float* y2)
|
||||
TVG_API Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float* y1, float* x2, float* y2)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<LinearGradient*>(grad)->linear(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, float cy, float radius)
|
||||
TVG_API Tvg_Result tvg_radial_gradient_set(Tvg_Gradient* grad, float cx, float cy, float radius)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<RadialGradient*>(grad)->radial(cx, cy, radius);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, float* cy, float* radius)
|
||||
TVG_API Tvg_Result tvg_radial_gradient_get(Tvg_Gradient* grad, float* cx, float* cy, float* radius)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<RadialGradient*>(grad)->radial(cx, cy, radius);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop* color_stop, uint32_t cnt)
|
||||
TVG_API Tvg_Result tvg_gradient_set_color_stops(Tvg_Gradient* grad, const Tvg_Color_Stop* color_stop, uint32_t cnt)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Fill*>(grad)->colorStops(reinterpret_cast<const Fill::ColorStop*>(color_stop), cnt);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, const Tvg_Color_Stop** color_stop, uint32_t* cnt)
|
||||
TVG_API Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, const Tvg_Color_Stop** color_stop, uint32_t* cnt)
|
||||
{
|
||||
if (!grad || !color_stop || !cnt) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*cnt = reinterpret_cast<const Fill*>(grad)->colorStops(reinterpret_cast<const Fill::ColorStop**>(color_stop));
|
||||
|
@ -582,14 +582,14 @@ TVG_EXPORT Tvg_Result tvg_gradient_get_color_stops(const Tvg_Gradient* grad, con
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_set_spread(Tvg_Gradient* grad, const Tvg_Stroke_Fill spread)
|
||||
TVG_API Tvg_Result tvg_gradient_set_spread(Tvg_Gradient* grad, const Tvg_Stroke_Fill spread)
|
||||
{
|
||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Fill*>(grad)->spread((FillSpread)spread);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient* grad, Tvg_Stroke_Fill* spread)
|
||||
TVG_API Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient* grad, Tvg_Stroke_Fill* spread)
|
||||
{
|
||||
if (!grad || !spread) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*spread = (Tvg_Stroke_Fill) reinterpret_cast<const Fill*>(grad)->spread();
|
||||
|
@ -597,14 +597,14 @@ TVG_EXPORT Tvg_Result tvg_gradient_get_spread(const Tvg_Gradient* grad, Tvg_Stro
|
|||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_set_transform(Tvg_Gradient* grad, const Tvg_Matrix* m)
|
||||
TVG_API Tvg_Result tvg_gradient_set_transform(Tvg_Gradient* grad, const Tvg_Matrix* m)
|
||||
{
|
||||
if (!grad || !m) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Fill*>(grad)->transform(*(reinterpret_cast<const Matrix*>(m)));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_Matrix* m)
|
||||
TVG_API Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_Matrix* m)
|
||||
{
|
||||
if (!grad || !m) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
*reinterpret_cast<Matrix*>(m) = reinterpret_cast<Fill*>(const_cast<Tvg_Gradient*>(grad))->transform();
|
||||
|
@ -615,27 +615,27 @@ TVG_EXPORT Tvg_Result tvg_gradient_get_transform(const Tvg_Gradient* grad, Tvg_M
|
|||
/* Scene API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Paint* tvg_scene_new()
|
||||
TVG_API Tvg_Paint* tvg_scene_new()
|
||||
{
|
||||
return (Tvg_Paint*) Scene::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size)
|
||||
TVG_API Tvg_Result tvg_scene_reserve(Tvg_Paint* scene, uint32_t size)
|
||||
{
|
||||
if (!scene) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Scene*>(scene)->reserve(size);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint)
|
||||
TVG_API Tvg_Result tvg_scene_push(Tvg_Paint* scene, Tvg_Paint* paint)
|
||||
{
|
||||
if (!scene || !paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Scene*>(scene)->push(unique_ptr<Paint>((Paint*)paint));
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free)
|
||||
TVG_API Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free)
|
||||
{
|
||||
if (!scene) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Scene*>(scene)->clear(free);
|
||||
|
@ -646,27 +646,27 @@ TVG_EXPORT Tvg_Result tvg_scene_clear(Tvg_Paint* scene, bool free)
|
|||
/* Saver API */
|
||||
/************************************************************************/
|
||||
|
||||
TVG_EXPORT Tvg_Saver* tvg_saver_new()
|
||||
TVG_API Tvg_Saver* tvg_saver_new()
|
||||
{
|
||||
return (Tvg_Saver*) Saver::gen().release();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress)
|
||||
TVG_API Tvg_Result tvg_saver_save(Tvg_Saver* saver, Tvg_Paint* paint, const char* path, bool compress)
|
||||
{
|
||||
if (!saver || !paint || !path) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Saver*>(saver)->save(unique_ptr<Paint>((Paint*)paint), path, compress);
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_saver_sync(Tvg_Saver* saver)
|
||||
TVG_API Tvg_Result tvg_saver_sync(Tvg_Saver* saver)
|
||||
{
|
||||
if (!saver) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Saver*>(saver)->sync();
|
||||
}
|
||||
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_saver_del(Tvg_Saver* saver)
|
||||
TVG_API Tvg_Result tvg_saver_del(Tvg_Saver* saver)
|
||||
{
|
||||
if (!saver) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
delete(reinterpret_cast<Saver*>(saver));
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
compiler_flags = ['-DTVG_BUILD']
|
||||
|
||||
examples_dep = dependency('elementary', required : true)
|
||||
|
||||
source_file = [
|
||||
|
@ -53,6 +55,7 @@ foreach current_file : source_file
|
|||
executable(name, current_file,
|
||||
include_directories : headers,
|
||||
link_with : thorvg_lib,
|
||||
cpp_args : compiler_flags,
|
||||
dependencies : examples_dep)
|
||||
endforeach
|
||||
|
||||
|
@ -67,6 +70,7 @@ if get_option('bindings').contains('capi') == true
|
|||
executable(name, current_file,
|
||||
include_directories : headers,
|
||||
link_with : thorvg_lib,
|
||||
cpp_args : compiler_flags,
|
||||
dependencies : examples_dep)
|
||||
endforeach
|
||||
endif
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
compiler_flags = ['-DTVG_BUILD']
|
||||
override_options = []
|
||||
|
||||
lib_type = get_option('default_library')
|
||||
|
||||
if (lib_type == 'shared')
|
||||
compiler_flags += ['-DTVG_EXPORT']
|
||||
endif
|
||||
|
||||
cc = meson.get_compiler('cpp')
|
||||
if (cc.get_id() == 'clang-cl')
|
||||
if simd_type == 'avx'
|
||||
|
@ -50,11 +57,6 @@ thorvg_lib = library(
|
|||
override_options : override_options
|
||||
)
|
||||
|
||||
thorvg_dep = declare_dependency(
|
||||
include_directories: headers,
|
||||
link_with : thorvg_lib
|
||||
)
|
||||
|
||||
if (cc.get_id() == 'emscripten')
|
||||
subdir('wasm')
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ test_file = [
|
|||
tests = executable('capiUnitTests',
|
||||
test_file,
|
||||
include_directories : headers,
|
||||
link_with : thorvg_lib)
|
||||
link_with : thorvg_lib,
|
||||
cpp_args : compiler_flags)
|
||||
|
||||
test('Capi Unit Tests', tests)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
compiler_flags = ['-DTVG_BUILD']
|
||||
|
||||
test_file = [
|
||||
'testAccessor.cpp',
|
||||
'testFill.cpp',
|
||||
|
@ -16,7 +18,8 @@ test_file = [
|
|||
tests = executable('tvgUnitTests',
|
||||
test_file,
|
||||
include_directories : headers,
|
||||
link_with : thorvg_lib)
|
||||
link_with : thorvg_lib,
|
||||
cpp_args : compiler_flags)
|
||||
|
||||
test('Unit Tests', tests, args : ['--success'])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue