Open nyurik opened 9 months ago
# This tells Martin to handle images in some_sdf_dir as SDFs
As worded, this could be read as though the images will be interpreted as SDFs and served as-is. That's presumably not a desired use case, but it's a possible one, so this should imply that the images will be transformed to SDFs.
Thx @jleedev , good point. We seem to have 3 cases:
sdf: true
in the JSON spritesheet file.I could change the above use_sdf
to sdf: no | convert | assume
-- I am not a big fan of these names though... suggestions?
Perhaps sdf: false | true | pretransformed
. It's my assumption that it's slightly weird to have existing SDF images that you want to serve, but it's trivial to support this so it would be weirder not to. The plain value of sdf: true
can mean "apply the SDF transformation to these images".
Agree, thx, updated the proposal above
So, I looked into this:
Spreet sets the sdf
variable to in the output to true
, if they are asked to make_sdf
.
=> I think removing pretransformed
makes sense. Otherwise, we would need to duplicate that code.
Honestly, think not having that option is likely better => less testing involved
About the configuration shema, I would like to split this up for reviewability.
=> one adding default_sdf
+ martin --sdf-sprites
and one adding the sprite level sdf
-switch.
Will provide the PR tomorrow after further testing that it works ^^
Scratch that, since spreet
just converts the entirety of the stylesheet, it either makes sense to just reduce this to one setting make_sdf: bool
which affects all sprites.
In some cases, images should be encoded using SDF first. The @flother's spreet crate already supports it with https://github.com/flother/spreet/issues/58, so it should be fairly easy (?) to use that.
Overview
Similar to the regular spritesheets, given a directory with png/svg/... images, converts all images in that directory and subdirectories to SDF images before packaging them in a spritesheet. If needed SDF and non-SDF spritesheets can be combined by the client, e.g.
GET /sprites/icons,sdf_icons.png
(or.json|@2x.png|@2x.json
. No new API endpoints are introduced.CLI Configuration
YAML Configuration