From b40f83194a50fb781e1ff2fd8f0e297764a7dd59 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 31 Oct 2015 13:45:39 +1100 Subject: [PATCH] Fix Color component order Former-commit-id: 851778bc5ece309963a04164270dd93c24ee914c Former-commit-id: 22497c332d115463ca5a008cd1ec35c31dcc32fa Former-commit-id: 8e841b0f35ca1d340151ecb2fda8f04483eaafe1 --- src/ImageProcessor/Colors/Color.cs | 8 ++++---- src/ImageProcessor/ImageBase.cs | 3 ++- src/ImageProcessor/Samplers/Resize.cs | 7 +++---- .../ImageProcessor.Tests/Processors/ProcessorTestBase.cs | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ImageProcessor/Colors/Color.cs b/src/ImageProcessor/Colors/Color.cs index 58bfd4040..4b13fb1dd 100644 --- a/src/ImageProcessor/Colors/Color.cs +++ b/src/ImageProcessor/Colors/Color.cs @@ -62,9 +62,9 @@ namespace ImageProcessor public bool IsEmpty => this.backingVector.Equals(default(Vector4)); /// - /// Gets or sets the blue component of the color. + /// Gets or sets the red component of the color. /// - public float B + public float R { get { @@ -94,9 +94,9 @@ namespace ImageProcessor } /// - /// Gets or sets the red component of the color. + /// Gets or sets the blue component of the color. /// - public float R + public float B { get { diff --git a/src/ImageProcessor/ImageBase.cs b/src/ImageProcessor/ImageBase.cs index 805ee76d0..5e1aaa1a6 100644 --- a/src/ImageProcessor/ImageBase.cs +++ b/src/ImageProcessor/ImageBase.cs @@ -163,6 +163,7 @@ namespace ImageProcessor /// public void SetPixels(int width, int height, float[] pixels) { +#if DEBUG if (width <= 0) { throw new ArgumentOutOfRangeException(nameof(width), "Width must be greater than or equals than zero."); @@ -177,7 +178,7 @@ namespace ImageProcessor { throw new ArgumentException("Pixel array must have the length of Width * Height * 4."); } - +#endif this.Width = width; this.Height = height; this.Pixels = pixels; diff --git a/src/ImageProcessor/Samplers/Resize.cs b/src/ImageProcessor/Samplers/Resize.cs index c1751ff3e..b63e54bcf 100644 --- a/src/ImageProcessor/Samplers/Resize.cs +++ b/src/ImageProcessor/Samplers/Resize.cs @@ -1,6 +1,6 @@ // -// Copyright (c) James South and contributors -// Licensed under the Apache License, Version 2.0. license. +// Copyright (c) James South and contributors. +// Licensed under the Apache License, Version 2.0. // namespace ImageProcessor.Samplers @@ -97,8 +97,7 @@ namespace ImageProcessor.Samplers } int originX = xw.Index; - Color sourceColor = source[originX, originY]; - sourceColor = PixelOperations.ToLinear(sourceColor); + Color sourceColor = PixelOperations.ToLinear(source[originX, originY]); float weight = (yw.Value / verticalSum) * (xw.Value / horizontalSum); diff --git a/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs b/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs index d7e0c58db..7f9e8ccc6 100644 --- a/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs +++ b/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs @@ -29,8 +29,8 @@ namespace ImageProcessor.Tests "../../TestImages/Formats/Png/splash.png", "../../TestImages/Formats/Gif/leaf.gif", "../../TestImages/Formats/Gif/rings.gif", - "../../TestImages/Formats/Gif/ani2.gif" , - "../../TestImages/Formats/Gif/giphy.gif" + "../../TestImages/Formats/Gif/ani2.gif", + "../../TestImages/Formats/Gif/giphy.gif" }; } }