[JungWooHyun] doing merge job ~
[framework/uifw/elementary.git] / src / examples / image_example_01.c
1 //Compile with:
2 //gcc -g `pkg-config --cflags --libs elementary` image_example_01.c -o image_example_01
3
4 #include <Elementary.h>
5 #ifdef HAVE_CONFIG_H
6 # include "elementary_config.h"
7 #else
8 # define __UNUSED__
9 # define PACKAGE_DATA_DIR "."
10 #endif
11
12 int
13 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
14 {
15    Evas_Object *win, *bg, *image;
16    char buf[PATH_MAX];
17
18    win = elm_win_add(NULL, "image", ELM_WIN_BASIC);
19    elm_win_title_set(win, "Image");
20    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
21    elm_win_autodel_set(win, EINA_TRUE);
22
23    bg = elm_bg_add(win);
24    elm_bg_color_set(bg, 255,255 ,255);
25    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
26    elm_win_resize_object_add(win, bg);
27    evas_object_show(bg);
28
29    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
30
31    image = elm_image_add(win);
32    if (!elm_image_file_set(image, buf, NULL))
33      {
34         printf("error: could not load image \"%s\"\n", buf);
35         return -1;
36      }
37
38    elm_image_no_scale_set(image, EINA_TRUE);
39 <<<<<<< HEAD
40    elm_image_scale_set(image, EINA_FALSE, EINA_TRUE);
41 =======
42    elm_image_resizable_set(image, EINA_FALSE, EINA_TRUE);
43 >>>>>>> remotes/origin/upstream
44    elm_image_smooth_set(image, EINA_FALSE);
45    elm_image_orient_set(image, ELM_IMAGE_FLIP_HORIZONTAL);
46    elm_image_aspect_fixed_set(image, EINA_TRUE);
47    elm_image_fill_outside_set(image, EINA_TRUE);
48    elm_image_editable_set(image, EINA_TRUE);
49
50    evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51    elm_win_resize_object_add(win, image);
52    evas_object_show(image);
53
54    evas_object_size_hint_min_set(bg, 160, 160);
55    evas_object_size_hint_max_set(bg, 640, 640);
56    evas_object_resize(win, 320, 320);
57    evas_object_show(win);
58
59    elm_run();
60
61    return 0;
62 }
63
64 ELM_MAIN()