Merge "Removed redundant resource loading code" into devel/master
[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 // EXTERNAL INCLUDES
21 #include <dali/public-api/images/image-operations.h>
22 #include <dali/integration-api/resource-types.h>
23 #include <dali/integration-api/bitmap.h>
24
25 // INTERNAL INCLUDES
26 #include "resource-loading-client.h"
27
28 namespace Dali
29 {
30 namespace Integration
31 {
32 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
33 } // Integration
34
35 namespace TizenPlatform
36 {
37 namespace ImageLoader
38 {
39 /**
40  * Convert a file stream into a bitmap.
41  * @param[in] resourceType The type of resource to convert.
42  * @param[in] path The path to the resource.
43  * @param[in] fp File Pointer. Closed on exit.
44  * @param[in] client The component that is initiating the conversion.
45  * @param[out] bitmap Pointer to write bitmap to
46  * @return true on success, false on failure
47  */
48 bool ConvertStreamToBitmap( const Integration::ResourceType& resourceType, std::string path, FILE * const fp, const ResourceLoadingClient& client, Integration::BitmapPtr& ptr);
49
50 /**
51  * Convert a bitmap and write to a file stream.
52  * @param[in] path The path to the resource.
53  * @param[in] fp File Pointer. Closed on exit.
54  * @param[out] bitmap Pointer from which to read bitmap
55  * @return true on success, false on failure
56  */
57 bool ConvertBitmapToStream( std::string path, FILE * const fp, Integration::BitmapPtr& ptr );
58
59
60 Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
61
62 ImageDimensions  GetClosestImageSize( const std::string& filename,
63                           ImageDimensions size,
64                           FittingMode::Type fittingMode,
65                           SamplingMode::Type samplingMode,
66                           bool orientationCorrection );
67
68 ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
69                           ImageDimensions size,
70                           FittingMode::Type fittingMode,
71                           SamplingMode::Type samplingMode,
72                           bool orientationCorrection );
73
74 } // ImageLoader
75 } // TizenPlatform
76 } // Dali
77
78 #endif // __DALI_TIZEN_PLATFORM_IMAGE_LOADER_H__