Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Color.php')
-rw-r--r--lib/public/Color.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/public/Color.php b/lib/public/Color.php
index e2cabd9c2fc..6c9a35ca49c 100644
--- a/lib/public/Color.php
+++ b/lib/public/Color.php
@@ -125,6 +125,14 @@ class Color {
return $palette;
}
+ public function alphaBlending(float $opacity, Color $source): Color {
+ return new Color(
+ (int)((1 - $opacity) * $source->red() + $opacity * $this->red()),
+ (int)((1 - $opacity) * $source->green() + $opacity * $this->green()),
+ (int)((1 - $opacity) * $source->blue() + $opacity * $this->blue())
+ );
+ }
+
/**
* Calculate steps between two Colors
* @param int $steps start color