[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / shader-effects / nine-patch-mask-effect.h
1 #ifndef __DALI_TOOLKIT_NINE_PATCH_MASK_EFFECT_H__
2 #define __DALI_TOOLKIT_NINE_PATCH_MASK_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_FRAMEWORK
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  * NinePatchMaskEffect is used to control which parts of an image are visible, using the alpha channel of a separate mask image.
36  * The mask image is expected to be smaller than the main image being viewed.
37  * Conceptually the mask image is divided into a 3x3 grid (9 patches). The middle patch is stretched whilst the outer border is not.
38  *
39  * Usage example:
40  *
41  * @code
42  *   ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
43  *   NinePatchMaskEffect::Apply( actor, MASK_IMAGE_PATH );
44  * @endcode
45  *
46  * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch.
47  */
48 namespace NinePatchMaskEffect
49 {
50
51 /**
52  * Apply the mask effect to an ImageActor.
53  * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch.
54  * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect().
55  * @param [in] maskImage The path to a file containing the mask. The center pixels of the mask will be stretched.
56  */
57 void Apply( ImageActor actor, const std::string& maskImage );
58
59 /**
60  * Apply the mask effect to an ImageActor.
61  * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch.
62  * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect().
63  * @param [in] maskImage The path to a file containing the mask.
64  * @param [in] maskBorder Specifies the part of the mask image that will be stretched (left, top, right, bottom).
65  */
66 void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder );
67
68 } // namespace NinePatchMaskEffect
69
70 } // namespace Toolkit
71
72 } // namespace Dali
73
74 /**
75  * @}
76  */
77 #endif // __DALI_TOOLKIT_NINE_PATCH_MASK_EFFECT_H__