Support YUV decoding for JPEG
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / image-loader-input.h
old mode 100755 (executable)
new mode 100644 (file)
index f2e7d24..80d7b61
@@ -2,7 +2,7 @@
 #define DALI_TIZEN_PLATFORM_IMAGE_LOADER_INPUT_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 <cstdio>
-#include <dali/public-api/images/image-operations.h>
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali/integration-api/bitmap.h>
+#include <dali/public-api/images/image-operations.h>
+#include <cstdio>
 
 // INTERNAL INCLUDES
 
@@ -29,50 +29,58 @@ namespace Dali
 {
 namespace ImageLoader
 {
-
 /**
  * @brief A simple immutable struct to bundle together parameters for scaling an image.
  */
 class ScalingParameters
 {
 public:
-  ScalingParameters( ImageDimensions dimensions = ImageDimensions(), FittingMode::Type fittingMode = FittingMode::DEFAULT, SamplingMode::Type samplingMode = SamplingMode::DEFAULT ) :
-    dimensions(dimensions), scalingMode(fittingMode), samplingMode(samplingMode) {}
-  const ImageDimensions dimensions;
-  const FittingMode::Type scalingMode;
+  ScalingParameters(ImageDimensions dimensions = ImageDimensions(), FittingMode::Type fittingMode = FittingMode::DEFAULT, SamplingMode::Type samplingMode = SamplingMode::DEFAULT)
+  : dimensions(dimensions),
+    scalingMode(fittingMode),
+    samplingMode(samplingMode)
+  {
+  }
+  const ImageDimensions    dimensions;
+  const FittingMode::Type  scalingMode;
   const SamplingMode::Type samplingMode;
 };
 
-  /**
+/**
    * @brief Bundle-up the data pushed into an image loader.
    */
 struct Input
 {
-  Input( FILE* file, ScalingParameters scalingParameters = ScalingParameters(), bool reorientationRequested = true ) :
-    file(file), scalingParameters(scalingParameters), reorientationRequested(reorientationRequested) {}
-  FILE* file;
+  Input(FILE* file, ScalingParameters scalingParameters = ScalingParameters(), bool reorientationRequested = true)
+  : file(file),
+    scalingParameters(scalingParameters),
+    reorientationRequested(reorientationRequested)
+  {
+  }
+  FILE*             file;
   ScalingParameters scalingParameters;
-  bool reorientationRequested;
+  bool              reorientationRequested;
 };
 
-
-using LoadBitmapFunction = bool( * )( const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& pixelData );
-using LoadBitmapHeaderFunction = bool( * )( const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height );
+using LoadBitmapFunction       = bool (*)(const Dali::ImageLoader::Input& input, Dali::Devel::PixelBuffer& pixelData);
+using LoadPlanesFunction       = bool (*)(const Dali::ImageLoader::Input& input, std::vector<Dali::Devel::PixelBuffer>& pixelBuffers);
+using LoadBitmapHeaderFunction = bool (*)(const Dali::ImageLoader::Input& input, unsigned int& width, unsigned int& height);
 
 /**
  * Stores the magic bytes, and the loader and header functions used for each image loader.
  */
 struct BitmapLoader
 {
-  unsigned char magicByte1;        ///< The first byte in the file should be this
-  unsigned char magicByte2;        ///< The second byte in the file should be this
-  LoadBitmapFunction loader;       ///< The function which decodes the file
-  LoadBitmapHeaderFunction header; ///< The function which decodes the header of the file
-  Dali::Integration::Bitmap::Profile profile;         ///< The kind of bitmap to be created
-                                   ///  (addressable packed pixels or an opaque compressed blob).
+  unsigned char                      magicByte1;    ///< The first byte in the file should be this
+  unsigned char                      magicByte2;    ///< The second byte in the file should be this
+  LoadBitmapFunction                 loader;        ///< The function which decodes the file
+  LoadPlanesFunction                 planeLoader;   ///< The function which decodes the file to each plane
+  LoadBitmapHeaderFunction           header;        ///< The function which decodes the header of the file
+  Dali::Integration::Bitmap::Profile profile;       ///< The kind of bitmap to be created
+                                                    ///  (addressable packed pixels or an opaque compressed blob).
 };
 
-} // ImageLoader
-} // Dali
+} // namespace ImageLoader
+} // namespace Dali
 
 #endif // DALI_TIZEN_PLATFORM_IMAGE_LOADER_INPUT_H