How to display SVG?

喜欢而已 提交于 2021-02-17 06:44:05

问题


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:

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)?


回答1:


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);



来源:https://stackoverflow.com/questions/65949611/how-to-display-svg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!