Is there an equivalent of elm_object_part_text_set() for Image parts in EDC files?

Original Created Apr 14, 2017 | Regeneration Apr 22, 2026

I have an EDC file with both text and image parts. For text parts, I can easily modify the content at runtime using elm_object_part_text_set(watchface_layout, "txt_title", "Change text").

However, I need to perform similar modifications for image parts - specifically to rotate images or change their opacity. The image part is defined in the EDC file as follows:

part {
    name: "image_example";
    type: IMAGE;
    scale: 1.0;
    description {
        state: "default" 0.0;
        visible: 1;
        max: 360 360;
        image.normal: "example.png";
        align: 0.5 0.5;
        rel1.relative: 0.00 0.00;
        rel2.relative: 1.00 1.00;
        map {
            on: 1;
            rotation {
                x: 0.0;
                y: 0.0;
                z: 0.0;
            }
        }
    }
}

How can I get a handle to this image defined in the EDC file to modify its properties during runtime? I've only found methods to manipulate images created during runtime, not those defined in EDC files.

Problem Understanding

The user wants to manipulate image parts defined in EDC files at runtime, similar to how text parts can be modified using elm_object_part_text_set(). Specifically, they need to rotate images and change their opacity.

Solution Methods

  1. Using Elementary Image API:

    • You can access and manipulate image parts using the Elementary Image API functions.
    • First, get the image object using elm_object_part_content_get().
    • Then apply transformations using appropriate API functions.
  2. Rotation Example:

    Evas_Object *img = elm_object_part_content_get(watchface_layout, "image_example");
    if (img) {
        elm_image_orient_set(img, ELM_IMAGE_ROTATE_90);
    }
    
  3. Opacity Example:

    Evas_Object *img = elm_object_part_content_get(watchface_layout, "image_example");
    if (img) {
        evas_object_color_set(img, 255, 255, 255, 128); // 50% opacity
    }
    

Code Examples

Complete example for rotating an image:

Evas_Object *img = elm_object_part_content_get(watchface_layout, "image_example");
if (img) {
    // Rotate 90 degrees clockwise
    elm_image_orient_set(img, ELM_IMAGE_ROTATE_90);
    
    // Set 50% opacity
    evas_object_color_set(img, 255, 255, 255, 128);
}

Additional Tips

  • Remember to check if the image object is valid before applying transformations.
  • For more advanced image manipulation, consider using Evas Object functions.
  • The Elementary Image API provides additional functions for scaling, flipping, and other transformations.

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.