2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 * @file FMedia_ImageBufferImpl.h
21 * @brief This is the header file for the _ImageBufferImpl class.
23 * This header file contains the declarations of the Tizen::Media::_ImageBufferImpl class.
25 #ifndef _FMEDIA_INTERNAL_IMAGE_BUFFER_IMPL_H_
26 #define _FMEDIA_INTERNAL_IMAGE_BUFFER_IMPL_H_
28 #include <unique_ptr.h>
29 #include <FMediaImageTypes.h>
31 namespace Tizen { namespace Media
36 class _OSP_EXPORT_ _ImageBufferImpl
37 : public Tizen::Base::Object
42 * This is the default constructor for this class.
43 * The object is not fully constructed after this constructor is called.
44 * For full construction, the Construct() method must be called right after
45 * calling this constructor.
49 _ImageBufferImpl(void);
52 * This is the destructor for this class.
53 * This destructor overrides Tizen::Base::Object::~Object()
57 virtual ~_ImageBufferImpl(void);
60 * @see ImageBuffer::Construct()
62 result Construct(int width, int height, MediaPixelFormat pixelFormat);
65 * @see ImageBuffer::Construct()
67 result Construct(const Tizen::Base::String &srcImagePath,
68 const Tizen::Graphics::Rectangle *pDecodingRegion = null,
69 bool autoRotate = true);
72 * @see ImageBuffer::Construct()
74 result Construct(const Tizen::Base::ByteBuffer &srcImageBuf,
75 const Tizen::Graphics::Rectangle *pDecodingRegion = null,
76 bool autoRotate = true);
79 * @see ImageBuffer::Construct()
81 result Construct(int width, int height, MediaPixelFormat pixelFormat,
82 const byte* pData = null, int length = 0);
85 * @see ImageBuffer::Construct()
87 result Construct(const Tizen::Graphics::Bitmap &srcBitmap);
89 result Construct(const Tizen::Base::String &srcImagePath, int destWidth, int destHeight, ImageScalingMethod scalingMethod);
91 result Construct(const Tizen::Base::ByteBuffer &srcImageBuf, int destWidth, int destHeight, ImageScalingMethod scalingMethod);
93 ExifOrientation GetExifOrientation(void) const;
96 * @see ImageBuffer::Equals()
98 virtual bool Equals(ImageBuffer* pRhs) const;
101 * @see ImageBuffer::GetHashCode()
103 virtual int GetHashCode(void) const;
106 * @see ImageBuffer::GetHeight()
108 int GetHeight(void) const;
111 * @see ImageBuffer::GetWidth()
113 int GetWidth(void) const;
116 * @see ImageBuffer::GetPixelFormat()
118 MediaPixelFormat GetPixelFormat(void) const;
121 * @see ImageBuffer::Lock()
123 result Lock(byte* &data, int &length, MediaPixelFormat &pixelFormat);
126 * @see ImageBuffer::Unlock()
131 * @see ImageBuffer::EncodeToBufferN()
133 Tizen::Base::ByteBuffer* EncodeToBufferN(ImageFormat destImageFormat, int quality = 90) const;
136 * @see ImageBuffer::EncodeToFile()
138 result EncodeToFile(const Tizen::Base::String &destImagePath, ImageFormat destImageFormat, bool overwrite, int quality = 90) const;
141 * @see ImageBuffer::GetBitmapN()
143 Tizen::Graphics::Bitmap* GetBitmapN(Tizen::Graphics::BitmapPixelFormat pixelFormat, Tizen::Graphics::BufferScaling bufferScaling) const;
146 * @see ImageBuffer::GetBitmapN()
148 Tizen::Graphics::Bitmap* GetBitmapN(Tizen::Graphics::BitmapPixelFormat pixelFormat, const Tizen::Graphics::FloatDimension &destDim) const;
151 * @see ImageBuffer::GetByteBufferN()
153 Tizen::Base::ByteBuffer* GetByteBufferN(MediaPixelFormat pixelFormat) const;
156 * @see ImageBuffer::CloneN()
158 virtual ImageBuffer* CloneN(void) const;
161 * @see ImageBuffer::ConvertPixelFormatN()
163 ImageBuffer* ConvertPixelFormatN(MediaPixelFormat pixelFormat) const;
166 * @see ImageBuffer::ResizeN()
168 ImageBuffer* ResizeN(int width, int height) const;
171 * @see ImageBuffer::FlipN()
173 ImageBuffer* FlipN(ImageFlipType flipType) const;
176 * @see ImageBuffer::RotateN()
178 ImageBuffer* RotateN(ImageRotationType rotateType) const;
181 * @see ImageBuffer::CropN()
183 ImageBuffer* CropN(int x, int y, int width, int height) const;
186 * @see ImageBuffer::GetImageInfo()
188 static result GetImageInfo(const Tizen::Base::String& srcImagePath, ImageFormat &imageFormat, int &width, int &height);
191 * @see ImageBuffer::GetImageInfo()
193 static result GetImageInfo(const Tizen::Base::ByteBuffer& srcImageBuf, ImageFormat &imageFormat, int &width, int &height);
195 static bool IsSupportedPixelFormat(MediaPixelFormat pixelFormat);
197 * @see ImageBuffer::GetSupportedPixelFormatListN()
199 static Tizen::Base::Collection::IListT<MediaPixelFormat>* GetSupportedPixelFormatListN(void);
201 static _ImageBufferImpl* GetInstance(ImageBuffer& a);
203 static const _ImageBufferImpl* GetInstance(const ImageBuffer& a);
207 * The implementation of this copy constructor is intentionally blank
208 * and declared as private to prohibit copying of objects.
210 _ImageBufferImpl(const _ImageBufferImpl& rhs);
213 * The implementation of this copy assignment operator is intentionally blank
214 * and declared as private to prohibit copying of objects.
216 _ImageBufferImpl& operator =(const _ImageBufferImpl& rhs);
218 std::unique_ptr<byte[]> __pBuffer;
222 ExifOrientation __orientation;
223 MediaPixelFormat __pixelFormat;
229 #endif // _FMEDIA_INTERNAL_IMAGE_BUFFER_IMPL_H_