X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fgradient%2Fgradient.h;h=f1b154e13d74310c1b5b7533331fefb811c31efa;hb=80ffb529157a623cc2a9d8e5d26dab98b62ec07e;hp=f08af994a21bd013404b842dfbe65258701c8032;hpb=1972f043026a3e1bdcaad71c17859a8f324d1e6d;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/gradient/gradient.h b/dali-toolkit/internal/visuals/gradient/gradient.h index f08af99..f1b154e 100644 --- a/dali-toolkit/internal/visuals/gradient/gradient.h +++ b/dali-toolkit/internal/visuals/gradient/gradient.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_GRADIENT_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,24 +18,23 @@ * */ -//EXTERNAL INCLUDES +// EXTERNAL INCLUDES #include -#include #include #include #include +// INTERNAL INCLUDES +#include + namespace Dali { - class Vector4; namespace Toolkit { - namespace Internal { - /** * Gradients consist of continuously smooth color transitions along a vector from one color to another, * possibly followed by additional transitions along the same vector to other colors. @@ -44,45 +43,26 @@ class Gradient : public RefObject { public: /** - * Defines the coordinate system of the attributes - * (start and end position for linear gradient, circle center and radius for radial gradient) - */ - enum GradientUnits - { - USER_SPACE_ON_USE, - OBJECT_BOUNDING_BOX - }; - - /** - * Indicates what happens if the gradient starts or ends inside the bounds of the object being painted by the gradient. - */ - enum SpreadMethod - { - PAD, // use the terminal colors of the gradient to fill the remainder of the target region - REPEAT, // reflect the gradient pattern start-to-end, end-to-start, start-to-end, etc. continuously until the target rectangle is filled - REFLECT // repeat the gradient pattern start-to-end, start-to-end, start-to-end, etc. continuously until the target region is filled - }; - - /** * The stop node tells the gradient what color it should be at certain position. */ struct GradientStop { - GradientStop( float offset, const Vector4& color ) - : mOffset( offset ), mStopColor( color ) - {} + GradientStop(float offset, const Vector4& color) + : mOffset(offset), + mStopColor(color) + { + } bool operator<(const GradientStop& rhs) const { return mOffset < rhs.mOffset; } - float mOffset; // A value ranging from 0 to 1 to indicate where the gradient stop is placed. - Vector4 mStopColor; // The color to use at this gradient stop + float mOffset; // A value ranging from 0 to 1 to indicate where the gradient stop is placed. + Vector4 mStopColor; // The color to use at this gradient stop }; public: - /** * Add a gradient stop. * @@ -101,13 +81,13 @@ public: * Set the coordinate system used by the gradient attributes. * @param[in] gradientUnits The the attributes are defined using the current user coordinate system or the bounding box of the shape. */ - void SetGradientUnits( GradientUnits gradientUnits ); + void SetGradientUnits(Toolkit::GradientVisual::Units::Type gradientUnits); /** * Get the coordinate system used by the gradient attributes. * @return USER_SPACE_ON_USE or OBJECT_BOUNDING_BOX */ - GradientUnits GetGradientUnits() const; + Toolkit::GradientVisual::Units::Type GetGradientUnits() const; /** * Indicates what happens if the gradient starts or ends inside the bounds of the target rectangle. @@ -115,13 +95,13 @@ public: * * @param[in] spread The method to fill the remainder of target region which is outside the gradient bounds */ - void SetSpreadMethod( SpreadMethod spread ); + void SetSpreadMethod(Toolkit::GradientVisual::SpreadMethod::Type spread); /** * Get the filling method for the the remainder of target region which is outside the gradient boun. * @return PAD, REFLECT or REPEAT */ - SpreadMethod GetSpreadMethod() const; + Toolkit::GradientVisual::SpreadMethod::Type GetSpreadMethod() const; /** * Get the transformation matrix to align the vertices with the gradient line/circle @@ -136,7 +116,6 @@ public: Dali::Texture GenerateLookupTexture(); private: - /** * Estimate the resolution of the lookup texture. * Note: Only call this function after the gradient stops are sorted in order. @@ -144,7 +123,6 @@ private: unsigned int EstimateTextureResolution(); protected: - /** * Construct a new Gradient object * Called in the constructor of subclasses @@ -157,18 +135,16 @@ protected: virtual ~Gradient(); // Undefined - Gradient( const Gradient& gradient ); + Gradient(const Gradient& gradient); // Undefined - Gradient& operator=( const Gradient& handle ); + Gradient& operator=(const Gradient& handle); protected: - - Vector mGradientStops; - Matrix3 mAlignmentTransform; - GradientUnits mGradientUnits; - SpreadMethod mSpreadMethod; - + Vector mGradientStops; + Matrix3 mAlignmentTransform; + Toolkit::GradientVisual::Units::Type mGradientUnits; + Toolkit::GradientVisual::SpreadMethod::Type mSpreadMethod; }; } // namespace Internal