Merge "Add support for new accessibility actions" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / shader-effects / quadratic-bezier.h
1 #ifndef __DALI_TOOLKIT_QUADRATIC_BEZIER_H__
2 #define __DALI_TOOLKIT_QUADRATIC_BEZIER_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/shader-effects/shader-effect.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29 /**
30  * @brief QuadraticBezier is a custom shader to render quadratic bezier curves and bounded regions.
31  *
32  * Implementation based on the paper "Resolution Independent Curve Rendering using Programmable Graphics Hardware"
33  * by Charles Loop and Jim Blinn.
34  *
35  * The coordinates of the control points is passed to the shader via uniforms.
36  * aNormal attribute is used to pass the coefficients of each control point (xy coordinates) as well as the vertex ID (z coordinate).
37  * A quadratic curve should have as normal for the first control point (0.0,0.0), (0.5,0.0) for the second and (1.0,1.0) for the third.
38  * Triangles that do not contain curves should have coordinates (0.0,1.0) for each control point in order to be filled properly.
39  */
40
41 class DALI_IMPORT_API QuadraticBezier : public ShaderEffect
42 {
43 public:
44
45   /**
46    * @brief Create an uninitialized QuadraticBezier; this can be initialized with QuadraticBezier::New().
47    *
48    * Calling member functions with an uninitialized Dali::Object is not allowed.
49    */
50   QuadraticBezier();
51
52   /**
53    * @brief Destructor
54    *
55    * This is non-virtual since derived Handle types must not contain data or virtual methods.
56    */
57   ~QuadraticBezier();
58
59   /**
60    * @brief Create an initialized QuadraticBezier.
61    *
62    * @param[in] pointCount The maximum number of vertices
63    * @param[in] filled Specify whether the the bounded region should be filled or not
64    * @return A handle to a newly allocated Dali resource.
65    */
66   static QuadraticBezier New(unsigned int pointCount, bool filled );
67
68   /**
69    * @brief Set position coordinates for a point in the curve
70    *
71    * @param[in] index The index of the vertex
72    * @param[in] position The new position
73    */
74   void SetPoint( unsigned int index, const Vector3& position );
75
76   /**
77    * @brief Set the width of the pathThis is only for not filled curves
78    *
79    * @param[in] width Width of the line in pixels
80    */
81   void SetLineWidth( float width );
82
83   /**
84    * @brief Sets the color of the curve
85    *
86    * @param[in] color The new color
87    */
88   void SetColor( const Vector4& color );
89
90   /**
91    * @brief Get the name of a the point property given its index
92    *
93    * @param[in] index Index of the vertex
94    * @return A std::string containing the property name
95    */
96   std::string GetPointPropertyName( unsigned int index ) const;
97
98   /**
99    * @brief Get the name of the line width property
100    *
101    * @return A std::string containing the property name
102    */
103   std::string GetLineWidthPropertyName( ) const;
104
105   /**
106    * @brief Get the name of the color property
107    *
108    * @return A std::string containing the property name
109    */
110   std::string GetColorPropertyName( ) const;
111
112 private: // Not intended for application developers
113
114   DALI_INTERNAL QuadraticBezier(ShaderEffect handle);
115
116 };
117
118 } // namespace Toolkit
119
120 } // namespace Dali
121
122 #endif // __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__