0

I was trying to set image on tizen native widget but I dont know how to retrieve path and apply it. Below is my try:

//image
                char full_path[PATH_MAX] = { 0, };
                data_get_resource_path("images/testimg.png", full_path, (int) PATH_MAX); //getting error here.



                    Evas_Object *image;
                    image = elm_image_add(wid->conform);

                    elm_object_item_data_set(image, full_path); //how to set path?

                    elm_image_no_scale_set(image, EINA_TRUE);
                    elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE);
                    /* Tell the image to keep original aspect ratio */
                    elm_image_aspect_fixed_set(image, EINA_TRUE);
                    /* Then let the image fill the entire object */
                    elm_image_fill_outside_set(image, EINA_TRUE);

                    evas_object_show(image);

Tried from doc of image from tizen dev website, no information exclusively for path setting.

How can I add a simple image and show it?

Rifat
  • 1,700
  • 3
  • 20
  • 51

1 Answers1

0

You can use relative file paths and set image files to efl object.

There are many sample applications. For example, BuddyUI Sample Application show how to get image file path

A image file is in res/images/wc_contact_bg.png.

#define IMAGE_CONTACT_BG "images/wc_contact_bg.png"

static bool app_create(void *user_data)
{
    Evas_Object *win = NULL;
    Eina_List *item_list = NULL;
    Evas_Object *main_view_layout = NULL;
    Evas_Object *naviframe = NULL;
    int item_count = 0;
    int i = 0;
    char default_img_path[PATH_MAX] = { 0, };
    char edj_path[PATH_MAX] = { 0, };

    data_get_resource_path(EDJ_FILE, edj_path, sizeof(edj_path));
    data_get_resource_path(IMAGE_CONTACT_BG, default_img_path, sizeof(default_img_path));

You can get the absolute path to the application resource directory by app_get_resource_path.

void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max)
{
    char *res_path = app_get_resource_path();
    if (res_path) {
        snprintf(file_path_out, file_path_max, "%s%s", res_path, file_in);
        free(res_path);
    }
}

You can find a lot of information at the link below.
File System Directory Hierarchy

msalt.net
  • 106
  • 7