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