For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.
The current graphical backend and the C++ frontend are not yet supported
The generation is still incomplete, but this change passes them to the C++ generator
when not inlining.
Another option would've been a "inline: bool", but that won't suffice in
the future when we may want to use heuristics to selectively inline some
and others not. And always taking used_types.sub_components is wrong
when inlining as those are ... inlined.
This is a two-stage change, that first centralizes the file I/O code
path for on-disk and builtin:/ files. Secondly the resource embedding
pass now produces diagnostics if a file cannot be located.
For loading images that are included in the widget library that's included in turn
in the compiler binary, we need to create ImageInner::EmbeddedData
with &'static data and &'static file extension. The latter was
created using string interning, but we can also access the path of the
widget library data structure.
Currently, it is a bit limited in the amount of property that it removes
because it will not remove property that are used by properties being
removed, or will consider setting properties as an usage
We need to do the ensure_window pass before the binding_analysis
otherwise the with and height property of the root element
will be considered as constant and will not adapt to the window size.
Unfortunately we can't really test that now because our test system
doesn't really test the Window, but here is a testcase:
```
MainWindow := Rectangle {
preferred-width: 400px;
preferred-height: 400px;
background: yellow;
VerticalLayout {
Rectangle {
background: red;
Text { text: root.width / 1px; }
}
}
}
```
(we should see the red rectangle)
The pass must be done at the begining so that synthetised property don't
become public, and also so that analyses pass can use the public api information
This removes the need to manually register fonts. This is initially
applied to the printer demo, but the other demos and removal of the
public manual registration API will come in follow-up commits.
This reverts commit 2dcbc45cd6.
It breaks loading of the printer demo in the editor because in
import_file we fail to return the absolute path and thus end up
importing common.60 too many times.