1 #ifndef __DALI_ENCODED_BUFFER_IMAGE_H__
2 #define __DALI_ENCODED_BUFFER_IMAGE_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
32 * @addtogroup dali_core_images
36 namespace Internal DALI_INTERNAL
38 class EncodedBufferImage;
41 typedef Uint16Pair ImageDimensions; ///< Image dimension type @since_tizen 2.4
45 * @brief EncodedBufferImage represents an image resource that can be added to
48 * A memory buffer of encoded image data is provided by the application and
49 * decoded asynchronously on a background thread to fill the image's
52 * The buffer of data provided to an EncodedBufferImage factory function
53 * (New) should be filled with encoded image data in one of %Dali's
54 * supported image file formats, with the sequence of bytes in the buffer
55 * exactly matching the sequence of bytes that a file in the file system
56 * holding the encoded image data would have.
58 * The application may free the encoded image buffer passed to one of the
59 * New() static factory member functions as soon as they return.
63 * Image::UploadedSignal is emitted when the decoded image data gets
64 * uploaded to the OpenGL ES implementation.
67 class DALI_IMPORT_API EncodedBufferImage : public Image
71 * @brief Constructor which creates an uninitialized EncodedBufferImage object.
73 * Use @ref Image::New to create an initialised object.
79 * @brief Create an initialised image object from an encoded image buffer in memory.
82 * @remarks Image::ReleasePolicy is an experimental feature and might not be supported in the next release.
83 * We do recommend not to use this method.
84 * Please refer the remarks of ReleasePolicy for more information.
85 * @param [in] encodedImage The encoded bytes of an image, in a supported
86 * image format such as PNG, JPEG, GIF, BMP, KTX, ICO, and WBMP, organised
87 * exactly as it would be as a file in the filesystem.
88 * The caller retains ownership of this buffer and is free to modify or
89 * discard it as soon as the function returns.
90 * @param [in] encodedImageByteCount The size in bytes of the buffer pointed to
92 * @param [in] size The width and height to fit the loaded image to.
93 * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
94 * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
95 * @param [in] releasePol The releasePolicy to apply to Image. If the Image::UNUSED.
96 * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
97 * policy is set, a reload will not be possible, so the Image should never be
98 * used once all actors using it have gone off-stage.
99 * @return A handle to a newly allocated object.
101 static EncodedBufferImage New( const uint8_t * const encodedImage, std::size_t encodedImageByteCount, ImageDimensions size, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, ReleasePolicy releasePol = Image::NEVER, bool orientationCorrection = true );
104 * @brief Create an initialised image object from an encoded image buffer in memory.
107 * @param [in] encodedImage The encoded bytes of an image, in a supported
108 * image format such as PNG, JPEG, GIF, BMP, KTX, ICO, and WBMP, organised
109 * exactly as it would be as a file in the filesystem.
110 * The caller retains ownership of this buffer and is free to modify or
111 * discard it as soon as the function returns.
112 * @param [in] encodedImageByteCount The size in bytes of the buffer pointed to
114 * @return A handle to a newly allocated object.
116 static EncodedBufferImage New( const uint8_t * const encodedImage, std::size_t encodedImageByteCount );
119 * @brief Downcast a handle to EncodedBufferImage handle.
121 * If handle points to a EncodedBufferImage the
122 * downcast produces valid handle. If not the returned handle is left uninitialized.
124 * @param[in] handle Handle to an object
125 * @return Handle to a EncodedBufferImage or an uninitialized handle
127 static EncodedBufferImage DownCast( BaseHandle handle );
132 * This is non-virtual since derived Handle types must not contain data or virtual methods.
135 ~EncodedBufferImage();
138 * @brief This copy constructor is required for (smart) pointer semantics.
141 * @param [in] handle A reference to the copied handle
143 EncodedBufferImage(const EncodedBufferImage& handle);
146 * @brief This assignment operator is required for (smart) pointer semantics.
149 * @param [in] rhs A reference to the copied handle
150 * @return A reference to this
152 EncodedBufferImage& operator=(const EncodedBufferImage& rhs);
154 public: // Not intended for application developers
156 explicit DALI_INTERNAL EncodedBufferImage(Internal::EncodedBufferImage*);
164 #endif // __DALI_ENCODED_BUFFER_IMAGE_H__