[3.0] Remove/move experimental features
[platform/core/uifw/dali-core.git] / dali / internal / event / images / encoded-buffer-image-impl.h
1 #ifndef __DALI_INTERNAL_ENCODED_BUFFER_IMAGE_H__
2 #define __DALI_INTERNAL_ENCODED_BUFFER_IMAGE_H__
3
4 /*
5  * Copyright (c) 2014 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 // INTERNAL INCLUDES
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/internal/event/images/image-impl.h>
24 #include <dali/public-api/images/encoded-buffer-image.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class EncodedBufferImage;
33 typedef IntrusivePtr<EncodedBufferImage> EncodedBufferImagePtr;
34
35 class ResourceClient;
36 class ResourceManager;
37
38 namespace SceneGraph
39 {
40 class UpdateManager;
41 }
42 /**
43  * EncodedBufferImage represents an image resource that can be added to actors etc.
44  *
45  * A memory buffer of encoded image data is provided by the application and
46  * decoded asynchronously on a background thread to fill the image's
47  * pixel data.
48  */
49 class EncodedBufferImage : public Image
50 {
51 private:
52   /**
53    * Construct using the supplied load policy.
54    */
55   EncodedBufferImage() : Image() {}
56
57 public:
58   /**
59    * Create an initialised image object from an encoded image buffer in memory.
60    * @param [in] encodedImage The encoded bytes of an image, in a supported
61    * image format such as PNG, JPEG, GIF, BMP, KTX, ICO, and WBMP, organised
62    * exactly as it would be as a file in the filesystem.
63    * The caller retains ownership of this buffer and is free to modify or
64    * discard it as soon as the function returns.
65    * @param [in] encodedImageByteCount The size in bytes of the buffer pointed to
66    * by encodedImage.
67    * @param [in] attributes Requested parameters for loading (size, scaling etc.).
68    * @return A pointer to a newly allocated object, or null on error.
69    */
70   static EncodedBufferImagePtr New(const uint8_t * const encodedImage,
71                                    const std::size_t encodedImageByteCount,
72                                    ImageDimensions size = ImageDimensions(0, 0),
73                                    FittingMode::Type scalingMode = FittingMode::SHRINK_TO_FIT,
74                                    SamplingMode::Type samplingMode = SamplingMode::BOX,
75                                    bool orientationCorrection = true);
76 };
77
78 } // namespace Internal
79
80 /**
81  * Helper methods for public API.
82  */
83 inline Internal::EncodedBufferImage& GetImplementation(Dali::EncodedBufferImage& image)
84 {
85   DALI_ASSERT_ALWAYS( image && "EncodedBufferImage handle is empty" );
86
87   BaseObject& handle = image.GetBaseObject();
88
89   return static_cast<Internal::EncodedBufferImage&>(handle);
90 }
91
92 inline const Internal::EncodedBufferImage& GetImplementation(const Dali::EncodedBufferImage& image)
93 {
94   DALI_ASSERT_ALWAYS( image && "EncodedBufferImage handle is empty" );
95
96   const BaseObject& handle = image.GetBaseObject();
97
98   return static_cast<const Internal::EncodedBufferImage&>(handle);
99 }
100
101 } // namespace Dali
102
103 #endif // __DALI_INTERNAL_ENCODED_BUFFER_IMAGE_H__