[dali_1.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / legacy / common / tizen-platform-abstraction.h
1 #ifndef __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
2 #define __DALI_TIZEN_PLATFORM_ABSTRACTION_H__
3
4 /*
5  * Copyright (c) 2018 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 // INTERNAL INCLUDES
22 #include <dali/public-api/dali-adaptor-common.h>
23
24 // EXTERNAL INCLUDES
25 #include <string>
26 #include <dali/integration-api/platform-abstraction.h>
27
28 namespace Dali
29 {
30
31 namespace TizenPlatform
32 {
33
34 class ResourceLoader;
35
36 /**
37  * Concrete implementation of the platform abstraction class.
38  */
39 class TizenPlatformAbstraction : public Integration::PlatformAbstraction
40 {
41
42 public: // Construction & Destruction
43
44   /**
45    * Constructor
46    */
47   TizenPlatformAbstraction();
48
49   /**
50    * Destructor
51    */
52   virtual ~TizenPlatformAbstraction();
53
54 public: // PlatformAbstraction overrides
55
56   /**
57    * @copydoc PlatformAbstraction::GetClosestImageSize()
58    */
59   virtual ImageDimensions GetClosestImageSize( const std::string& filename,
60                                                ImageDimensions size,
61                                                FittingMode::Type fittingMode,
62                                                SamplingMode::Type samplingMode,
63                                                bool orientationCorrection );
64
65   /**
66    * @copydoc PlatformAbstraction::GetClosestImageSize()
67    */
68   virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
69                                                ImageDimensions size,
70                                                FittingMode::Type fittingMode,
71                                                SamplingMode::Type samplingMode,
72                                                bool orientationCorrection );
73
74   /**
75    * @copydoc PlatformAbstraction::LoadImageSynchronously()
76    */
77   virtual Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& resourcePath);
78
79   /**
80    * @copydoc PlatformAbstraction::DecodeBuffer()
81    */
82   virtual Integration::BitmapPtr DecodeBuffer( const Integration::BitmapResourceType& resource, uint8_t * buffer, size_t size );
83
84   /**
85    * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
86    */
87   virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
88
89   /**
90    * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
91    */
92   virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
93
94   /**
95    * Sets path for data/resource storage.
96    * @param[in] path data/resource storage path
97    */
98   void SetDataStoragePath( const std::string& path );
99
100 private:
101
102   TizenPlatformAbstraction( const TizenPlatformAbstraction& ); ///< Undefined
103   TizenPlatformAbstraction& operator=( const TizenPlatformAbstraction& ); ///< Undefined
104
105   std::string mDataStoragePath;
106
107 };
108
109 /**
110  * Construct a platform abstraction and return it.
111  * @return TizenPlatformAbstraction instance
112  */
113 TizenPlatformAbstraction* CreatePlatformAbstraction();
114
115 /**
116  * Save a file to disk
117  * @param filename to create
118  * @param buffer to store
119  * @param numBytes to store
120  * @return true if successful, false otherwise
121  */
122 bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes );
123
124 }  // namespace TizenPlatform
125
126 }  // namespace Dali
127
128 #endif // __DALI_TIZEN_PLATFORM_ABSTRACTION_H__