Seperate the API macros
[platform/core/uifw/dali-core.git] / dali / public-api / images / encoded-buffer-image.h
1 #ifndef __DALI_ENCODED_BUFFER_IMAGE_H__
2 #define __DALI_ENCODED_BUFFER_IMAGE_H__
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <stdint.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/images/image.h>
26 #include <dali/public-api/images/image-operations.h>
27 #include <dali/public-api/math/uint-16-pair.h>
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_core_images
33  * @{
34  */
35
36 namespace Internal DALI_INTERNAL
37 {
38 class EncodedBufferImage;
39 }
40
41 typedef Uint16Pair ImageDimensions;
42
43
44 /**
45  * @DEPRECATED_1_2.41
46  *
47  * @brief EncodedBufferImage represents an image resource as a buffer of encoded pixel data.
48  *
49  * A memory buffer of encoded image data is provided by the application and
50  * decoded asynchronously on a background thread to fill the image's
51  * pixel data.
52  *
53  * The buffer of data provided to an EncodedBufferImage factory function
54  * (New) should be filled with encoded image data in one of %Dali's
55  * supported image file formats, with the sequence of bytes in the buffer
56  * exactly matching the sequence of bytes that a file in the file system
57  * holding the encoded image data would have.
58  *
59  * The application may free the encoded image buffer passed to one of the
60  * New() static factory member functions as soon as they return.
61  *
62  * <h3> Signals </h3>
63  *
64  * Image::LoadingFinishedSignal is emitted when the decoding of the
65  * image data is completed, either successfully or not.
66  *
67  * Image::UploadedSignal is emitted when the decoded image data gets
68  * uploaded to the OpenGL ES implementation.
69  * @SINCE_1_0.0
70  */
71 class DALI_CORE_API EncodedBufferImage : public Image
72 {
73 public:
74
75   /**
76    * @DEPRECATED_1_2.41
77    *
78    * @brief Constructor which creates an uninitialized EncodedBufferImage object.
79    *
80    * Use @ref EncodedBufferImage::New to create an initialised object.
81    * @SINCE_1_0.0
82    */
83   EncodedBufferImage() DALI_DEPRECATED_API;
84
85   /**
86    * @DEPRECATED_1_2.41
87    *
88    * @brief Creates an initialized image object from an encoded image buffer in memory.
89    *
90    * @SINCE_1_0.0
91    * @param[in] encodedImage The encoded bytes of an image, in a supported
92    * image format such as PNG, JPEG, GIF, BMP, KTX, ICO, and WBMP, organised
93    * exactly as it would be as a file in the filesystem.
94    * The caller retains ownership of this buffer and is free to modify or
95    * discard it as soon as the function returns
96    * @param[in] encodedImageByteCount The size in bytes of the buffer pointed to
97    * by encodedImage.
98    * @return A handle to a newly allocated object
99    */
100   static EncodedBufferImage New( const uint8_t * const encodedImage, std::size_t encodedImageByteCount ) DALI_DEPRECATED_API;
101
102   /**
103    * @DEPRECATED_1_2.41
104    *
105    * @brief Creates an initialized image object from an encoded image buffer in memory.
106    *
107    * @SINCE_1_1.4
108    * @param[in] encodedImage The encoded bytes of an image, in a supported
109    * image format such as PNG, JPEG, GIF, BMP, KTX, ICO, and WBMP, organised
110    * exactly as it would be as a file in the filesystem.
111    * The caller retains ownership of this buffer and is free to modify or
112    * discard it as soon as the function returns
113    * @param[in] encodedImageByteCount The size in bytes of the buffer pointed to
114    * by encodedImage
115    * @param[in] size The width and height to fit the loaded image to
116    * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
117    * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
118    * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
119    * policy is set, a reload will not be possible, so the Image should never be
120    * used once all actors using it have gone off-stage
121    * @return A handle to a newly allocated object
122    */
123   static EncodedBufferImage New( const uint8_t * const encodedImage, std::size_t encodedImageByteCount, ImageDimensions size, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection = true ) DALI_DEPRECATED_API;
124
125   /**
126    * @DEPRECATED_1_2.41
127    *
128    * @brief Downcasts a handle to EncodedBufferImage handle.
129    *
130    * If handle points to a EncodedBufferImage, the
131    * downcast produces valid handle. If not, the returned handle is left uninitialized.
132    * @SINCE_1_0.0
133    * @param[in] handle Handle to an object
134    * @return Handle to a EncodedBufferImage or an uninitialized handle
135    */
136   static EncodedBufferImage DownCast( BaseHandle handle ) DALI_DEPRECATED_API;
137
138   /**
139    * @DEPRECATED_1_2.41
140    *
141    * @brief Destructor.
142    *
143    * This is non-virtual since derived Handle types must not contain data or virtual methods.
144    * @SINCE_1_0.0
145    */
146   ~EncodedBufferImage() DALI_DEPRECATED_API;
147
148   /**
149    * @DEPRECATED_1_2.41
150    *
151    * @brief This copy constructor is required for (smart) pointer semantics.
152    *
153    * @SINCE_1_0.0
154    * @param[in] handle A reference to the copied handle
155    */
156   EncodedBufferImage(const EncodedBufferImage& handle) DALI_DEPRECATED_API;
157
158   /**
159    * @DEPRECATED_1_2.41
160    *
161    * @brief This assignment operator is required for (smart) pointer semantics.
162    *
163    * @SINCE_1_0.0
164    * @param[in] rhs A reference to the copied handle
165    * @return A reference to this
166    */
167   EncodedBufferImage& operator=(const EncodedBufferImage& rhs) DALI_DEPRECATED_API;
168
169 public: // Not intended for application developers
170
171   explicit DALI_INTERNAL EncodedBufferImage(Internal::EncodedBufferImage*);
172 };
173
174 /**
175  * @}
176  */
177 } // namespace Dali
178
179 #endif // __DALI_ENCODED_BUFFER_IMAGE_H__