mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-07 07:06:45 +00:00
common: chores wrt scene effect
- corrected data type (float -> double) - guarantee to call va_end() - docs / samples revision - include cstdarg as an essential header
This commit is contained in:
parent
9124342f28
commit
1d92a16739
4 changed files with 11 additions and 9 deletions
|
@ -104,7 +104,7 @@ struct UserExample : tvgexam::Example
|
||||||
//Apply GaussianBlur post effect (sigma, direction, border option, quality)
|
//Apply GaussianBlur post effect (sigma, direction, border option, quality)
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
blur[i]->push(tvg::SceneEffect::ClearAll);
|
blur[i]->push(tvg::SceneEffect::ClearAll);
|
||||||
blur[i]->push(tvg::SceneEffect::GaussianBlur, (double)(10.0f * progress), i, 0, 100);
|
blur[i]->push(tvg::SceneEffect::GaussianBlur, 10.0 * double(progress), i, 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply Fill post effect (rgba)
|
//Apply Fill post effect (rgba)
|
||||||
|
|
10
inc/thorvg.h
10
inc/thorvg.h
|
@ -4,6 +4,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <cstdarg>
|
||||||
|
|
||||||
#ifdef TVG_API
|
#ifdef TVG_API
|
||||||
#undef TVG_API
|
#undef TVG_API
|
||||||
|
@ -230,10 +231,10 @@ enum class BlendMethod : uint8_t
|
||||||
enum class SceneEffect : uint8_t
|
enum class SceneEffect : uint8_t
|
||||||
{
|
{
|
||||||
ClearAll = 0, ///< Reset all previously applied scene effects, restoring the scene to its original state.
|
ClearAll = 0, ///< Reset all previously applied scene effects, restoring the scene to its original state.
|
||||||
GaussianBlur, ///< Apply a blur effect with a Gaussian filter. Param(4) = {sigma(float)[> 0], direction(int)[both: 0 / horizontal: 1 / vertical: 2], border(int)[duplicate: 0 / wrap: 1], quality(int)[0 - 100]}
|
GaussianBlur, ///< Apply a blur effect with a Gaussian filter. Param(4) = {sigma(double)[> 0], direction(int)[both: 0 / horizontal: 1 / vertical: 2], border(int)[duplicate: 0 / wrap: 1], quality(int)[0 - 100]}
|
||||||
DropShadow, ///< Apply a drop shadow effect with a Gaussian Blur filter. Param(8) = {color_R(int)[0 - 255], color_G(int)[0 - 255], color_B(int)[0 - 255], opacity(int)[0 - 255], angle(double)[0 - 360], distance(double), blur_sigma(double)[> 0], quality(int)[0 - 100]}
|
DropShadow, ///< Apply a drop shadow effect with a Gaussian Blur filter. Param(8) = {color_R(int)[0 - 255], color_G(int)[0 - 255], color_B(int)[0 - 255], opacity(int)[0 - 255], angle(double)[0 - 360], distance(double), blur_sigma(double)[> 0], quality(int)[0 - 100]}
|
||||||
Fill, ///< Override the scene content color with a given fill information (Experimental API). Param(4) = {color_R(int)[0 - 255], color_G(int)[0 - 255], color_B(int)[0 - 255], opacity(int)[0 - 255]}
|
Fill, ///< Override the scene content color with a given fill information (Experimental API). Param(4) = {color_R(int)[0 - 255], color_G(int)[0 - 255], color_B(int)[0 - 255], opacity(int)[0 - 255]}
|
||||||
Tint, ///< Tinting the current scene color with a given black, white color paramters (Experimental API). Param(7) = {black_R(int)[0 - 255], black_G(int)[0 - 255], black_B(int)[0 - 255], white_R(int)[0 - 255], white_G(int)[0 - 255], white_B(int)[0 - 255], intensity(float)[0 - 100]}
|
Tint, ///< Tinting the current scene color with a given black, white color parameters (Experimental API). Param(7) = {black_R(int)[0 - 255], black_G(int)[0 - 255], black_B(int)[0 - 255], white_R(int)[0 - 255], white_G(int)[0 - 255], white_B(int)[0 - 255], intensity(double)[0 - 100]}
|
||||||
Tritone ///< Apply a tritone color effect to the scene using three color parameters for shadows, midtones, and highlights (Experimental API). Param(9) = {Shadow_R(int)[0 - 255], Shadow_G(int)[0 - 255], Shadow_B(int)[0 - 255], Midtone_R(int)[0 - 255], Midtone_G(int)[0 - 255], Midtone_B(int)[0 - 255], Highlight_R(int)[0 - 255], Highlight_G(int)[0 - 255], Highlight_B(int)[0 - 255]}
|
Tritone ///< Apply a tritone color effect to the scene using three color parameters for shadows, midtones, and highlights (Experimental API). Param(9) = {Shadow_R(int)[0 - 255], Shadow_G(int)[0 - 255], Shadow_B(int)[0 - 255], Midtone_R(int)[0 - 255], Midtone_G(int)[0 - 255], Midtone_B(int)[0 - 255], Highlight_R(int)[0 - 255], Highlight_G(int)[0 - 255], Highlight_B(int)[0 - 255]}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1520,8 +1521,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Apply a post-processing effect to the scene.
|
* @brief Apply a post-processing effect to the scene.
|
||||||
*
|
*
|
||||||
* This function adds a specified scene effect, such as clearing all effects or applying a Gaussian blur,
|
* This function adds a specified effect—such as clearing all effects, applying a Gaussian blur,
|
||||||
* to the scene after it has been rendered. Multiple effects can be applied in sequence.
|
* or adding a drop shadow—to the scene after rendering. Multiple effects can be applied in sequence
|
||||||
|
* by calling this function multiple times.
|
||||||
*
|
*
|
||||||
* @param[in] effect The scene effect to apply. Options are defined in the SceneEffect enum.
|
* @param[in] effect The scene effect to apply. Options are defined in the SceneEffect enum.
|
||||||
* For example, use SceneEffect::GaussianBlur to apply a blur with specific parameters.
|
* For example, use SceneEffect::GaussianBlur to apply a blur with specific parameters.
|
||||||
|
|
|
@ -61,6 +61,7 @@ Result Scene::push(SceneEffect effect, ...) noexcept
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, effect);
|
va_start(args, effect);
|
||||||
|
auto ret = SCENE(this)->push(effect, args);
|
||||||
return SCENE(this)->push(effect, args);
|
va_end(args);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#define _TVG_SCENE_H_
|
#define _TVG_SCENE_H_
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdarg>
|
|
||||||
#include "tvgMath.h"
|
#include "tvgMath.h"
|
||||||
#include "tvgPaint.h"
|
#include "tvgPaint.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue