feat: barebones image width/height script functions

Ideally want a better way to make these properties or something.
This commit is contained in:
Brendan Hagan
2022-07-28 00:18:28 -04:00
parent 0b22b17153
commit a1fda8c6cd
+15 -1
View File
@@ -36,6 +36,18 @@ SCRIPT_FUNCTION(to_card_image) {
}
// ----------------------------------------------------------------------------- : Image functions
SCRIPT_FUNCTION(width_of) {
SCRIPT_PARAM(GeneratedImageP, input);
Image image = input->generate(GeneratedImage::Options());
SCRIPT_RETURN(image.GetWidth());
}
SCRIPT_FUNCTION(height_of) {
SCRIPT_PARAM(GeneratedImageP, input);
Image image = input->generate(GeneratedImage::Options());
SCRIPT_RETURN(image.GetHeight());
}
SCRIPT_FUNCTION(linear_blend) {
SCRIPT_PARAM(GeneratedImageP, image1);
@@ -217,7 +229,9 @@ SCRIPT_FUNCTION(built_in_image) {
void init_script_image_functions(Context& ctx) {
ctx.setVariable(_("to_image"), script_to_image);
ctx.setVariable(_("to_card_image"), script_to_card_image);
ctx.setVariable(_("to_card_image"), script_to_card_image);
ctx.setVariable(_("width_of"), script_width_of);
ctx.setVariable(_("height_of"), script_height_of);
ctx.setVariable(_("linear_blend"), script_linear_blend);
ctx.setVariable(_("masked_blend"), script_masked_blend);
ctx.setVariable(_("combine_blend"), script_combine_blend);