Merge "UTC added for Text, Multi-language." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-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) 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/actors/image-actor.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 /**
31  * @brief NinePatchMaskEffect is used to control which parts of an image are visible, using the alpha channel of a separate mask image.
32  *
33  * The mask image is expected to be smaller than the main image being viewed.
34  * Conceptually the mask image is divided into a 3x3 grid (9 patches). The middle patch is stretched whilst the outer border is not.
35  *
36  * Usage example:
37  *
38  * @code
39  *   ImageActor actor = ImageActor::New( Image( EXAMPLE_IMAGE_PATH ) );
40  *   NinePatchMaskEffect::Apply( actor, MASK_IMAGE_PATH );
41  * @endcode
42  *
43  * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch.
44  */
45 namespace NinePatchMaskEffect
46 {
47
48 /**
49  * @brief Apply the mask effect to an ImageActor.
50  *
51  * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch.
52  * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect().
53  * @param [in] maskImage The path to a file containing the mask. The center pixels of the mask will be stretched.
54  */
55 DALI_IMPORT_API void Apply( ImageActor actor, const std::string& maskImage );
56
57 /**
58  * @brief Apply the mask effect to an ImageActor.
59  *
60  * NinePatchMaskEffect is mutually exclusive with ImageActor::STYLE_NINE_PATCH i.e. the actor's main image should not be a nine-patch.
61  * @param [in] actor The actor which needs the effect. To remove the effect call actor.RemoveShaderEffect().
62  * @param [in] maskImage The path to a file containing the mask.
63  * @param [in] maskBorder Specifies the part of the mask image that will be stretched (left, top, right, bottom).
64  */
65 DALI_IMPORT_API void Apply( ImageActor actor, const std::string& maskImage, const Vector4& maskBorder );
66
67 } // namespace NinePatchMaskEffect
68
69 } // namespace Toolkit
70
71 } // namespace Dali
72
73 #endif // __DALI_TOOLKIT_NINE_PATCH_MASK_EFFECT_H__