Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
331 views
in Technique[技术] by (71.8m points)

tizen - How to display SVG?

I have a simple SVG and want to display it with EDC:

<svg width="360" height="360" viewBox="0 0 360 360">
    <path d="M180 0 L80 300 L280 300 Z" fill="#ff0000"/>
</svg>

This is just as simple:

enter image description here

My EDC:

collections {
   group { 
      name: "main";

      images {
         vector: "simple.svg";
      }

      parts {
         vector { "test";
            desc { "default"; 
               image.normal: "simple.svg";
            }
         }         
      }
   }
}

Target is Tizen 5.5 wearable. Whole screen is black. How can I display this SVG (if I don't want to convert it to PNG)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There are two ways to output SVG files. One way is to use the VECTOR part of EDC and the other is to use elm_animation_view (tizen 5.5 or higher). Refer to this https://docs.tizen.org/application/native/api/mobile/5.5/group__Elm__Animation__View.html

[edc] Make a SWALLOW part

collections {
   group { name: "main";
      parts {
         part {
              name: "svgfile";
              type: SWALLOW;
         }
      }
   }
}

[c code]

    char buf[255];
    sprintf(buf, /*Resource PATH*/);
    
    Evas_Object *anim = elm_animation_view_add(layout);
    elm_animation_view_file_set(anim, buf, NULL);
    evas_object_size_hint_weight_set(anim, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(anim, EVAS_HINT_FILL, EVAS_HINT_FILL);
    elm_object_part_content_set(layout, "svgfile", anim);

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...