]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
add new function ply_frame_buffer_fill_with_hex_color_at_opacity
authorRay Strode <rstrode@redhat.com>
Fri, 30 May 2008 14:23:22 +0000 (10:23 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 30 May 2008 14:23:22 +0000 (10:23 -0400)
It's sometimes useful to specify an opacity to fill with for the
passed in color, too, independent of its alpha.

src/libply/ply-frame-buffer.c
src/libply/ply-frame-buffer.h

index 0ed6e727a3d88cbe2fea7c3a33c981bd9ea7f773..5b09d76a86df1e696798641e1363f0d4afedb613 100644 (file)
@@ -673,9 +673,10 @@ ply_frame_buffer_fill_with_color (ply_frame_buffer_t      *buffer,
 }
 
 bool
-ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t      *buffer,
-                                      ply_frame_buffer_area_t *area,
-                                      uint32_t                 hex_color)
+ply_frame_buffer_fill_with_hex_color_at_opacity (ply_frame_buffer_t      *buffer,
+                                                 ply_frame_buffer_area_t *area,
+                                                 uint32_t                 hex_color,
+                                                 double                   opacity)
 {
   ply_frame_buffer_area_t cropped_area;
   uint32_t pixel_value;
@@ -702,6 +703,8 @@ ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t      *buffer,
   blue = ((double) (hex_color & 0x0000ff00) / 0x0000ff00);
   alpha = ((double) (hex_color & 0x000000ff) / 0x000000ff);
 
+  alpha *= opacity;
+
   red *= alpha;
   green *= alpha;
   blue *= alpha;
@@ -715,6 +718,14 @@ ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t      *buffer,
   return ply_frame_buffer_flush (buffer);
 }
 
+bool
+ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t      *buffer,
+                                      ply_frame_buffer_area_t *area,
+                                      uint32_t                 hex_color)
+{
+  return ply_frame_buffer_fill_with_hex_color_at_opacity (buffer, area, hex_color, 1.0);
+}
+
 bool 
 ply_frame_buffer_fill_with_argb32_data_at_opacity (ply_frame_buffer_t      *buffer,
                                                    ply_frame_buffer_area_t *area,
index a3e406a9d19a4ed4a1a6087f7c3f80934adab327..a4d259fc43c9545a483511eafe08e6dcc9dd8a84 100644 (file)
@@ -67,6 +67,11 @@ bool ply_frame_buffer_fill_with_hex_color (ply_frame_buffer_t      *buffer,
                                            ply_frame_buffer_area_t *area,
                                            uint32_t                 hex_color);
 
+bool ply_frame_buffer_fill_with_hex_color_at_opacity (ply_frame_buffer_t      *buffer,
+                                                      ply_frame_buffer_area_t *area,
+                                                      uint32_t                 hex_color,
+                                                      double                   opacity);
+
 bool ply_frame_buffer_fill_with_argb32_data (ply_frame_buffer_t      *buffer,
                                              ply_frame_buffer_area_t  *area,
                                              unsigned long        x,