From c5ff7aa243fdc4ad5fbe5b37846ed212dd948444 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: 5543167383314e5d387a526a69fe2215a547d323 Former-commit-id: 4f587f2840c6658cb89e11e11fc3be8b7f06d060 Former-commit-id: d449169fc6db36b9d08bad258a5ed005b0a3fa56 --- 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); } }); }