Browse Source

Remove not needed ToRgba()

pull/1570/head
Brian Popow 6 years ago
parent
commit
a3eb174f94
  1. 4
      src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs
  2. 4
      src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs
  3. 4
      src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs
  4. 2
      src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs

4
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor.cs

@ -26,8 +26,8 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
int offset = 0; int offset = 0;
var black = Color.Black.ToRgba32(); Color black = Color.Black;
var white = Color.White.ToRgba32(); Color white = Color.White;
for (int y = top; y < top + height; y++) for (int y = top; y < top + height; y++)
{ {
for (int x = left; x < left + width; x += 8) for (int x = left; x < left + width; x += 8)

4
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZeroTiffColor.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
public BlackIsZeroTiffColor(ushort[] bitsPerSample) public BlackIsZeroTiffColor(ushort[] bitsPerSample)
{ {
this.bitsPerSample0 = bitsPerSample[0]; this.bitsPerSample0 = bitsPerSample[0];
this.factor = (float)(1 << this.bitsPerSample0) - 1.0f; this.factor = (1 << this.bitsPerSample0) - 1.0f;
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
for (int x = left; x < left + width; x++) for (int x = left; x < left + width; x++)
{ {
int value = bitReader.ReadBits(this.bitsPerSample0); int value = bitReader.ReadBits(this.bitsPerSample0);
float intensity = ((float)value) / this.factor; float intensity = value / this.factor;
color.FromVector4(new Vector4(intensity, intensity, intensity, 1.0f)); color.FromVector4(new Vector4(intensity, intensity, intensity, 1.0f));
pixels[x, y] = color; pixels[x, y] = color;

4
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor.cs

@ -25,8 +25,8 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
int offset = 0; int offset = 0;
var black = Color.Black.ToRgba32(); Color black = Color.Black;
var white = Color.White.ToRgba32(); Color white = Color.White;
for (int y = top; y < top + height; y++) for (int y = top; y < top + height; y++)
{ {
for (int x = left; x < left + width; x += 8) for (int x = left; x < left + width; x += 8)

2
src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZeroTiffColor.cs

@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Formats.Experimental.Tiff
for (int x = left; x < left + width; x++) for (int x = left; x < left + width; x++)
{ {
int value = bitReader.ReadBits(this.bitsPerSample0); int value = bitReader.ReadBits(this.bitsPerSample0);
float intensity = 1.0f - (((float)value) / this.factor); float intensity = 1.0f - (value / this.factor);
color.FromVector4(new Vector4(intensity, intensity, intensity, 1.0f)); color.FromVector4(new Vector4(intensity, intensity, intensity, 1.0f));
pixels[x, y] = color; pixels[x, y] = color;

Loading…
Cancel
Save