Browse Source

Fix Color component order

Former-commit-id: 851778bc5ece309963a04164270dd93c24ee914c
Former-commit-id: 22497c332d115463ca5a008cd1ec35c31dcc32fa
Former-commit-id: 8e841b0f35ca1d340151ecb2fda8f04483eaafe1
af/merge-core
James Jackson-South 10 years ago
parent
commit
b40f83194a
  1. 8
      src/ImageProcessor/Colors/Color.cs
  2. 3
      src/ImageProcessor/ImageBase.cs
  3. 7
      src/ImageProcessor/Samplers/Resize.cs
  4. 4
      tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs

8
src/ImageProcessor/Colors/Color.cs

@ -62,9 +62,9 @@ namespace ImageProcessor
public bool IsEmpty => this.backingVector.Equals(default(Vector4));
/// <summary>
/// Gets or sets the blue component of the color.
/// Gets or sets the red component of the color.
/// </summary>
public float B
public float R
{
get
{
@ -94,9 +94,9 @@ namespace ImageProcessor
}
/// <summary>
/// Gets or sets the red component of the color.
/// Gets or sets the blue component of the color.
/// </summary>
public float R
public float B
{
get
{

3
src/ImageProcessor/ImageBase.cs

@ -163,6 +163,7 @@ namespace ImageProcessor
/// <inheritdoc/>
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;

7
src/ImageProcessor/Samplers/Resize.cs

@ -1,6 +1,6 @@
// <copyright file="Resize.cs" company="James South">
// 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.
// </copyright>
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);

4
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"
};
}
}

Loading…
Cancel
Save