Browse Source

Update PaletteIndexReader.cs

Almost certainly a typo in the original implementation, pallete was ignored completely

Former-commit-id: 8684abdcebf848782b6f624241939f17c50ba563
Former-commit-id: ab4424fbafa82720745e3c92f1b749a6a8ea0305
Former-commit-id: 8737ade7b5ebd167ebf87b228bcbd967b890c6d4
pull/1/head
Vladislav Richter 10 years ago
parent
commit
946e9c751c
  1. 7
      src/ImageProcessorCore/Formats/Png/PaletteIndexReader.cs

7
src/ImageProcessorCore/Formats/Png/PaletteIndexReader.cs

@ -56,9 +56,10 @@ namespace ImageProcessorCore.Formats
offset = ((this.row * header.Width) + i) * 4;
int pixelOffset = index * 3;
float r = newScanline[pixelOffset] / 255f;
float g = newScanline[pixelOffset + 1] / 255f;
float b = newScanline[pixelOffset + 2] / 255f;
// BUGFIX changed newScanline[] to this.palette[] , 99% sure it was a typo and not intent
float r = this.palette[pixelOffset] / 255f;
float g = this.palette[pixelOffset + 1] / 255f;
float b = this.palette[pixelOffset + 2] / 255f;
float a = this.paletteAlpha.Length > index
? this.paletteAlpha[index] / 255f
: 1;

Loading…
Cancel
Save