mirror of
https://github.com/kettek/png-js
synced 2025-03-14 06:24:30 -07:00
Fix toImageData to actually use passed palette
This commit is contained in:
parent
39e8ee8f25
commit
cedcb60245
|
@ -294,7 +294,8 @@ class IndexedPNG {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async toImageData(palette = this.decodePalette()) {
|
async toImageData(options) {
|
||||||
|
const palette = options.palette || this.decodedPalette
|
||||||
if (!this.decodedPixels) {
|
if (!this.decodedPixels) {
|
||||||
await this.decode()
|
await this.decode()
|
||||||
}
|
}
|
||||||
|
@ -308,6 +309,7 @@ class IndexedPNG {
|
||||||
pixels[j++] = palette[index+2] // B
|
pixels[j++] = palette[index+2] // B
|
||||||
pixels[j++] = palette[index+3] // A
|
pixels[j++] = palette[index+3] // A
|
||||||
}
|
}
|
||||||
|
console.log(pixels)
|
||||||
return new ImageData(pixels, this.width)
|
return new ImageData(pixels, this.width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user