mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
add scene effects to capi header
This commit is contained in:
parent
02907b0293
commit
5fe7c4b7f6
3 changed files with 27 additions and 7 deletions
|
@ -2063,7 +2063,10 @@ TVG_API Tvg_Result tvg_scene_remove(Tvg_Paint* scene, Tvg_Paint* paint);
|
|||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
TVG_API Tvg_Result tvg_scene_push_effect(Tvg_Paint* scene, Tvg_Scene_Effect effect, ...);
|
||||
|
||||
TVG_API Tvg_Result tvg_scene_reset_effects(Tvg_Paint* scene);
|
||||
|
||||
TVG_API Tvg_Result tvg_scene_push_drop_shadow(Tvg_Paint* scene, int r, int g, int b, int a, double angle, double distance, double sigma, int quality);
|
||||
|
||||
/** \} */ // end defgroup ThorVGCapi_Scene
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <thorvg_lottie.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace tvg;
|
||||
|
||||
|
@ -785,14 +787,21 @@ TVG_API Tvg_Result tvg_scene_remove(Tvg_Paint* scene, Tvg_Paint* paint)
|
|||
return TVG_RESULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
||||
TVG_API Tvg_Result tvg_scene_push_effect(Tvg_Paint* scene, Tvg_Scene_Effect effect, ...)
|
||||
TVG_API Tvg_Result tvg_scene_reset_effects(Tvg_Paint* scene)
|
||||
{
|
||||
if (scene) {
|
||||
va_list args;
|
||||
va_start(args, effect);
|
||||
Tvg_Result result = (Tvg_Result) reinterpret_cast<Scene*>(scene)->push(static_cast<SceneEffect>(effect), args);
|
||||
va_end(args);
|
||||
std::cout << "reset:scene:effects:reset" << std::endl;
|
||||
Tvg_Result result = (Tvg_Result) reinterpret_cast<Scene*>(scene)->push(SceneEffect::ClearAll);
|
||||
std::cout << "reset:scene:effects:reset:result:" << result << std::endl;
|
||||
return result;
|
||||
}
|
||||
return TVG_RESULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
TVG_API Tvg_Result tvg_scene_push_drop_shadow(Tvg_Paint* scene, int r, int g, int b, int a, double angle, double distance, double sigma, int quality)
|
||||
{
|
||||
if (scene) {
|
||||
Tvg_Result result = (Tvg_Result) reinterpret_cast<Scene*>(scene)->push(static_cast<SceneEffect>(SceneEffect::DropShadow), r, g, b, a, angle, distance, sigma, quality);
|
||||
return result;
|
||||
}
|
||||
return TVG_RESULT_INVALID_ARGUMENT;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "tvgCommon.h"
|
||||
#include "tvgArray.h"
|
||||
#include "tvgLock.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace tvg
|
||||
{
|
||||
|
@ -339,6 +340,7 @@ struct RenderEffectDropShadow : RenderEffect
|
|||
|
||||
static RenderEffectDropShadow* gen(va_list& args)
|
||||
{
|
||||
std::cout << "gen:drop shadow" << std::endl;
|
||||
auto inst = new RenderEffectDropShadow;
|
||||
inst->color[0] = va_arg(args, int);
|
||||
inst->color[1] = va_arg(args, int);
|
||||
|
@ -349,6 +351,12 @@ struct RenderEffectDropShadow : RenderEffect
|
|||
inst->sigma = std::max((float) va_arg(args, double), 0.0f);
|
||||
inst->quality = std::min(va_arg(args, int), 100);
|
||||
inst->type = SceneEffect::DropShadow;
|
||||
std::cout << "gen:drop shadow:color:" << (int)inst->color[0] << "," << (int)inst->color[1] << "," << (int)inst->color[2] << "," << (int)inst->color[3] << std::endl;
|
||||
std::cout << "gen:drop shadow:angle:" << inst->angle << std::endl;
|
||||
std::cout << "gen:drop shadow:distance:" << inst->distance << std::endl;
|
||||
std::cout << "gen:drop shadow:sigma:" << inst->sigma << std::endl;
|
||||
std::cout << "gen:drop shadow:quality:" << (int)inst->quality << std::endl;
|
||||
std::cout << "gen:drop shadow:end" << std::endl;
|
||||
return inst;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue