Canvas* pCanvas = null;
AnimationFrame* pFrame = null;
Bitmap* pBitmap = null;
+ String imagePath = L"";
pFrame = GetCurrentFrame();
SysTryCatch(NID_UI_CTRL, pFrame != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get the current animation frame.");
if (pBitmap != null)
{
- pCanvas = __pAnimation->GetCanvasN();
-
- SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error has occurred. Failed to get the animation canvas.");
-
- pCanvas->SetBackgroundColor(Color());
- pCanvas->Clear();
+ if (!_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
+ {
+ imagePath = _BitmapImpl::GetInstance(*pBitmap)->GetFileName();
+ }
- if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
+ if(!imagePath.IsEmpty())
{
- r = pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBitmap);
+ __pVisualElement->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
+ __pVisualElement->SetImageSource(imagePath);
}
else
{
- r = pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBitmap);
- }
+ __pVisualElement->SetImageSource(L"");
+ pCanvas = __pAnimation->GetCanvasN();
+
+ SysTryReturnResult(NID_UI_CTRL, pCanvas != null, E_SYSTEM, "A system error has occurred. Failed to get the animation canvas.");
+
+ pCanvas->SetBackgroundColor(Color());
+ pCanvas->Clear();
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to draw the bitmap", GetErrorMessage(r));
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
+ {
+ r = pCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBitmap);
+ }
+ else
+ {
+ r = pCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, bounds.width, bounds.height), *pBitmap);
+ }
+
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to draw the bitmap", GetErrorMessage(r));
+ }
}
CATCH:
if (pBackgroundBitmap)
{
- Canvas* pCanvas = __pSearchBar->GetCanvasN();
- r = GetLastResult();
- SysTryReturn(NID_UI_CTRL, (pCanvas != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
+ String imagePath = L"";
- pCanvas->SetBackgroundColor(bgColor);
- pCanvas->Clear();
+ if (!_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBackgroundBitmap))
+ {
+ imagePath = _BitmapImpl::GetInstance(*pBackgroundBitmap)->GetFileName();
+ }
- if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBackgroundBitmap))
+ if(!imagePath.IsEmpty())
{
- pCanvas->DrawNinePatchedBitmap(bounds, *pBackgroundBitmap);
+ __pSearchBar->GetVisualElement()->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255, (float)bgColor.GetGreen() / 255, (float)bgColor.GetBlue() / 255, (float)bgColor.GetAlpha() / 255));
+ __pSearchBar->GetVisualElement()->SetImageSource(imagePath);
}
else
{
- pCanvas->DrawBitmap(bounds, *pBackgroundBitmap, FloatRectangle(0.0f, 0.0f, pBackgroundBitmap->GetWidthF(), pBackgroundBitmap->GetHeightF()));
- }
+ __pSearchBar->GetVisualElement()->SetImageSource(L"");
+ Canvas* pCanvas = __pSearchBar->GetCanvasN();
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, (pCanvas != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
- delete pCanvas;
+ pCanvas->SetBackgroundColor(bgColor);
+ pCanvas->Clear();
+
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBackgroundBitmap))
+ {
+ pCanvas->DrawNinePatchedBitmap(bounds, *pBackgroundBitmap);
+ }
+ else
+ {
+ pCanvas->DrawBitmap(bounds, *pBackgroundBitmap, FloatRectangle(0.0f, 0.0f, pBackgroundBitmap->GetWidthF(), pBackgroundBitmap->GetHeightF()));
+ }
+
+ delete pCanvas;
+ }
}
else
{