pxt-arcade 1.13.11 → 1.13.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/common-sim.d.ts +4 -0
- package/built/common-sim.js +187 -0
- package/built/sim.js +187 -0
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.json +1 -1
- package/docs/concepts/bouncing-burger.md +5 -5
- package/docs/concepts/breadcrumb-trail.md +4 -4
- package/docs/concepts/picnic-food.md +6 -6
- package/docs/concepts/princess-pizza.md +4 -4
- package/docs/concepts/setting-the-scene.md +2 -2
- package/docs/concepts/throw-a-bone.md +5 -5
- package/docs/concepts/walking-hero.md +3 -3
- package/docs/lessons/barrel-dodger.md +3 -3
- package/docs/multiplayer-games.md +12 -12
- package/docs/projects/SUMMARY.md +6 -6
- package/docs/recipes/shark-splash/01-character.md +3 -3
- package/docs/recipes/shark-splash/02-A-enemies.md +2 -2
- package/docs/recipes/shark-splash/02-enemies.md +5 -5
- package/docs/recipes/shark-splash/04-background.md +3 -3
- package/docs/recipes/side-scroller/02-create-car.md +2 -2
- package/docs/skillmaps.md +2 -0
- package/docs/static/badges/badge-adventure-locked.png +0 -0
- package/docs/static/badges/badge-adventure.png +0 -0
- package/docs/test/skillmap/dino/dino3.md +1 -0
- package/docs/test/skillmap/star/star1.md +7 -31
- package/docs/test/skillmap/star/star2.md +4 -1
- package/docs/test/skillmap/star/star4.md +54 -3
- package/docs/tutorials/catch-the-football.md +8 -8
- package/docs/tutorials/chase-the-basketball.md +5 -5
- package/docs/tutorials/free-throw.md +4 -4
- package/package.json +2 -2
- package/pxtarget.json +1 -1
- package/targetconfig.json +1 -1
package/built/common-sim.d.ts
CHANGED
|
@@ -1131,6 +1131,10 @@ declare namespace pxsim.ImageMethods {
|
|
|
1131
1131
|
function _drawIcon(img: RefImage, icon: RefBuffer, xy: number, color: number): void;
|
|
1132
1132
|
function fillCircle(img: RefImage, cx: number, cy: number, r: number, c: number): void;
|
|
1133
1133
|
function _fillCircle(img: RefImage, cxy: number, r: number, c: number): void;
|
|
1134
|
+
function fillTriangle(img: RefImage, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, c: number): void;
|
|
1135
|
+
function _fillTriangle(img: RefImage, args: RefCollection): void;
|
|
1136
|
+
function fillPolygon4(img: RefImage, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, c: number): void;
|
|
1137
|
+
function _fillPolygon4(img: RefImage, args: RefCollection): void;
|
|
1134
1138
|
function _blitRow(img: RefImage, xy: number, from: RefImage, xh: number): void;
|
|
1135
1139
|
function blitRow(img: RefImage, x: number, y: number, from: RefImage, fromX: number, fromH: number): void;
|
|
1136
1140
|
function _blit(img: RefImage, src: RefImage, args: RefCollection): boolean;
|
package/built/common-sim.js
CHANGED
|
@@ -4301,6 +4301,193 @@ var pxsim;
|
|
|
4301
4301
|
fillCircle(img, XX(cxy), YY(cxy), r, c);
|
|
4302
4302
|
}
|
|
4303
4303
|
ImageMethods._fillCircle = _fillCircle;
|
|
4304
|
+
function nextYRange_Low(x, line, yRange) {
|
|
4305
|
+
while (line.x === x && line.x <= line.x1 && line.x < line.W) {
|
|
4306
|
+
if (0 <= line.x) {
|
|
4307
|
+
if (line.y < yRange.min)
|
|
4308
|
+
yRange.min = line.y;
|
|
4309
|
+
if (line.y > yRange.max)
|
|
4310
|
+
yRange.max = line.y;
|
|
4311
|
+
}
|
|
4312
|
+
if (line.D > 0) {
|
|
4313
|
+
line.y += line.yi;
|
|
4314
|
+
line.D -= line.dx;
|
|
4315
|
+
}
|
|
4316
|
+
line.D += line.dy;
|
|
4317
|
+
++line.x;
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
function nextYRange_HighUp(x, line, yRange) {
|
|
4321
|
+
while (line.x == x && line.y >= line.y1 && line.x < line.W) {
|
|
4322
|
+
if (0 <= line.x) {
|
|
4323
|
+
if (line.y < yRange.min)
|
|
4324
|
+
yRange.min = line.y;
|
|
4325
|
+
if (line.y > yRange.max)
|
|
4326
|
+
yRange.max = line.y;
|
|
4327
|
+
}
|
|
4328
|
+
if (line.D > 0) {
|
|
4329
|
+
line.x += line.xi;
|
|
4330
|
+
line.D += line.dy;
|
|
4331
|
+
}
|
|
4332
|
+
line.D += line.dx;
|
|
4333
|
+
--line.y;
|
|
4334
|
+
}
|
|
4335
|
+
}
|
|
4336
|
+
function nextYRange_HighDown(x, line, yRange) {
|
|
4337
|
+
while (line.x == x && line.y <= line.y1 && line.x < line.W) {
|
|
4338
|
+
if (0 <= line.x) {
|
|
4339
|
+
if (line.y < yRange.min)
|
|
4340
|
+
yRange.min = line.y;
|
|
4341
|
+
if (line.y > yRange.max)
|
|
4342
|
+
yRange.max = line.y;
|
|
4343
|
+
}
|
|
4344
|
+
if (line.D > 0) {
|
|
4345
|
+
line.x += line.xi;
|
|
4346
|
+
line.D -= line.dy;
|
|
4347
|
+
}
|
|
4348
|
+
line.D += line.dx;
|
|
4349
|
+
++line.y;
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4352
|
+
function initYRangeGenerator(X0, Y0, X1, Y1) {
|
|
4353
|
+
const line = {
|
|
4354
|
+
x: X0,
|
|
4355
|
+
y: Y0,
|
|
4356
|
+
x0: X0,
|
|
4357
|
+
y0: Y0,
|
|
4358
|
+
x1: X1,
|
|
4359
|
+
y1: Y1,
|
|
4360
|
+
W: 0,
|
|
4361
|
+
H: 0,
|
|
4362
|
+
dx: X1 - X0,
|
|
4363
|
+
dy: Y1 - Y0,
|
|
4364
|
+
yi: 0,
|
|
4365
|
+
xi: 0,
|
|
4366
|
+
D: 0,
|
|
4367
|
+
nextFuncIndex: 0,
|
|
4368
|
+
};
|
|
4369
|
+
if ((line.dy < 0 ? -line.dy : line.dy) < line.dx) {
|
|
4370
|
+
line.yi = 1;
|
|
4371
|
+
if (line.dy < 0) {
|
|
4372
|
+
line.yi = -1;
|
|
4373
|
+
line.dy = -line.dy;
|
|
4374
|
+
}
|
|
4375
|
+
line.D = 2 * line.dy - line.dx;
|
|
4376
|
+
line.dx = line.dx << 1;
|
|
4377
|
+
line.dy = line.dy << 1;
|
|
4378
|
+
line.nextFuncIndex = 0;
|
|
4379
|
+
return line;
|
|
4380
|
+
}
|
|
4381
|
+
else {
|
|
4382
|
+
line.xi = 1;
|
|
4383
|
+
if (line.dy < 0) {
|
|
4384
|
+
line.D = 2 * line.dx + line.dy;
|
|
4385
|
+
line.dx = line.dx << 1;
|
|
4386
|
+
line.dy = line.dy << 1;
|
|
4387
|
+
line.nextFuncIndex = 1;
|
|
4388
|
+
return line;
|
|
4389
|
+
}
|
|
4390
|
+
else {
|
|
4391
|
+
line.D = 2 * line.dx - line.dy;
|
|
4392
|
+
line.dx = line.dx << 1;
|
|
4393
|
+
line.dy = line.dy << 1;
|
|
4394
|
+
line.nextFuncIndex = 2;
|
|
4395
|
+
return line;
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
function fillTriangle(img, x0, y0, x1, y1, x2, y2, c) {
|
|
4400
|
+
if (x1 < x0) {
|
|
4401
|
+
[x1, x0] = [x0, x1];
|
|
4402
|
+
[y1, y0] = [y0, y1];
|
|
4403
|
+
}
|
|
4404
|
+
if (x2 < x1) {
|
|
4405
|
+
[x2, x1] = [x1, x2];
|
|
4406
|
+
[y2, y1] = [y1, y2];
|
|
4407
|
+
}
|
|
4408
|
+
if (x1 < x0) {
|
|
4409
|
+
[x1, x0] = [x0, x1];
|
|
4410
|
+
[y1, y0] = [y0, y1];
|
|
4411
|
+
}
|
|
4412
|
+
const lines = [
|
|
4413
|
+
initYRangeGenerator(x0, y0, x2, y2),
|
|
4414
|
+
initYRangeGenerator(x0, y0, x1, y1),
|
|
4415
|
+
initYRangeGenerator(x1, y1, x2, y2)
|
|
4416
|
+
];
|
|
4417
|
+
lines[0].W = lines[1].W = lines[2].W = width(img);
|
|
4418
|
+
lines[0].H = lines[1].H = lines[2].H = height(img);
|
|
4419
|
+
const nextFuncList = [
|
|
4420
|
+
nextYRange_Low,
|
|
4421
|
+
nextYRange_HighUp,
|
|
4422
|
+
nextYRange_HighDown
|
|
4423
|
+
];
|
|
4424
|
+
const fpNext0 = nextFuncList[lines[0].nextFuncIndex];
|
|
4425
|
+
const fpNext1 = nextFuncList[lines[1].nextFuncIndex];
|
|
4426
|
+
const fpNext2 = nextFuncList[lines[2].nextFuncIndex];
|
|
4427
|
+
const yRange = {
|
|
4428
|
+
min: lines[0].H,
|
|
4429
|
+
max: -1
|
|
4430
|
+
};
|
|
4431
|
+
for (let x = lines[1].x0; x <= lines[1].x1; x++) {
|
|
4432
|
+
yRange.min = lines[0].H;
|
|
4433
|
+
yRange.max = -1;
|
|
4434
|
+
fpNext0(x, lines[0], yRange);
|
|
4435
|
+
fpNext1(x, lines[1], yRange);
|
|
4436
|
+
fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
|
|
4437
|
+
}
|
|
4438
|
+
fpNext2(lines[2].x0, lines[2], yRange);
|
|
4439
|
+
for (let x = lines[2].x0 + 1; x <= lines[2].x1; x++) {
|
|
4440
|
+
yRange.min = lines[0].H;
|
|
4441
|
+
yRange.max = -1;
|
|
4442
|
+
fpNext0(x, lines[0], yRange);
|
|
4443
|
+
fpNext2(x, lines[2], yRange);
|
|
4444
|
+
fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
ImageMethods.fillTriangle = fillTriangle;
|
|
4448
|
+
function _fillTriangle(img, args) {
|
|
4449
|
+
fillTriangle(img, args.getAt(0) | 0, args.getAt(1) | 0, args.getAt(2) | 0, args.getAt(3) | 0, args.getAt(4) | 0, args.getAt(5) | 0, args.getAt(6) | 0);
|
|
4450
|
+
}
|
|
4451
|
+
ImageMethods._fillTriangle = _fillTriangle;
|
|
4452
|
+
function fillPolygon4(img, x0, y0, x1, y1, x2, y2, x3, y3, c) {
|
|
4453
|
+
const lines = [
|
|
4454
|
+
(x0 < x1) ? initYRangeGenerator(x0, y0, x1, y1) : initYRangeGenerator(x1, y1, x0, y0),
|
|
4455
|
+
(x1 < x2) ? initYRangeGenerator(x1, y1, x2, y2) : initYRangeGenerator(x2, y2, x1, y1),
|
|
4456
|
+
(x2 < x3) ? initYRangeGenerator(x2, y2, x3, y3) : initYRangeGenerator(x3, y3, x2, y2),
|
|
4457
|
+
(x0 < x3) ? initYRangeGenerator(x0, y0, x3, y3) : initYRangeGenerator(x3, y3, x0, y0)
|
|
4458
|
+
];
|
|
4459
|
+
lines[0].W = lines[1].W = lines[2].W = lines[3].W = width(img);
|
|
4460
|
+
lines[0].H = lines[1].H = lines[2].H = lines[3].H = height(img);
|
|
4461
|
+
let minX = Math.min(Math.min(x0, x1), Math.min(x2, x3));
|
|
4462
|
+
let maxX = Math.min(Math.max(Math.max(x0, x1), Math.max(x2, x3)), lines[0].W - 1);
|
|
4463
|
+
const nextFuncList = [
|
|
4464
|
+
nextYRange_Low,
|
|
4465
|
+
nextYRange_HighUp,
|
|
4466
|
+
nextYRange_HighDown
|
|
4467
|
+
];
|
|
4468
|
+
const fpNext0 = nextFuncList[lines[0].nextFuncIndex];
|
|
4469
|
+
const fpNext1 = nextFuncList[lines[1].nextFuncIndex];
|
|
4470
|
+
const fpNext2 = nextFuncList[lines[2].nextFuncIndex];
|
|
4471
|
+
const fpNext3 = nextFuncList[lines[3].nextFuncIndex];
|
|
4472
|
+
const yRange = {
|
|
4473
|
+
min: lines[0].H,
|
|
4474
|
+
max: -1
|
|
4475
|
+
};
|
|
4476
|
+
for (let x = minX; x <= maxX; x++) {
|
|
4477
|
+
yRange.min = lines[0].H;
|
|
4478
|
+
yRange.max = -1;
|
|
4479
|
+
fpNext0(x, lines[0], yRange);
|
|
4480
|
+
fpNext1(x, lines[1], yRange);
|
|
4481
|
+
fpNext2(x, lines[2], yRange);
|
|
4482
|
+
fpNext3(x, lines[3], yRange);
|
|
4483
|
+
fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
|
|
4484
|
+
}
|
|
4485
|
+
}
|
|
4486
|
+
ImageMethods.fillPolygon4 = fillPolygon4;
|
|
4487
|
+
function _fillPolygon4(img, args) {
|
|
4488
|
+
fillPolygon4(img, args.getAt(0) | 0, args.getAt(1) | 0, args.getAt(2) | 0, args.getAt(3) | 0, args.getAt(4) | 0, args.getAt(5) | 0, args.getAt(6) | 0, args.getAt(7) | 0, args.getAt(8) | 0);
|
|
4489
|
+
}
|
|
4490
|
+
ImageMethods._fillPolygon4 = _fillPolygon4;
|
|
4304
4491
|
function _blitRow(img, xy, from, xh) {
|
|
4305
4492
|
blitRow(img, XX(xy), YY(xy), from, XX(xh), YY(xh));
|
|
4306
4493
|
}
|
package/built/sim.js
CHANGED
|
@@ -1988,6 +1988,193 @@ var pxsim;
|
|
|
1988
1988
|
fillCircle(img, XX(cxy), YY(cxy), r, c);
|
|
1989
1989
|
}
|
|
1990
1990
|
ImageMethods._fillCircle = _fillCircle;
|
|
1991
|
+
function nextYRange_Low(x, line, yRange) {
|
|
1992
|
+
while (line.x === x && line.x <= line.x1 && line.x < line.W) {
|
|
1993
|
+
if (0 <= line.x) {
|
|
1994
|
+
if (line.y < yRange.min)
|
|
1995
|
+
yRange.min = line.y;
|
|
1996
|
+
if (line.y > yRange.max)
|
|
1997
|
+
yRange.max = line.y;
|
|
1998
|
+
}
|
|
1999
|
+
if (line.D > 0) {
|
|
2000
|
+
line.y += line.yi;
|
|
2001
|
+
line.D -= line.dx;
|
|
2002
|
+
}
|
|
2003
|
+
line.D += line.dy;
|
|
2004
|
+
++line.x;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
function nextYRange_HighUp(x, line, yRange) {
|
|
2008
|
+
while (line.x == x && line.y >= line.y1 && line.x < line.W) {
|
|
2009
|
+
if (0 <= line.x) {
|
|
2010
|
+
if (line.y < yRange.min)
|
|
2011
|
+
yRange.min = line.y;
|
|
2012
|
+
if (line.y > yRange.max)
|
|
2013
|
+
yRange.max = line.y;
|
|
2014
|
+
}
|
|
2015
|
+
if (line.D > 0) {
|
|
2016
|
+
line.x += line.xi;
|
|
2017
|
+
line.D += line.dy;
|
|
2018
|
+
}
|
|
2019
|
+
line.D += line.dx;
|
|
2020
|
+
--line.y;
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
function nextYRange_HighDown(x, line, yRange) {
|
|
2024
|
+
while (line.x == x && line.y <= line.y1 && line.x < line.W) {
|
|
2025
|
+
if (0 <= line.x) {
|
|
2026
|
+
if (line.y < yRange.min)
|
|
2027
|
+
yRange.min = line.y;
|
|
2028
|
+
if (line.y > yRange.max)
|
|
2029
|
+
yRange.max = line.y;
|
|
2030
|
+
}
|
|
2031
|
+
if (line.D > 0) {
|
|
2032
|
+
line.x += line.xi;
|
|
2033
|
+
line.D -= line.dy;
|
|
2034
|
+
}
|
|
2035
|
+
line.D += line.dx;
|
|
2036
|
+
++line.y;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
function initYRangeGenerator(X0, Y0, X1, Y1) {
|
|
2040
|
+
const line = {
|
|
2041
|
+
x: X0,
|
|
2042
|
+
y: Y0,
|
|
2043
|
+
x0: X0,
|
|
2044
|
+
y0: Y0,
|
|
2045
|
+
x1: X1,
|
|
2046
|
+
y1: Y1,
|
|
2047
|
+
W: 0,
|
|
2048
|
+
H: 0,
|
|
2049
|
+
dx: X1 - X0,
|
|
2050
|
+
dy: Y1 - Y0,
|
|
2051
|
+
yi: 0,
|
|
2052
|
+
xi: 0,
|
|
2053
|
+
D: 0,
|
|
2054
|
+
nextFuncIndex: 0,
|
|
2055
|
+
};
|
|
2056
|
+
if ((line.dy < 0 ? -line.dy : line.dy) < line.dx) {
|
|
2057
|
+
line.yi = 1;
|
|
2058
|
+
if (line.dy < 0) {
|
|
2059
|
+
line.yi = -1;
|
|
2060
|
+
line.dy = -line.dy;
|
|
2061
|
+
}
|
|
2062
|
+
line.D = 2 * line.dy - line.dx;
|
|
2063
|
+
line.dx = line.dx << 1;
|
|
2064
|
+
line.dy = line.dy << 1;
|
|
2065
|
+
line.nextFuncIndex = 0;
|
|
2066
|
+
return line;
|
|
2067
|
+
}
|
|
2068
|
+
else {
|
|
2069
|
+
line.xi = 1;
|
|
2070
|
+
if (line.dy < 0) {
|
|
2071
|
+
line.D = 2 * line.dx + line.dy;
|
|
2072
|
+
line.dx = line.dx << 1;
|
|
2073
|
+
line.dy = line.dy << 1;
|
|
2074
|
+
line.nextFuncIndex = 1;
|
|
2075
|
+
return line;
|
|
2076
|
+
}
|
|
2077
|
+
else {
|
|
2078
|
+
line.D = 2 * line.dx - line.dy;
|
|
2079
|
+
line.dx = line.dx << 1;
|
|
2080
|
+
line.dy = line.dy << 1;
|
|
2081
|
+
line.nextFuncIndex = 2;
|
|
2082
|
+
return line;
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
function fillTriangle(img, x0, y0, x1, y1, x2, y2, c) {
|
|
2087
|
+
if (x1 < x0) {
|
|
2088
|
+
[x1, x0] = [x0, x1];
|
|
2089
|
+
[y1, y0] = [y0, y1];
|
|
2090
|
+
}
|
|
2091
|
+
if (x2 < x1) {
|
|
2092
|
+
[x2, x1] = [x1, x2];
|
|
2093
|
+
[y2, y1] = [y1, y2];
|
|
2094
|
+
}
|
|
2095
|
+
if (x1 < x0) {
|
|
2096
|
+
[x1, x0] = [x0, x1];
|
|
2097
|
+
[y1, y0] = [y0, y1];
|
|
2098
|
+
}
|
|
2099
|
+
const lines = [
|
|
2100
|
+
initYRangeGenerator(x0, y0, x2, y2),
|
|
2101
|
+
initYRangeGenerator(x0, y0, x1, y1),
|
|
2102
|
+
initYRangeGenerator(x1, y1, x2, y2)
|
|
2103
|
+
];
|
|
2104
|
+
lines[0].W = lines[1].W = lines[2].W = width(img);
|
|
2105
|
+
lines[0].H = lines[1].H = lines[2].H = height(img);
|
|
2106
|
+
const nextFuncList = [
|
|
2107
|
+
nextYRange_Low,
|
|
2108
|
+
nextYRange_HighUp,
|
|
2109
|
+
nextYRange_HighDown
|
|
2110
|
+
];
|
|
2111
|
+
const fpNext0 = nextFuncList[lines[0].nextFuncIndex];
|
|
2112
|
+
const fpNext1 = nextFuncList[lines[1].nextFuncIndex];
|
|
2113
|
+
const fpNext2 = nextFuncList[lines[2].nextFuncIndex];
|
|
2114
|
+
const yRange = {
|
|
2115
|
+
min: lines[0].H,
|
|
2116
|
+
max: -1
|
|
2117
|
+
};
|
|
2118
|
+
for (let x = lines[1].x0; x <= lines[1].x1; x++) {
|
|
2119
|
+
yRange.min = lines[0].H;
|
|
2120
|
+
yRange.max = -1;
|
|
2121
|
+
fpNext0(x, lines[0], yRange);
|
|
2122
|
+
fpNext1(x, lines[1], yRange);
|
|
2123
|
+
fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
|
|
2124
|
+
}
|
|
2125
|
+
fpNext2(lines[2].x0, lines[2], yRange);
|
|
2126
|
+
for (let x = lines[2].x0 + 1; x <= lines[2].x1; x++) {
|
|
2127
|
+
yRange.min = lines[0].H;
|
|
2128
|
+
yRange.max = -1;
|
|
2129
|
+
fpNext0(x, lines[0], yRange);
|
|
2130
|
+
fpNext2(x, lines[2], yRange);
|
|
2131
|
+
fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
ImageMethods.fillTriangle = fillTriangle;
|
|
2135
|
+
function _fillTriangle(img, args) {
|
|
2136
|
+
fillTriangle(img, args.getAt(0) | 0, args.getAt(1) | 0, args.getAt(2) | 0, args.getAt(3) | 0, args.getAt(4) | 0, args.getAt(5) | 0, args.getAt(6) | 0);
|
|
2137
|
+
}
|
|
2138
|
+
ImageMethods._fillTriangle = _fillTriangle;
|
|
2139
|
+
function fillPolygon4(img, x0, y0, x1, y1, x2, y2, x3, y3, c) {
|
|
2140
|
+
const lines = [
|
|
2141
|
+
(x0 < x1) ? initYRangeGenerator(x0, y0, x1, y1) : initYRangeGenerator(x1, y1, x0, y0),
|
|
2142
|
+
(x1 < x2) ? initYRangeGenerator(x1, y1, x2, y2) : initYRangeGenerator(x2, y2, x1, y1),
|
|
2143
|
+
(x2 < x3) ? initYRangeGenerator(x2, y2, x3, y3) : initYRangeGenerator(x3, y3, x2, y2),
|
|
2144
|
+
(x0 < x3) ? initYRangeGenerator(x0, y0, x3, y3) : initYRangeGenerator(x3, y3, x0, y0)
|
|
2145
|
+
];
|
|
2146
|
+
lines[0].W = lines[1].W = lines[2].W = lines[3].W = width(img);
|
|
2147
|
+
lines[0].H = lines[1].H = lines[2].H = lines[3].H = height(img);
|
|
2148
|
+
let minX = Math.min(Math.min(x0, x1), Math.min(x2, x3));
|
|
2149
|
+
let maxX = Math.min(Math.max(Math.max(x0, x1), Math.max(x2, x3)), lines[0].W - 1);
|
|
2150
|
+
const nextFuncList = [
|
|
2151
|
+
nextYRange_Low,
|
|
2152
|
+
nextYRange_HighUp,
|
|
2153
|
+
nextYRange_HighDown
|
|
2154
|
+
];
|
|
2155
|
+
const fpNext0 = nextFuncList[lines[0].nextFuncIndex];
|
|
2156
|
+
const fpNext1 = nextFuncList[lines[1].nextFuncIndex];
|
|
2157
|
+
const fpNext2 = nextFuncList[lines[2].nextFuncIndex];
|
|
2158
|
+
const fpNext3 = nextFuncList[lines[3].nextFuncIndex];
|
|
2159
|
+
const yRange = {
|
|
2160
|
+
min: lines[0].H,
|
|
2161
|
+
max: -1
|
|
2162
|
+
};
|
|
2163
|
+
for (let x = minX; x <= maxX; x++) {
|
|
2164
|
+
yRange.min = lines[0].H;
|
|
2165
|
+
yRange.max = -1;
|
|
2166
|
+
fpNext0(x, lines[0], yRange);
|
|
2167
|
+
fpNext1(x, lines[1], yRange);
|
|
2168
|
+
fpNext2(x, lines[2], yRange);
|
|
2169
|
+
fpNext3(x, lines[3], yRange);
|
|
2170
|
+
fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
ImageMethods.fillPolygon4 = fillPolygon4;
|
|
2174
|
+
function _fillPolygon4(img, args) {
|
|
2175
|
+
fillPolygon4(img, args.getAt(0) | 0, args.getAt(1) | 0, args.getAt(2) | 0, args.getAt(3) | 0, args.getAt(4) | 0, args.getAt(5) | 0, args.getAt(6) | 0, args.getAt(7) | 0, args.getAt(8) | 0);
|
|
2176
|
+
}
|
|
2177
|
+
ImageMethods._fillPolygon4 = _fillPolygon4;
|
|
1991
2178
|
function _blitRow(img, xy, from, xh) {
|
|
1992
2179
|
blitRow(img, XX(xy), YY(xy), from, XX(xh), YY(xh));
|
|
1993
2180
|
}
|