Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

外部加载资源 #2

Open
joyhope opened this issue Jun 30, 2021 · 5 comments
Open

外部加载资源 #2

joyhope opened this issue Jun 30, 2021 · 5 comments

Comments

@joyhope
Copy link

joyhope commented Jun 30, 2021

svg_image.c ,我尝试外部加载

image = svg_image_create(win, 10, 10, 200, 200);
if (RET_OK!=image_set_image(image, "file:///res/girl.svg")) //我copy了girl.svg到 res的目录下,但是无法显示出需要的内容。
{
log_debug("image_set_image failure\n");
}

应该如何加载外部资源?

@xianjimli
Copy link
Member

svg要用bsvggen生成二进制格式才能显示

 ./bin/bsvggen foo.svg. foo.bsvg bin

@joyhope
Copy link
Author

joyhope commented Jul 1, 2021

image = svg_image_create(win, 10, 10, 200, 200);
image_set_image(image, "file://girl.bsvg")) // 和 demo_svg_image在一个目录下 就是在 bin下,正常

image_set_image(image, "file://res/girl.bsvg")) // 必须是 bin/demo_svg_image 执行正常。 说明项目的根目录以执行目录为参照点。

程序执行时候日志: app_root=../res 是什么含义, 这个感觉是 把执行根设置到了res 为执行目录点,这样和 可以部署在 bin/girl.bsvg 才能执行有矛盾了。 而 girel.bsvg 在/res下不能执行正常。

这个app_root 的输出含义能否介绍一下。

@xianjimli
Copy link
Member

为什么放到res目录下,又要用外部资源。直接放在design/default/images/svg目录不就好了吗。

@xianjimli
Copy link
Member

外部资源,最好用绝对路径。

@joyhope
Copy link
Author

joyhope commented Jul 1, 2021

新手,还没开始用design这个工具。理解了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants