return r;
}
+
+
+
+
+result
+ImageBuffer::Construct(const Tizen::Base::String &srcImagePath,
+ int destWidth, int destHeight, ImageScalingMethod scalingMethod)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pImpl == null,
+ "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ SysTryReturnResult(NID_MEDIA, !srcImagePath.IsEmpty(), E_INVALID_ARG,"path is empty.");
+
+ SysTryReturnResult(NID_MEDIA, File::IsFileExist(srcImagePath), E_FILE_NOT_FOUND,
+ "file not found: %ls", srcImagePath.GetPointer());
+
+ _ImageBufferImpl* pImageBufferImpl = new (std::nothrow) _ImageBufferImpl();
+ SysTryReturnResult(NID_MEDIA, pImageBufferImpl != null, E_OUT_OF_MEMORY, "Create instance failed.");
+
+ r = pImageBufferImpl->Construct(srcImagePath, destWidth, destHeight, scalingMethod);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , GetLastResult(),
+ "[%s] Construct instance failed.", GetErrorMessage(GetLastResult()));
+
+ __pImpl = pImageBufferImpl;
+ return r;
+
+CATCH:
+ if (pImageBufferImpl != null)
+ {
+ delete pImageBufferImpl;
+ pImageBufferImpl = null;
+ }
+ return r;
+}
+
+result
+ImageBuffer::Construct(const Tizen::Base::ByteBuffer &srcImageBuf,
+ int destWidth, int destHeight, ImageScalingMethod scalingMethod)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pImpl == null,
+ "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ SysTryReturnResult(NID_MEDIA, &srcImageBuf != null, E_INVALID_ARG,
+ "src buffer is null");
+
+ _ImageBufferImpl* pImageBufferImpl = new (std::nothrow) _ImageBufferImpl();
+ SysTryReturnResult(NID_MEDIA, pImageBufferImpl != null, E_OUT_OF_MEMORY, "Create instance failed.");
+
+ r = pImageBufferImpl->Construct(srcImageBuf, destWidth, destHeight, scalingMethod);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r,
+ "[%s] Construct instance failed.", GetErrorMessage(r));
+
+ __pImpl = pImageBufferImpl;
+ return r;
+
+CATCH:
+ if (pImageBufferImpl != null)
+ {
+ delete pImageBufferImpl;
+ pImageBufferImpl = null;
+ }
+ return r;
+}
+
+
+ExifOrientation
+ImageBuffer::GetExifOrientation(void) const
+{
+ SysAssertf(__pImpl != null,
+ "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetExifOrientation();
+}
+
bool
ImageBuffer::Equals(const Object& rhs) const
{
return __pImpl->GetBitmapN(pixelFormat, bufferScaling);
}
+Bitmap*
+ImageBuffer::GetBitmapN(BitmapPixelFormat pixelFormat, float destWidth, float destHeight) const
+{
+ SysAssertf(__pImpl != null,
+ "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetBitmapN(pixelFormat, FloatDimension(destWidth, destHeight));
+}
+
ByteBuffer*
ImageBuffer::GetByteBufferN(MediaPixelFormat pixelFormat) const
{