Browse Source

Avoid divide by zero

Former-commit-id: cff8caa266353b9074290e878e99e1443e249a45
Former-commit-id: fd97b06cc7eed6df6dd11f1575ea8c810a06f760
Former-commit-id: f3cb76149fcd020a99014762d89820d9a1ea4440
pull/17/head
James Jackson-South 10 years ago
parent
commit
ff3ca3984d
  1. 5
      src/ImageProcessor/Colors/Color.cs

5
src/ImageProcessor/Colors/Color.cs

@ -532,6 +532,11 @@ namespace ImageProcessor
/// <returns>The <see cref="Color"/>.</returns>
public static Color ToNonPremultiplied(float r, float g, float b, float a)
{
if (Math.Abs(a) < Epsilon)
{
return new Color(r, g, b, a);
}
return new Color(r / a, g / a, b / a, a);
}

Loading…
Cancel
Save