1

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,

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179
ani
  • 11
  • 1
  • 4
  • I checked more on this the function pCanvas->Show() is throwing the following error : E_UNSUPPORTED_OPERATION. – ani Jul 29 '13 at 09:03

3 Answers3

0

Use GetCanvasN() method from your form.

kTT
  • 1,340
  • 11
  • 19
  • I am getting following error on using GetCanvasN() method :non-static member 'GetCanvasN' found in multiple base-class subobjects of type 'Tizen::Ui::Control': – ani Jul 29 '13 at 11:39
0

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;
}
  • I have 2 forms in my project : Main & Gamescreen. Its working fine for main but for Gamescreen its giving the error : ambiguous conversion from derived class 'Gamescreen' to base class 'Tizen::Ui::Control'.Whats wrong? – ani Jul 30 '13 at 04:41
0

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;

 }
yeasir007
  • 2,110
  • 2
  • 28
  • 43