feat: script functions for generating and manipulating card images #34
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.
The ultimate goal here is both #32 and #33.
to_card_image(input, zoom, angle)
as a script function to allow for variable access to resolved card images.card_region
as a stylesheet property to define slice regions for a card.Example of
card_region
width_of(input)
andheight_of(input)
script functions for accessing image width/height.Ideally I would want width/height to be properties, but the nature of images in MSE is that they don't have these values until drawn so this internally is having to draw the images. There's probably a better way around that by drawing intermediate layers and storing the values for property access, but haven't really sorted that out - nor did I find a good way to reflect the return value of a function as a property. Images right now don't have reflected properties at all.
I think next steps from here would be...
write_image_file()
could add a param then to be region aware and return a map of images.to_card_image()
could do the same, rather then leaving it for the script writer to try and slice their own cards which would require math to adjust for scale factor.