[dali_1.0.39] Merge branch 'tizen'
[platform/core/uifw/dali-toolkit.git] / 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) 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 /**
31  * @brief ImageRegionEffect is a custom shader effect to show only a region of an Image actor.
32  */
33 class DALI_IMPORT_API ImageRegionEffect : public ShaderEffect
34 {
35 public:
36
37   /**
38    * @brief Create an uninitialized ImageRegionEffect; this can be initialized with ImageRegionEffect::New().
39    *
40    * Calling member functions with an uninitialized Dali::Object is not allowed.
41    */
42   ImageRegionEffect();
43
44   /**
45    * @brief Destructor
46    *
47    * This is non-virtual since derived Handle types must not contain data or virtual methods.
48    */
49   ~ImageRegionEffect();
50
51   /**
52    * @brief Create an initialized ImageRegionEffect.
53    *
54    * @return A handle to a newly allocated Dali resource.
55    */
56   static ImageRegionEffect New();
57
58   /**
59    * @brief Set the top-left corner of the image region.
60    *
61    * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
62    * @param [in] point The top-left corner of the region.
63    */
64   void SetTopLeft(const Vector2& point);
65
66   /**
67    * @brief Set the bottom-right corner of the image region.
68    *
69    * The coordinates are in percentage, (0,0) being the top-left and (1,1) the bottom right of the original image.
70    * @param [in] point The bottom-right corner of the region.
71    */
72   void SetBottomRight(const Vector2& point);
73
74   /**
75    * @brief Get the name for the top-left point property.
76    *
77    * which can be used in Animation API's
78    * @return A std::string containing the property name
79    */
80   const std::string& GetTopLeftPropertyName() const;
81
82   /**
83    * @brief Get the name for the bottom-right point property which can be used in Animation APIs.
84    *
85    * @return A std::string containing the property name
86    */
87   const std::string& GetBottomRightPropertyName() const;
88
89 private: // Not intended for application developers
90   DALI_INTERNAL ImageRegionEffect(ShaderEffect handle);
91 };
92
93 } // namespace Toolkit
94
95 } // namespace Dali
96
97 #endif // __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__