From 4a450c2cad187cf738aa4eddc79432a7cde1ecc2 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 7 Jan 2016 19:37:57 +1100 Subject: [PATCH] Fix glow/vignette Former-commit-id: a54034b7230609232a91bb6e9c59d184b26c69dc Former-commit-id: 23ad01e51ee979e6ce4d571b34624175c1305e0a Former-commit-id: 61bded86dc05bc1718e67222fa423b2c1be3721d --- src/ImageProcessor/Filters/Glow.cs | 2 +- src/ImageProcessor/Filters/Vignette.cs | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ImageProcessor/Filters/Glow.cs b/src/ImageProcessor/Filters/Glow.cs index 690ead7874..e87da3a25e 100644 --- a/src/ImageProcessor/Filters/Glow.cs +++ b/src/ImageProcessor/Filters/Glow.cs @@ -49,7 +49,7 @@ namespace ImageProcessor.Filters { float distance = Vector2.Distance(centre, new Vector2(x, y)); Color sourceColor = target[x, y]; - target[x, y] = Color.Lerp(sourceColor, glowColor, .5f * (1 - distance / maxDistance)); + target[x, y] = Color.Lerp(glowColor, sourceColor, .5f * (distance / maxDistance)); } }); } diff --git a/src/ImageProcessor/Filters/Vignette.cs b/src/ImageProcessor/Filters/Vignette.cs index bae28f5656..8d29af6421 100644 --- a/src/ImageProcessor/Filters/Vignette.cs +++ b/src/ImageProcessor/Filters/Vignette.cs @@ -17,7 +17,7 @@ namespace ImageProcessor.Filters /// /// Gets or sets the vignette color to apply. /// - public Color Color { get; set; } = new Color(0, 0, 0, 1); + public Color Color { get; set; } = Color.Black; /// /// Gets or sets the the x-radius. @@ -49,14 +49,7 @@ namespace ImageProcessor.Filters { float distance = Vector2.Distance(centre, new Vector2(x, y)); Color sourceColor = target[x, y]; - //if (sourceColor.A > 0) - //{ - target[x, y] = Color.Lerp(sourceColor, vignetteColor, .9f * distance / maxDistance); - //} - //else - //{ - // target[x, y] = Color.Lerp(sourceColor, color, distance / maxDistance); - //} + target[x, y] = Color.Lerp(vignetteColor, sourceColor, 1 - .9f * distance / maxDistance); } }); }