Procházet zdrojové kódy

LibGfx: Add Color::with_opacity(float opacity)

This returns the color with its alpha scaled by the opacity.
MacDue před 2 roky
rodič
revize
120e5b6b6f
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      Userland/Libraries/LibGfx/Color.h

+ 5 - 0
Userland/Libraries/LibGfx/Color.h

@@ -331,6 +331,11 @@ public:
             alpha());
     }
 
+    constexpr Color with_opacity(float opacity) const
+    {
+        return with_alpha(alpha() * opacity);
+    }
+
     constexpr Color darkened(float amount = 0.5f) const
     {
         return Color(red() * amount, green() * amount, blue() * amount, alpha());