]> 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)
committernerdopolis <bluescreen_avenger@verizon.net>
Thu, 1 Jun 2023 02:45:11 +0000 (22:45 -0400)
src/libply-splash-graphics/ply-label.c
src/libply-splash-graphics/ply-label.h

index 581dbff5b818b6289c9c598be88c0c5329bef676..16256861f2391e7a544bcb888338da0736bba8e9 100644 (file)
@@ -286,6 +286,30 @@ ply_label_set_font (ply_label_t *label,
                                                        fontdesc);
 }
 
+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 55debd84a7f9fc000a258831835c204b6e46ae5c..f936f72ae79b20f48319ab2e6fa032d25a6827a7 100644 (file)
@@ -66,6 +66,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,