Support animation of Visual transform properties
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / texture-upload-observer.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
2 #define DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H
3
4 /*
5  * Copyright (c) 2020 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/devel-api/adaptor-framework/pixel-buffer.h>
23 #include <dali/public-api/signals/dali-signal.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
27 #include <dali-toolkit/internal/visuals/visual-url.h>
28
29 namespace Dali
30 {
31
32 class TextureSet;
33
34 namespace Toolkit
35 {
36
37
38 /**
39  * @brief Base class used to observe the upload status of a texture.
40  *
41  * Derived class must implement the UploadComplete method which is
42  * executed once the texture is ready to draw.
43  */
44 class TextureUploadObserver
45 {
46 public:
47
48   typedef Signal< void ( TextureUploadObserver* ) > DestructionSignalType; ///< Signal prototype for the Destruction Signal.
49
50   /**
51    * @brief Constructor.
52    */
53   TextureUploadObserver();
54
55   /**
56    * @brief Virtual destructor.
57    */
58   virtual ~TextureUploadObserver();
59
60   /**
61    * The action to be taken once the async load has finished and the upload to GPU is completed.
62    * This should be overridden by the deriving class.
63    *
64    * @param[in] loadSuccess True if the texture load was successful (i.e. the resource is available). If false, then the resource failed to load. In future, this will automatically upload a "broken" image.
65    * @param[in] textureId   The textureId of the loaded texture in the TextureManager
66    * @param[in] textureSet  The TextureSet containing the Texture
67    * @param[in] useAtlasing True if atlasing was used (note: this may be different to what was requested)
68    * @param[in] atlasRect   If using atlasing, this is the rectangle within the atlas to use.
69    * @param[in] preMultiplied True if the image had pre-multiplied alpha applied
70    */
71   virtual void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing,
72                                const Vector4& atlasRect, bool preMultiplied ) = 0;
73
74   /**
75    * The action to be taken once the async load has finished.
76    * This should be overridden by the deriving class.
77    *
78    * @param[in] loadSuccess   True if the image load was successful (i.e. the resource is available). If false, then the resource failed to load.
79    * @param[in] pixelBuffer   The PixelBuffer of the loaded image.
80    * @param[in] url           The url address of the loaded image.
81    * @param[in] preMultiplied True if the image had pre-multiplied alpha applied
82    */
83   virtual void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const Internal::VisualUrl& url, bool preMultiplied ) = 0;
84
85   /**
86    * @brief Returns the destruction signal.
87    * This is emitted when the observer is destroyed.
88    * This is used by the observer notifier to mark this observer as destroyed (IE. It no longer needs notifying).
89    */
90   DestructionSignalType& DestructionSignal();
91
92 private:
93
94   DestructionSignalType mDestructionSignal; ///< The destruction signal emitted when the observer is destroyed.
95
96 };
97
98
99 } // namespace Toolkit
100
101 } // namespace Dali
102
103 #endif // DALI_TOOLKIT_INTERNAL_TEXTURE_UPLOAD_OBSERVER_H