Allow disabling image loading and saving functionalities #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am testing out PlutoSVG to render OT-SVG fonts in Lite XL. I'm impressed by the results (it did work) but I've noticed a 400kb increase in the binary size, in -O3 stripped. I then noticed that plutovg is vendoring stb_image to load surfaces from images and write surfaces to files. I am only planning to use Pluto(S)VG to render graphics to memory, so I didn't need to stb_image and stb_image_write to read and write images.
This PR includes the
PLUTOVG_USE_STB_IMAGE
(CMake) anduse_stb_image
(meson) options to enable / disable image support. This would also indirectly allow the library to support other image libraries in the future, like how nanovg/fontstash.h supports FreeType and stbtt for rendering text. The following screenshot shows 300kb being saved by just omitting stb_image.h and stb_image_write.h.