Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/embedpre.../assets/pdf/build
File: pdf.worker.js
widthCode = this.cMap.lookup(charcode);
[29500] Fix | Delete
if (typeof widthCode === "string") {
[29501] Fix | Delete
widthCode = convertCidString(charcode, widthCode);
[29502] Fix | Delete
}
[29503] Fix | Delete
}
[29504] Fix | Delete
width = this.widths[widthCode];
[29505] Fix | Delete
if (typeof width !== "number") {
[29506] Fix | Delete
width = this.defaultWidth;
[29507] Fix | Delete
}
[29508] Fix | Delete
const vmetric = this.vmetrics?.[widthCode];
[29509] Fix | Delete
let unicode = this.toUnicode.get(charcode) || charcode;
[29510] Fix | Delete
if (typeof unicode === "number") {
[29511] Fix | Delete
unicode = String.fromCharCode(unicode);
[29512] Fix | Delete
}
[29513] Fix | Delete
let isInFont = this.toFontChar[charcode] !== undefined;
[29514] Fix | Delete
fontCharCode = this.toFontChar[charcode] || charcode;
[29515] Fix | Delete
if (this.missingFile) {
[29516] Fix | Delete
const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
[29517] Fix | Delete
if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
[29518] Fix | Delete
fontCharCode = 0x20;
[29519] Fix | Delete
}
[29520] Fix | Delete
fontCharCode = mapSpecialUnicodeValues(fontCharCode);
[29521] Fix | Delete
}
[29522] Fix | Delete
if (this.isType3Font) {
[29523] Fix | Delete
operatorListId = fontCharCode;
[29524] Fix | Delete
}
[29525] Fix | Delete
let accent = null;
[29526] Fix | Delete
if (this.seacMap?.[charcode]) {
[29527] Fix | Delete
isInFont = true;
[29528] Fix | Delete
const seac = this.seacMap[charcode];
[29529] Fix | Delete
fontCharCode = seac.baseFontCharCode;
[29530] Fix | Delete
accent = {
[29531] Fix | Delete
fontChar: String.fromCodePoint(seac.accentFontCharCode),
[29532] Fix | Delete
offset: seac.accentOffset
[29533] Fix | Delete
};
[29534] Fix | Delete
}
[29535] Fix | Delete
let fontChar = "";
[29536] Fix | Delete
if (typeof fontCharCode === "number") {
[29537] Fix | Delete
if (fontCharCode <= 0x10ffff) {
[29538] Fix | Delete
fontChar = String.fromCodePoint(fontCharCode);
[29539] Fix | Delete
} else {
[29540] Fix | Delete
warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
[29541] Fix | Delete
}
[29542] Fix | Delete
}
[29543] Fix | Delete
glyph = new fonts_Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
[29544] Fix | Delete
return this._glyphCache[charcode] = glyph;
[29545] Fix | Delete
}
[29546] Fix | Delete
charsToGlyphs(chars) {
[29547] Fix | Delete
let glyphs = this._charsCache[chars];
[29548] Fix | Delete
if (glyphs) {
[29549] Fix | Delete
return glyphs;
[29550] Fix | Delete
}
[29551] Fix | Delete
glyphs = [];
[29552] Fix | Delete
if (this.cMap) {
[29553] Fix | Delete
const c = Object.create(null),
[29554] Fix | Delete
ii = chars.length;
[29555] Fix | Delete
let i = 0;
[29556] Fix | Delete
while (i < ii) {
[29557] Fix | Delete
this.cMap.readCharCode(chars, i, c);
[29558] Fix | Delete
const {
[29559] Fix | Delete
charcode,
[29560] Fix | Delete
length
[29561] Fix | Delete
} = c;
[29562] Fix | Delete
i += length;
[29563] Fix | Delete
const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
[29564] Fix | Delete
glyphs.push(glyph);
[29565] Fix | Delete
}
[29566] Fix | Delete
} else {
[29567] Fix | Delete
for (let i = 0, ii = chars.length; i < ii; ++i) {
[29568] Fix | Delete
const charcode = chars.charCodeAt(i);
[29569] Fix | Delete
const glyph = this._charToGlyph(charcode, charcode === 0x20);
[29570] Fix | Delete
glyphs.push(glyph);
[29571] Fix | Delete
}
[29572] Fix | Delete
}
[29573] Fix | Delete
return this._charsCache[chars] = glyphs;
[29574] Fix | Delete
}
[29575] Fix | Delete
getCharPositions(chars) {
[29576] Fix | Delete
const positions = [];
[29577] Fix | Delete
if (this.cMap) {
[29578] Fix | Delete
const c = Object.create(null);
[29579] Fix | Delete
let i = 0;
[29580] Fix | Delete
while (i < chars.length) {
[29581] Fix | Delete
this.cMap.readCharCode(chars, i, c);
[29582] Fix | Delete
const length = c.length;
[29583] Fix | Delete
positions.push([i, i + length]);
[29584] Fix | Delete
i += length;
[29585] Fix | Delete
}
[29586] Fix | Delete
} else {
[29587] Fix | Delete
for (let i = 0, ii = chars.length; i < ii; ++i) {
[29588] Fix | Delete
positions.push([i, i + 1]);
[29589] Fix | Delete
}
[29590] Fix | Delete
}
[29591] Fix | Delete
return positions;
[29592] Fix | Delete
}
[29593] Fix | Delete
get glyphCacheValues() {
[29594] Fix | Delete
return Object.values(this._glyphCache);
[29595] Fix | Delete
}
[29596] Fix | Delete
encodeString(str) {
[29597] Fix | Delete
const buffers = [];
[29598] Fix | Delete
const currentBuf = [];
[29599] Fix | Delete
const hasCurrentBufErrors = () => buffers.length % 2 === 1;
[29600] Fix | Delete
const getCharCode = this.toUnicode instanceof IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
[29601] Fix | Delete
for (let i = 0, ii = str.length; i < ii; i++) {
[29602] Fix | Delete
const unicode = str.codePointAt(i);
[29603] Fix | Delete
if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
[29604] Fix | Delete
i++;
[29605] Fix | Delete
}
[29606] Fix | Delete
if (this.toUnicode) {
[29607] Fix | Delete
const charCode = getCharCode(unicode);
[29608] Fix | Delete
if (charCode !== -1) {
[29609] Fix | Delete
if (hasCurrentBufErrors()) {
[29610] Fix | Delete
buffers.push(currentBuf.join(""));
[29611] Fix | Delete
currentBuf.length = 0;
[29612] Fix | Delete
}
[29613] Fix | Delete
const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
[29614] Fix | Delete
for (let j = charCodeLength - 1; j >= 0; j--) {
[29615] Fix | Delete
currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
[29616] Fix | Delete
}
[29617] Fix | Delete
continue;
[29618] Fix | Delete
}
[29619] Fix | Delete
}
[29620] Fix | Delete
if (!hasCurrentBufErrors()) {
[29621] Fix | Delete
buffers.push(currentBuf.join(""));
[29622] Fix | Delete
currentBuf.length = 0;
[29623] Fix | Delete
}
[29624] Fix | Delete
currentBuf.push(String.fromCodePoint(unicode));
[29625] Fix | Delete
}
[29626] Fix | Delete
buffers.push(currentBuf.join(""));
[29627] Fix | Delete
return buffers;
[29628] Fix | Delete
}
[29629] Fix | Delete
}
[29630] Fix | Delete
class ErrorFont {
[29631] Fix | Delete
constructor(error) {
[29632] Fix | Delete
this.error = error;
[29633] Fix | Delete
this.loadedName = "g_font_error";
[29634] Fix | Delete
this.missingFile = true;
[29635] Fix | Delete
}
[29636] Fix | Delete
charsToGlyphs() {
[29637] Fix | Delete
return [];
[29638] Fix | Delete
}
[29639] Fix | Delete
encodeString(chars) {
[29640] Fix | Delete
return [chars];
[29641] Fix | Delete
}
[29642] Fix | Delete
exportData(extraProperties = false) {
[29643] Fix | Delete
return {
[29644] Fix | Delete
error: this.error
[29645] Fix | Delete
};
[29646] Fix | Delete
}
[29647] Fix | Delete
}
[29648] Fix | Delete
[29649] Fix | Delete
;// CONCATENATED MODULE: ./src/core/pattern.js
[29650] Fix | Delete
[29651] Fix | Delete
[29652] Fix | Delete
[29653] Fix | Delete
[29654] Fix | Delete
[29655] Fix | Delete
[29656] Fix | Delete
[29657] Fix | Delete
[29658] Fix | Delete
[29659] Fix | Delete
[29660] Fix | Delete
[29661] Fix | Delete
const ShadingType = {
[29662] Fix | Delete
FUNCTION_BASED: 1,
[29663] Fix | Delete
AXIAL: 2,
[29664] Fix | Delete
RADIAL: 3,
[29665] Fix | Delete
FREE_FORM_MESH: 4,
[29666] Fix | Delete
LATTICE_FORM_MESH: 5,
[29667] Fix | Delete
COONS_PATCH_MESH: 6,
[29668] Fix | Delete
TENSOR_PATCH_MESH: 7
[29669] Fix | Delete
};
[29670] Fix | Delete
class Pattern {
[29671] Fix | Delete
constructor() {
[29672] Fix | Delete
unreachable("Cannot initialize Pattern.");
[29673] Fix | Delete
}
[29674] Fix | Delete
static parseShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache) {
[29675] Fix | Delete
const dict = shading instanceof BaseStream ? shading.dict : shading;
[29676] Fix | Delete
const type = dict.get("ShadingType");
[29677] Fix | Delete
try {
[29678] Fix | Delete
switch (type) {
[29679] Fix | Delete
case ShadingType.AXIAL:
[29680] Fix | Delete
case ShadingType.RADIAL:
[29681] Fix | Delete
return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
[29682] Fix | Delete
case ShadingType.FREE_FORM_MESH:
[29683] Fix | Delete
case ShadingType.LATTICE_FORM_MESH:
[29684] Fix | Delete
case ShadingType.COONS_PATCH_MESH:
[29685] Fix | Delete
case ShadingType.TENSOR_PATCH_MESH:
[29686] Fix | Delete
return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
[29687] Fix | Delete
default:
[29688] Fix | Delete
throw new FormatError("Unsupported ShadingType: " + type);
[29689] Fix | Delete
}
[29690] Fix | Delete
} catch (ex) {
[29691] Fix | Delete
if (ex instanceof MissingDataException) {
[29692] Fix | Delete
throw ex;
[29693] Fix | Delete
}
[29694] Fix | Delete
warn(ex);
[29695] Fix | Delete
return new DummyShading();
[29696] Fix | Delete
}
[29697] Fix | Delete
}
[29698] Fix | Delete
}
[29699] Fix | Delete
class BaseShading {
[29700] Fix | Delete
static SMALL_NUMBER = 1e-6;
[29701] Fix | Delete
constructor() {
[29702] Fix | Delete
if (this.constructor === BaseShading) {
[29703] Fix | Delete
unreachable("Cannot initialize BaseShading.");
[29704] Fix | Delete
}
[29705] Fix | Delete
}
[29706] Fix | Delete
getIR() {
[29707] Fix | Delete
unreachable("Abstract method `getIR` called.");
[29708] Fix | Delete
}
[29709] Fix | Delete
}
[29710] Fix | Delete
class RadialAxialShading extends BaseShading {
[29711] Fix | Delete
constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
[29712] Fix | Delete
super();
[29713] Fix | Delete
this.shadingType = dict.get("ShadingType");
[29714] Fix | Delete
let coordsLen = 0;
[29715] Fix | Delete
if (this.shadingType === ShadingType.AXIAL) {
[29716] Fix | Delete
coordsLen = 4;
[29717] Fix | Delete
} else if (this.shadingType === ShadingType.RADIAL) {
[29718] Fix | Delete
coordsLen = 6;
[29719] Fix | Delete
}
[29720] Fix | Delete
this.coordsArr = dict.getArray("Coords");
[29721] Fix | Delete
if (!isNumberArray(this.coordsArr, coordsLen)) {
[29722] Fix | Delete
throw new FormatError("RadialAxialShading: Invalid /Coords array.");
[29723] Fix | Delete
}
[29724] Fix | Delete
const cs = ColorSpace.parse({
[29725] Fix | Delete
cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
[29726] Fix | Delete
xref,
[29727] Fix | Delete
resources,
[29728] Fix | Delete
pdfFunctionFactory,
[29729] Fix | Delete
localColorSpaceCache
[29730] Fix | Delete
});
[29731] Fix | Delete
this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
[29732] Fix | Delete
let t0 = 0.0,
[29733] Fix | Delete
t1 = 1.0;
[29734] Fix | Delete
const domainArr = dict.getArray("Domain");
[29735] Fix | Delete
if (isNumberArray(domainArr, 2)) {
[29736] Fix | Delete
[t0, t1] = domainArr;
[29737] Fix | Delete
}
[29738] Fix | Delete
let extendStart = false,
[29739] Fix | Delete
extendEnd = false;
[29740] Fix | Delete
const extendArr = dict.getArray("Extend");
[29741] Fix | Delete
if (isBooleanArray(extendArr, 2)) {
[29742] Fix | Delete
[extendStart, extendEnd] = extendArr;
[29743] Fix | Delete
}
[29744] Fix | Delete
if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
[29745] Fix | Delete
const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
[29746] Fix | Delete
const distance = Math.hypot(x1 - x2, y1 - y2);
[29747] Fix | Delete
if (r1 <= r2 + distance && r2 <= r1 + distance) {
[29748] Fix | Delete
warn("Unsupported radial gradient.");
[29749] Fix | Delete
}
[29750] Fix | Delete
}
[29751] Fix | Delete
this.extendStart = extendStart;
[29752] Fix | Delete
this.extendEnd = extendEnd;
[29753] Fix | Delete
const fnObj = dict.getRaw("Function");
[29754] Fix | Delete
const fn = pdfFunctionFactory.createFromArray(fnObj);
[29755] Fix | Delete
const NUMBER_OF_SAMPLES = 840;
[29756] Fix | Delete
const step = (t1 - t0) / NUMBER_OF_SAMPLES;
[29757] Fix | Delete
const colorStops = this.colorStops = [];
[29758] Fix | Delete
if (t0 >= t1 || step <= 0) {
[29759] Fix | Delete
info("Bad shading domain.");
[29760] Fix | Delete
return;
[29761] Fix | Delete
}
[29762] Fix | Delete
const color = new Float32Array(cs.numComps),
[29763] Fix | Delete
ratio = new Float32Array(1);
[29764] Fix | Delete
let rgbColor;
[29765] Fix | Delete
let iBase = 0;
[29766] Fix | Delete
ratio[0] = t0;
[29767] Fix | Delete
fn(ratio, 0, color, 0);
[29768] Fix | Delete
let rgbBase = cs.getRgb(color, 0);
[29769] Fix | Delete
const cssColorBase = Util.makeHexColor(rgbBase[0], rgbBase[1], rgbBase[2]);
[29770] Fix | Delete
colorStops.push([0, cssColorBase]);
[29771] Fix | Delete
let iPrev = 1;
[29772] Fix | Delete
ratio[0] = t0 + step;
[29773] Fix | Delete
fn(ratio, 0, color, 0);
[29774] Fix | Delete
let rgbPrev = cs.getRgb(color, 0);
[29775] Fix | Delete
let maxSlopeR = rgbPrev[0] - rgbBase[0] + 1;
[29776] Fix | Delete
let maxSlopeG = rgbPrev[1] - rgbBase[1] + 1;
[29777] Fix | Delete
let maxSlopeB = rgbPrev[2] - rgbBase[2] + 1;
[29778] Fix | Delete
let minSlopeR = rgbPrev[0] - rgbBase[0] - 1;
[29779] Fix | Delete
let minSlopeG = rgbPrev[1] - rgbBase[1] - 1;
[29780] Fix | Delete
let minSlopeB = rgbPrev[2] - rgbBase[2] - 1;
[29781] Fix | Delete
for (let i = 2; i < NUMBER_OF_SAMPLES; i++) {
[29782] Fix | Delete
ratio[0] = t0 + i * step;
[29783] Fix | Delete
fn(ratio, 0, color, 0);
[29784] Fix | Delete
rgbColor = cs.getRgb(color, 0);
[29785] Fix | Delete
const run = i - iBase;
[29786] Fix | Delete
maxSlopeR = Math.min(maxSlopeR, (rgbColor[0] - rgbBase[0] + 1) / run);
[29787] Fix | Delete
maxSlopeG = Math.min(maxSlopeG, (rgbColor[1] - rgbBase[1] + 1) / run);
[29788] Fix | Delete
maxSlopeB = Math.min(maxSlopeB, (rgbColor[2] - rgbBase[2] + 1) / run);
[29789] Fix | Delete
minSlopeR = Math.max(minSlopeR, (rgbColor[0] - rgbBase[0] - 1) / run);
[29790] Fix | Delete
minSlopeG = Math.max(minSlopeG, (rgbColor[1] - rgbBase[1] - 1) / run);
[29791] Fix | Delete
minSlopeB = Math.max(minSlopeB, (rgbColor[2] - rgbBase[2] - 1) / run);
[29792] Fix | Delete
const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB;
[29793] Fix | Delete
if (!slopesExist) {
[29794] Fix | Delete
const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
[29795] Fix | Delete
colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]);
[29796] Fix | Delete
maxSlopeR = rgbColor[0] - rgbPrev[0] + 1;
[29797] Fix | Delete
maxSlopeG = rgbColor[1] - rgbPrev[1] + 1;
[29798] Fix | Delete
maxSlopeB = rgbColor[2] - rgbPrev[2] + 1;
[29799] Fix | Delete
minSlopeR = rgbColor[0] - rgbPrev[0] - 1;
[29800] Fix | Delete
minSlopeG = rgbColor[1] - rgbPrev[1] - 1;
[29801] Fix | Delete
minSlopeB = rgbColor[2] - rgbPrev[2] - 1;
[29802] Fix | Delete
iBase = iPrev;
[29803] Fix | Delete
rgbBase = rgbPrev;
[29804] Fix | Delete
}
[29805] Fix | Delete
iPrev = i;
[29806] Fix | Delete
rgbPrev = rgbColor;
[29807] Fix | Delete
}
[29808] Fix | Delete
const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
[29809] Fix | Delete
colorStops.push([1, cssColor]);
[29810] Fix | Delete
let background = "transparent";
[29811] Fix | Delete
if (dict.has("Background")) {
[29812] Fix | Delete
rgbColor = cs.getRgb(dict.get("Background"), 0);
[29813] Fix | Delete
background = Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
[29814] Fix | Delete
}
[29815] Fix | Delete
if (!extendStart) {
[29816] Fix | Delete
colorStops.unshift([0, background]);
[29817] Fix | Delete
colorStops[1][0] += BaseShading.SMALL_NUMBER;
[29818] Fix | Delete
}
[29819] Fix | Delete
if (!extendEnd) {
[29820] Fix | Delete
colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
[29821] Fix | Delete
colorStops.push([1, background]);
[29822] Fix | Delete
}
[29823] Fix | Delete
this.colorStops = colorStops;
[29824] Fix | Delete
}
[29825] Fix | Delete
getIR() {
[29826] Fix | Delete
const {
[29827] Fix | Delete
coordsArr,
[29828] Fix | Delete
shadingType
[29829] Fix | Delete
} = this;
[29830] Fix | Delete
let type, p0, p1, r0, r1;
[29831] Fix | Delete
if (shadingType === ShadingType.AXIAL) {
[29832] Fix | Delete
p0 = [coordsArr[0], coordsArr[1]];
[29833] Fix | Delete
p1 = [coordsArr[2], coordsArr[3]];
[29834] Fix | Delete
r0 = null;
[29835] Fix | Delete
r1 = null;
[29836] Fix | Delete
type = "axial";
[29837] Fix | Delete
} else if (shadingType === ShadingType.RADIAL) {
[29838] Fix | Delete
p0 = [coordsArr[0], coordsArr[1]];
[29839] Fix | Delete
p1 = [coordsArr[3], coordsArr[4]];
[29840] Fix | Delete
r0 = coordsArr[2];
[29841] Fix | Delete
r1 = coordsArr[5];
[29842] Fix | Delete
type = "radial";
[29843] Fix | Delete
} else {
[29844] Fix | Delete
unreachable(`getPattern type unknown: ${shadingType}`);
[29845] Fix | Delete
}
[29846] Fix | Delete
return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
[29847] Fix | Delete
}
[29848] Fix | Delete
}
[29849] Fix | Delete
class MeshStreamReader {
[29850] Fix | Delete
constructor(stream, context) {
[29851] Fix | Delete
this.stream = stream;
[29852] Fix | Delete
this.context = context;
[29853] Fix | Delete
this.buffer = 0;
[29854] Fix | Delete
this.bufferLength = 0;
[29855] Fix | Delete
const numComps = context.numComps;
[29856] Fix | Delete
this.tmpCompsBuf = new Float32Array(numComps);
[29857] Fix | Delete
const csNumComps = context.colorSpace.numComps;
[29858] Fix | Delete
this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
[29859] Fix | Delete
}
[29860] Fix | Delete
get hasData() {
[29861] Fix | Delete
if (this.stream.end) {
[29862] Fix | Delete
return this.stream.pos < this.stream.end;
[29863] Fix | Delete
}
[29864] Fix | Delete
if (this.bufferLength > 0) {
[29865] Fix | Delete
return true;
[29866] Fix | Delete
}
[29867] Fix | Delete
const nextByte = this.stream.getByte();
[29868] Fix | Delete
if (nextByte < 0) {
[29869] Fix | Delete
return false;
[29870] Fix | Delete
}
[29871] Fix | Delete
this.buffer = nextByte;
[29872] Fix | Delete
this.bufferLength = 8;
[29873] Fix | Delete
return true;
[29874] Fix | Delete
}
[29875] Fix | Delete
readBits(n) {
[29876] Fix | Delete
let buffer = this.buffer;
[29877] Fix | Delete
let bufferLength = this.bufferLength;
[29878] Fix | Delete
if (n === 32) {
[29879] Fix | Delete
if (bufferLength === 0) {
[29880] Fix | Delete
return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
[29881] Fix | Delete
}
[29882] Fix | Delete
buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
[29883] Fix | Delete
const nextByte = this.stream.getByte();
[29884] Fix | Delete
this.buffer = nextByte & (1 << bufferLength) - 1;
[29885] Fix | Delete
return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
[29886] Fix | Delete
}
[29887] Fix | Delete
if (n === 8 && bufferLength === 0) {
[29888] Fix | Delete
return this.stream.getByte();
[29889] Fix | Delete
}
[29890] Fix | Delete
while (bufferLength < n) {
[29891] Fix | Delete
buffer = buffer << 8 | this.stream.getByte();
[29892] Fix | Delete
bufferLength += 8;
[29893] Fix | Delete
}
[29894] Fix | Delete
bufferLength -= n;
[29895] Fix | Delete
this.bufferLength = bufferLength;
[29896] Fix | Delete
this.buffer = buffer & (1 << bufferLength) - 1;
[29897] Fix | Delete
return buffer >> bufferLength;
[29898] Fix | Delete
}
[29899] Fix | Delete
align() {
[29900] Fix | Delete
this.buffer = 0;
[29901] Fix | Delete
this.bufferLength = 0;
[29902] Fix | Delete
}
[29903] Fix | Delete
readFlag() {
[29904] Fix | Delete
return this.readBits(this.context.bitsPerFlag);
[29905] Fix | Delete
}
[29906] Fix | Delete
readCoordinate() {
[29907] Fix | Delete
const bitsPerCoordinate = this.context.bitsPerCoordinate;
[29908] Fix | Delete
const xi = this.readBits(bitsPerCoordinate);
[29909] Fix | Delete
const yi = this.readBits(bitsPerCoordinate);
[29910] Fix | Delete
const decode = this.context.decode;
[29911] Fix | Delete
const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
[29912] Fix | Delete
return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
[29913] Fix | Delete
}
[29914] Fix | Delete
readComponents() {
[29915] Fix | Delete
const numComps = this.context.numComps;
[29916] Fix | Delete
const bitsPerComponent = this.context.bitsPerComponent;
[29917] Fix | Delete
const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
[29918] Fix | Delete
const decode = this.context.decode;
[29919] Fix | Delete
const components = this.tmpCompsBuf;
[29920] Fix | Delete
for (let i = 0, j = 4; i < numComps; i++, j += 2) {
[29921] Fix | Delete
const ci = this.readBits(bitsPerComponent);
[29922] Fix | Delete
components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
[29923] Fix | Delete
}
[29924] Fix | Delete
const color = this.tmpCsCompsBuf;
[29925] Fix | Delete
if (this.context.colorFn) {
[29926] Fix | Delete
this.context.colorFn(components, 0, color, 0);
[29927] Fix | Delete
}
[29928] Fix | Delete
return this.context.colorSpace.getRgb(color, 0);
[29929] Fix | Delete
}
[29930] Fix | Delete
}
[29931] Fix | Delete
let bCache = Object.create(null);
[29932] Fix | Delete
function buildB(count) {
[29933] Fix | Delete
const lut = [];
[29934] Fix | Delete
for (let i = 0; i <= count; i++) {
[29935] Fix | Delete
const t = i / count,
[29936] Fix | Delete
t_ = 1 - t;
[29937] Fix | Delete
lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3]));
[29938] Fix | Delete
}
[29939] Fix | Delete
return lut;
[29940] Fix | Delete
}
[29941] Fix | Delete
function getB(count) {
[29942] Fix | Delete
return bCache[count] ||= buildB(count);
[29943] Fix | Delete
}
[29944] Fix | Delete
function clearPatternCaches() {
[29945] Fix | Delete
bCache = Object.create(null);
[29946] Fix | Delete
}
[29947] Fix | Delete
class MeshShading extends BaseShading {
[29948] Fix | Delete
static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
[29949] Fix | Delete
static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
[29950] Fix | Delete
static TRIANGLE_DENSITY = 20;
[29951] Fix | Delete
constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
[29952] Fix | Delete
super();
[29953] Fix | Delete
if (!(stream instanceof BaseStream)) {
[29954] Fix | Delete
throw new FormatError("Mesh data is not a stream");
[29955] Fix | Delete
}
[29956] Fix | Delete
const dict = stream.dict;
[29957] Fix | Delete
this.shadingType = dict.get("ShadingType");
[29958] Fix | Delete
this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
[29959] Fix | Delete
const cs = ColorSpace.parse({
[29960] Fix | Delete
cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
[29961] Fix | Delete
xref,
[29962] Fix | Delete
resources,
[29963] Fix | Delete
pdfFunctionFactory,
[29964] Fix | Delete
localColorSpaceCache
[29965] Fix | Delete
});
[29966] Fix | Delete
this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
[29967] Fix | Delete
const fnObj = dict.getRaw("Function");
[29968] Fix | Delete
const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
[29969] Fix | Delete
this.coords = [];
[29970] Fix | Delete
this.colors = [];
[29971] Fix | Delete
this.figures = [];
[29972] Fix | Delete
const decodeContext = {
[29973] Fix | Delete
bitsPerCoordinate: dict.get("BitsPerCoordinate"),
[29974] Fix | Delete
bitsPerComponent: dict.get("BitsPerComponent"),
[29975] Fix | Delete
bitsPerFlag: dict.get("BitsPerFlag"),
[29976] Fix | Delete
decode: dict.getArray("Decode"),
[29977] Fix | Delete
colorFn: fn,
[29978] Fix | Delete
colorSpace: cs,
[29979] Fix | Delete
numComps: fn ? 1 : cs.numComps
[29980] Fix | Delete
};
[29981] Fix | Delete
const reader = new MeshStreamReader(stream, decodeContext);
[29982] Fix | Delete
let patchMesh = false;
[29983] Fix | Delete
switch (this.shadingType) {
[29984] Fix | Delete
case ShadingType.FREE_FORM_MESH:
[29985] Fix | Delete
this._decodeType4Shading(reader);
[29986] Fix | Delete
break;
[29987] Fix | Delete
case ShadingType.LATTICE_FORM_MESH:
[29988] Fix | Delete
const verticesPerRow = dict.get("VerticesPerRow") | 0;
[29989] Fix | Delete
if (verticesPerRow < 2) {
[29990] Fix | Delete
throw new FormatError("Invalid VerticesPerRow");
[29991] Fix | Delete
}
[29992] Fix | Delete
this._decodeType5Shading(reader, verticesPerRow);
[29993] Fix | Delete
break;
[29994] Fix | Delete
case ShadingType.COONS_PATCH_MESH:
[29995] Fix | Delete
this._decodeType6Shading(reader);
[29996] Fix | Delete
patchMesh = true;
[29997] Fix | Delete
break;
[29998] Fix | Delete
case ShadingType.TENSOR_PATCH_MESH:
[29999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function