Merge "Remove unnecessary functions from Scripting, support strings in actor properti...
[platform/core/uifw/dali-core.git] / dali / integration-api / resource-types.h
index 3319aae..1d5182e 100644 (file)
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/images/image-attributes.h>
+#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/math/uint-16-pair.h>
+#include <dali/public-api/math/vector2.h>
 #include <dali/integration-api/resource-declarations.h>
 
 namespace Dali
 {
 
+typedef Uint16Pair ImageDimensions;
+
 namespace Integration
 {
 
@@ -43,9 +47,7 @@ enum ResourceTypeId
 {
   ResourceBitmap,
   ResourceNativeImage,
-  ResourceTargetImage,
-  ResourceShader,
-  ResourceMesh
+  ResourceTargetImage
 };
 
 /**
@@ -90,11 +92,20 @@ struct BitmapResourceType : public ResourceType
 {
   /**
    * Constructor.
-   * @param[in] attribs parameters for image loading request
-   */
-  BitmapResourceType(const ImageAttributes& attribs)
+   * @param[in] size The requested size for the bitmap.
+   * @param[in] scalingMode The method to use to map the source bitmap to the desired
+   * dimensions.
+   * @param[in] samplingMode The filter to use if the bitmap needs to be downsampled
+   * to the requested size.
+   * @param[in] orientationCorrection Whether to use bitmap metadata to rotate or
+   * flip the bitmap, e.g., from portrait to landscape.
+   */
+  BitmapResourceType( ImageDimensions size = ImageDimensions( 0, 0 ),
+                      FittingMode::Type scalingMode = FittingMode::DEFAULT,
+                      SamplingMode::Type samplingMode = SamplingMode::DEFAULT,
+                      bool orientationCorrection = true )
   : ResourceType(ResourceBitmap),
-    imageAttributes(attribs) {}
+    size(size), scalingMode(scalingMode), samplingMode(samplingMode), orientationCorrection(orientationCorrection) {}
 
   /**
    * Destructor.
@@ -106,13 +117,16 @@ struct BitmapResourceType : public ResourceType
    */
   virtual ResourceType* Clone() const
   {
-    return new BitmapResourceType(imageAttributes);
+    return new BitmapResourceType( size, scalingMode, samplingMode, orientationCorrection );
   }
 
   /**
    * Attributes are copied from the request.
    */
-  ImageAttributes imageAttributes;
+  ImageDimensions size;
+  FittingMode::Type scalingMode;
+  SamplingMode::Type samplingMode;
+  bool orientationCorrection;
 
 private:
 
@@ -138,11 +152,11 @@ struct NativeImageResourceType : public ResourceType
 
   /**
    * Constructor.
-   * @param[in] attribs parameters for image loading request
+   * @param[in] dimensions Width and Height to allocate for image.
    */
-  NativeImageResourceType(const ImageAttributes& attribs)
+  NativeImageResourceType( ImageDimensions dimensions )
   : ResourceType(ResourceNativeImage),
-    imageAttributes(attribs) {}
+    imageDimensions(dimensions) {}
 
   /**
    * Destructor.
@@ -154,13 +168,13 @@ struct NativeImageResourceType : public ResourceType
   */
   virtual ResourceType* Clone() const
   {
-    return new NativeImageResourceType(imageAttributes);
+    return new NativeImageResourceType(imageDimensions);
   }
 
   /**
    * Attributes are copied from the request (if supplied).
    */
-  ImageAttributes imageAttributes;
+  ImageDimensions imageDimensions;
 
 private:
 
@@ -185,11 +199,11 @@ struct RenderTargetResourceType : public ResourceType
 
   /**
    * Constructor.
-   * @param[in] attribs parameters for image loading request
+   * @param[in] dims Width and Height to allocate for image.
    */
-  RenderTargetResourceType(const ImageAttributes& attribs)
+  RenderTargetResourceType( ImageDimensions dims )
   : ResourceType(ResourceTargetImage),
-    imageAttributes(attribs) {}
+    imageDimensions(dims) {}
 
   /**
    * Destructor.
@@ -201,13 +215,13 @@ struct RenderTargetResourceType : public ResourceType
    */
   virtual ResourceType* Clone() const
   {
-    return new RenderTargetResourceType(imageAttributes);
+    return new RenderTargetResourceType(imageDimensions);
   }
 
   /**
-   * Attributes are copied from the request.
+   * Image size is copied from the request.
    */
-  ImageAttributes imageAttributes;
+  ImageDimensions imageDimensions;
 
 private:
 
@@ -218,86 +232,6 @@ private:
   RenderTargetResourceType& operator=(const RenderTargetResourceType& rhs);
 };
 
-/**
- * ShaderResourceType describes a shader program resource, which can be requested
- * from PlatformAbstraction::LoadResource()
- */
-struct ShaderResourceType : public ResourceType
-{
-  /**
-   * Constructor.
-   */
-  ShaderResourceType(size_t shaderHash, const std::string& vertexSource, const std::string& fragmentSource)
-  : ResourceType(ResourceShader),
-    hash(shaderHash),
-    vertexShader(vertexSource),
-    fragmentShader(fragmentSource)
-  {
-  }
-
-  /**
-   * Destructor.
-   */
-  virtual ~ShaderResourceType()
-  {
-  }
-
-  /**
-   * @copydoc ResourceType::Clone
-   */
-  virtual ResourceType* Clone() const
-  {
-    return new ShaderResourceType(hash, vertexShader, fragmentShader);
-  }
-
-public: // Attributes
-  size_t            hash;              ///< Hash of the vertex/fragment sources
-  const std::string vertexShader;      ///< source code for vertex program
-  const std::string fragmentShader;    ///< source code for fragment program
-
-private:
-
-  // Undefined copy constructor.
-  ShaderResourceType(const ShaderResourceType& typePath);
-
-  // Undefined assignment operator.
-  ShaderResourceType& operator=(const ShaderResourceType& rhs);
-};
-
-/**
- * MeshResourceType describes a mesh program resource, which can be created
- * using ResourceManager::AllocateMesh.
- */
-struct MeshResourceType : public ResourceType
-{
-  /**
-   * Constructor.
-   */
-  MeshResourceType()
-  : ResourceType(ResourceMesh) {}
-
-  /**
-   * Destructor.
-   */
-  virtual ~MeshResourceType() {}
-
-  /**
-   * @copydoc ResourceType::Clone
-   */
-  virtual ResourceType* Clone() const
-  {
-    return new MeshResourceType();
-  }
-
-private:
-
-  // Undefined copy constructor.
-  MeshResourceType(const MeshResourceType& typePath);
-
-  // Undefined assignment operator.
-  MeshResourceType& operator=(const MeshResourceType& rhs);
-};
-
 } // namespace Integration
 
 } // namespace Dali