@kurot/atlas 0.1.0 → 0.1.1
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/CHANGELOG.md +130 -1
- package/README.md +5 -10
- package/dist/png/index.d.ts.map +1 -1
- package/dist/png/index.js +27 -2
- package/dist/png/index.js.map +1 -1
- package/docs/ai-context.md +4 -2
- package/docs/cli-integration.md +124 -102
- package/docs/reference-validation.md +55 -89
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1 — 2026-11-08
|
|
4
|
+
|
|
5
|
+
Prepared for publication.
|
|
6
|
+
|
|
7
|
+
- Reject repeated PNG image headers during preflight, before decoding either an individual image or a batch. Bound decompression for interlaced PNGs while retaining valid Adam7 input and the existing RGBA/atlas format.
|
|
8
|
+
|
|
3
9
|
## 0.1.0 — 2026-10-07
|
|
4
10
|
|
|
5
|
-
Initial
|
|
11
|
+
Initial release, published to npm.
|
|
6
12
|
|
|
7
13
|
- Add independent portable RGBA atlas packing with deterministic nonrotated
|
|
8
14
|
MaxRects placement and single-sheet power-of-two size selection.
|
|
@@ -19,3 +25,126 @@ Initial local implementation; not published.
|
|
|
19
25
|
No Core, CLI, Editor, Reskin or game project behavior changes. Filesystem writes,
|
|
20
26
|
skin edits, manifest updates, rotation, deduplication and multipack are outside
|
|
21
27
|
this release.
|
|
28
|
+
|
|
29
|
+
## Reference and CLI validation — 2026-10-07
|
|
30
|
+
|
|
31
|
+
## basis / basis_icon format and pixel validation
|
|
32
|
+
|
|
33
|
+
Validation date: 2026-10-07 (Asia/Shanghai). Implementation: local `@kurot/atlas 0.1.0`.
|
|
34
|
+
Reference project: `CrashMaster/kurot-project-kui`, using the source images and
|
|
35
|
+
TexturePacker outputs updated for this validation.
|
|
36
|
+
|
|
37
|
+
### Results
|
|
38
|
+
|
|
39
|
+
All 61 resources across both sets passed checks for names, frame fields, crop
|
|
40
|
+
sizes, offsets, original dimensions and pixels. The new outputs work with the
|
|
41
|
+
existing resource format, without changing KUI, resource manifests or Core atlas
|
|
42
|
+
parsing. Placement coordinates differ, so PNG and JSON must be replaced together.
|
|
43
|
+
Format compatibility does not imply identical output bytes.
|
|
44
|
+
|
|
45
|
+
| Metric | basis | basis_icon |
|
|
46
|
+
| ----------------------------------------------- | ------------- | ------------- |
|
|
47
|
+
| Source images / frames | 29 / 29 | 32 / 32 |
|
|
48
|
+
| Trimmed images | 0 | 32 |
|
|
49
|
+
| TexturePacker atlas | 1024 × 1024 | 256 × 512 |
|
|
50
|
+
| atlas library output | 1024 × 1024 | 256 × 512 |
|
|
51
|
+
| Total frame rectangle area, excluding extrusion | 728,044 px | 97,021 px |
|
|
52
|
+
| Frames with different placement coordinates | 26 | 32 |
|
|
53
|
+
| TexturePacker PNG size | 875,190 bytes | 158,473 bytes |
|
|
54
|
+
| atlas library PNG size | 909,753 bytes | 159,652 bytes |
|
|
55
|
+
|
|
56
|
+
The new PNGs are approximately 3.95% and 0.74% larger, respectively. There is no
|
|
57
|
+
atlas-area or GPU texture memory improvement in these samples. Both placement
|
|
58
|
+
and encoding affect PNG byte size; the difference cannot be attributed solely
|
|
59
|
+
to compression. This validation did not include a stable performance benchmark
|
|
60
|
+
or browser interaction/screenshot acceptance tests.
|
|
61
|
+
|
|
62
|
+
### Reference inputs and configuration
|
|
63
|
+
|
|
64
|
+
- Source images: `ui-tps/src/basis/*.png`, `ui-tps/src/basis_icon/*.png`.
|
|
65
|
+
- Reference outputs: `ui-tps/export/r_basis.{json,png,tps}`, `r_basis_icon.{json,png,tps}`.
|
|
66
|
+
- Project resources: `resource/assets/ui/app/r_basis.{json,png}`, `r_basis_icon.{json,png}`.
|
|
67
|
+
Runtime PNG/JSON files for both sets are byte-for-byte identical to the export files.
|
|
68
|
+
- TexturePacker 8.3 Egret export: single sheet, no rotation, POT, rectangular sheets
|
|
69
|
+
allowed, maximum 2048², scale 1, RGBA8888 PNG, alpha threshold 1, trim margin 1,
|
|
70
|
+
extrude 1, shape/border padding 0, and cleared RGB for fully transparent pixels.
|
|
71
|
+
Auto-alias is enabled, but neither set contains aliased frames.
|
|
72
|
+
|
|
73
|
+
Atlas used default packing options, with only the corresponding PNG filename
|
|
74
|
+
specified explicitly. The library did not read `.tps`; the validation scope is
|
|
75
|
+
these actual settings and the two resource sets.
|
|
76
|
+
|
|
77
|
+
### Validation coverage
|
|
78
|
+
|
|
79
|
+
`scripts/verify-reference.ts` and `scripts/reference-checks.ts` check:
|
|
80
|
+
|
|
81
|
+
1. Source image names exactly match the reference JSON frame set.
|
|
82
|
+
2. JSON uses `file` + `frames`. Each frame has integer `x/y/w/h` and optional
|
|
83
|
+
`offX/offY/sourceW/sourceH`, with no rotation or nested format.
|
|
84
|
+
3. Reference and new PNGs are 8-bit RGBA. Frames and their 1 px extrusion fit
|
|
85
|
+
within atlas bounds; extruded rectangles do not overlap.
|
|
86
|
+
4. Independently computed bounds contain source alpha ≥ 1, expanded by a 1 px
|
|
87
|
+
margin and clamped to source bounds. Both reference and new crops match;
|
|
88
|
+
discarded regions contain no nonzero alpha.
|
|
89
|
+
5. Each frame is restored to its source canvas using offX/offY. All retained
|
|
90
|
+
pixels match channel by channel: fully transparent pixels have RGB checked
|
|
91
|
+
against 0, and nonzero-alpha pixels have exactly matching RGBA.
|
|
92
|
+
6. Every pixel in the 1 px edge and corner extrusion matches.
|
|
93
|
+
7. Apart from x/y, old and new frames have identical field values and field presence.
|
|
94
|
+
8. Reversing input order produces identical new PNG bytes and JSON objects.
|
|
95
|
+
9. Reports retain source/reference SHA-256 hashes to identify the baseline after
|
|
96
|
+
future source-image updates.
|
|
97
|
+
|
|
98
|
+
For example, `r_icon_bars` is cropped to 56 × 43 with offX/offY of 6/11, while
|
|
99
|
+
its logical size remains 64 × 64. Base resources `r_bg_stepper` and `r_txt_input`
|
|
100
|
+
are 180 × 60 and 140 × 60, respectively.
|
|
101
|
+
|
|
102
|
+
The new library does not emit TexturePacker's top-level `meta`; Core's
|
|
103
|
+
SheetAnalyzer does not read it. `meta.smartupdate` is TexturePacker update
|
|
104
|
+
metadata and must not retain an old value as if it described a new output.
|
|
105
|
+
|
|
106
|
+
### Actual CLI build validation
|
|
107
|
+
|
|
108
|
+
A temporary project copy used the sample's installed CLI 3.3.0 to build the
|
|
109
|
+
original atlases, then replaced only the two PNG/JSON pairs. Both development
|
|
110
|
+
`build --strict` runs and the replacement `build --release --strict` succeeded,
|
|
111
|
+
compiling 66 KUI skins each time. The real sample project was not modified.
|
|
112
|
+
|
|
113
|
+
- All 66 authored KUI files, `default.res.json` and `style.json` remained
|
|
114
|
+
byte-for-byte identical to the original project.
|
|
115
|
+
- Development `default.thm.js` outputs were identical after normalizing CLI's
|
|
116
|
+
random temporary directory name. Raw byte comparison differs because the
|
|
117
|
+
generated-source comments contain `kurot-skins-<random>`.
|
|
118
|
+
- All four new atlas resources in development and release outputs were
|
|
119
|
+
byte-for-byte identical to the packing results.
|
|
120
|
+
- Build validation confirms that the existing compilation/copy pipeline accepts
|
|
121
|
+
these outputs. Frame pixel checks and Core's source contract support crop/offset
|
|
122
|
+
compatibility; browser resource loading was not tested.
|
|
123
|
+
|
|
124
|
+
The installed CLI entry was invoked directly with
|
|
125
|
+
`node node_modules/@kurot/cli/dist/index.js ...`. In the temporary copy,
|
|
126
|
+
`pnpm exec` tried to verify dependencies and failed because the newly published
|
|
127
|
+
CLI/ui-document versions had not met minimumReleaseAge. The policy was not
|
|
128
|
+
relaxed, and dependencies were neither reinstalled nor replaced.
|
|
129
|
+
|
|
130
|
+
### Repeating the validation
|
|
131
|
+
|
|
132
|
+
Run from the engine repository root. The second argument must be a directory
|
|
133
|
+
that does not yet exist and is outside the sample project:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
pnpm --dir packages/atlas verify:reference \
|
|
137
|
+
/path/to/CrashMaster/kurot-project-kui \
|
|
138
|
+
/tmp/kurot-atlas-reference-new
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The script reads the sample project without modifying it and writes two PNG/JSON
|
|
142
|
+
pairs plus `report.json` to the new directory. Failures exit with a nonzero code.
|
|
143
|
+
It is a local reference-validation tool with no fixed developer path; it is not
|
|
144
|
+
part of default CI tests, and its scripts are not published. Rerun it after
|
|
145
|
+
baseline files change. An old report does not verify new files.
|
|
146
|
+
|
|
147
|
+
Local outputs from this run are at `/private/tmp/kurot-atlas-reference-20261007`,
|
|
148
|
+
with `cli-report.json` recording temporary-project build comparisons. These
|
|
149
|
+
temporary files are not distributed with the package.
|
|
150
|
+
See [cli-integration.md](docs/cli-integration.md) for follow-up integration and optimization.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @kurot/atlas
|
|
2
2
|
|
|
3
|
-
Version **0.1.
|
|
3
|
+
Version **0.1.1**, prepared for publication.
|
|
4
4
|
|
|
5
5
|
Independent, deterministic sprite-atlas tooling. Packs straight-alpha RGBA pixels
|
|
6
6
|
and outputs the flat `file`/`frames` sheet format consumed by Kurot. No dependency
|
|
@@ -79,7 +79,7 @@ TexturePacker's exact placement or compressed PNG bytes.
|
|
|
79
79
|
|
|
80
80
|
Margin, extrusion and padding are integers 0–1024. maxPixels is an integer
|
|
81
81
|
1–67108864. Batches contain 1–4096 sources. PNG input has a 32 MiB per-file limit;
|
|
82
|
-
dimensions are checked before decoding a batch. Static PNG input is normalized to
|
|
82
|
+
dimensions and a unique IHDR are checked before decoding a batch; interlaced image data is also checked against its pixel budget before the codec expands it. Static PNG input is normalized to
|
|
83
83
|
RGBA8; APNG is rejected. The input buffers, decoder intermediates and output may
|
|
84
84
|
coexist, so maxPixels is not a process-wide memory quota.
|
|
85
85
|
|
|
@@ -131,14 +131,9 @@ pnpm --dir packages/atlas test
|
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
Unit tests use synthetic images and do not require the local game checkout.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
RGBA pixels and edge/corner extrusion match the sources, and reversed source
|
|
138
|
-
order produces identical JSON and PNG bytes. CLI 3.3.0 development/release builds
|
|
139
|
-
accept the new resources without authored skin, manifest or stylesheet changes.
|
|
140
|
-
That validation does not promise identical layout to TexturePacker or replace
|
|
141
|
-
future Editor/Reskin integration and rendered-game acceptance.
|
|
134
|
+
Reference verification checks frame geometry, retained pixels, extrusion and
|
|
135
|
+
input-order determinism against supplied read-only assets. Format compatibility
|
|
136
|
+
does not promise identical packing to TexturePacker or establish game acceptance.
|
|
142
137
|
|
|
143
138
|
To repeat local reference verification, provide the sample project root and a new
|
|
144
139
|
output directory outside that project:
|
package/dist/png/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI5E,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,EAAE,OAAO,GAAE,YAAiB,GAAG,cAAc,CAgB3G;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,SAAa,GAAG,UAAU,CAiC/E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAWvD"}
|
package/dist/png/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
import { PNG } from 'pngjs';
|
|
3
|
+
import { inflateSync } from 'node:zlib';
|
|
3
4
|
import { AtlasError } from '../AtlasError.js';
|
|
4
5
|
import { packAtlas } from '../pack-atlas.js';
|
|
5
6
|
import { resolveOptions } from '../options.js';
|
|
@@ -32,10 +33,30 @@ export function decodePNG(bytes, maxPixels = 16_777_216) {
|
|
|
32
33
|
if (!Number.isSafeInteger(maxPixels) || maxPixels < 1 || maxPixels > 67_108_864) {
|
|
33
34
|
throw new AtlasError('invalid-options', 'Invalid maxPixels limit.');
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
const pixels = readPixelCount(bytes);
|
|
37
|
+
if (pixels > maxPixels) {
|
|
36
38
|
throw new AtlasError('invalid-input', 'PNG pixels exceed maxPixels.');
|
|
37
39
|
}
|
|
38
40
|
try {
|
|
41
|
+
// pngjs bounds ordinary scanlines but uses an unbounded inflate for Adam7.
|
|
42
|
+
// Verify that stream first: even RGBA16 needs at most 8 bytes plus one
|
|
43
|
+
// filter byte per pixel, including all seven passes.
|
|
44
|
+
if (bytes[28] === 1) {
|
|
45
|
+
const buffer = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
46
|
+
const chunks = [];
|
|
47
|
+
for (let offset = 33; offset + 12 <= buffer.length;) {
|
|
48
|
+
const length = buffer.readUInt32BE(offset);
|
|
49
|
+
const type = buffer.toString('latin1', offset + 4, offset + 8);
|
|
50
|
+
if (type === 'IEND') {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
if (type === 'IDAT' && length > 0) {
|
|
54
|
+
chunks.push(buffer.subarray(offset + 8, offset + 8 + length));
|
|
55
|
+
}
|
|
56
|
+
offset += length + 12;
|
|
57
|
+
}
|
|
58
|
+
inflateSync(Buffer.concat(chunks), { maxOutputLength: pixels * 9 });
|
|
59
|
+
}
|
|
39
60
|
const png = PNG.sync.read(Buffer.from(bytes), { checkCRC: true });
|
|
40
61
|
return { width: png.width, height: png.height, pixels: new Uint8Array(png.data) };
|
|
41
62
|
}
|
|
@@ -79,7 +100,11 @@ function readPixelCount(bytes) {
|
|
|
79
100
|
if (length > buffer.length - offset - 12) {
|
|
80
101
|
throw new AtlasError('invalid-png', 'Truncated PNG chunk.');
|
|
81
102
|
}
|
|
82
|
-
|
|
103
|
+
const type = buffer.toString('latin1', offset + 4, offset + 8);
|
|
104
|
+
if (offset !== 8 && type === 'IHDR') {
|
|
105
|
+
throw new AtlasError('invalid-png', 'PNG must contain exactly one IHDR chunk.');
|
|
106
|
+
}
|
|
107
|
+
if (type === 'acTL') {
|
|
83
108
|
throw new AtlasError('invalid-png', 'Animated PNG is not supported.');
|
|
84
109
|
}
|
|
85
110
|
offset += length + 12;
|
package/dist/png/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/png/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAc/C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAkC,EAAE,UAAwB,EAAE;IAC1F,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QAC9E,MAAM,IAAI,UAAU,CAAC,eAAe,EAAE,yCAAyC,CAAC,CAAC;IAClF,CAAC;IACD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IAAI,KAAK,MAAM,EAAE,CAAC;YACrC,MAAM,IAAI,UAAU,CAAC,aAAa,EAAE,0CAA0C,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YACrB,MAAM,IAAI,UAAU,CAAC,aAAa,EAAE,gCAAgC,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,IAAI,MAAM,GAAG,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,GAAG,MAAM,CAAC;AACvB,CAAC"}
|
package/docs/ai-context.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @kurot/atlas — AI context map
|
|
2
2
|
|
|
3
|
-
Version 0.1.
|
|
4
|
-
atlas library; no Kurot package dependencies
|
|
3
|
+
Version 0.1.1, prepared for publication. Independent build-time
|
|
4
|
+
atlas library; no Kurot package dependencies. Private tools/default-ui-assets
|
|
5
|
+
consumes registry 0.1.0 to generate the committed KUI default atlas. No published
|
|
6
|
+
SDK or browser runtime gains an atlas dependency.
|
|
5
7
|
Read README.md for input limits and the pixel/output contract.
|
|
6
8
|
|
|
7
9
|
## Directory map
|
package/docs/cli-integration.md
CHANGED
|
@@ -1,108 +1,130 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Atlas integration with CLI and optimization recommendations
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Editor 或 Reskin,也没有添加消费者依赖。
|
|
3
|
+
This document describes the current atlas pipeline and optional tooling work.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## Current pipeline
|
|
7
6
|
|
|
8
7
|
```text
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
resource/default.res.json → CLI
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
Source images → @kurot/atlas → PNG + atlas JSON
|
|
9
|
+
↓ saved by the caller
|
|
10
|
+
resource/default.res.json → CLI reads resource defaults → KUI compilation
|
|
11
|
+
PNG/JSON under resource/ → CLI copyAssets → build output
|
|
12
|
+
Atlas JSON/PNG in output → Core SheetAnalyzer → SpriteSheet / Texture
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
CLI
|
|
17
|
-
`src/core/kui/skin-module-builder.ts`
|
|
18
|
-
`parseUIResourceConfigEntries`
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
15
|
+
CLI does not parse atlas frame coordinates or PNG data when compiling KUI.
|
|
16
|
+
`src/core/kui/skin-module-builder.ts` reads `default.res.json` and uses
|
|
17
|
+
ui-document's `parseUIResourceConfigEntries` to obtain resources and nine-slice
|
|
18
|
+
defaults. `kui-parser.ts` applies resource defaults, Label presets and colors to
|
|
19
|
+
copies, in that order. `plugins/copy-assets.ts` copies resource files, excluding
|
|
20
|
+
authored KUI and generated theme files.
|
|
21
|
+
|
|
22
|
+
Core's `packages/core/src/kurot/resource/analyzers/SheetAnalyzer.ts` reads
|
|
23
|
+
`file/frames` at runtime and passes crop coordinates, offsets and original sizes
|
|
24
|
+
to `SpriteSheet.createTexture`. The output format supports
|
|
25
|
+
this pipeline; adopting the library does not require changes to CLI's KUI parser
|
|
26
|
+
or Core.
|
|
27
|
+
|
|
28
|
+
Atlas remains independent. Reskin/Editor resource services can call it. If CLI
|
|
29
|
+
later offers packing, CLI may depend on atlas; atlas must not depend on CLI/Core.
|
|
30
|
+
Copying or consuming prebuilt atlases requires no new dependency.
|
|
31
|
+
|
|
32
|
+
## Resource updates and grouped commits
|
|
33
|
+
|
|
34
|
+
The CLI watches the resource tree, batches copies, handles deletion and serves
|
|
35
|
+
no-store responses. Resource watching works without a UI configuration. See
|
|
36
|
+
[CLI resource watching](../../cli/docs/dev-resource-watching.md) for the current
|
|
37
|
+
implementation and batch limits. PNG/atlas JSON changes refresh resources;
|
|
38
|
+
manifest defaults, styles and KUI changes also request Skin recompilation. Browser
|
|
39
|
+
refresh remains manual.
|
|
40
|
+
|
|
41
|
+
Strict PNG/JSON transactions remain a separate tooling concern.
|
|
42
|
+
Renaming PNG and JSON separately does not create an atomic two-file transaction.
|
|
43
|
+
The caller should generate and validate temporary outputs, then commit the whole
|
|
44
|
+
pair. In one process, a commit-complete event can serialize copying. External
|
|
45
|
+
file watchers may use debouncing and bounded retries, but these cannot guarantee
|
|
46
|
+
that same-sized PNG/JSON files belong to the same generation. Strict consistency
|
|
47
|
+
across processes may require versioned directories with a single pointer switch,
|
|
48
|
+
or an explicit commit marker / generation protocol. Review that design separately.
|
|
49
|
+
Publish success only after grouped validation and copying finish. Preview refresh
|
|
50
|
+
must also account for Core resource caches and browser caches. A full-page reload
|
|
51
|
+
is more reliable for the first stage than clearing one subtexture. Do not add
|
|
52
|
+
undefined cache fields to output JSON.
|
|
53
|
+
|
|
54
|
+
## Second priority: resource integrity checks before building
|
|
55
|
+
|
|
56
|
+
Add a separate validation step before compilation/copying, without changing
|
|
57
|
+
authored KUI:
|
|
58
|
+
|
|
59
|
+
- A manifest sheet URL points to an existing JSON file, whose `file` points to a
|
|
60
|
+
valid, existing relative PNG.
|
|
61
|
+
- PNG dimensions, integer frame fields, bounds, crop offsets and logical sizes
|
|
62
|
+
agree. Reject unsupported rotation formats.
|
|
63
|
+
- Keep `subkeys` in object form. Compare them with actual frames and report missing
|
|
64
|
+
or extra entries. In strict mode, fail on unresolved frame references, including
|
|
65
|
+
the sheet name, resource path and frame name in the error.
|
|
66
|
+
- Validate resource-default `scale9grid` against untrimmed sourceW/sourceH. Do not
|
|
67
|
+
recalculate it from atlas x/y or cropped w/h.
|
|
68
|
+
- Preserve existing name/alias precedence and distinguish duplicate bare frame
|
|
69
|
+
names from usable `sheet.frame` references.
|
|
70
|
+
|
|
71
|
+
See `packages/ui-document/docs/resource-nine-slice.md` for the contract. The
|
|
72
|
+
existing manifest parser does not read PNG/frame files, so successful parsing
|
|
73
|
+
is not complete atlas validation. Pure format checks can live in a separate
|
|
74
|
+
tool module. Do not force Core or ui-document to depend on atlas just to read
|
|
75
|
+
prebuilt sheets. If a shared validator is introduced, consider a separate entry
|
|
76
|
+
without PNG encoding before deciding whether CLI needs the dependency.
|
|
77
|
+
|
|
78
|
+
Reskin preserves resource keys by default and replaces assets under existing
|
|
79
|
+
keys. Repacking does not require regenerating the whole manifest. Preserve frame
|
|
80
|
+
nine-slice values, unknown metadata, groups, URLs and resource order. Report key
|
|
81
|
+
set changes before applying them; do not silently remove or rewrite references.
|
|
82
|
+
Do not automatically adjust skins or layouts, or migrate local fields to presets.
|
|
83
|
+
|
|
84
|
+
## Third priority: incremental processing and optional packing
|
|
85
|
+
|
|
86
|
+
Cache outputs by source image content fingerprint, normalized options and library
|
|
87
|
+
version. A cache hit skips decoding, packing and encoding. Input path order does
|
|
88
|
+
not affect output; the existing determinism checks cover this.
|
|
89
|
+
CLI can read the manifest and each relevant sheet once per build to create a
|
|
90
|
+
resource index, avoiding repeated I/O for multiple skins. Coordinate changes do
|
|
91
|
+
not affect KUI compilation; default nine-slice or style changes affect generated
|
|
92
|
+
code. Reducing compilation through resource/style-to-skin dependencies first
|
|
93
|
+
requires complete reference tracking and deletion-event tests.
|
|
94
|
+
|
|
95
|
+
For an opt-in CLI packing plugin, the recommended order is:
|
|
96
|
+
`configuration validation → packing → grouped validation/commit → KUI compilation → copyAssets`.
|
|
97
|
+
Configuration must explicitly specify source/output paths, stable resource names
|
|
98
|
+
and packing options. Do not infer existing resource keys from directory scans.
|
|
99
|
+
A generic CLI project should not automatically repack existing PNG/JSON files.
|
|
100
|
+
Other consumers can continue calling the same atlas API directly.
|
|
101
|
+
Tools own paths, file commits, queues/workers and progress. The library continues
|
|
102
|
+
to return only in-memory results.
|
|
103
|
+
|
|
104
|
+
## Atlas optimization opportunities
|
|
105
|
+
|
|
106
|
+
Experiments can compare PNG filter/deflate settings, alternative
|
|
107
|
+
lossless encoders and MaxRects sorting combinations, recording time, PNG bytes,
|
|
108
|
+
atlas area and peak memory. Choose strategies using several resource benchmarks.
|
|
109
|
+
Every strategy must pass RGBA, crop and extrusion checks again. Fewer PNG bytes
|
|
110
|
+
do not imply lower GPU memory use.
|
|
111
|
+
|
|
112
|
+
Rotation and
|
|
113
|
+
multipack would expand Core, manifest and tooling contracts, so they are outside
|
|
114
|
+
the current format-compatibility optimization scope. Lossy quantization,
|
|
115
|
+
discarding low-alpha pixels or reducing margin/extrusion cannot claim compliance
|
|
116
|
+
with the current pixel contract just because they reduce output size.
|
|
117
|
+
|
|
118
|
+
## Recommended acceptance order
|
|
119
|
+
|
|
120
|
+
1. Keep the `verify:reference` baseline and first complete grouped replacement and
|
|
121
|
+
full-page preview refresh in Reskin/Editor.
|
|
122
|
+
2. Verify CLI dev updates for PNG/JSON-only replacement, resource deletion,
|
|
123
|
+
interrupted external commits and Core-only projects.
|
|
124
|
+
3. Verify nine-slice logical dimensions, cropped icons, unchanged manifests,
|
|
125
|
+
unmodified KUI and preserved preset references.
|
|
126
|
+
4. Introduce input caching, incremental copying or opt-in CLI packing afterward;
|
|
127
|
+
measure each improvement and test rollback on failure.
|
|
128
|
+
|
|
129
|
+
Use [reference validation](reference-validation.md) to check format compatibility;
|
|
130
|
+
record completed results in CHANGELOG.md.
|
|
@@ -1,85 +1,53 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
完全透明像素的 RGB 按 0 核对,非零 alpha 像素的 RGBA 必须精确相同。
|
|
52
|
-
6. 逐像素核对四边和四角的 1 px extrusion。
|
|
53
|
-
7. 新旧帧除了 x/y,其他字段的值和字段是否存在都完全相同。
|
|
54
|
-
8. 反转输入顺序后,新 PNG 字节和 JSON 对象保持一致。
|
|
55
|
-
9. 报告保留源图和参考产物的 SHA-256,供后续原图更新时识别验证基线。
|
|
56
|
-
|
|
57
|
-
例如 `r_icon_bars` 裁剪为 56 × 43,offX/offY 为 6/11,逻辑尺寸仍是 64 × 64。
|
|
58
|
-
基础资源 `r_bg_stepper` 为 180 × 60,`r_txt_input` 为 140 × 60。
|
|
59
|
-
|
|
60
|
-
TexturePacker 的顶层 `meta` 不由新库生成;Core 的 SheetAnalyzer 不读取它。
|
|
61
|
-
`meta.smartupdate` 属于 TexturePacker 更新信息,不能保留旧值冒充新产物。
|
|
62
|
-
|
|
63
|
-
## CLI 实际构建验证
|
|
64
|
-
|
|
65
|
-
在项目临时副本中使用样例已安装的 CLI 3.3.0,先构建原始图集,再仅替换两组 PNG/JSON。
|
|
66
|
-
两次 development `build --strict` 和替换后的 `build --release --strict` 均成功,
|
|
67
|
-
每次编译 66 个 KUI skin。没有修改真实示例项目。
|
|
68
|
-
|
|
69
|
-
- 66 个 authored KUI、`default.res.json` 和 `style.json` 与原项目逐字节相同。
|
|
70
|
-
- development 编译的 `default.thm.js` 在归一化 CLI 随机临时目录名后完全相同;
|
|
71
|
-
原始字节比较会因 `kurot-skins-<random>` 的生成来源注释不同而失败。
|
|
72
|
-
- development 和 release 中的四个新图集资源均与打包结果逐字节相同。
|
|
73
|
-
- 构建验证证明现有编译和复制链可接收这些产物;逐帧像素校验与 Core 源码契约
|
|
74
|
-
支持裁剪/偏移兼容判断,未执行浏览器资源加载测试。
|
|
75
|
-
|
|
76
|
-
使用已安装的 CLI 入口直接调用 `node node_modules/@kurot/cli/dist/index.js ...`。
|
|
77
|
-
临时副本中的 `pnpm exec` 尝试检查依赖,并因新发布的 CLI/ui-document 未满足
|
|
78
|
-
minimumReleaseAge 而失败;没有放宽策略、重新安装或更换依赖。
|
|
79
|
-
|
|
80
|
-
## 重复验证
|
|
81
|
-
|
|
82
|
-
从引擎仓库根目录运行,第二个参数必须是尚不存在、且位于示例项目外的目录:
|
|
1
|
+
# Atlas reference validation
|
|
2
|
+
|
|
3
|
+
Use the local read-only reference validator to check frame geometry and pixels
|
|
4
|
+
against supplied basis/basis_icon source and atlas files. Reference data is not
|
|
5
|
+
part of the npm package.
|
|
6
|
+
|
|
7
|
+
## Reference inputs and configuration
|
|
8
|
+
|
|
9
|
+
- Source images: `ui-tps/src/basis/*.png`, `ui-tps/src/basis_icon/*.png`.
|
|
10
|
+
- Reference outputs: `ui-tps/export/r_basis.{json,png,tps}`, `r_basis_icon.{json,png,tps}`.
|
|
11
|
+
- Project resources: `resource/assets/ui/app/r_basis.{json,png}`, `r_basis_icon.{json,png}`.
|
|
12
|
+
Compare the selected baseline explicitly rather than assuming it matches runtime copies.
|
|
13
|
+
- TexturePacker 8.3 Egret export: single sheet, no rotation, POT, rectangular sheets
|
|
14
|
+
allowed, maximum 2048², scale 1, RGBA8888 PNG, alpha threshold 1, trim margin 1,
|
|
15
|
+
extrude 1, shape/border padding 0, and cleared RGB for fully transparent pixels.
|
|
16
|
+
Auto-alias is enabled; alias behavior requires a separate fixture when relevant.
|
|
17
|
+
|
|
18
|
+
Use default packing options, with only the corresponding PNG filename
|
|
19
|
+
specified explicitly. The library does not read `.tps`; scope compatibility to the selected settings
|
|
20
|
+
and source sets.
|
|
21
|
+
|
|
22
|
+
## Validation coverage
|
|
23
|
+
|
|
24
|
+
`scripts/verify-reference.ts` and `scripts/reference-checks.ts` check:
|
|
25
|
+
|
|
26
|
+
1. Source image names exactly match the reference JSON frame set.
|
|
27
|
+
2. JSON uses `file` + `frames`. Each frame has integer `x/y/w/h` and optional
|
|
28
|
+
`offX/offY/sourceW/sourceH`, with no rotation or nested format.
|
|
29
|
+
3. Reference and new PNGs are 8-bit RGBA. Frames and their 1 px extrusion fit
|
|
30
|
+
within atlas bounds; extruded rectangles do not overlap.
|
|
31
|
+
4. Independently computed bounds contain source alpha ≥ 1, expanded by a 1 px
|
|
32
|
+
margin and clamped to source bounds. Both reference and new crops match;
|
|
33
|
+
discarded regions contain no nonzero alpha.
|
|
34
|
+
5. Each frame is restored to its source canvas using offX/offY. All retained
|
|
35
|
+
pixels match channel by channel: fully transparent pixels have RGB checked
|
|
36
|
+
against 0, and nonzero-alpha pixels have exactly matching RGBA.
|
|
37
|
+
6. Every pixel in the 1 px edge and corner extrusion matches.
|
|
38
|
+
7. Apart from x/y, old and new frames have identical field values and field presence.
|
|
39
|
+
8. Reversing input order produces identical new PNG bytes and JSON objects.
|
|
40
|
+
9. Reports retain source/reference SHA-256 hashes to identify the baseline after
|
|
41
|
+
future source-image updates.
|
|
42
|
+
|
|
43
|
+
The library does not emit TexturePacker's top-level `meta`; Core's
|
|
44
|
+
SheetAnalyzer does not read it. `meta.smartupdate` is TexturePacker update
|
|
45
|
+
metadata and must not retain an old value as if it described a new output.
|
|
46
|
+
|
|
47
|
+
## Repeating the validation
|
|
48
|
+
|
|
49
|
+
Run from the engine repository root. The second argument must be a directory
|
|
50
|
+
that does not yet exist and is outside the sample project:
|
|
83
51
|
|
|
84
52
|
```sh
|
|
85
53
|
pnpm --dir packages/atlas verify:reference \
|
|
@@ -87,10 +55,8 @@ pnpm --dir packages/atlas verify:reference \
|
|
|
87
55
|
/tmp/kurot-atlas-reference-new
|
|
88
56
|
```
|
|
89
57
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`cli-report.json` 记录临时项目的构建核对结果。这些临时文件不随包分发。
|
|
96
|
-
后续接入与优化见 [cli-integration.md](./cli-integration.md)。
|
|
58
|
+
The script reads the sample project without modifying it and writes two PNG/JSON
|
|
59
|
+
pairs plus `report.json` to the new directory. Failures exit with a nonzero code.
|
|
60
|
+
It is a local reference-validation tool with no fixed developer path; it is not
|
|
61
|
+
part of default CI tests, and its scripts are not published. Rerun it after
|
|
62
|
+
baseline files change. An old report does not verify new files.
|