1 #ifndef DALI_TIZEN_PLATFORM_IMAGE_LOADER_H
2 #define DALI_TIZEN_PLATFORM_IMAGE_LOADER_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
22 #include <dali/integration-api/bitmap.h>
23 #include <dali/integration-api/resource-types.h>
24 #include <dali/public-api/images/image-operations.h>
25 #include <dali/public-api/images/pixel-data.h>
32 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
33 } // namespace Integration
35 namespace TizenPlatform
40 * Convert a file stream into a bitmap.
41 * @param[in] resource The resource to convert.
42 * @param[in] path The path to the resource.
43 * @param[in] fp File Pointer. Closed on exit.
44 * @param[out] bitmap Pointer to write bitmap to
45 * @return true on success, false on failure
47 bool ConvertStreamToBitmap(const Integration::BitmapResourceType& resource, std::string path, FILE* const fp, Dali::Devel::PixelBuffer& pixelBuffer);
50 * Convert a file stream into image planes.
51 * @param[in] resource The resource to convert.
52 * @param[in] path The path to the resource.
53 * @param[in] fp File Pointer. Closed on exit.
54 * @param[out] pixelBuffers Pointer to write buffer to
55 * @return true on success, false on failure
57 bool ConvertStreamToPlanes(const Integration::BitmapResourceType& resource, std::string path, FILE* const fp, std::vector<Dali::Devel::PixelBuffer>& pixelBuffers);
60 * Convert a bitmap and write to a file stream.
61 * @param[in] path The path to the resource.
62 * @param[in] fp File Pointer. Closed on exit.
63 * @param[out] pixelData Reference to PixelData object.
64 * @return true on success, false on failure
66 bool ConvertBitmapToStream(std::string path, FILE* const fp, Dali::Devel::PixelBuffer& pixelBuffer);
69 * Loads an image synchronously
70 * @param resource details of the image
71 * @param path to the image
74 Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& path);
77 * @returns the closest image size
79 ImageDimensions GetClosestImageSize(const std::string& filename,
81 FittingMode::Type fittingMode,
82 SamplingMode::Type samplingMode,
83 bool orientationCorrection);
86 * @returns the closest image size
88 ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer,
90 FittingMode::Type fittingMode,
91 SamplingMode::Type samplingMode,
92 bool orientationCorrection);
95 * @brief Set the maximum texture size. Then size can be kwown by GL_MAX_TEXTURE_SIZE.
97 * @param [in] size The maximum texture size to set
99 void SetMaxTextureSize(unsigned int size);
102 * @brief Get the maximum texture size.
104 * @return The maximum texture size
106 unsigned int GetMaxTextureSize();
109 * @brief Check the gMaxTextureSize is updated or not.
111 * @return Whether the gMaxTextureSize is updated or not.
113 bool MaxTextureSizeUpdated();
115 } // namespace ImageLoader
116 } // namespace TizenPlatform
119 #endif // DALI_TIZEN_PLATFORM_IMAGE_LOADER_H