godot: ImageLoaderSVG: Couldn't set target on ThorVG canvas.

Godot version

4.0.beta16

System information

Windows 10, Vulkan, NVIDIA GeForce GTX 1050

Issue description

Importing SVG’s from Kenney.NL fails with the following message:

  ImageLoaderSVG: Couldn't set target on ThorVG canvas.
  core/io/image_loader.cpp:101 - Error loading image: res://assets/icons/skull.svg
  editor/editor_file_system.cpp:2004 - Error importing 'res://assets/icons/skull.svg'.

Steps to reproduce

  1. Grab icons from Kenney.NL here: https://www.kenney.nl/assets/board-game-icons
  2. Try importing an .svg from it
  3. The process will fail: image

Minimal reproduction project

N/A

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 37 (21 by maintainers)

Commits related to this issue

Most upvoted comments

@mgrudzinska update: Both current godot 26fb911f79d7b16c46ca476923fe1f32ab5d27ed and thorvg 65116b87ada27689d79fa4db241cf777f3b268c5 github tip work together (the crash/dealock has been fixed). If the changes are in your next release, I don’t see any issues.

@mgrudzinska everything related to the image size and empty viewport/viewbox seems to be ok now. I have not yet received a response to #75034, I hope that one day it will be fixed too πŸ˜ƒ

image

great, so I’ll take care now of this one extra pixel

@mgrudzinska

I hope that I’ve misunderstood - all of the images have a size equal 0? even if it shouldn;t be?

Most images show a picture πŸ‘ I didn’t examine if they are correct cropped. The 0 size is no longer a bug after this patch. It renders 1 pixel images in this case.

From all test images, I posted:

The 0 size cases are: <svg width=β€œ0”> (the Gnome Image Viewer: whole picture) -> t8.svg <svg viewBox=β€œ0 0 0 200”> (giv: 1 pixel) <svg viewBox=β€œ0 0 200 0”> (giv: 1 pixel) <svg viewBox=β€œ0 0 0 0”> (giv: 1 pixel) <svg width=β€œ0” height=β€œ0” viewBox=β€œ0 0 200 200”> (giv: 1 pixel) <svg width=β€œ0” height=β€œ200” viewBox=β€œ0 0 20 20”> (giv: 1 pixel) same: <svg width=β€œ0” height=β€œ200” viewBox=β€œ0 0 200 200”> <svg width=β€œ200” height=β€œ0” viewBox=β€œ0 0 20 20”>

This renders a transparent 200x200 sized images (giv: 200x200 cropped picture): <svg width=β€œ200” height=β€œ200” viewBox=β€œ0 0 0 0”> <svg width=β€œ200” height=β€œ200” viewBox=β€œ0 0 0 200”> <svg width=β€œ200” height=β€œ200” viewBox=β€œ0 0 200 0”>

</details

@mgrudzinska I haven’t had a chance to read through the code yet, had only a quick look at the SVG specs and Godot results with the last pr. The spec is, as you said, very css specific. Here, he also suggests, missing SVG size attributes should mean auto, so the whole image here, Godot now shows only 1x1 px image.

I missed this, I’ll solve this asap and let you know

@capnm I’ll try to make the pr ready asap - it is after rev and waiting for some changes.