]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-label: Add ply_label_set_hex_color () based off of ply_pixel_buffer_fill_with_hex...
authorn3rdopolis <bluescreen_avenger@verizon.net>
Mon, 20 Mar 2023 02:40:52 +0000 (22:40 -0400)
committerRay Strode <rstrode@redhat.com>
Sat, 2 Dec 2023 23:14:42 +0000 (18:14 -0500)
src/libply-splash-graphics/ply-label.c
src/libply-splash-graphics/ply-label.h

index f3a99fd8e1c0ea1b7c9acdf30aaa21162a4a6ea2..ecb794044693ec5e42df0561cf22b3acf88a7d38 100644 (file)
@@ -334,6 +334,30 @@ ply_label_set_font (ply_label_t *label,
                                                        font);
 }
 
+void
+ply_label_set_hex_color (ply_label_t *label,
+                         uint32_t     hex_color)
+{
+        double red;
+        double green;
+        double blue;
+        double alpha;
+
+        red = ((double) (hex_color & 0xff000000) / 0xff000000);
+        green = ((double) (hex_color & 0x00ff0000) / 0x00ff0000);
+        blue = ((double) (hex_color & 0x0000ff00) / 0x0000ff00);
+        alpha = ((double) (hex_color & 0x000000ff) / 0x000000ff);
+
+        if (label->plugin_interface == NULL)
+                return;
+
+        label->plugin_interface->set_color_for_control (label->control,
+                                                        red,
+                                                        green,
+                                                        blue,
+                                                        alpha);
+}
+
 void
 ply_label_set_color (ply_label_t *label,
                      float        red,
index 085aa6920e931051c5e18242eef02bd634d9b643..5f4e6e81f2ead97588c86c2f293087ce618d277a 100644 (file)
@@ -72,6 +72,8 @@ void ply_label_set_width (ply_label_t *label,
                           long         width);
 void ply_label_set_font (ply_label_t *label,
                          const char  *fontdesc);
+void ply_label_set_hex_color (ply_label_t *label,
+                              uint32_t     hex_color);
 void ply_label_set_color (ply_label_t *label,
                           float        red,
                           float        green,