Browse Source

Use default(T)

Former-commit-id: b6028bf2565e2e25395e0658332e351df870277b
Former-commit-id: cfdbc86934bc83757056a87600580cbd81743b53
Former-commit-id: ac78e9ca21eccb3830d5ba12ca573a9f54aae995
pull/1/head
James Jackson-South 10 years ago
parent
commit
80fecd1f58
  1. 8
      src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs
  2. 10
      src/ImageProcessorCore/ImageProcessor.cs

8
src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs

@ -239,7 +239,7 @@ namespace ImageProcessorCore.Formats
int arrayOffset = (row * width) + (colOffset + shift);
// Stored in b-> g-> r-> a order.
T packed = new T();
T packed = default(T);
packed.PackBytes(colors[colorIndex], colors[colorIndex + 1], colors[colorIndex + 2], 255);
imageData[arrayOffset] = packed;
}
@ -289,7 +289,7 @@ namespace ImageProcessorCore.Formats
int arrayOffset = ((row * width) + x);
// Stored in b-> g-> r-> a order.
T packed = new T();
T packed = default(T);
packed.PackBytes(b, g, r, 255);
imageData[arrayOffset] = packed;
}
@ -328,7 +328,7 @@ namespace ImageProcessorCore.Formats
// We divide by 255 as we will store the colors in our floating point format.
// Stored in b-> g-> r-> a order.
T packed = new T();
T packed = default(T);
packed.PackBytes(data[offset], data[offset + 1], data[offset + 2], 255);
imageData[arrayOffset] = packed;
}
@ -366,7 +366,7 @@ namespace ImageProcessorCore.Formats
int arrayOffset = ((row * width) + x);
// Stored in b-> g-> r-> a order.
T packed = new T();
T packed = default(T);
packed.PackBytes(data[offset], data[offset + 1], data[offset + 2], data[offset + 3]);
imageData[arrayOffset] = packed;
}

10
src/ImageProcessorCore/ImageProcessor.cs

@ -88,6 +88,8 @@ namespace ImageProcessorCore.Processors
/// <summary>
/// This method is called before the process is applied to prepare the processor.
/// </summary>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <param name="target">Target image to apply the process to.</param>
/// <param name="source">The source image. Cannot be null.</param>
/// <param name="targetRectangle">
@ -104,10 +106,11 @@ namespace ImageProcessorCore.Processors
}
/// <summary>
/// Applies the process to the specified portion of the specified <see cref="ImageBase{T}"/> at the specified location
/// Applies the process to the specified portion of the specified <see cref="ImageBase{T, TP}"/> at the specified location
/// and with the specified size.
/// </summary>
/// <typeparam name="T">The type of pixels contained within the image.</typeparam>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <param name="target">Target image to apply the process to.</param>
/// <param name="source">The source image. Cannot be null.</param>
/// <param name="targetRectangle">
@ -130,7 +133,8 @@ namespace ImageProcessorCore.Processors
/// <summary>
/// This method is called after the process is applied to prepare the processor.
/// </summary>
/// <typeparam name="T">The type of pixels contained within the image.</typeparam>
/// <typeparam name="T">The pixel format.</typeparam>
/// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
/// <param name="target">Target image to apply the process to.</param>
/// <param name="source">The source image. Cannot be null.</param>
/// <param name="targetRectangle">

Loading…
Cancel
Save