mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
api: add focal parameters to the radial apis
API modification: - Result RadialGradient::radial(float cx, float cy, float radius) - Result RadialGradient::radial(float cx, float cy, float r, float fx, float fy, float fr) - Result RadialGradient::radial(float* cx, float* cy, float* radius) - Result RadialGradient::radial(float* cx, float* cy, float* r, float* fx = nullptr, float* fy = nullptr, float* fr = nullptr) @Issue: https://github.com/thorvg/thorvg/issues/2860
This commit is contained in:
parent
b851d98805
commit
422674b4c9
16 changed files with 138 additions and 91 deletions
|
@ -94,7 +94,7 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
//RadialGradient
|
//RadialGradient
|
||||||
auto fill2 = tvg::RadialGradient::gen();
|
auto fill2 = tvg::RadialGradient::gen();
|
||||||
fill2->radial(300, 800, 150);
|
fill2->radial(300, 800, 150, 300, 800, 0);
|
||||||
fill2->colorStops(colorStops, 2);
|
fill2->colorStops(colorStops, 2);
|
||||||
|
|
||||||
shape6->fill(std::move(fill2));
|
shape6->fill(std::move(fill2));
|
||||||
|
|
|
@ -103,7 +103,7 @@ void contents()
|
||||||
|
|
||||||
//Prepare a radial gradient for the fill
|
//Prepare a radial gradient for the fill
|
||||||
Tvg_Gradient* grad2 = tvg_radial_gradient_new();
|
Tvg_Gradient* grad2 = tvg_radial_gradient_new();
|
||||||
tvg_radial_gradient_set(grad2, 600.0f, 180.0f, 50.0f);
|
tvg_radial_gradient_set(grad2, 600.0f, 180.0f, 50.0f, 640.0f, 180.0f, 0.0f);
|
||||||
Tvg_Color_Stop color_stops2[3] =
|
Tvg_Color_Stop color_stops2[3] =
|
||||||
{
|
{
|
||||||
{0.0f, 255, 0, 255, 255},
|
{0.0f, 255, 0, 255, 255},
|
||||||
|
@ -121,11 +121,11 @@ void contents()
|
||||||
const Tvg_Color_Stop* color_stops2_get;
|
const Tvg_Color_Stop* color_stops2_get;
|
||||||
tvg_gradient_get_color_stops(grad2, &color_stops2_get, &cnt);
|
tvg_gradient_get_color_stops(grad2, &color_stops2_get, &cnt);
|
||||||
|
|
||||||
float cx, cy, radius;
|
float cx, cy, r, fx, fy, fr;
|
||||||
tvg_radial_gradient_get(grad2, &cx, &cy, &radius);
|
tvg_radial_gradient_get(grad2, &cx, &cy, &r, &fx, &fy, &fr);
|
||||||
|
|
||||||
Tvg_Gradient* grad2_stroke = tvg_radial_gradient_new();
|
Tvg_Gradient* grad2_stroke = tvg_radial_gradient_new();
|
||||||
tvg_radial_gradient_set(grad2_stroke, cx, cy, radius);
|
tvg_radial_gradient_set(grad2_stroke, cx, cy, r, fx, fy, fr);
|
||||||
tvg_gradient_set_color_stops(grad2_stroke, color_stops2_get, cnt);
|
tvg_gradient_set_color_stops(grad2_stroke, color_stops2_get, cnt);
|
||||||
tvg_gradient_set_spread(grad2_stroke, TVG_STROKE_FILL_REPEAT);
|
tvg_gradient_set_spread(grad2_stroke, TVG_STROKE_FILL_REPEAT);
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ void contents()
|
||||||
} else {
|
} else {
|
||||||
//Radial gradient
|
//Radial gradient
|
||||||
Tvg_Gradient* grad = tvg_radial_gradient_new();
|
Tvg_Gradient* grad = tvg_radial_gradient_new();
|
||||||
tvg_radial_gradient_set(grad, 200.0f, 200.0f, 20.0f);
|
tvg_radial_gradient_set(grad, 200.0f, 200.0f, 20.0f, 200.0f, 200.0f, 0.0f);
|
||||||
Tvg_Color_Stop color_stops[2] =
|
Tvg_Color_Stop color_stops[2] =
|
||||||
{
|
{
|
||||||
{0.0f, 255, 0, 255, 255},
|
{0.0f, 255, 0, 255, 255},
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct UserExample : tvgexam::Example
|
||||||
shape1->appendRect(x1, y1, 2.0f * r, 2.0f * r);
|
shape1->appendRect(x1, y1, 2.0f * r, 2.0f * r);
|
||||||
|
|
||||||
auto fill1 = tvg::RadialGradient::gen();
|
auto fill1 = tvg::RadialGradient::gen();
|
||||||
fill1->radial(x1 + r, y1 + r, 40.0f);
|
fill1->radial(x1 + r, y1 + r, 40.0f, x1 + r, y1 + r, 0.0f);
|
||||||
fill1->colorStops(colorStops, colorCnt);
|
fill1->colorStops(colorStops, colorCnt);
|
||||||
fill1->spread(tvg::FillSpread::Pad);
|
fill1->spread(tvg::FillSpread::Pad);
|
||||||
shape1->fill(std::move(fill1));
|
shape1->fill(std::move(fill1));
|
||||||
|
@ -62,7 +62,7 @@ struct UserExample : tvgexam::Example
|
||||||
shape2->appendRect(x1, y1, 2.0f * r, 2.0f * r);
|
shape2->appendRect(x1, y1, 2.0f * r, 2.0f * r);
|
||||||
|
|
||||||
auto fill2 = tvg::RadialGradient::gen();
|
auto fill2 = tvg::RadialGradient::gen();
|
||||||
fill2->radial(x1 + r, y1 + r, 40.0f);
|
fill2->radial(x1 + r, y1 + r, 40.0f, x1 + r, y1 + r, 0.0f);
|
||||||
fill2->colorStops(colorStops, colorCnt);
|
fill2->colorStops(colorStops, colorCnt);
|
||||||
fill2->spread(tvg::FillSpread::Reflect);
|
fill2->spread(tvg::FillSpread::Reflect);
|
||||||
shape2->fill(std::move(fill2));
|
shape2->fill(std::move(fill2));
|
||||||
|
@ -75,7 +75,7 @@ struct UserExample : tvgexam::Example
|
||||||
shape3->appendRect(x1, y1, 2.0f * r, 2.0f * r);
|
shape3->appendRect(x1, y1, 2.0f * r, 2.0f * r);
|
||||||
|
|
||||||
auto fill3 = tvg::RadialGradient::gen();
|
auto fill3 = tvg::RadialGradient::gen();
|
||||||
fill3->radial(x1 + r, y1 + r, 40.0f);
|
fill3->radial(x1 + r, y1 + r, 40.0f, x1 + r, y1 + r, 0.0f);
|
||||||
fill3->colorStops(colorStops, colorCnt);
|
fill3->colorStops(colorStops, colorCnt);
|
||||||
fill3->spread(tvg::FillSpread::Repeat);
|
fill3->spread(tvg::FillSpread::Repeat);
|
||||||
shape3->fill(std::move(fill3));
|
shape3->fill(std::move(fill3));
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct UserExample : tvgexam::Example
|
||||||
shape2->strokeWidth(80);
|
shape2->strokeWidth(80);
|
||||||
|
|
||||||
auto fillStroke2 = tvg::RadialGradient::gen();
|
auto fillStroke2 = tvg::RadialGradient::gen();
|
||||||
fillStroke2->radial(600, 175, 100);
|
fillStroke2->radial(600, 175, 100, 600, 175, 0);
|
||||||
fillStroke2->colorStops(colorStops2, 2);
|
fillStroke2->colorStops(colorStops2, 2);
|
||||||
shape2->strokeFill(std::move(fillStroke2));
|
shape2->strokeFill(std::move(fillStroke2));
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
//RadialGradient
|
//RadialGradient
|
||||||
auto fill3 = tvg::RadialGradient::gen();
|
auto fill3 = tvg::RadialGradient::gen();
|
||||||
fill3->radial(175, 150, 75);
|
fill3->radial(175, 150, 75, 175, 150, 0);
|
||||||
|
|
||||||
//Gradient Color Stops
|
//Gradient Color Stops
|
||||||
tvg::Fill::ColorStop colorStops3[4];
|
tvg::Fill::ColorStop colorStops3[4];
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
//RadialGradient
|
//RadialGradient
|
||||||
auto fill = tvg::RadialGradient::gen();
|
auto fill = tvg::RadialGradient::gen();
|
||||||
fill->radial(200, 200, 200);
|
fill->radial(200, 200, 200, 200, 200, 0); //cx, cy, r, fx, fy, fr
|
||||||
|
|
||||||
//Gradient Color Stops
|
//Gradient Color Stops
|
||||||
tvg::Fill::ColorStop colorStops[2];
|
tvg::Fill::ColorStop colorStops[2];
|
||||||
|
@ -56,7 +56,7 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
//RadialGradient
|
//RadialGradient
|
||||||
auto fill2 = tvg::RadialGradient::gen();
|
auto fill2 = tvg::RadialGradient::gen();
|
||||||
fill2->radial(400, 400, 200);
|
fill2->radial(400, 400, 200, 400, 400, 0); //cx, cy, r, fx, fy, fr
|
||||||
|
|
||||||
//Gradient Color Stops
|
//Gradient Color Stops
|
||||||
tvg::Fill::ColorStop colorStops2[3];
|
tvg::Fill::ColorStop colorStops2[3];
|
||||||
|
@ -75,7 +75,7 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
//RadialGradient
|
//RadialGradient
|
||||||
auto fill3 = tvg::RadialGradient::gen();
|
auto fill3 = tvg::RadialGradient::gen();
|
||||||
fill3->radial(600, 600, 150);
|
fill3->radial(600, 600, 150, 700, 600, 20); //cx, cy, r, fx, fy, fr
|
||||||
|
|
||||||
//Gradient Color Stops
|
//Gradient Color Stops
|
||||||
tvg::Fill::ColorStop colorStops3[4];
|
tvg::Fill::ColorStop colorStops3[4];
|
||||||
|
|
|
@ -154,7 +154,7 @@ struct UserExample : tvgexam::Example
|
||||||
|
|
||||||
//LinearGradient
|
//LinearGradient
|
||||||
auto fill2 = tvg::RadialGradient::gen();
|
auto fill2 = tvg::RadialGradient::gen();
|
||||||
fill2->radial(x + w2 * 0.5f, y + h2 * 0.5f, w2 * 0.5f);
|
fill2->radial(x + w2 * 0.5f, y + h2 * 0.5f, w2 * 0.5f, x + w2 * 0.5f, y + h2 * 0.5f, 0.0f);
|
||||||
|
|
||||||
//Gradient Color Stops
|
//Gradient Color Stops
|
||||||
tvg::Fill::ColorStop colorStops2[3];
|
tvg::Fill::ColorStop colorStops2[3];
|
||||||
|
|
42
inc/thorvg.h
42
inc/thorvg.h
|
@ -767,31 +767,43 @@ public:
|
||||||
~RadialGradient();
|
~RadialGradient();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the radial gradient bounds.
|
* @brief Sets the radial gradient attributes.
|
||||||
*
|
*
|
||||||
* The radial gradient bounds are defined as a circle centered in a given point (@p cx, @p cy) of a given radius.
|
* The radial gradient is defined by the end circle with a center (@p cx, @p cy) and a radius @p r and
|
||||||
|
* the start circle with a center/focal point (@p fx, @p fy) and a radius @p fr.
|
||||||
|
* The gradient will be rendered such that the gradient stop at an offset of 100% aligns with the edge of the end circle
|
||||||
|
* and the stop at an offset of 0% aligns with the edge of the start circle.
|
||||||
*
|
*
|
||||||
* @param[in] cx The horizontal coordinate of the center of the bounding circle.
|
* @param[in] cx The horizontal coordinate of the center of the end circle.
|
||||||
* @param[in] cy The vertical coordinate of the center of the bounding circle.
|
* @param[in] cy The vertical coordinate of the center of the end circle.
|
||||||
* @param[in] radius The radius of the bounding circle.
|
* @param[in] r The radius of the end circle.
|
||||||
|
* @param[in] fx The horizontal coordinate of the center of the start circle.
|
||||||
|
* @param[in] fy The vertical coordinate of the center of the start circle.
|
||||||
|
* @param[in] fr The radius of the start circle.
|
||||||
*
|
*
|
||||||
* @retval Result::InvalidArguments in case the @p radius value is zero or less.
|
* @retval Result::InvalidArguments in case the radius @p r or @p fr value is negative.
|
||||||
*
|
*
|
||||||
* @note In case the @p radius is zero, an object is filled with a single color using the last color specified in the colorStops().
|
* @note In case the radius @p r is zero, an object is filled with a single color using the last color specified in the colorStops().
|
||||||
|
* @note By manipulating the position and size of the focal point, a wide range of visual effects can be achieved, such as directing
|
||||||
|
* the gradient focus towards a specific edge or enhancing the depth and complexity of shading patterns.
|
||||||
|
* If a focal effect is not desired, simply align the focal point (@p fx and @p fy) with the center of the end circle (@p cx and @p cy)
|
||||||
|
* and set the radius (@p fr) to zero. This will result in a uniform gradient without any focal variations.
|
||||||
*/
|
*/
|
||||||
Result radial(float cx, float cy, float radius) noexcept;
|
Result radial(float cx, float cy, float r, float fx, float fy, float fr) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the radial gradient bounds.
|
* @brief Gets the radial gradient attributes.
|
||||||
*
|
*
|
||||||
* The radial gradient bounds are defined as a circle centered in a given point (@p cx, @p cy) of a given radius.
|
* @param[out] cx The horizontal coordinate of the center of the end circle.
|
||||||
*
|
* @param[out] cy The vertical coordinate of the center of the end circle.
|
||||||
* @param[out] cx The horizontal coordinate of the center of the bounding circle.
|
* @param[out] r The radius of the end circle.
|
||||||
* @param[out] cy The vertical coordinate of the center of the bounding circle.
|
* @param[out] fx The horizontal coordinate of the center of the start circle.
|
||||||
* @param[out] radius The radius of the bounding circle.
|
* @param[out] fy The vertical coordinate of the center of the start circle.
|
||||||
|
* @param[out] fr The radius of the start circle.
|
||||||
*
|
*
|
||||||
|
* @see RadialGradient::radial()
|
||||||
*/
|
*/
|
||||||
Result radial(float* cx, float* cy, float* radius) const noexcept;
|
Result radial(float* cx, float* cy, float* r, float* fx = nullptr, float* fy = nullptr, float* fr = nullptr) const noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new RadialGradient object.
|
* @brief Creates a new RadialGradient object.
|
||||||
|
|
|
@ -1729,36 +1729,52 @@ TVG_API Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float*
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the radial gradient bounds.
|
* \brief Sets the radial gradient attributes.
|
||||||
*
|
*
|
||||||
* The radial gradient bounds are defined as a circle centered in a given point (@p cx, @p cy) of a given radius.
|
* The radial gradient is defined by the end circle with a center (@p cx, @p cy) and a radius @p r and
|
||||||
|
* the start circle with a center/focal point (@p fx, @p fy) and a radius @p fr.
|
||||||
|
* The gradient will be rendered such that the gradient stop at an offset of 100% aligns with the edge of the end circle
|
||||||
|
* and the stop at an offset of 0% aligns with the edge of the start circle.
|
||||||
*
|
*
|
||||||
* \param[in] grad The Tvg_Gradient object of which bounds are to be set.
|
* \param[in] grad The Tvg_Gradient object of which bounds are to be set.
|
||||||
* \param[in] cx The horizontal coordinate of the center of the bounding circle.
|
* \param[in] cx The horizontal coordinate of the center of the end circle.
|
||||||
* \param[in] cy The vertical coordinate of the center of the bounding circle.
|
* \param[in] cy The vertical coordinate of the center of the end circle.
|
||||||
* \param[in] radius The radius of the bounding circle.
|
* \param[in] r The radius of the end circle.
|
||||||
|
* \param[in] fx The horizontal coordinate of the center of the start circle.
|
||||||
|
* \param[in] fy The vertical coordinate of the center of the start circle.
|
||||||
|
* \param[in] fr The radius of the start circle.
|
||||||
*
|
*
|
||||||
* \return Tvg_Result enumeration.
|
* \return Tvg_Result enumeration.
|
||||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer or the @p radius value less than zero.
|
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer or the radius @p r or @p fr value is negative.
|
||||||
|
*
|
||||||
|
* \note In case the radius @p r is zero, an object is filled with a single color using the last color specified in the specified in the tvg_gradient_set_color_stops().
|
||||||
|
* \note By manipulating the position and size of the focal point, a wide range of visual effects can be achieved, such as directing
|
||||||
|
* the gradient focus towards a specific edge or enhancing the depth and complexity of shading patterns.
|
||||||
|
* If a focal effect is not desired, simply align the focal point (@p fx and @p fy) with the center of the end circle (@p cx and @p cy)
|
||||||
|
* and set the radius (@p fr) to zero. This will result in a uniform gradient without any focal variations.
|
||||||
*
|
*
|
||||||
* \note In case the @p radius is zero, an object is filled with a single color using the last color specified in the specified in the tvg_gradient_set_color_stops().
|
|
||||||
* \see tvg_gradient_set_color_stops()
|
* \see tvg_gradient_set_color_stops()
|
||||||
*/
|
*/
|
||||||
TVG_API 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 r, float fx, float fy, float fr);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The function gets radial gradient center point ant radius
|
* \brief The function gets radial gradient attributes.
|
||||||
*
|
*
|
||||||
* \param[in] grad The Tvg_Gradient object of which bounds are to be set.
|
* \param[in] grad The Tvg_Gradient object of which to get the gradient attributes.
|
||||||
* \param[out] cx The horizontal coordinate of the center of the bounding circle.
|
* \param[out] cx The horizontal coordinate of the center of the end circle.
|
||||||
* \param[out] cy The vertical coordinate of the center of the bounding circle.
|
* \param[out] cy The vertical coordinate of the center of the end circle.
|
||||||
* \param[out] radius The radius of the bounding circle.
|
* \param[out] r The radius of the end circle.
|
||||||
|
* \param[out] fx The horizontal coordinate of the center of the start circle.
|
||||||
|
* \param[out] fy The vertical coordinate of the center of the start circle.
|
||||||
|
* \param[out] fr The radius of the start circle.
|
||||||
*
|
*
|
||||||
* \return Tvg_Result enumeration.
|
* \return Tvg_Result enumeration.
|
||||||
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
* \retval TVG_RESULT_INVALID_ARGUMENT An invalid Tvg_Gradient pointer.
|
||||||
|
*
|
||||||
|
* \see tvg_radial_gradient_set()
|
||||||
*/
|
*/
|
||||||
TVG_API 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* r, float* fx, float* fy, float* fr);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -607,17 +607,17 @@ TVG_API Tvg_Result tvg_linear_gradient_get(Tvg_Gradient* grad, float* x1, float*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API 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 r, float fx, float fy, float fr)
|
||||||
{
|
{
|
||||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<RadialGradient*>(grad)->radial(cx, cy, radius);
|
return (Tvg_Result) reinterpret_cast<RadialGradient*>(grad)->radial(cx, cy, r, fx, fy, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API 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* r, float* fx, float* fy, float* fr)
|
||||||
{
|
{
|
||||||
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!grad) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<RadialGradient*>(grad)->radial(cx, cy, radius);
|
return (Tvg_Result) reinterpret_cast<RadialGradient*>(grad)->radial(cx, cy, r, fx, fy, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ Fill* LottieGradient::fill(float frameNo, LottieExpressions* exps)
|
||||||
auto progress = this->height(frameNo, exps) * 0.01f;
|
auto progress = this->height(frameNo, exps) * 0.01f;
|
||||||
|
|
||||||
if (tvg::zero(progress)) {
|
if (tvg::zero(progress)) {
|
||||||
P(static_cast<RadialGradient*>(fill))->radial(s.x, s.y, r, s.x, s.y, 0.0f);
|
static_cast<RadialGradient*>(fill)->radial(s.x, s.y, r, s.x, s.y, 0.0f);
|
||||||
} else {
|
} else {
|
||||||
if (tvg::equal(progress, 1.0f)) progress = 0.99f;
|
if (tvg::equal(progress, 1.0f)) progress = 0.99f;
|
||||||
auto startAngle = rad2deg(tvg::atan2(e.y - s.y, e.x - s.x));
|
auto startAngle = rad2deg(tvg::atan2(e.y - s.y, e.x - s.x));
|
||||||
|
@ -302,7 +302,7 @@ Fill* LottieGradient::fill(float frameNo, LottieExpressions* exps)
|
||||||
auto fx = s.x + cos(angle) * progress * r;
|
auto fx = s.x + cos(angle) * progress * r;
|
||||||
auto fy = s.y + sin(angle) * progress * r;
|
auto fy = s.y + sin(angle) * progress * r;
|
||||||
// Lottie doesn't have any focal radius concept
|
// Lottie doesn't have any focal radius concept
|
||||||
P(static_cast<RadialGradient*>(fill))->radial(s.x, s.y, r, fx, fy, 0.0f);
|
static_cast<RadialGradient*>(fill)->radial(s.x, s.y, r, fx, fy, 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,17 +163,20 @@ RadialGradient::~RadialGradient()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result RadialGradient::radial(float cx, float cy, float r) noexcept
|
Result RadialGradient::radial(float cx, float cy, float r, float fx, float fy, float fr) noexcept
|
||||||
{
|
{
|
||||||
return pImpl->radial(cx, cy, r, cx, cy, 0.0f);
|
return pImpl->radial(cx, cy, r, fx, fy, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result RadialGradient::radial(float* cx, float* cy, float* r) const noexcept
|
Result RadialGradient::radial(float* cx, float* cy, float* r, float* fx, float* fy, float* fr) const noexcept
|
||||||
{
|
{
|
||||||
if (cx) *cx = pImpl->cx;
|
if (cx) *cx = pImpl->cx;
|
||||||
if (cy) *cy = pImpl->cy;
|
if (cy) *cy = pImpl->cy;
|
||||||
if (r) *r = pImpl->r;
|
if (r) *r = pImpl->r;
|
||||||
|
if (fx) *fx = pImpl->fx;
|
||||||
|
if (fy) *fy = pImpl->fy;
|
||||||
|
if (fr) *fr = pImpl->fr;
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,16 @@ TEST_CASE("Set gradient center point and radius", "[capiRadialGradient]")
|
||||||
{
|
{
|
||||||
Tvg_Gradient *gradient = tvg_radial_gradient_new();
|
Tvg_Gradient *gradient = tvg_radial_gradient_new();
|
||||||
REQUIRE(gradient);
|
REQUIRE(gradient);
|
||||||
REQUIRE(tvg_radial_gradient_set(gradient, 10.0, 15.0, 30.0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_radial_gradient_set(gradient, 10.0, 15.0, 30.0, 11.0, 16.0, 1.0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
float cx, cy, radius;
|
float cx, cy, r, fx, fy, fr;
|
||||||
REQUIRE(tvg_radial_gradient_get(gradient, &cx, &cy, &radius) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_radial_gradient_get(gradient, &cx, &cy, &r, &fx, &fy, &fr) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(cx == Approx(10.0).margin(0.000001));
|
REQUIRE(cx == Approx(10.0).margin(0.000001));
|
||||||
REQUIRE(cy == Approx(15.0).margin(0.000001));
|
REQUIRE(cy == Approx(15.0).margin(0.000001));
|
||||||
REQUIRE(radius == Approx(30.0).margin(0.000001));
|
REQUIRE(r == Approx(30.0).margin(0.000001));
|
||||||
|
REQUIRE(fx == Approx(11.0).margin(0.000001));
|
||||||
|
REQUIRE(fy == Approx(16.0).margin(0.000001));
|
||||||
|
REQUIRE(fr == Approx(1.0).margin(0.000001));
|
||||||
|
|
||||||
REQUIRE(tvg_gradient_del(gradient) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_gradient_del(gradient) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +197,7 @@ TEST_CASE("Stroke Radial Gradient", "[capiRadialGradient]")
|
||||||
Tvg_Gradient *gradient = tvg_radial_gradient_new();
|
Tvg_Gradient *gradient = tvg_radial_gradient_new();
|
||||||
REQUIRE(gradient);
|
REQUIRE(gradient);
|
||||||
|
|
||||||
REQUIRE(tvg_radial_gradient_set(gradient, 10.0, 15.0, 30.0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_radial_gradient_set(gradient, 10.0, 15.0, 30.0, 11.0, 16.0, 0.0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
Tvg_Color_Stop color_stops[2] = {
|
Tvg_Color_Stop color_stops[2] = {
|
||||||
{0.0, 0, 0, 0, 255},
|
{0.0, 0, 0, 0, 255},
|
||||||
|
@ -218,11 +221,14 @@ TEST_CASE("Stroke Radial Gradient", "[capiRadialGradient]")
|
||||||
REQUIRE(color_stops_ret);
|
REQUIRE(color_stops_ret);
|
||||||
REQUIRE(color_stops_count_ret == 2);
|
REQUIRE(color_stops_count_ret == 2);
|
||||||
|
|
||||||
float cx, cy, radius;
|
float cx, cy, r, fx, fy, fr;
|
||||||
REQUIRE(tvg_radial_gradient_get(gradient_ret, &cx, &cy, &radius) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_radial_gradient_get(gradient_ret, &cx, &cy, &r, &fx, &fy, &fr) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(cx == Approx(10.0).margin(0.000001));
|
REQUIRE(cx == Approx(10.0).margin(0.000001));
|
||||||
REQUIRE(cy == Approx(15.0).margin(0.000001));
|
REQUIRE(cy == Approx(15.0).margin(0.000001));
|
||||||
REQUIRE(radius == Approx(30.0).margin(0.000001));
|
REQUIRE(r == Approx(30.0).margin(0.000001));
|
||||||
|
REQUIRE(fx == Approx(11.0).margin(0.000001));
|
||||||
|
REQUIRE(fy == Approx(16.0).margin(0.000001));
|
||||||
|
REQUIRE(fr == Approx(0.0).margin(0.000001));
|
||||||
|
|
||||||
REQUIRE(tvg_paint_del(shape) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(shape) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ TEST_CASE("Set gradient text fill", "[capiText]")
|
||||||
|
|
||||||
Tvg_Gradient *gradientRad = tvg_radial_gradient_new();
|
Tvg_Gradient *gradientRad = tvg_radial_gradient_new();
|
||||||
REQUIRE(gradientRad);
|
REQUIRE(gradientRad);
|
||||||
REQUIRE(tvg_radial_gradient_set(gradientRad, 10.0, 15.0, 30.0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_radial_gradient_set(gradientRad, 10.0, 15.0, 30.0, 10.0, 15.0, 0.0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
Tvg_Gradient *gradientLin = tvg_linear_gradient_new();
|
Tvg_Gradient *gradientLin = tvg_linear_gradient_new();
|
||||||
REQUIRE(gradientLin);
|
REQUIRE(gradientLin);
|
||||||
|
|
|
@ -151,24 +151,31 @@ TEST_CASE("Radial Filling", "[tvgFill]")
|
||||||
auto fill = RadialGradient::gen();
|
auto fill = RadialGradient::gen();
|
||||||
REQUIRE(fill);
|
REQUIRE(fill);
|
||||||
|
|
||||||
float cx, cy, radius;
|
float cx, cy, r, fx, fy, fr;
|
||||||
|
|
||||||
REQUIRE(fill->radial(0, 0, -1) == Result::InvalidArguments);
|
REQUIRE(fill->radial(0, 0, -1, 0, 0, 0) == Result::InvalidArguments);
|
||||||
|
REQUIRE(fill->radial(0, 0, 0, 0, 0, -1) == Result::InvalidArguments);
|
||||||
REQUIRE(fill->radial(nullptr, nullptr, nullptr) == Result::Success);
|
REQUIRE(fill->radial(nullptr, nullptr, nullptr) == Result::Success);
|
||||||
REQUIRE(fill->radial(100, 120, 50) == Result::Success);
|
REQUIRE(fill->radial(100, 120, 50, 10, 20, 5) == Result::Success);
|
||||||
|
|
||||||
REQUIRE(fill->radial(&cx, nullptr, &radius) == Result::Success);
|
REQUIRE(fill->radial(&cx, nullptr, &r) == Result::Success);
|
||||||
REQUIRE(cx == 100.0f);
|
REQUIRE(cx == 100.0f);
|
||||||
REQUIRE(radius == 50.0f);
|
REQUIRE(r == 50.0f);
|
||||||
|
|
||||||
REQUIRE(fill->radial(nullptr, &cy, nullptr) == Result::Success);
|
REQUIRE(fill->radial(nullptr, &cy, nullptr, &fx, &fy, &fr) == Result::Success);
|
||||||
REQUIRE(cy == 120);
|
REQUIRE(cy == 120);
|
||||||
|
REQUIRE(fx == 10);
|
||||||
|
REQUIRE(fy == 20);
|
||||||
|
REQUIRE(fr == 5);
|
||||||
|
|
||||||
REQUIRE(fill->radial(0, 0, 0) == Result::Success);
|
REQUIRE(fill->radial(0, 0, 0, 0, 0, 0) == Result::Success);
|
||||||
REQUIRE(fill->radial(&cx, &cy, &radius) == Result::Success);
|
REQUIRE(fill->radial(&cx, &cy, &r, &fx, &fy, &fr) == Result::Success);
|
||||||
REQUIRE(cx == 0.0f);
|
REQUIRE(cx == 0.0f);
|
||||||
REQUIRE(cy == 0.0f);
|
REQUIRE(cy == 0.0f);
|
||||||
REQUIRE(radius == 0.0f);
|
REQUIRE(r == 0.0f);
|
||||||
|
REQUIRE(fx == 0.0f);
|
||||||
|
REQUIRE(fy == 0.0f);
|
||||||
|
REQUIRE(fr == 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Linear Filling Duplication", "[tvgFill]")
|
TEST_CASE("Linear Filling Duplication", "[tvgFill]")
|
||||||
|
@ -241,7 +248,7 @@ TEST_CASE("Radial Filling Duplication", "[tvgFill]")
|
||||||
|
|
||||||
REQUIRE(fill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(fill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(fill->spread(FillSpread::Reflect) == Result::Success);
|
REQUIRE(fill->spread(FillSpread::Reflect) == Result::Success);
|
||||||
REQUIRE(fill->radial(100.0f, 120.0f, 50.0f) == Result::Success);
|
REQUIRE(fill->radial(100.0f, 120.0f, 50.0f, 10.0f, 20.0f, 5.0f) == Result::Success);
|
||||||
|
|
||||||
auto m = Matrix{1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, -7.7f, -8.8f, -9.9f};
|
auto m = Matrix{1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, -7.7f, -8.8f, -9.9f};
|
||||||
REQUIRE(fill->transform(m) == Result::Success);
|
REQUIRE(fill->transform(m) == Result::Success);
|
||||||
|
@ -252,11 +259,14 @@ TEST_CASE("Radial Filling Duplication", "[tvgFill]")
|
||||||
|
|
||||||
REQUIRE(dup->spread() == FillSpread::Reflect);
|
REQUIRE(dup->spread() == FillSpread::Reflect);
|
||||||
|
|
||||||
float cx, cy, radius;
|
float cx, cy, r, fx, fy, fr;
|
||||||
REQUIRE(dup->radial(&cx, &cy, &radius) == Result::Success);
|
REQUIRE(dup->radial(&cx, &cy, &r, &fx, &fy, &fr) == Result::Success);
|
||||||
REQUIRE(cx == 100.0f);
|
REQUIRE(cx == 100.0f);
|
||||||
REQUIRE(cy == 120.0f);
|
REQUIRE(cy == 120.0f);
|
||||||
REQUIRE(radius == 50.0f);
|
REQUIRE(r == 50.0f);
|
||||||
|
REQUIRE(fx == 10.0f);
|
||||||
|
REQUIRE(fy == 20.0f);
|
||||||
|
REQUIRE(fr == 5.0f);
|
||||||
|
|
||||||
const Fill::ColorStop* cs2 = nullptr;
|
const Fill::ColorStop* cs2 = nullptr;
|
||||||
REQUIRE(fill->colorStops(&cs2) == 4);
|
REQUIRE(fill->colorStops(&cs2) == 4);
|
||||||
|
|
|
@ -521,7 +521,7 @@ TEST_CASE("Filling Draw", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->spread(FillSpread::Repeat) == Result::Success);
|
REQUIRE(linearFill->spread(FillSpread::Repeat) == Result::Success);
|
||||||
REQUIRE(radialFill->spread(FillSpread::Pad) == Result::Success);
|
REQUIRE(radialFill->spread(FillSpread::Pad) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Filled Shapes
|
//Filled Shapes
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -570,7 +570,7 @@ TEST_CASE("Filling Opaque Draw", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Filled Shapes
|
//Filled Shapes
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -619,7 +619,7 @@ TEST_CASE("Filling AlphaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -678,7 +678,7 @@ TEST_CASE("Filling InvAlphaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -737,7 +737,7 @@ TEST_CASE("Filling LumaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -796,7 +796,7 @@ TEST_CASE("Filling Clipping", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Clipper
|
//Clipper
|
||||||
auto clipper = tvg::Shape::gen();
|
auto clipper = tvg::Shape::gen();
|
||||||
|
@ -855,7 +855,7 @@ TEST_CASE("RLE Filling Draw", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Filled Shapes
|
//Filled Shapes
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -904,7 +904,7 @@ TEST_CASE("RLE Filling Opaque Draw", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Filled Shapes
|
//Filled Shapes
|
||||||
auto shape3 = tvg::Shape::gen();
|
auto shape3 = tvg::Shape::gen();
|
||||||
|
@ -953,7 +953,7 @@ TEST_CASE("RLE Filling AlphaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -1012,7 +1012,7 @@ TEST_CASE("RLE Filling InvAlphaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -1071,7 +1071,7 @@ TEST_CASE("RLE Filling LumaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -1130,7 +1130,7 @@ TEST_CASE("RLE Filling InvLumaMask", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto mask = tvg::Shape::gen();
|
auto mask = tvg::Shape::gen();
|
||||||
|
@ -1189,7 +1189,7 @@ TEST_CASE("RLE Filling Clipping", "[tvgSwEngine]")
|
||||||
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(linearFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
REQUIRE(linearFill->linear(0.0f, 0.0f, 100.0f, 120.0f) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
//Mask
|
//Mask
|
||||||
auto clipper = tvg::Shape::gen();
|
auto clipper = tvg::Shape::gen();
|
||||||
|
@ -1391,7 +1391,7 @@ TEST_CASE("Blending with Gradient Filling", "[tvgSwEngine]")
|
||||||
auto radialFill = RadialGradient::gen();
|
auto radialFill = RadialGradient::gen();
|
||||||
REQUIRE(radialFill);
|
REQUIRE(radialFill);
|
||||||
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
auto shape2 = tvg::Shape::gen();
|
auto shape2 = tvg::Shape::gen();
|
||||||
REQUIRE(shape2);
|
REQUIRE(shape2);
|
||||||
|
@ -1422,7 +1422,7 @@ TEST_CASE("Blending with Gradient Filling", "[tvgSwEngine]")
|
||||||
auto radialFill2 = RadialGradient::gen();
|
auto radialFill2 = RadialGradient::gen();
|
||||||
REQUIRE(radialFill2);
|
REQUIRE(radialFill2);
|
||||||
REQUIRE(radialFill2->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill2->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill2->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill2->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
auto mask2 = tvg::Shape::gen();
|
auto mask2 = tvg::Shape::gen();
|
||||||
REQUIRE(mask2);
|
REQUIRE(mask2);
|
||||||
|
@ -1458,7 +1458,7 @@ TEST_CASE("Blending with Gradient Filling", "[tvgSwEngine]")
|
||||||
auto radialFill3 = RadialGradient::gen();
|
auto radialFill3 = RadialGradient::gen();
|
||||||
REQUIRE(radialFill3);
|
REQUIRE(radialFill3);
|
||||||
REQUIRE(radialFill3->colorStops(cs, 4) == Result::Success);
|
REQUIRE(radialFill3->colorStops(cs, 4) == Result::Success);
|
||||||
REQUIRE(radialFill3->radial(50.0f, 50.0f, 50.0f) == Result::Success);
|
REQUIRE(radialFill3->radial(50.0f, 50.0f, 50.0f, 50.0f, 50.0f, 0.0f) == Result::Success);
|
||||||
|
|
||||||
auto mask4 = tvg::Shape::gen();
|
auto mask4 = tvg::Shape::gen();
|
||||||
REQUIRE(mask4);
|
REQUIRE(mask4);
|
||||||
|
|
Loading…
Add table
Reference in a new issue