I have been trying to set background image in Tizen Native app but have not been successful so far.
I have tried doing the same through Canvas and Bitmap but its not working,though i am not getting any error.
I am using the below code in the OnInitializing function of my form.
AppResource *pAppResource = Application::GetInstance()->GetAppResource();
Bitmap* pBitmap1 = pAppResource->GetBitmapN(L"image.png");
Canvas *pCanvas = new Canvas();
pCanvas->Construct();
pCanvas->DrawBitmap(Point(0,0), *pBitmap1);
pCanvas->Show();
Any idea what could be the issue or any other simpler way of doing the same?
Thanks,
Use GetCanvasN() method from your form.
use OnDraw to draw the background
result TizenForm::OnDraw()
{
result r=E_SUCCESS;
Canvas* pCanvas;
if (__pFormBitmap)
{
pCanvas = this->GetCanvasN();
pCanvas->DrawBitmap(Point(0, 0), *__pFormBitmap);
}
delete pCanvas;
return r;
}
Add a folder named "screen-density-xhigh" to the resource folder and store image to this folder that you want to set as application background. Now declare result type onDraw() function into the application header.Now implement the code bellow to the .cpp file of this form.
result TizenForm::OnDraw()
{
result r = E_UNKNOWN;
AppResource *pAppResource = Application::GetInstance()->GetAppResource();
Bitmap* pBitmap1 = pAppResource->GetBitmapN(L"backgroundImage.jpg");
Canvas* pCanvas = GetCanvasN();
if (pCanvas != null)
{
pCanvas->DrawBitmap(Rectangle(0, 0,720,1280), *pBitmap1);
}
return r;
}