如何显示SVG?
How to display SVG?
我有一个简单的 SVG,想用 EDC 显示它:
<svg width="360" height="360" viewBox="0 0 360 360">
<path d="M180 0 L80 300 L280 300 Z" fill="#ff0000"/>
</svg>
就这么简单:
我的 EDC:
collections {
group {
name: "main";
images {
vector: "simple.svg";
}
parts {
vector { "test";
desc { "default";
image.normal: "simple.svg";
}
}
}
}
}
目标是 Tizen 5.5 可穿戴设备。整个屏幕是黑色的。如何显示此 SVG(如果我不想将其转换为 PNG)?
有两种方法可以输出 SVG 文件。一种方法是使用 EDC 的 VECTOR
部分,另一种方法是使用 elm_animation_view
(tizen 5.5 或更高版本)。
参考这个
https://docs.tizen.org/application/native/api/mobile/5.5/group__Elm__Animation__View.html
[edc]
做一个SWALLOW
部分
collections {
group { name: "main";
parts {
part {
name: "svgfile";
type: SWALLOW;
}
}
}
}
[c代码]
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);
我有一个简单的 SVG,想用 EDC 显示它:
<svg width="360" height="360" viewBox="0 0 360 360">
<path d="M180 0 L80 300 L280 300 Z" fill="#ff0000"/>
</svg>
就这么简单:
我的 EDC:
collections {
group {
name: "main";
images {
vector: "simple.svg";
}
parts {
vector { "test";
desc { "default";
image.normal: "simple.svg";
}
}
}
}
}
目标是 Tizen 5.5 可穿戴设备。整个屏幕是黑色的。如何显示此 SVG(如果我不想将其转换为 PNG)?
有两种方法可以输出 SVG 文件。一种方法是使用 EDC 的 VECTOR
部分,另一种方法是使用 elm_animation_view
(tizen 5.5 或更高版本)。
参考这个
https://docs.tizen.org/application/native/api/mobile/5.5/group__Elm__Animation__View.html
[edc]
做一个SWALLOW
部分
collections {
group { name: "main";
parts {
part {
name: "svgfile";
type: SWALLOW;
}
}
}
}
[c代码]
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);