Support YUV decoding for JPEG
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / common / image-loader.h
index 55f1680..b0d490f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TIZEN_PLATFORM_IMAGE_LOADER_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/images/image-operations.h>
-#include <dali/integration-api/resource-types.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali/integration-api/bitmap.h>
+#include <dali/integration-api/resource-types.h>
+#include <dali/public-api/images/image-operations.h>
 #include <dali/public-api/images/pixel-data.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <string>
 
 namespace Dali
@@ -30,7 +30,7 @@ namespace Dali
 namespace Integration
 {
 typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
-} // Integration
+} // namespace Integration
 
 namespace TizenPlatform
 {
@@ -44,16 +44,18 @@ namespace ImageLoader
  * @param[out] bitmap Pointer to write bitmap to
  * @return true on success, false on failure
  */
-bool ConvertStreamToBitmap( const Integration::BitmapResourceType& resource, std::string path, FILE * const fp, Dali::Devel::PixelBuffer& pixelBuffer );
+bool ConvertStreamToBitmap(const Integration::BitmapResourceType& resource, const std::string& path, FILE* const fp, Dali::Devel::PixelBuffer& pixelBuffer);
 
 /**
- * Convert a bitmap and write to a file stream.
+ * Convert a file stream into image planes.
+ * @param[in] resource The resource to convert.
  * @param[in] path The path to the resource.
  * @param[in] fp File Pointer. Closed on exit.
- * @param[out] pixelData Reference to PixelData object.
+ * @param[out] pixelBuffers Pointer to write buffer to
  * @return true on success, false on failure
+ * @note If the image file doesn't support to load planes, this method returns one RGB bitmap image.
  */
-bool ConvertBitmapToStream( std::string path, FILE * const fp, Dali::Devel::PixelBuffer& pixelBuffer );
+bool ConvertStreamToPlanes(const Integration::BitmapResourceType& resource, const std::string& path, FILE* const fp, std::vector<Dali::Devel::PixelBuffer>& pixelBuffers);
 
 /**
  * Loads an image synchronously
@@ -61,32 +63,32 @@ bool ConvertBitmapToStream( std::string path, FILE * const fp, Dali::Devel::Pixe
  * @param path to the image
  * @return bitmap
  */
-Integration::ResourcePointer LoadImageSynchronously( const Integration::BitmapResourceType& resource, const std::string& path );
+Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resource, const std::string& path);
 
 /**
  * @returns the closest image size
  */
-ImageDimensions  GetClosestImageSize( const std::string& filename,
-                          ImageDimensions size,
-                          FittingMode::Type fittingMode,
-                          SamplingMode::Type samplingMode,
-                          bool orientationCorrection );
+ImageDimensions GetClosestImageSize(const std::string& filename,
+                                    ImageDimensions    size,
+                                    FittingMode::Type  fittingMode,
+                                    SamplingMode::Type samplingMode,
+                                    bool               orientationCorrection);
 
 /**
  * @returns the closest image size
  */
-ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
-                          ImageDimensions size,
-                          FittingMode::Type fittingMode,
-                          SamplingMode::Type samplingMode,
-                          bool orientationCorrection );
+ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer,
+                                    ImageDimensions              size,
+                                    FittingMode::Type            fittingMode,
+                                    SamplingMode::Type           samplingMode,
+                                    bool                         orientationCorrection);
 
 /**
  * @brief Set the maximum texture size. Then size can be kwown by GL_MAX_TEXTURE_SIZE.
  *
  * @param [in] size The maximum texture size to set
  */
-void SetMaxTextureSize( unsigned int size );
+void SetMaxTextureSize(unsigned int size);
 
 /**
  * @brief Get the maximum texture size.
@@ -95,8 +97,15 @@ void SetMaxTextureSize( unsigned int size );
  */
 unsigned int GetMaxTextureSize();
 
-} // ImageLoader
-} // TizenPlatform
-} // Dali
+/**
+ * @brief Check the gMaxTextureSize is updated or not.
+ *
+ * @return Whether the gMaxTextureSize is updated or not.
+ */
+bool MaxTextureSizeUpdated();
+
+} // namespace ImageLoader
+} // namespace TizenPlatform
+} // namespace Dali
 
 #endif // DALI_TIZEN_PLATFORM_IMAGE_LOADER_H