bool imageScaling(true);
_AppResourceBitmapUtil::_Density resourceDensity = _AppResourceBitmapUtil::DENSITY_NONE;
- result r = __pAppResourceBitmapUtil->GetResourcePath(imageFileName, resourcePath, resourceDensity, imageScaling);
- SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- SysTryReturn(NID_APP, resourcePath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "[E_FILE_NOT_FOUND] The specified file does not exist.");
-
+ result r = E_SUCCESS;
+ if(__pAppResourceBitmapUtil->GetAppResourceType() != _AppResourceBitmapUtil::APP_RESOURCE_BITMAP)
+ {
+ r = __pAppResourceBitmapUtil->GetResourcePath(imageFileName, resourcePath, resourceDensity, imageScaling);
+ SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ SysTryReturn(NID_APP, resourcePath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "[E_FILE_NOT_FOUND] The specified file does not exist.");
+ }
+ else
+ {
+ resourcePath = imageFileName;
+ imageScaling = false;
+ pixelFormat = BITMAP_PIXEL_FORMAT_ARGB8888;
+ }
// GetBitmapN
Bitmap* pBitmap = null;
_AppResourceBitmapUtil::GetInstanceN(int type, const String& value)
{
String resourceFolder(L"");
+ Tizen::App::_AppResourceBitmapUtil::AppResourceBy appResourceType = _AppResourceBitmapUtil::APP_RESOURCE_DEFAULT;
switch(type)
{
+ case _AppResourceBitmapUtil::APP_RESOURCE_BITMAP:
+ appResourceType = _AppResourceBitmapUtil::APP_RESOURCE_BITMAP;
+ break;
case _AppResourceBitmapUtil::APP_RESOURCE_DEFAULT:
//fall through
case _AppResourceBitmapUtil::APP_RESOURCE_BY_LIBRARY_NAME:
resourceFolder.Append(L'/');
}
break;
-
case _AppResourceBitmapUtil::APP_RESOURCE_BY_APP_ID:
std::unique_ptr< PackageInfo> pPkgInfo(_PackageManagerImpl::GetInstance()->GetPackageInfoN(value));
SysTryReturn(NID_APP, pPkgInfo != null, null, E_APP_NOT_INSTALLED, "[E_APP_NOT_INSTALLED] Failed to get the package info.");
std::unique_ptr< _AppResourceBitmapUtil > pAppResourceBitmapUtil(new (std::nothrow) _AppResourceBitmapUtil());
SysTryReturn(NID_APP, pAppResourceBitmapUtil != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient." );
+ pAppResourceBitmapUtil->__resourceType = appResourceType;
+
result r = pAppResourceBitmapUtil->Construct(resourceFolder);
SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] Failed to construct _AppResourceBitmapUtil.", GetErrorMessage(r));
result
_AppResourceBitmapUtil::Construct(const String& resourceFolder)
{
+ if (__resourceType == _AppResourceBitmapUtil::APP_RESOURCE_BITMAP)
+ {
+ SysLog(NID_APP, "This is a BitmapUtil for getting a non-scaling bitmap resource");
+ return E_SUCCESS;
+ }
+
int deviceDPI = 0;
result r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/screen.dpi", deviceDPI);
SysTryReturnResult(NID_APP, r == E_SUCCESS, r, "[%s] Failed to get Screen DPI", GetErrorMessage(r));
return pBitmap.release();
}
+Tizen::App::_AppResourceBitmapUtil::AppResourceBy
+_AppResourceBitmapUtil::GetAppResourceType(void)
+{
+ return __resourceType;
+}
+
}} // Tizen::App
{
APP_RESOURCE_DEFAULT,
APP_RESOURCE_BY_APP_ID,
- APP_RESOURCE_BY_LIBRARY_NAME
+ APP_RESOURCE_BY_LIBRARY_NAME,
+ APP_RESOURCE_BITMAP
};
// This is the default constructor for this class.
static _AppResourceBitmapUtil* GetInstanceN(int type = APP_RESOURCE_DEFAULT, const Tizen::Base::String& value = L"");
+ Tizen::App::_AppResourceBitmapUtil::AppResourceBy GetAppResourceType(void);
+
private:
// This is the copy constructor for this class.
_AppResourceBitmapUtil(const _AppResourceBitmapUtil& rhs);
_Density __sortedDensity[DENSITY_MAX];
Tizen::Base::String __sortedDensityDirectories[DENSITY_MAX];
+ Tizen::App::_AppResourceBitmapUtil::AppResourceBy __resourceType;
+
}; // _AppResourceBitmapUtil
}} // Tizen::App