如何显示SVG? [英] How to display SVG?

查看:70
本文介绍了如何显示SVG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 SVG,想用 EDC 显示它:

<路径d=M180 0 L80 300 L280 300 Z"填充=#ff0000"/></svg>

这很简单:

我的 EDC:

集合{团体 {名称:主要";图片 {矢量:simple.svg";}部分 {向量{测试";desc {默认";image.normal: simple.svg";}}}}}

目标是 Tizen 5.5 可穿戴设备.整个屏幕都是黑色的.如何显示此 SVG(如果我不想将其转换为 PNG)?

解决方案

输出 SVG 文件有两种方式.一种方法是使用 EDC 的 VECTOR 部分,另一种方法是使用 elm_animation_view(tizen 5.5 或更高版本).参考这个

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

解决方案

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

这篇关于如何显示SVG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆