Languages

Menu
Sites
Language
How to set background image to my native app
Edited by: saranya tayi on 22 Aug, 2013

Responses

6 Replies
Siddharth Singh
U can do that by using Canvas class as follows: AppResource *pAppResource = Application::GetInstance()->GetAppResource(); Bitmap* pBitmap1 = pAppResource->GetBitmapN(L"sample.JPG"); //the image u want to set as background Canvas* pCanvas = GetCanvasN(); if (pCanvas != null) { // add your drawing code here pCanvas->DrawBitmap(Rectangle(0, 0,720,1280), *pBitmap1); }
Chintan Gandhi
Hi Sarnaya, Image image; image.Construct(); String filepath = App::GetInstance()->GetAppResourcePath() + L"/background.jpg"; __pTizenBitmap = image.DecodeN(filepath, BITMAP_PIXEL_FORMAT_ARGB8888); __pForm->DrawBitmap(Rectangle(0,0,_bounds.width,_bounds.height),*__pTizenBitmap); The above hint should work...create an instance for image....set a filepath....decode it and then use it in your respective container... and _bounds =__pForm->GetBounds(); NOTE: here "background.jpg" is the name of the image file which should be present in your "res" folder.
Use label as a background image
Md. Yeasir Arafat

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;

 }
 
Md. Yeasir Arafat

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; }

Adam P.

Hi,

Don't do it this way - a background image should be inserted only once, at the beginning of your drawing, if you put it in the OnDraw() method it will keep being redrawn EVERY SINGLE TIME.