Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / images / buffer-image.h
index 33f8b45..a6d72ad 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_BUFFER_IMAGE_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -35,11 +35,13 @@ namespace Internal DALI_INTERNAL
 class BufferImage;
 }
 
-typedef unsigned char         PixelBuffer;  ///< pixel data buffer @SINCE_1_0.0
-typedef Rect<unsigned int>    RectArea;     ///< rectangular area (x,y,w,h) @SINCE_1_0.0
+typedef uint8_t        PixelBuffer;  ///< pixel data buffer @SINCE_1_0.0
+typedef Rect<uint32_t> RectArea;     ///< rectangular area (x,y,w,h) @SINCE_1_0.0
 
 
 /**
+ * @DEPRECATED_1_2.41
+ *
  * @brief BufferImage represents an image resource as a pixel data buffer.
  *
  * Its pixel buffer data is provided by the application developer.
@@ -50,65 +52,46 @@ typedef Rect<unsigned int>    RectArea;     ///< rectangular area (x,y,w,h) @SIN
  *
  * @SINCE_1_0.0
  */
-class DALI_IMPORT_API BufferImage : public Image
+class DALI_CORE_API BufferImage : public Image
 {
 public:
+
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Constructor which creates an uninitialized BufferImage object.
    *
-   * Use BufferImage::New(...) to create an initialised object.
+   * Use BufferImage::New(...) to create an initialized object.
    * @SINCE_1_0.0
    */
-  BufferImage();
+  BufferImage() DALI_DEPRECATED_API;
 
   /**
-   * @brief Create a new BufferImage.
+   * @DEPRECATED_1_2.41
+   *
+   * @brief Creates a new BufferImage.
    *
    * Also a pixel buffer for image data is allocated.
    * Dali has ownership of the buffer.
    * For better performance and portability use power of two dimensions.
    * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
    * @SINCE_1_0.0
-   * @param [in] width       Image width in pixels
-   * @param [in] height      Image height in pixels
-   * @param [in] pixelformat The pixel format (rgba 32 bit by default)
+   * @param[in] width  Image width in pixels
+   * @param[in] height Image height in pixels
+   * @param[in] pixelformat The pixel format (rgba 32 bit by default)
    * @return A handle to a new instance of BufferImage
    * @pre width & height are greater than zero
    * @note default resource management policies are Immediate and Never
    *
    */
-  static BufferImage New(unsigned int width,
-                         unsigned int height,
-                         Pixel::Format pixelformat=Pixel::RGBA8888);
+  static BufferImage New(uint32_t width,
+                         uint32_t height,
+                         Pixel::Format pixelformat=Pixel::RGBA8888) DALI_DEPRECATED_API;
 
   /**
-   * @DEPRECATED_1_1.3. Use New( unsigned int width, unsigned int height ) instead.
-   *
-   * @brief Create a new BufferImage.
-   *
-   * Also a pixel buffer for image data is allocated.
-   * Dali has ownership of the buffer.
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
+   * @DEPRECATED_1_2.41
    *
-   * @SINCE_1_0.0
-   * @remarks ReleasePolicy is an experimental feature and might not be supported in the next release.
-   * We do recommend not to use this method.
-   * Please refer the Remarks of ReleasePolicy for more information.
-   * @param [in] width          Image width in pixels
-   * @param [in] height         Image height in pixels
-   * @param [in] pixelFormat    The pixel format
-   * @param [in] releasePolicy  Optionally release memory when image is not visible on screen.
-   * @return A handle to a new instance of BufferImage
-   * @pre width & height are greater than zero
-   */
-  static BufferImage New(unsigned int  width,
-                         unsigned int  height,
-                         Pixel::Format pixelFormat,
-                         ReleasePolicy releasePolicy);
-
-  /**
-   * @brief Create a new BufferImage, which uses an external data source.
+   * @brief Creates a new BufferImage, which uses an external data source.
    *
    * The PixelBuffer has to be allocated by application.
    *
@@ -121,106 +104,81 @@ public:
    * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
    *
    * @SINCE_1_0.0
-   * @param [in] pixelBuffer  Pixel buffer. has to be allocated by application.
-   * @param [in] width        Image width in pixels
-   * @param [in] height       Image height in pixels
-   * @param [in] pixelFormat  The pixel format (rgba 32 bit by default)
-   * @param [in] stride       The internal stride of the pixelbuffer in pixels
+   * @param[in] pixelBuffer  Pixel buffer has to be allocated by application
+   * @param[in] width        Image width in pixels
+   * @param[in] height       Image height in pixels
+   * @param[in] pixelFormat  The pixel format (rgba 32 bit by default)
+   * @param[in] stride       The internal stride of the pixelbuffer in pixels
    * @return A handle to a new instance of BufferImage
    * @pre width & height are greater than zero
    */
   static BufferImage New(PixelBuffer*  pixelBuffer,
-                         unsigned int  width,
-                         unsigned int  height,
+                         uint32_t  width,
+                         uint32_t  height,
                          Pixel::Format pixelFormat=Pixel::RGBA8888,
-                         unsigned int  stride=0);
+                         uint32_t  stride=0) DALI_DEPRECATED_API;
 
   /**
-   * @DEPRECATED_1_1.3. Use New( PixelBuffer* pixelBuffer, unsigned int width, unsigned int height ) instead.
-   *
-   * @brief Create a new BufferImage, which uses an external data source.
+   * @DEPRECATED_1_2.41
    *
-   * The PixelBuffer has to be allocated by application.
+   * @brief Downcasts a handle to BufferImage handle.
    *
-   * The application holds ownership of the buffer. It must not
-   * destroy the PixelBuffer on a staged image if it has called
-   * Update() and hasn't received a Image::UploadedSignal, or if it has just
-   * added it to the stage and has not received a Image::UploadedSignal.
-   *
-   * For better performance and portability use power of two dimensions.
-   * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
-   *
-   * @SINCE_1_0.0
-   * @remarks ReleasePolicy is an experimental feature and might not be supported in the next release.
-   * We do recommend not to use this method.
-   * Please refer the Remarks of ReleasePolicy for more information.
-   * @param [in] pixelBuffer   Pixel buffer. has to be allocated by application.
-   * @param [in] width         Image width in pixels
-   * @param [in] height        Image height in pixels
-   * @param [in] pixelFormat   The pixel format
-   * @param [in] stride        The internal stride of the pixelbuffer in pixels
-   * @param [in] releasePolicy Optionally relase memory when image is not visible on screen.
-   * @return A handle to a new instance of BufferImage
-   * @pre width & height are greater than zero
-   * @note in case releasePolicy is Image::UNUSED, application has to call
-   * BufferImage::Update() whenever image is re-added to the stage
-   *
-   */
-  static BufferImage New(PixelBuffer*  pixelBuffer,
-                         unsigned int  width,
-                         unsigned int  height,
-                         Pixel::Format pixelFormat,
-                         unsigned int  stride,
-                         ReleasePolicy releasePolicy);
-
-  /**
-   * @brief Downcast a handle to BufferImage handle.
-   *
-   * If handle points to a BufferImage the downcast produces valid
-   * handle. If not the returned handle is left uninitialized.
+   * If the handle points to a BufferImage, the downcast produces valid handle.
+   * If not, the returned handle is left uninitialized.
    *
    * @SINCE_1_0.0
    * @param[in] handle Handle to an object
    * @return Handle to a BufferImage or an uninitialized handle
    */
-  static BufferImage DownCast( BaseHandle handle );
+  static BufferImage DownCast( BaseHandle handle ) DALI_DEPRECATED_API;
 
   /**
-   * @brief Destructor
+   * @DEPRECATED_1_2.41
+   *
+   * @brief Destructor.
    *
    * This is non-virtual since derived Handle types must not contain data or virtual methods.
    * @SINCE_1_0.0
    */
-  ~BufferImage();
+  ~BufferImage() DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief This copy constructor is required for (smart) pointer semantics.
    *
    * @SINCE_1_0.0
-   * @param [in] handle A reference to the copied handle
+   * @param[in] handle A reference to the copied handle
    */
-  BufferImage(const BufferImage& handle);
+  BufferImage(const BufferImage& handle) DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief This assignment operator is required for (smart) pointer semantics.
    *
    * @SINCE_1_0.0
-   * @param [in] rhs A reference to the copied handle
+   * @param[in] rhs A reference to the copied handle
    * @return A reference to this
    */
-  BufferImage& operator=(const BufferImage& rhs);
+  BufferImage& operator=(const BufferImage& rhs) DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief White pixel as image data.
    *
    * Can be used to create solid color actors.
    * @SINCE_1_0.0
    * @return 1 white pixel with 32 bit colordepth
    */
-  static const BufferImage WHITE();
+  static const BufferImage WHITE() DALI_DEPRECATED_API;
 
 public:
+
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Returns the pixel buffer of the Image.
    *
    * The application can write to the buffer to modify its contents.
@@ -232,33 +190,41 @@ public:
    * @SINCE_1_0.0
    * @return The pixel buffer
    */
-  PixelBuffer* GetBuffer();
+  PixelBuffer* GetBuffer() DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Returns buffer size in bytes.
    *
    * @SINCE_1_0.0
    * @return The buffer size in bytes
    */
-  unsigned int GetBufferSize() const;
+  uint32_t GetBufferSize() const DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Returns buffer stride (in bytes).
    *
    * @SINCE_1_0.0
    * @return The buffer stride
    */
-  unsigned int GetBufferStride() const;
+  uint32_t GetBufferStride() const DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Returns the pixel format of the contained buffer
    *
    * @SINCE_1_0.0
    * @return The pixel format
    */
-  Pixel::Format GetPixelFormat() const;
+  Pixel::Format GetPixelFormat() const DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Inform Dali that the contents of the buffer have changed.
    *
    * Image::UploadedSignal will be sent in response if the image is on stage
@@ -275,15 +241,19 @@ public:
    * @note Some GPUs may not support Non power of two buffer updates (for
    * example C110/SGX540)
    */
-  void Update();
+  void Update() DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @copydoc Update()
-   * @param [in] updateArea Area that has changed in buffer
+   * @param[in] updateArea Area that has changed in buffer
    */
-  void Update( RectArea updateArea );
+  void Update( RectArea updateArea ) DALI_DEPRECATED_API;
 
   /**
+   * @DEPRECATED_1_2.41
+   *
    * @brief Returns whether BufferImage uses external data source or not.
    *
    * If not, dali holds ownership of the PixelBuffer, otherwise the application
@@ -293,9 +263,9 @@ public:
    * if it has called Update() and hasn't received a Image::UploadedSignal.
    *
    * @SINCE_1_0.0
-   * @return true if application owns data, false otherwise
+   * @return @c true if application owns data, @c false otherwise
    */
-  bool IsDataExternal() const;
+  bool IsDataExternal() const DALI_DEPRECATED_API;
 
 public: // Not intended for application developers