Michael Brown
Michael Brown

Reputation: 1

How to get the information necessary from a Widget's paint to convert to SVG

I'm looking into a proof of concept for writing a Widget -> SVG converter in Flutter. My idea is to implement a custom Canvas which will build the SVG when painted to by the Widget's RenderBox (kind of similar to what the TestRecordingCanvas does when testing). The problem is, there seems to be key information missing from the types passed into the Canvas methods.

I've tried to extract all the information I need from the low-level commands given to the Canvas, but I don't see what I expect to see. For example, the Canvas's drawPath method is called with a Path object, which contains all the methods necessary for drawing the path, but I can't for the life of me figure out how to extract the path that's already been drawn to create the equivalent <path> element. Same with the drawParagraph, I can't seem get the actual underlying text, just the measurement information. I can see that these are all native wrappers, and that the implementations are platform-specific. Am I missing something? Is there a way to get the information I need?

Upvotes: 0

Views: 80

Answers (0)

Related Questions