Hi,
I follow the tutorials to display an image using the `elm_image_add` function to put an image in background of the default Watch Face template provided in Tizen Studio 4.1
But I can't get to have it displayed. Here are the main parts of the application. The load_image receives the application `appdata` which has a reference to the `win` window object and also the `conform` conformant object. But the image is not displayed (note the `elm_image_file_set` is returning `true`.
#define IMG_DIR "/opt/usr/apps/com.example.app-id/res/images"
static bool load_image(appdata_s *ad) {
char filename[PATH_MAX];
snprintf(filename, sizeof(filename), "%s/jsc-watch-face.png", IMG_DIR);
ad->image = elm_image_add(ad->conform);
elm_image_file_set(ad->image, filename, NULL);
elm_image_no_scale_set(ad->image, EINA_TRUE);
elm_image_resizable_set(ad->image, EINA_TRUE, EINA_TRUE);
elm_image_aspect_fixed_set(ad->image, EINA_TRUE);
elm_image_fill_outside_set(ad->image, EINA_TRUE);
elm_image_preload_disabled_set(ad->image, EINA_TRUE);
return true;
}
Then in the `create_base_gui` function I added the Image section and call to `evas_object_show` to show the image:
static void create_base_gui(appdata_s *ad, int width, int height) {
int ret;
watch_time_h watch_time = NULL;
/* Window */
ret = watch_app_get_elm_win(&ad->win);
if (ret != APP_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "failed to get window. err = %d", ret);
return;
}
evas_object_resize(ad->win, width, height);
/* Conformant */
ad->conform = elm_conformant_add(ad->win);
evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
elm_win_resize_object_add(ad->win, ad->conform);
evas_object_show(ad->conform);
/* Label*/
ad->label = elm_label_add(ad->conform);
evas_object_resize(ad->label, width, height / 3);
evas_object_move(ad->label, 0, height / 3);
evas_object_show(ad->label);
/* Image */
load_image(ad);
evas_object_show(ad->image);
ret = watch_time_get_current_time(&watch_time);
if (ret != APP_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "failed to get current time. err = %d",
ret);
update_watch(ad, watch_time, 0);
watch_time_delete(watch_time);
/* Show window after base gui is set up */
evas_object_show(ad->win);
}
The image is not displayed. Anything I am doing wrong?