From 1c7c281ec02d97e0c10fbf8c1426f1bb79d14a51 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Tue, 12 Oct 2021 13:13:48 +0200 Subject: [PATCH] capi: introduced Tvg_Colorspace enum instead of defs Used in the tvg_swcanvas_set_target() capi. --- src/bindings/capi/thorvg_capi.h | 29 +++++++++++------------------ src/bindings/capi/tvgCapi.cpp | 2 +- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/bindings/capi/thorvg_capi.h b/src/bindings/capi/thorvg_capi.h index 826ec77..f96f63c 100644 --- a/src/bindings/capi/thorvg_capi.h +++ b/src/bindings/capi/thorvg_capi.h @@ -62,22 +62,6 @@ extern "C" { #define TVG_ENGINE_GL (1 << 2) -/*! -* \brief The 8-bit color channels are combined into 32-bit color in the order: alpha, blue, green, red. -* -* \ingroup ThorVGCapi_Canvas -*/ -#define TVG_COLORSPACE_ABGR8888 0 - - -/*! -* \brief The 8-bit color channels are combined into 32-bit color in the order: alpha, red, green, blue. -* -* \ingroup ThorVGCapi_Canvas -*/ -#define TVG_COLORSPACE_ARGB8888 1 - - /** * \brief A structure responsible for managing and drawing graphical elements. * @@ -327,6 +311,15 @@ TVG_EXPORT Tvg_Result tvg_engine_term(unsigned engine_method); /************************************************************************/ /* SwCanvas API */ /************************************************************************/ + +/** + * \brief Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color. + */ +typedef enum { + TVG_COLORSPACE_ABGR8888 = 0, ///< The 8-bit color channels are combined into 32-bit color in the order: alpha, blue, green, red. + TVG_COLORSPACE_ARGB8888 ///< The 8-bit color channels are combined into 32-bit color in the order: alpha, red, green, blue. +} Tvg_Colorspace; + /*! * \brief Creates a Canvas object. * @@ -377,9 +370,9 @@ TVG_EXPORT Tvg_Canvas* tvg_swcanvas_create(); * * \warning Do not access @p buffer during tvg_canvas_draw() - tvg_canvas_sync(). It should not be accessed while TVG is writing on it. * -* \see TVG_COLORSPACE_ARGB8888, TVG_COLORSPACE_ABGR8888 +* \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, uint32_t cs); +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); /** \} */ // end defgroup ThorVGCapi_SwCanvas diff --git a/src/bindings/capi/tvgCapi.cpp b/src/bindings/capi/tvgCapi.cpp index 5409432..5fab3d1 100644 --- a/src/bindings/capi/tvgCapi.cpp +++ b/src/bindings/capi/tvgCapi.cpp @@ -67,7 +67,7 @@ TVG_EXPORT Tvg_Result tvg_canvas_destroy(Tvg_Canvas* canvas) } -TVG_EXPORT Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h, uint32_t cs) +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) { if (!canvas) return TVG_RESULT_INVALID_ARGUMENT; return (Tvg_Result) reinterpret_cast(canvas)->target(buffer, stride, w, h, static_cast(cs)); -- 2.7.4