Merge branch 'tizen' into devel/new_mesh
[platform/core/uifw/dali-adaptor.git] / platform-abstractions / tizen / image-loaders / image-loader.h
1 #ifndef __DALI_TIZEN_PLATFORM_IMAGE_LOADER_H__
2 #define __DALI_TIZEN_PLATFORM_IMAGE_LOADER_H__
3
4 /*
5  * Copyright (c) 2014 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 #include <dali/integration-api/resource-cache.h>
21 #include <dali/integration-api/resource-types.h>
22 #include <dali/integration-api/bitmap.h>
23 #include "resource-loading-client.h"
24
25 namespace Dali
26 {
27 namespace TizenPlatform
28 {
29 namespace ImageLoader
30 {
31 /**
32  * Convert a file stream into a bitmap.
33  * @param[in] resourceType The type of resource to convert.
34  * @param[in] path The path to the resource.
35  * @param[in] fp File Pointer. Closed on exit.
36  * @param[in] client The component that is initiating the conversion.
37  * @param[out] bitmap Pointer to write bitmap to
38  * @return true on success, false on failure
39  */
40 bool ConvertStreamToBitmap( const Integration::ResourceType& resourceType, std::string path, FILE * const fp, const ResourceLoadingClient& client, Integration::BitmapPtr& ptr);
41
42 /**
43  * Convert a bitmap and write to a file stream.
44  * @param[in] path The path to the resource.
45  * @param[in] fp File Pointer. Closed on exit.
46  * @param[out] bitmap Pointer from which to read bitmap
47  * @return true on success, false on failure
48  */
49 bool ConvertBitmapToStream( std::string path, FILE * const fp, Integration::BitmapPtr& ptr );
50
51
52 Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
53
54 void GetClosestImageSize( const std::string& filename,
55                           const ImageAttributes& attributes,
56                           Vector2 &closestSize );
57
58 void GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
59                           const ImageAttributes& attributes,
60                           Vector2 &closestSize );
61
62 } // ImageLoader
63 } // TizenPlatform
64 } // Dali
65
66 #endif // __DALI_TIZEN_PLATFORM_IMAGE_LOADER_H__