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: script.js
case FontRenderOps.RESTORE:
[10000] Fix | Delete
commands.push(ctx => ctx.restore());
[10001] Fix | Delete
break;
[10002] Fix | Delete
case FontRenderOps.SAVE:
[10003] Fix | Delete
commands.push(ctx => ctx.save());
[10004] Fix | Delete
break;
[10005] Fix | Delete
case FontRenderOps.SCALE:
[10006] Fix | Delete
assert(commands.length === 2, "Scale command is only valid at the third position.");
[10007] Fix | Delete
break;
[10008] Fix | Delete
case FontRenderOps.TRANSFORM:
[10009] Fix | Delete
{
[10010] Fix | Delete
const [a, b, c, d, e, f] = cmds.slice(i, i + 6);
[10011] Fix | Delete
commands.push(ctx => ctx.transform(a, b, c, d, e, f));
[10012] Fix | Delete
i += 6;
[10013] Fix | Delete
}
[10014] Fix | Delete
break;
[10015] Fix | Delete
case FontRenderOps.TRANSLATE:
[10016] Fix | Delete
{
[10017] Fix | Delete
const [a, b] = cmds.slice(i, i + 2);
[10018] Fix | Delete
commands.push(ctx => ctx.translate(a, b));
[10019] Fix | Delete
i += 2;
[10020] Fix | Delete
}
[10021] Fix | Delete
break;
[10022] Fix | Delete
}
[10023] Fix | Delete
}
[10024] Fix | Delete
return this.compiledGlyphs[character] = function glyphDrawer(ctx, size) {
[10025] Fix | Delete
commands[0](ctx);
[10026] Fix | Delete
commands[1](ctx);
[10027] Fix | Delete
ctx.scale(size, -size);
[10028] Fix | Delete
for (let i = 2, ii = commands.length; i < ii; i++) {
[10029] Fix | Delete
commands[i](ctx);
[10030] Fix | Delete
}
[10031] Fix | Delete
};
[10032] Fix | Delete
}
[10033] Fix | Delete
}
[10034] Fix | Delete
[10035] Fix | Delete
;// CONCATENATED MODULE: ./src/display/node_utils.js
[10036] Fix | Delete
[10037] Fix | Delete
[10038] Fix | Delete
[10039] Fix | Delete
[10040] Fix | Delete
[10041] Fix | Delete
[10042] Fix | Delete
[10043] Fix | Delete
[10044] Fix | Delete
[10045] Fix | Delete
if (isNodeJS) {
[10046] Fix | Delete
var packageCapability = Promise.withResolvers();
[10047] Fix | Delete
var packageMap = null;
[10048] Fix | Delete
const loadPackages = async () => {
[10049] Fix | Delete
const fs = await import( /*webpackIgnore: true*/"fs"),
[10050] Fix | Delete
http = await import( /*webpackIgnore: true*/"http"),
[10051] Fix | Delete
https = await import( /*webpackIgnore: true*/"https"),
[10052] Fix | Delete
url = await import( /*webpackIgnore: true*/"url");
[10053] Fix | Delete
let canvas, path2d;
[10054] Fix | Delete
try {
[10055] Fix | Delete
canvas = await import( /*webpackIgnore: true*/"canvas");
[10056] Fix | Delete
} catch {}
[10057] Fix | Delete
try {
[10058] Fix | Delete
path2d = await import( /*webpackIgnore: true*/"path2d");
[10059] Fix | Delete
} catch {}
[10060] Fix | Delete
return new Map(Object.entries({
[10061] Fix | Delete
fs,
[10062] Fix | Delete
http,
[10063] Fix | Delete
https,
[10064] Fix | Delete
url,
[10065] Fix | Delete
canvas,
[10066] Fix | Delete
path2d
[10067] Fix | Delete
}));
[10068] Fix | Delete
};
[10069] Fix | Delete
loadPackages().then(map => {
[10070] Fix | Delete
packageMap = map;
[10071] Fix | Delete
packageCapability.resolve();
[10072] Fix | Delete
if (!globalThis.DOMMatrix) {
[10073] Fix | Delete
const DOMMatrix = map.get("canvas")?.DOMMatrix;
[10074] Fix | Delete
if (DOMMatrix) {
[10075] Fix | Delete
globalThis.DOMMatrix = DOMMatrix;
[10076] Fix | Delete
} else {
[10077] Fix | Delete
warn("Cannot polyfill `DOMMatrix`, rendering may be broken.");
[10078] Fix | Delete
}
[10079] Fix | Delete
}
[10080] Fix | Delete
if (!globalThis.Path2D) {
[10081] Fix | Delete
const CanvasRenderingContext2D = map.get("canvas")?.CanvasRenderingContext2D;
[10082] Fix | Delete
const applyPath2DToCanvasRenderingContext = map.get("path2d")?.applyPath2DToCanvasRenderingContext;
[10083] Fix | Delete
const Path2D = map.get("path2d")?.Path2D;
[10084] Fix | Delete
if (CanvasRenderingContext2D && applyPath2DToCanvasRenderingContext && Path2D) {
[10085] Fix | Delete
applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);
[10086] Fix | Delete
globalThis.Path2D = Path2D;
[10087] Fix | Delete
} else {
[10088] Fix | Delete
warn("Cannot polyfill `Path2D`, rendering may be broken.");
[10089] Fix | Delete
}
[10090] Fix | Delete
}
[10091] Fix | Delete
}, reason => {
[10092] Fix | Delete
warn(`loadPackages: ${reason}`);
[10093] Fix | Delete
packageMap = new Map();
[10094] Fix | Delete
packageCapability.resolve();
[10095] Fix | Delete
});
[10096] Fix | Delete
}
[10097] Fix | Delete
class NodePackages {
[10098] Fix | Delete
static get promise() {
[10099] Fix | Delete
return packageCapability.promise;
[10100] Fix | Delete
}
[10101] Fix | Delete
static get(name) {
[10102] Fix | Delete
return packageMap?.get(name);
[10103] Fix | Delete
}
[10104] Fix | Delete
}
[10105] Fix | Delete
const node_utils_fetchData = function (url) {
[10106] Fix | Delete
const fs = NodePackages.get("fs");
[10107] Fix | Delete
return fs.promises.readFile(url).then(data => new Uint8Array(data));
[10108] Fix | Delete
};
[10109] Fix | Delete
class NodeFilterFactory extends BaseFilterFactory {}
[10110] Fix | Delete
class NodeCanvasFactory extends BaseCanvasFactory {
[10111] Fix | Delete
_createCanvas(width, height) {
[10112] Fix | Delete
const canvas = NodePackages.get("canvas");
[10113] Fix | Delete
return canvas.createCanvas(width, height);
[10114] Fix | Delete
}
[10115] Fix | Delete
}
[10116] Fix | Delete
class NodeCMapReaderFactory extends BaseCMapReaderFactory {
[10117] Fix | Delete
_fetchData(url, compressionType) {
[10118] Fix | Delete
return node_utils_fetchData(url).then(data => ({
[10119] Fix | Delete
cMapData: data,
[10120] Fix | Delete
compressionType
[10121] Fix | Delete
}));
[10122] Fix | Delete
}
[10123] Fix | Delete
}
[10124] Fix | Delete
class NodeStandardFontDataFactory extends BaseStandardFontDataFactory {
[10125] Fix | Delete
_fetchData(url) {
[10126] Fix | Delete
return node_utils_fetchData(url);
[10127] Fix | Delete
}
[10128] Fix | Delete
}
[10129] Fix | Delete
[10130] Fix | Delete
;// CONCATENATED MODULE: ./src/display/pattern_helper.js
[10131] Fix | Delete
[10132] Fix | Delete
[10133] Fix | Delete
const PathType = {
[10134] Fix | Delete
FILL: "Fill",
[10135] Fix | Delete
STROKE: "Stroke",
[10136] Fix | Delete
SHADING: "Shading"
[10137] Fix | Delete
};
[10138] Fix | Delete
function applyBoundingBox(ctx, bbox) {
[10139] Fix | Delete
if (!bbox) {
[10140] Fix | Delete
return;
[10141] Fix | Delete
}
[10142] Fix | Delete
const width = bbox[2] - bbox[0];
[10143] Fix | Delete
const height = bbox[3] - bbox[1];
[10144] Fix | Delete
const region = new Path2D();
[10145] Fix | Delete
region.rect(bbox[0], bbox[1], width, height);
[10146] Fix | Delete
ctx.clip(region);
[10147] Fix | Delete
}
[10148] Fix | Delete
class BaseShadingPattern {
[10149] Fix | Delete
constructor() {
[10150] Fix | Delete
if (this.constructor === BaseShadingPattern) {
[10151] Fix | Delete
unreachable("Cannot initialize BaseShadingPattern.");
[10152] Fix | Delete
}
[10153] Fix | Delete
}
[10154] Fix | Delete
getPattern() {
[10155] Fix | Delete
unreachable("Abstract method `getPattern` called.");
[10156] Fix | Delete
}
[10157] Fix | Delete
}
[10158] Fix | Delete
class RadialAxialShadingPattern extends BaseShadingPattern {
[10159] Fix | Delete
constructor(IR) {
[10160] Fix | Delete
super();
[10161] Fix | Delete
this._type = IR[1];
[10162] Fix | Delete
this._bbox = IR[2];
[10163] Fix | Delete
this._colorStops = IR[3];
[10164] Fix | Delete
this._p0 = IR[4];
[10165] Fix | Delete
this._p1 = IR[5];
[10166] Fix | Delete
this._r0 = IR[6];
[10167] Fix | Delete
this._r1 = IR[7];
[10168] Fix | Delete
this.matrix = null;
[10169] Fix | Delete
}
[10170] Fix | Delete
_createGradient(ctx) {
[10171] Fix | Delete
let grad;
[10172] Fix | Delete
if (this._type === "axial") {
[10173] Fix | Delete
grad = ctx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]);
[10174] Fix | Delete
} else if (this._type === "radial") {
[10175] Fix | Delete
grad = ctx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1);
[10176] Fix | Delete
}
[10177] Fix | Delete
for (const colorStop of this._colorStops) {
[10178] Fix | Delete
grad.addColorStop(colorStop[0], colorStop[1]);
[10179] Fix | Delete
}
[10180] Fix | Delete
return grad;
[10181] Fix | Delete
}
[10182] Fix | Delete
getPattern(ctx, owner, inverse, pathType) {
[10183] Fix | Delete
let pattern;
[10184] Fix | Delete
if (pathType === PathType.STROKE || pathType === PathType.FILL) {
[10185] Fix | Delete
const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, getCurrentTransform(ctx)) || [0, 0, 0, 0];
[10186] Fix | Delete
const width = Math.ceil(ownerBBox[2] - ownerBBox[0]) || 1;
[10187] Fix | Delete
const height = Math.ceil(ownerBBox[3] - ownerBBox[1]) || 1;
[10188] Fix | Delete
const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", width, height, true);
[10189] Fix | Delete
const tmpCtx = tmpCanvas.context;
[10190] Fix | Delete
tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
[10191] Fix | Delete
tmpCtx.beginPath();
[10192] Fix | Delete
tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height);
[10193] Fix | Delete
tmpCtx.translate(-ownerBBox[0], -ownerBBox[1]);
[10194] Fix | Delete
inverse = Util.transform(inverse, [1, 0, 0, 1, ownerBBox[0], ownerBBox[1]]);
[10195] Fix | Delete
tmpCtx.transform(...owner.baseTransform);
[10196] Fix | Delete
if (this.matrix) {
[10197] Fix | Delete
tmpCtx.transform(...this.matrix);
[10198] Fix | Delete
}
[10199] Fix | Delete
applyBoundingBox(tmpCtx, this._bbox);
[10200] Fix | Delete
tmpCtx.fillStyle = this._createGradient(tmpCtx);
[10201] Fix | Delete
tmpCtx.fill();
[10202] Fix | Delete
pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
[10203] Fix | Delete
const domMatrix = new DOMMatrix(inverse);
[10204] Fix | Delete
pattern.setTransform(domMatrix);
[10205] Fix | Delete
} else {
[10206] Fix | Delete
applyBoundingBox(ctx, this._bbox);
[10207] Fix | Delete
pattern = this._createGradient(ctx);
[10208] Fix | Delete
}
[10209] Fix | Delete
return pattern;
[10210] Fix | Delete
}
[10211] Fix | Delete
}
[10212] Fix | Delete
function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
[10213] Fix | Delete
const coords = context.coords,
[10214] Fix | Delete
colors = context.colors;
[10215] Fix | Delete
const bytes = data.data,
[10216] Fix | Delete
rowSize = data.width * 4;
[10217] Fix | Delete
let tmp;
[10218] Fix | Delete
if (coords[p1 + 1] > coords[p2 + 1]) {
[10219] Fix | Delete
tmp = p1;
[10220] Fix | Delete
p1 = p2;
[10221] Fix | Delete
p2 = tmp;
[10222] Fix | Delete
tmp = c1;
[10223] Fix | Delete
c1 = c2;
[10224] Fix | Delete
c2 = tmp;
[10225] Fix | Delete
}
[10226] Fix | Delete
if (coords[p2 + 1] > coords[p3 + 1]) {
[10227] Fix | Delete
tmp = p2;
[10228] Fix | Delete
p2 = p3;
[10229] Fix | Delete
p3 = tmp;
[10230] Fix | Delete
tmp = c2;
[10231] Fix | Delete
c2 = c3;
[10232] Fix | Delete
c3 = tmp;
[10233] Fix | Delete
}
[10234] Fix | Delete
if (coords[p1 + 1] > coords[p2 + 1]) {
[10235] Fix | Delete
tmp = p1;
[10236] Fix | Delete
p1 = p2;
[10237] Fix | Delete
p2 = tmp;
[10238] Fix | Delete
tmp = c1;
[10239] Fix | Delete
c1 = c2;
[10240] Fix | Delete
c2 = tmp;
[10241] Fix | Delete
}
[10242] Fix | Delete
const x1 = (coords[p1] + context.offsetX) * context.scaleX;
[10243] Fix | Delete
const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY;
[10244] Fix | Delete
const x2 = (coords[p2] + context.offsetX) * context.scaleX;
[10245] Fix | Delete
const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY;
[10246] Fix | Delete
const x3 = (coords[p3] + context.offsetX) * context.scaleX;
[10247] Fix | Delete
const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY;
[10248] Fix | Delete
if (y1 >= y3) {
[10249] Fix | Delete
return;
[10250] Fix | Delete
}
[10251] Fix | Delete
const c1r = colors[c1],
[10252] Fix | Delete
c1g = colors[c1 + 1],
[10253] Fix | Delete
c1b = colors[c1 + 2];
[10254] Fix | Delete
const c2r = colors[c2],
[10255] Fix | Delete
c2g = colors[c2 + 1],
[10256] Fix | Delete
c2b = colors[c2 + 2];
[10257] Fix | Delete
const c3r = colors[c3],
[10258] Fix | Delete
c3g = colors[c3 + 1],
[10259] Fix | Delete
c3b = colors[c3 + 2];
[10260] Fix | Delete
const minY = Math.round(y1),
[10261] Fix | Delete
maxY = Math.round(y3);
[10262] Fix | Delete
let xa, car, cag, cab;
[10263] Fix | Delete
let xb, cbr, cbg, cbb;
[10264] Fix | Delete
for (let y = minY; y <= maxY; y++) {
[10265] Fix | Delete
if (y < y2) {
[10266] Fix | Delete
const k = y < y1 ? 0 : (y1 - y) / (y1 - y2);
[10267] Fix | Delete
xa = x1 - (x1 - x2) * k;
[10268] Fix | Delete
car = c1r - (c1r - c2r) * k;
[10269] Fix | Delete
cag = c1g - (c1g - c2g) * k;
[10270] Fix | Delete
cab = c1b - (c1b - c2b) * k;
[10271] Fix | Delete
} else {
[10272] Fix | Delete
let k;
[10273] Fix | Delete
if (y > y3) {
[10274] Fix | Delete
k = 1;
[10275] Fix | Delete
} else if (y2 === y3) {
[10276] Fix | Delete
k = 0;
[10277] Fix | Delete
} else {
[10278] Fix | Delete
k = (y2 - y) / (y2 - y3);
[10279] Fix | Delete
}
[10280] Fix | Delete
xa = x2 - (x2 - x3) * k;
[10281] Fix | Delete
car = c2r - (c2r - c3r) * k;
[10282] Fix | Delete
cag = c2g - (c2g - c3g) * k;
[10283] Fix | Delete
cab = c2b - (c2b - c3b) * k;
[10284] Fix | Delete
}
[10285] Fix | Delete
let k;
[10286] Fix | Delete
if (y < y1) {
[10287] Fix | Delete
k = 0;
[10288] Fix | Delete
} else if (y > y3) {
[10289] Fix | Delete
k = 1;
[10290] Fix | Delete
} else {
[10291] Fix | Delete
k = (y1 - y) / (y1 - y3);
[10292] Fix | Delete
}
[10293] Fix | Delete
xb = x1 - (x1 - x3) * k;
[10294] Fix | Delete
cbr = c1r - (c1r - c3r) * k;
[10295] Fix | Delete
cbg = c1g - (c1g - c3g) * k;
[10296] Fix | Delete
cbb = c1b - (c1b - c3b) * k;
[10297] Fix | Delete
const x1_ = Math.round(Math.min(xa, xb));
[10298] Fix | Delete
const x2_ = Math.round(Math.max(xa, xb));
[10299] Fix | Delete
let j = rowSize * y + x1_ * 4;
[10300] Fix | Delete
for (let x = x1_; x <= x2_; x++) {
[10301] Fix | Delete
k = (xa - x) / (xa - xb);
[10302] Fix | Delete
if (k < 0) {
[10303] Fix | Delete
k = 0;
[10304] Fix | Delete
} else if (k > 1) {
[10305] Fix | Delete
k = 1;
[10306] Fix | Delete
}
[10307] Fix | Delete
bytes[j++] = car - (car - cbr) * k | 0;
[10308] Fix | Delete
bytes[j++] = cag - (cag - cbg) * k | 0;
[10309] Fix | Delete
bytes[j++] = cab - (cab - cbb) * k | 0;
[10310] Fix | Delete
bytes[j++] = 255;
[10311] Fix | Delete
}
[10312] Fix | Delete
}
[10313] Fix | Delete
}
[10314] Fix | Delete
function drawFigure(data, figure, context) {
[10315] Fix | Delete
const ps = figure.coords;
[10316] Fix | Delete
const cs = figure.colors;
[10317] Fix | Delete
let i, ii;
[10318] Fix | Delete
switch (figure.type) {
[10319] Fix | Delete
case "lattice":
[10320] Fix | Delete
const verticesPerRow = figure.verticesPerRow;
[10321] Fix | Delete
const rows = Math.floor(ps.length / verticesPerRow) - 1;
[10322] Fix | Delete
const cols = verticesPerRow - 1;
[10323] Fix | Delete
for (i = 0; i < rows; i++) {
[10324] Fix | Delete
let q = i * verticesPerRow;
[10325] Fix | Delete
for (let j = 0; j < cols; j++, q++) {
[10326] Fix | Delete
drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]);
[10327] Fix | Delete
drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]);
[10328] Fix | Delete
}
[10329] Fix | Delete
}
[10330] Fix | Delete
break;
[10331] Fix | Delete
case "triangles":
[10332] Fix | Delete
for (i = 0, ii = ps.length; i < ii; i += 3) {
[10333] Fix | Delete
drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]);
[10334] Fix | Delete
}
[10335] Fix | Delete
break;
[10336] Fix | Delete
default:
[10337] Fix | Delete
throw new Error("illegal figure");
[10338] Fix | Delete
}
[10339] Fix | Delete
}
[10340] Fix | Delete
class MeshShadingPattern extends BaseShadingPattern {
[10341] Fix | Delete
constructor(IR) {
[10342] Fix | Delete
super();
[10343] Fix | Delete
this._coords = IR[2];
[10344] Fix | Delete
this._colors = IR[3];
[10345] Fix | Delete
this._figures = IR[4];
[10346] Fix | Delete
this._bounds = IR[5];
[10347] Fix | Delete
this._bbox = IR[7];
[10348] Fix | Delete
this._background = IR[8];
[10349] Fix | Delete
this.matrix = null;
[10350] Fix | Delete
}
[10351] Fix | Delete
_createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) {
[10352] Fix | Delete
const EXPECTED_SCALE = 1.1;
[10353] Fix | Delete
const MAX_PATTERN_SIZE = 3000;
[10354] Fix | Delete
const BORDER_SIZE = 2;
[10355] Fix | Delete
const offsetX = Math.floor(this._bounds[0]);
[10356] Fix | Delete
const offsetY = Math.floor(this._bounds[1]);
[10357] Fix | Delete
const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
[10358] Fix | Delete
const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
[10359] Fix | Delete
const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
[10360] Fix | Delete
const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE);
[10361] Fix | Delete
const scaleX = boundsWidth / width;
[10362] Fix | Delete
const scaleY = boundsHeight / height;
[10363] Fix | Delete
const context = {
[10364] Fix | Delete
coords: this._coords,
[10365] Fix | Delete
colors: this._colors,
[10366] Fix | Delete
offsetX: -offsetX,
[10367] Fix | Delete
offsetY: -offsetY,
[10368] Fix | Delete
scaleX: 1 / scaleX,
[10369] Fix | Delete
scaleY: 1 / scaleY
[10370] Fix | Delete
};
[10371] Fix | Delete
const paddedWidth = width + BORDER_SIZE * 2;
[10372] Fix | Delete
const paddedHeight = height + BORDER_SIZE * 2;
[10373] Fix | Delete
const tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false);
[10374] Fix | Delete
const tmpCtx = tmpCanvas.context;
[10375] Fix | Delete
const data = tmpCtx.createImageData(width, height);
[10376] Fix | Delete
if (backgroundColor) {
[10377] Fix | Delete
const bytes = data.data;
[10378] Fix | Delete
for (let i = 0, ii = bytes.length; i < ii; i += 4) {
[10379] Fix | Delete
bytes[i] = backgroundColor[0];
[10380] Fix | Delete
bytes[i + 1] = backgroundColor[1];
[10381] Fix | Delete
bytes[i + 2] = backgroundColor[2];
[10382] Fix | Delete
bytes[i + 3] = 255;
[10383] Fix | Delete
}
[10384] Fix | Delete
}
[10385] Fix | Delete
for (const figure of this._figures) {
[10386] Fix | Delete
drawFigure(data, figure, context);
[10387] Fix | Delete
}
[10388] Fix | Delete
tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
[10389] Fix | Delete
const canvas = tmpCanvas.canvas;
[10390] Fix | Delete
return {
[10391] Fix | Delete
canvas,
[10392] Fix | Delete
offsetX: offsetX - BORDER_SIZE * scaleX,
[10393] Fix | Delete
offsetY: offsetY - BORDER_SIZE * scaleY,
[10394] Fix | Delete
scaleX,
[10395] Fix | Delete
scaleY
[10396] Fix | Delete
};
[10397] Fix | Delete
}
[10398] Fix | Delete
getPattern(ctx, owner, inverse, pathType) {
[10399] Fix | Delete
applyBoundingBox(ctx, this._bbox);
[10400] Fix | Delete
let scale;
[10401] Fix | Delete
if (pathType === PathType.SHADING) {
[10402] Fix | Delete
scale = Util.singularValueDecompose2dScale(getCurrentTransform(ctx));
[10403] Fix | Delete
} else {
[10404] Fix | Delete
scale = Util.singularValueDecompose2dScale(owner.baseTransform);
[10405] Fix | Delete
if (this.matrix) {
[10406] Fix | Delete
const matrixScale = Util.singularValueDecompose2dScale(this.matrix);
[10407] Fix | Delete
scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]];
[10408] Fix | Delete
}
[10409] Fix | Delete
}
[10410] Fix | Delete
const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.cachedCanvases);
[10411] Fix | Delete
if (pathType !== PathType.SHADING) {
[10412] Fix | Delete
ctx.setTransform(...owner.baseTransform);
[10413] Fix | Delete
if (this.matrix) {
[10414] Fix | Delete
ctx.transform(...this.matrix);
[10415] Fix | Delete
}
[10416] Fix | Delete
}
[10417] Fix | Delete
ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
[10418] Fix | Delete
ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
[10419] Fix | Delete
return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
[10420] Fix | Delete
}
[10421] Fix | Delete
}
[10422] Fix | Delete
class DummyShadingPattern extends BaseShadingPattern {
[10423] Fix | Delete
getPattern() {
[10424] Fix | Delete
return "hotpink";
[10425] Fix | Delete
}
[10426] Fix | Delete
}
[10427] Fix | Delete
function getShadingPattern(IR) {
[10428] Fix | Delete
switch (IR[0]) {
[10429] Fix | Delete
case "RadialAxial":
[10430] Fix | Delete
return new RadialAxialShadingPattern(IR);
[10431] Fix | Delete
case "Mesh":
[10432] Fix | Delete
return new MeshShadingPattern(IR);
[10433] Fix | Delete
case "Dummy":
[10434] Fix | Delete
return new DummyShadingPattern();
[10435] Fix | Delete
}
[10436] Fix | Delete
throw new Error(`Unknown IR type: ${IR[0]}`);
[10437] Fix | Delete
}
[10438] Fix | Delete
const PaintType = {
[10439] Fix | Delete
COLORED: 1,
[10440] Fix | Delete
UNCOLORED: 2
[10441] Fix | Delete
};
[10442] Fix | Delete
class TilingPattern {
[10443] Fix | Delete
static MAX_PATTERN_SIZE = 3000;
[10444] Fix | Delete
constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) {
[10445] Fix | Delete
this.operatorList = IR[2];
[10446] Fix | Delete
this.matrix = IR[3];
[10447] Fix | Delete
this.bbox = IR[4];
[10448] Fix | Delete
this.xstep = IR[5];
[10449] Fix | Delete
this.ystep = IR[6];
[10450] Fix | Delete
this.paintType = IR[7];
[10451] Fix | Delete
this.tilingType = IR[8];
[10452] Fix | Delete
this.color = color;
[10453] Fix | Delete
this.ctx = ctx;
[10454] Fix | Delete
this.canvasGraphicsFactory = canvasGraphicsFactory;
[10455] Fix | Delete
this.baseTransform = baseTransform;
[10456] Fix | Delete
}
[10457] Fix | Delete
createPatternCanvas(owner) {
[10458] Fix | Delete
const operatorList = this.operatorList;
[10459] Fix | Delete
const bbox = this.bbox;
[10460] Fix | Delete
const xstep = this.xstep;
[10461] Fix | Delete
const ystep = this.ystep;
[10462] Fix | Delete
const paintType = this.paintType;
[10463] Fix | Delete
const tilingType = this.tilingType;
[10464] Fix | Delete
const color = this.color;
[10465] Fix | Delete
const canvasGraphicsFactory = this.canvasGraphicsFactory;
[10466] Fix | Delete
info("TilingType: " + tilingType);
[10467] Fix | Delete
const x0 = bbox[0],
[10468] Fix | Delete
y0 = bbox[1],
[10469] Fix | Delete
x1 = bbox[2],
[10470] Fix | Delete
y1 = bbox[3];
[10471] Fix | Delete
const matrixScale = Util.singularValueDecompose2dScale(this.matrix);
[10472] Fix | Delete
const curMatrixScale = Util.singularValueDecompose2dScale(this.baseTransform);
[10473] Fix | Delete
const combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]];
[10474] Fix | Delete
const dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]);
[10475] Fix | Delete
const dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]);
[10476] Fix | Delete
const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true);
[10477] Fix | Delete
const tmpCtx = tmpCanvas.context;
[10478] Fix | Delete
const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx);
[10479] Fix | Delete
graphics.groupLevel = owner.groupLevel;
[10480] Fix | Delete
this.setFillAndStrokeStyleToContext(graphics, paintType, color);
[10481] Fix | Delete
let adjustedX0 = x0;
[10482] Fix | Delete
let adjustedY0 = y0;
[10483] Fix | Delete
let adjustedX1 = x1;
[10484] Fix | Delete
let adjustedY1 = y1;
[10485] Fix | Delete
if (x0 < 0) {
[10486] Fix | Delete
adjustedX0 = 0;
[10487] Fix | Delete
adjustedX1 += Math.abs(x0);
[10488] Fix | Delete
}
[10489] Fix | Delete
if (y0 < 0) {
[10490] Fix | Delete
adjustedY0 = 0;
[10491] Fix | Delete
adjustedY1 += Math.abs(y0);
[10492] Fix | Delete
}
[10493] Fix | Delete
tmpCtx.translate(-(dimx.scale * adjustedX0), -(dimy.scale * adjustedY0));
[10494] Fix | Delete
graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
[10495] Fix | Delete
tmpCtx.save();
[10496] Fix | Delete
this.clipBbox(graphics, adjustedX0, adjustedY0, adjustedX1, adjustedY1);
[10497] Fix | Delete
graphics.baseTransform = getCurrentTransform(graphics.ctx);
[10498] Fix | Delete
graphics.executeOperatorList(operatorList);
[10499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function