This example is as simple as possible. An icon object will be added to the window over a white background, and set to be resizable together with the window. All the options set through the example will affect the behavior of this icon.
We start with the code for creating a window:
Now we create the icon object, and set lookup order of the icon, and choose the "home" icon:
An interesting thing is that after setting this, it's possible to check where in the filesystem is the theme used by this icon, and the name of the group used:
We can now go setting our options.
elm_image_no_scale_set() is used just to set this value to true (we don't want to scale our icon anyway, just resize it).
elm_image_resizable_set() is used to allow the icon to be resized to a size smaller than the original one, but not to a size bigger than it.
elm_image_smooth_set() will disable the smooth scaling, so the scale algorithm used to scale the icon to the new object size is going to be faster, but with a lower quality.
elm_image_fill_outside_set() is used to ensure that the icon will fill the entire area available to it, even if keeping the aspect ratio. The icon will overflow its width or height (any of them that is necessary) to the object area, instead of resizing the icon down until it can fit entirely in this area.
This is the code for setting these options:
However, if you try this example you may notice that this image is not being affected by all of these options. This happens because the used icon will be from elementary theme, and thus it has its own set of options like smooth scaling and fill_outside options. You can change the "home" icon to use some image (from your system) and see that then those options will be respected.
Now some last touches in our object size hints, window and background, to display this icon properly:
This example will look like this: