What is the best place to report bugs? Here is an ...
# compose-desktop
a
What is the best place to report bugs? Here is an obvious one. Without override it get guaranteed SO.
a
a
OK. It seems a bit too clogged.
Ah, as I expected the problem seems to be in the upstream compose core
Actually, while I am here. Canvas API seems to be a mess. It requires major rework.
a
What is the file?
a
androidx\compose\ui\graphics\drawscope\DrawScope
a
a
I do not work on Android so it is hard for me to track it. I am currently doing a simple SVG backend for canvas to be able to export something. And it is clear that there are a lot of design problems in the API. I will publish the results so maybe people from Google can look at it. The problem with infinite recursion is rather minor compared to everything else.
a
Since it's a common API, it's still primarily maintained by Google. So reporting bugs via the buganizer would be a good idea. For feedback you could also try #compose channel, there are many Googlers from Compose team there.
m
@altavir What exactly are your complaints about the Canvas (which canvas actually. DrawScope, Canvas or native Canvas).
a
The problem is that there is a lot of duplicating behavior. Canvas and DrawScope do the same thing, but use different arguments and it does not seem to be possible to reimplement only one of them. Also there is DrawContext that does not have any meaning at all. There are also parts of internal API like Matrix dangling randomly from some places.
Some things could not be achieved without casting a Canvas to specific type of native canvas and obviously the only native canvas hardcoded there is the skia canvas.
Also Path could not be accessed without casting it to Skia path.
m
I also had to use some SVG recently (in an app for desktop, android and ios) and found that three different parsers where needed to do that and none of them could render directly into a Compose canvas. Are you planning anything in that direction?
a
I've actually already done that 🙂 Adding some finishing touches right now. It does not fully support all features, but at least those that I need are working. I will finish the code today and add a link here.
m
That would be great.
By the way, did you have a look at the native Skia SVG? I now use that instead of the Batik stuff on desktop.
a
I took a look, but did not find it Useful. I used JFreeSVG instead.
m
Oh god, that would be the fourth one 😉🙃.
Some canvas features like layers are missing, but most of it works fine.
m
Thanks, I’ll have a look.
a
We can create a separate library from that. Right now I need that scheme features are working.
l
I think DrawScope is a better functional abstraction layer wrapping Canvas that platforms use to implement the actual behavior for each Paints, and you see Canvas can be a single one that gets passed around DrawEntities while DrawScope may have plenty.
a
Well, in practice in order to use them, one needs to duplicate the functionality thrice: in Canvas, DrawScope and DrawContext. The latest could be delegated, but it does not really help. Also there is no way (without hacks) to implement rendering for Path. Because Path does not provide a way to read its content.
l
I imagine one could only implement Canvas? Also yeah Path is surely an expect thing.
a
No, you can't implement only canvas because DrawScope does not delegate to canvas by default. Only for some specific methods. As for Path I am not sure how it is "expected".
l
oh that's unfortunate
If you mention Path then ShaderBrush is also a 😶
a
Yes, but this does seem to be expected. Shader depend on the platform after all.
l
Maybe google has not come up with a clean idea for Path.
They're not that abstract after all.
a
It looks like it just requires a cleanup. It obviously was designed with single implementation in mind.
Is this still there?
a
Don't know. Have not worked with animations yet
l
Is this still there?
Confirmed that this still remains unfixed. Surprised that no one gets affected.