6dbdf9bb75ff564cc17d4f64f9037f49c126cdce
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / shader-effects / image-region-effect.h
1 #ifndef __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__
2 #define __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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  * @addtogroup CAPI_DALI_TOOLKIT_SHADER_EFFECTS_MODULE
22  * @{
23  */
24
25 // INTERNAL INCLUDES
26 #include <dali/dali.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30
31 namespace Toolkit
32 {
33
34 /**
35  * @brief ImageRegionEffect is a custom shader effect to show only a region of an Image actor.
36  */
37 class ImageRegionEffect : public ShaderEffect
38 {
39 public:
40
41   /**
42    * @brief Create an uninitialized ImageRegionEffect; this can be initialized with ImageRegionEffect::New().
43    *
44    * Calling member functions with an uninitialized Dali::Object is not allowed.
45    */
46   ImageRegionEffect();
47
48   /**
49    * @brief Virtual destructor.
50    */
51   virtual ~ImageRegionEffect();
52
53   /**
54    * @brief Create an initialized ImageRegionEffect.
55    *
56    * @return A handle to a newly allocated Dali resource.
57    */
58   static ImageRegionEffect New();
59
60   /**
61    * @brief Set the top-left corner of the image region.
62    *
63    * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
64    * @param [in] point The top-left corner of the region.
65    */
66   void SetTopLeft(const Vector2& point);
67
68   /**
69    * @brief Set the bottom-right corner of the image region.
70    *
71    * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
72    * @param [in] point The bottom-right corner of the region.
73    */
74   void SetBottomRight(const Vector2& point);
75
76   /**
77    * @brief Get the name for the top-left point property.
78    *
79    * which can be used in Animation API's
80    * @return A std::string containing the property name
81    */
82   const std::string& GetTopLeftPropertyName() const;
83
84   /**
85    * @brief Get the name for the bottom-right point property which can be used in Animation APIs.
86    *
87    * @return A std::string containing the property name
88    */
89   const std::string& GetBottomRightPropertyName() const;
90
91 private: // Not intended for application developers
92   ImageRegionEffect(ShaderEffect handle);
93 };
94
95 } // namespace Toolkit
96
97 } // namespace Dali
98
99 /**
100  * @}
101  */
102 #endif // __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__