]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
script: Add image tile support.
authorDimitri John Ledkov <xnox@ubuntu.com>
Tue, 10 Sep 2019 13:00:08 +0000 (14:00 +0100)
committerRay Strode <rstrode@redhat.com>
Wed, 11 Sep 2019 13:11:24 +0000 (09:11 -0400)
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
src/plugins/splash/script/script-lib-image.c
src/plugins/splash/script/script-lib-image.script

index 748e6d1e7a48d6c8d5a7239c552e7bc65d5bc976..c53e0b0ec8a7064be5f8624b1ad50b4d656cecb5 100644 (file)
@@ -146,6 +146,21 @@ static script_return_t image_scale (script_state_t *state,
         return script_return_obj_null ();
 }
 
+static script_return_t image_tile (script_state_t *state,
+                                    void           *user_data)
+{
+        script_lib_image_data_t *data = user_data;
+        ply_pixel_buffer_t *image = script_obj_as_native_of_class (state->this, data->class);
+        int width = script_obj_hash_get_number (state->local, "width");
+        int height = script_obj_hash_get_number (state->local, "height");
+
+        if (image) {
+                ply_pixel_buffer_t *new_image = ply_pixel_buffer_tile (image, width, height);
+                return script_return_obj (script_obj_new_native (new_image, data->class));
+        }
+        return script_return_obj_null ();
+}
+
 static script_return_t image_text (script_state_t *state,
                                    void           *user_data)
 {
@@ -255,6 +270,13 @@ script_lib_image_data_t *script_lib_image_setup (script_state_t *state,
                                     "width",
                                     "height",
                                     NULL);
+        script_add_native_function (image_hash,
+                                    "_Tile",
+                                    image_tile,
+                                    data,
+                                    "width",
+                                    "height",
+                                    NULL);
         script_add_native_function (image_hash,
                                     "GetWidth",
                                     image_get_width,
index 00b1c19c2b06f2d5c303d7cb7bf747ae692266cf..ab4b7cfe8a07bb76a43e1719faa051d688022b01 100644 (file)
@@ -14,6 +14,11 @@ Image.Scale = fun (width, height)
   return Image.Adopt (this._Scale(width, height));
 };
 
+Image.Tile = fun (width, height)
+{
+  return Image.Adopt (this._Tile(width, height));
+};
+
 Image.Text = fun (text, red, green, blue, alpha, font, align)
 {
   return Image.Adopt (Image._Text (text, red, green, blue, alpha, font, align));