I would like to define descendants of TPath class for SVG shapes that I use regularly, to register them on the palette instead of having to paste in the object inspector long SVG path strings.
this would also have the advantage of being able to, by changing a single string somewhere, impact all my objects of type TSVGxxx without having to run after them and edit each one after the other.
The first step was done:
TSVGsomeshape = class (TPath)
and in the Loaded:
Data.Data := 'an SVG path';
The problem: when this path gets too long, Delphi's string literal limitation forces me to break it down and concatenate its bits. Which I would like to avoid.
Resources come to mind. the idea: put all SVG paths into some RC file (simple paste of path as-is, no concatenation hassle), which in turns compiles and generates a RES file.
However, it seems that with paths being loaded as resources, I lose the ability to see those paths when dropping my TSVGxxx at design-time, which sort of defeats the purpose.
Am i over-complicating things, and is there a more simple approach to all of this?
edit 1:
In VCL, the main way of using resources was to add the {$R } rc or res file (I still prefer using the RC one and have it compiled every time, and ignore the generated res from version control).
I would consider for this a single resource file "svg.rc / res", which contains multiple text-only entries describing the path section only of each SVG.
LoadFromStream the resource into a string list, and feed it to the "Data" property, pretty straightforward.
Admittedly, I don't recall ever having done so in a control at design time. This is the first difficulty encountered using resources approach: getting "resource not found".
Is doing so at design time generally doable?
The second difficulty I suppose is more related to FMX, due to the multitude approaches to add resources (deployment menu, resources and images menu, standard {$R } approach). All of which also yielded resource not found at runtime.
I've used the Deployment menu for loading custom fonts, but not multi-key rc files. How could this be done?
Thanks
PS: i also had a look at SKIA4Delphi, and while great, may be overkill for the simple SVG paths that I am interested in (and also a Google dependency)
Note on tags: while the question does mention SVG and TPath, the problem at its core concerns neither of them, and as such, SVG and FMX tags are omitted.