Removed Texture Atlas for the GIF image.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-base-data-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_VISUAL_BASE_DATA_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_VISUAL_BASE_DATA_IMPL_H
3
4 /*
5  * Copyright (c) 2017 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/math/vector2.h>
23 #include <dali/public-api/rendering/renderer.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
27 #include <dali-toolkit/internal/visuals/visual-resource-observer.h>
28 #include <dali-toolkit/public-api/align-enumerations.h>
29 #include <dali-toolkit/public-api/visuals/visual-properties.h>
30
31 namespace Dali
32 {
33
34 namespace Toolkit
35 {
36
37 namespace Internal
38 {
39
40 namespace Visual
41 {
42
43 struct Base::Impl
44 {
45   /**
46    * Constructor
47    */
48   Impl();
49
50   /**
51    * Destructor
52    */
53   ~Impl();
54
55   enum Flags
56   {
57     IS_ON_STAGE = 1,
58     IS_ATLASING_APPLIED = 1<<1,
59     IS_PREMULTIPLIED_ALPHA = 1 << 2,
60     IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 3
61   };
62
63   struct CustomShader
64   {
65     CustomShader( const Property::Map& map );
66     void SetPropertyMap( const Property::Map& map );
67     void CreatePropertyMap( Property::Map& map ) const;
68
69     std::string mVertexShader;
70     std::string mFragmentShader;
71     Dali::ImageDimensions mGridSize;
72     Dali::Shader::Hint::Value mHints; //(bitfield) values from enum Shader::Hint
73   };
74
75   struct Transform
76   {
77     /**
78      * Default constructor ensures the visual fills the control
79      */
80     Transform();
81
82     /**
83      * Use the property map to set zero or more of the transform
84      * attributes, and sets the remaining attributes to their default
85      * values.
86      */
87     void SetPropertyMap( const Property::Map& map );
88
89     /**
90      * Add the transform attributes to the map (using integer keys)
91      */
92     void GetPropertyMap( Property::Map& map ) const;
93
94     /**
95      * Update zero or more attributes from the property map.
96      */
97     void UpdatePropertyMap( const Property::Map& map );
98
99     /**
100      * Register or set the uniform properties onto the renderer
101      */
102     void RegisterUniforms( Renderer renderer, Toolkit::Direction::Type direction );
103
104     /**
105      * Convert the control size and the transform attributes into the actual
106      * size of the visual.
107      */
108     Vector2 GetVisualSize( const Vector2& controlSize );
109
110     Vector2 mOffset;
111     Vector2 mSize;
112     Vector4 mOffsetSizeMode;
113     Toolkit::Align::Type mOrigin;
114     Toolkit::Align::Type mAnchorPoint;
115   };
116
117   Renderer        mRenderer;
118   CustomShader*   mCustomShader;
119   SlotDelegate<Visual::Base>* mBlendSlotDelegate; ///< Used to own mix color animation connection
120   ResourceObserver* mResourceObserver;  ///< Allows controls to observe when the visual resources are loaded and ready
121   std::string     mName;
122   Transform       mTransform;
123   Vector4         mMixColor;
124   Size            mControlSize;
125   int             mDepthIndex;
126   Property::Index mMixColorIndex;
127   Property::Index mOpacityIndex;
128   int             mFlags;
129   Toolkit::Visual::ResourceStatus  mResourceStatus;
130 };
131
132 } // namespace Visual
133
134 } // namespace Internal
135
136 } // namespace Toolkit
137
138 } // namespace Dali
139
140 #endif // DALI_TOOLKIT_INTERNAL_VISUAL_BASE_DATA_IMPL_H