mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Change the signature of the JpegImage
constructor, to allow passing in various options directly
This commit is contained in:
parent
620da6f4df
commit
682672db8e
2 changed files with 13 additions and 9 deletions
|
@ -63,7 +63,10 @@ let JpegStream = (function JpegStreamClosure() {
|
|||
if (this.eof) {
|
||||
return;
|
||||
}
|
||||
let jpegImage = new JpegImage();
|
||||
let jpegOptions = {
|
||||
decodeTransform: undefined,
|
||||
colorTransform: undefined,
|
||||
};
|
||||
|
||||
// Checking if values need to be transformed before conversion.
|
||||
let decodeArr = this.dict.getArray('Decode', 'D');
|
||||
|
@ -81,16 +84,17 @@ let JpegStream = (function JpegStreamClosure() {
|
|||
}
|
||||
}
|
||||
if (transformNeeded) {
|
||||
jpegImage.decodeTransform = transform;
|
||||
jpegOptions.decodeTransform = transform;
|
||||
}
|
||||
}
|
||||
// Fetching the 'ColorTransform' entry, if it exists.
|
||||
if (isDict(this.params)) {
|
||||
let colorTransform = this.params.get('ColorTransform');
|
||||
if (Number.isInteger(colorTransform)) {
|
||||
jpegImage.colorTransform = colorTransform;
|
||||
jpegOptions.colorTransform = colorTransform;
|
||||
}
|
||||
}
|
||||
const jpegImage = new JpegImage(jpegOptions);
|
||||
|
||||
jpegImage.parse(this.bytes);
|
||||
let data = jpegImage.getData(this.drawWidth, this.drawHeight,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue