@paged-media/image-manifest 0.0.1-canary.0

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/LICENSE.md ADDED
@@ -0,0 +1,50 @@
1
+ # License
2
+
3
+ This **paged plugin** (<https://paged.media>) is **dual-licensed**. You may use,
4
+ modify, and distribute it under the terms of **either**:
5
+
6
+ - the **GNU Affero General Public License, version 3** (AGPL-3.0) — the
7
+ open-source option; the full text is in [`LICENSE`](./LICENSE); or
8
+ - the **Paged Media Enterprise License** (PMEL) — a commercial option
9
+ available from **And The Next GmbH**.
10
+
11
+ `SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-PMEL`
12
+
13
+ This matches the paged **editor**, which is also AGPL-3.0 OR PMEL — a plugin is
14
+ part of the editor application. The render **engine** (`paged-media/core`) and
15
+ the **plugin SDK** (`paged-media/plugin-sdk`) this builds on are instead
16
+ **MPL-2.0 OR PMEL**, deliberately more permissive so they can be embedded
17
+ broadly. (That's why your *own* plugins, built on the MPL SDK, can carry
18
+ whatever license you choose — only paged's first-party plugins are AGPL.)
19
+
20
+ Source files carry the license notice in their header; new files must include
21
+ it (copy it from any existing source file, or see [`CONTRIBUTING.md`](./CONTRIBUTING.md)).
22
+
23
+ ## GNU Affero General Public License v3 (open source)
24
+
25
+ The standard, **unmodified** AGPL-3.0 governs — see [`LICENSE`](./LICENSE), or
26
+ obtain a copy at <https://www.gnu.org/licenses/agpl-3.0.html>. The AGPL's
27
+ copyleft is strong and whole-work, and its §13 network clause extends it to use
28
+ over a network.
29
+
30
+ ## Paged Media Enterprise License (commercial)
31
+
32
+ A commercial license is available from **And The Next GmbH** for users who need
33
+ terms AGPL-3.0 does not provide — for example the right to build closed-source or
34
+ hosted derivatives **without** the AGPL's reciprocity and network-source
35
+ obligations, plus warranty, indemnification, liability cover, support SLAs, and
36
+ patent assurances. Contact And The Next GmbH for terms.
37
+
38
+ ## Contributions
39
+
40
+ Contributions are accepted under the project's Contributor License Agreement,
41
+ which lets And The Next GmbH distribute them under **both** the AGPL-3.0 and the
42
+ Paged Media Enterprise License. See [`CONTRIBUTING.md`](./CONTRIBUTING.md) and
43
+ [`CLA.md`](./CLA.md).
44
+
45
+ ## Trademarks
46
+
47
+ `paged`, `paged.media`, and the paged logo are trademarks of And The Next GmbH.
48
+ The open-source license grants copyright permissions, not trademark permissions.
49
+
50
+ © And The Next GmbH. All rights reserved except as expressly granted above.
package/manifest.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "id": "media.paged.image",
3
+ "name": "paged.image",
4
+ "version": "0.1.0",
5
+ "apiVersion": "^0.2",
6
+ "publisher": "paged.media",
7
+ "capabilities": {
8
+ "document": {
9
+ "read": "broad",
10
+ "write": "scoped"
11
+ },
12
+ "rendering": [
13
+ "sceneLayer",
14
+ "hitTest",
15
+ "resourceProvider",
16
+ "overlay"
17
+ ],
18
+ "assets": [
19
+ "images"
20
+ ],
21
+ "network": false,
22
+ "clipboard": "full",
23
+ "workers": {
24
+ "max": 4,
25
+ "sharedMemory": true
26
+ },
27
+ "gpu": {
28
+ "realm": "bundle"
29
+ },
30
+ "wasm": [
31
+ {
32
+ "name": "compute",
33
+ "path": "wasm/image_js_bg.wasm",
34
+ "purpose": "compute",
35
+ "maxBytes": 8388608
36
+ }
37
+ ]
38
+ },
39
+ "contributes": {
40
+ "panels": [
41
+ "media.paged.image.panel.adjustments",
42
+ "panels/image-adjustments.panel.json"
43
+ ],
44
+ "commands": [
45
+ "media.paged.image.command.openImage",
46
+ "media.paged.image.command.adjustSelected",
47
+ "media.paged.image.command.autoEnhance",
48
+ "media.paged.image.command.claimTiles",
49
+ "media.paged.image.command.commitCrop"
50
+ ],
51
+ "tools": [
52
+ "media.paged.image.tool.crop"
53
+ ],
54
+ "importers": [
55
+ "media.paged.image.importer.raster"
56
+ ]
57
+ }
58
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@paged-media/image-manifest",
3
+ "private": false,
4
+ "version": "0.0.1-canary.0",
5
+ "type": "module",
6
+ "exports": {
7
+ "./manifest.json": "./manifest.json",
8
+ "./wasm/*": "./wasm/*"
9
+ },
10
+ "files": [
11
+ "manifest.json",
12
+ "wasm"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "tag": "canary"
17
+ },
18
+ "scripts": {
19
+ "typecheck": "node ../../plugin-sdk/packages/plugin-cli/bin/paged-plugin.mjs validate manifest.json",
20
+ "test": "node ../../plugin-sdk/packages/plugin-cli/bin/paged-plugin.mjs validate manifest.json"
21
+ }
22
+ }
package/wasm/.gitkeep ADDED
File without changes
@@ -0,0 +1,255 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * A decoded image's identity on the surface: the handle keys the
6
+ * engine-held pixels; width/height are the natural extent.
7
+ */
8
+ export class DecodedHandle {
9
+ private constructor();
10
+ free(): void;
11
+ [Symbol.dispose](): void;
12
+ handle: number;
13
+ height: number;
14
+ width: number;
15
+ }
16
+
17
+ export function abi_version(): number;
18
+
19
+ /**
20
+ * Run the M4 adjustments chain on a decoded image and return the
21
+ * straight-RGBA8 result — the C-1 Stage-A scene-item payload.
22
+ * Identity params return the decode verbatim (no dispatch to run);
23
+ * anything else requires `init_gpu` to have succeeded.
24
+ */
25
+ export function adjust_image(handle: number, exposure_ev: number, brightness: number, contrast: number, saturation: number): Promise<Uint8Array>;
26
+
27
+ /**
28
+ * The FULL adjustments pass — the levels/curves/white-balance panel's
29
+ * committed values. The 9 scalars are exposure/brightness/contrast/
30
+ * saturation (as `adjust_image`), white balance (temp/tint), and the
31
+ * composite levels in/gamma/out window; `curve_lut` is an OPTIONAL
32
+ * 256-byte tone LUT (the panel builds it from its curve control points
33
+ * via `image_core::curve_lut`; pass an empty array for no curve). The
34
+ * curves stage is a CPU LUT pass (no GPU LUT kernel yet — the honest
35
+ * deferral); everything else is the GPU adjust chain. Returns straight
36
+ * RGBA8 (the C-1 Stage-A scene payload).
37
+ */
38
+ export function adjust_image_full(handle: number, exposure_ev: number, brightness: number, contrast: number, saturation: number, temp: number, tint: number, in_black: number, in_white: number, gamma: number, out_black: number, out_white: number, curve_lut: Uint8Array): Promise<Uint8Array>;
39
+
40
+ /**
41
+ * Apply a pointer drag from `(sx, sy)` to `(px, py)` (image-px) to the
42
+ * rect `[x, y, w, h]` at `handle` (the [`crop_hit_handle`]
43
+ * discriminant), with the aspect lock + image-extent clamp. Returns
44
+ * the new rect as `[x, y, w, h]`. An unknown handle returns the rect
45
+ * unchanged (defensive).
46
+ */
47
+ export function crop_apply_drag(x: number, y: number, w: number, h: number, handle: number, sx: number, sy: number, px: number, py: number, aspect_w: number, aspect_h: number, image_w: number, image_h: number): Float32Array;
48
+
49
+ /**
50
+ * The four corners of the crop FRAME rotated by the straighten
51
+ * `degrees`, as a flat `[x0,y0, x1,y1, x2,y2, x3,y3]` (TL, TR, BR, BL)
52
+ * the overlay draws as a closed polyline.
53
+ */
54
+ export function crop_frame_corners(x: number, y: number, w: number, h: number, degrees: number): Float32Array;
55
+
56
+ /**
57
+ * Hit-test the crop chrome at `(px, py)` (image-px) against the rect
58
+ * `[x, y, w, h]` with grab radius `tol`. Returns the [`image_core::
59
+ * Handle`] discriminant (0..=7 grips, 8 = body Move) or `-1` for a
60
+ * miss — the TS machine maps it to a cursor + the active grip.
61
+ */
62
+ export function crop_hit_handle(x: number, y: number, w: number, h: number, px: number, py: number, tol: number): number;
63
+
64
+ /**
65
+ * Commit a CROP: cut the integer pixel rectangle `(x, y, w, h)`
66
+ * (clamped to the image extent) out of an engine-held image and
67
+ * register the result as a NEW engine-held image, returning its
68
+ * handle. The source handle is left intact (the caller frees it). An
69
+ * out-of-bounds / empty rectangle is a clean error (never a torn
70
+ * image). The straighten-angle resample is a separate stage (not in
71
+ * this axis-aligned cut — see the crop interaction machine).
72
+ */
73
+ export function crop_image(handle: number, x: number, y: number, w: number, h: number): DecodedHandle;
74
+
75
+ /**
76
+ * Build a 256-byte tone LUT from flat `[i0,o0, i1,o1, …]` curve
77
+ * control points in `[0,1]` (the CURVES editor's points) — the LUT
78
+ * `adjust_image_full` consumes. Wraps `image_core::curve_lut`.
79
+ */
80
+ export function curve_lut(points: Float32Array): Uint8Array;
81
+
82
+ /**
83
+ * Decode PSD/PNG/JPEG bytes (sniffed by magic) into an engine-held
84
+ * RGBA8 image. Free with `free_image`.
85
+ */
86
+ export function decode_image(bytes: Uint8Array): DecodedHandle;
87
+
88
+ /**
89
+ * Release an engine-held decoded image (and its mip pyramid cache).
90
+ */
91
+ export function free_image(handle: number): void;
92
+
93
+ /**
94
+ * Whether `init_gpu` succeeded (the glue probes this to gate the
95
+ * adjust controls honestly).
96
+ */
97
+ export function gpu_ready(): boolean;
98
+
99
+ /**
100
+ * Compute the AUTO-ENHANCE adjustment parameters for an engine-held
101
+ * image and return them as `[in_black, in_white, temp, tint]` (4
102
+ * `f32`). A single "auto" estimate composing the EXISTING levels +
103
+ * white-balance kernels: it builds the RGB+luma histogram (the same
104
+ * `histogram_rgba8` reduction the panel reads), derives a percentile-
105
+ * clipped auto-levels black/white range (0.5%/99.5% of luma) and a
106
+ * gray-world white-balance `temp`/`tint`, and emits the params the
107
+ * LEVELS/WB panel commits through `adjust_image_full` (levels
108
+ * `in_black`/`in_white`, white-balance `temp`/`tint`; gamma/output
109
+ * range stay identity). Pure CPU readout/orchestration (spec §6) —
110
+ * deterministic, no GPU, no kernel dispatch row. A flat or already-
111
+ * neutral image yields the identity `[0, 1, 0, 0]` (a guaranteed
112
+ * no-op), never a wrong-looking auto-correction.
113
+ */
114
+ export function image_auto_enhance_params(handle: number): Float32Array;
115
+
116
+ /**
117
+ * Compute the RGB + luma 256-bin histogram of an engine-held image as
118
+ * a flat `[r…, g…, b…, luma…]` 1024-`u32` array (the LEVELS / CURVES
119
+ * panel slices it into four channels). Pure CPU reduction over the
120
+ * straight-RGBA8 buffer (no GPU); deterministic.
121
+ */
122
+ export function image_histogram(handle: number): Uint32Array;
123
+
124
+ /**
125
+ * C-6 (I-06) — copy a LEVEL-0 tile window `(x, y, w, h)` out of a
126
+ * decoded image as tightly packed RGBA8 (`w*h*4` bytes, row-major).
127
+ * Edge tiles are clamped to the image extent (the caller passes the
128
+ * requested grid origin + size; the returned buffer is the clipped
129
+ * intersection). This is the HONEST SUBSET of the resource provider:
130
+ * pure windowing of the already-decoded buffer (no resampling kernel,
131
+ * no GPU dispatch — orchestration, spec §6). The mip pyramid + the
132
+ * Engine B `(node, region, level)` window evaluation
133
+ * (`image_graph::BufferGraph::request`, rgba16float) are NOT yet
134
+ * wired across this wasm boundary — see the gap note in
135
+ * glue/src/tile-provider.ts. Returns an empty buffer when the window
136
+ * lies fully outside the image (a transparent miss the provider skips).
137
+ */
138
+ export function image_tile_rgba8(handle: number, x: number, y: number, w: number, h: number): Uint8Array;
139
+
140
+ /**
141
+ * C-6 (I-06) — copy a tile window `(x, y, w, h)` out of a decoded
142
+ * image at mip `level` as tightly packed RGBA8 (`w'*h'*4` bytes,
143
+ * clipped to the level extent, row-major). `level == 0` is the fast
144
+ * level-0 path ([`image_tile_rgba8`]'s pure windowing); `level > 0`
145
+ * routes through Engine B's tiled buffer graph
146
+ * (`image_graph::BufferGraph`): a 2×-box mip pyramid of rgba16float
147
+ * source tiles is built once per handle (cached) and the requested
148
+ * window is gathered from `(level, coord)` source reads and
149
+ * downconverted back to RGBA8. The coordinates are in the LEVEL's
150
+ * pixel space (already halved per level — the caller scales). No GPU
151
+ * is required (a source read carries no kernel dispatch). Returns an
152
+ * empty buffer when the window lies fully outside the level, or when
153
+ * `level` exceeds the pyramid top (a transparent miss the provider
154
+ * skips). `max_level` bounds the pyramid height built on first touch.
155
+ */
156
+ export function image_tile_rgba8_level(handle: number, level: number, x: number, y: number, size: number): Uint8Array;
157
+
158
+ /**
159
+ * K-3 (S-07 / I-02) — register a PRE-DECODED straight-RGBA8 buffer
160
+ * (from the decode worker pool, which ran the codec/PSD CPU lanes
161
+ * off-thread) as an engine-held image, returning a handle for the GPU
162
+ * adjust + tile paths. `bytes` must be exactly `width*height*4` RGBA8;
163
+ * a length mismatch is a clean error. Free with `free_image`.
164
+ */
165
+ export function ingest_rgba8(width: number, height: number, bytes: Uint8Array): DecodedHandle;
166
+
167
+ export function init(): void;
168
+
169
+ /**
170
+ * Request the WebGPU adapter/device for kernel execution.
171
+ * Idempotent. Rejects when the environment has no WebGPU — the
172
+ * honest no-GPU state (no CPU kernel path ships, spec §6).
173
+ */
174
+ export function init_gpu(): Promise<void>;
175
+
176
+ export function kernel_count(): number;
177
+
178
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
179
+
180
+ export interface InitOutput {
181
+ readonly memory: WebAssembly.Memory;
182
+ readonly __wbg_decodedhandle_free: (a: number, b: number) => void;
183
+ readonly __wbg_get_decodedhandle_handle: (a: number) => number;
184
+ readonly __wbg_get_decodedhandle_height: (a: number) => number;
185
+ readonly __wbg_get_decodedhandle_width: (a: number) => number;
186
+ readonly __wbg_set_decodedhandle_handle: (a: number, b: number) => void;
187
+ readonly __wbg_set_decodedhandle_height: (a: number, b: number) => void;
188
+ readonly __wbg_set_decodedhandle_width: (a: number, b: number) => void;
189
+ readonly abi_version: () => number;
190
+ readonly adjust_image: (a: number, b: number, c: number, d: number, e: number) => any;
191
+ readonly adjust_image_full: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => any;
192
+ readonly crop_apply_drag: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number];
193
+ readonly crop_frame_corners: (a: number, b: number, c: number, d: number, e: number) => [number, number];
194
+ readonly crop_hit_handle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
195
+ readonly crop_image: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
196
+ readonly curve_lut: (a: number, b: number) => [number, number];
197
+ readonly decode_image: (a: number, b: number) => [number, number, number];
198
+ readonly free_image: (a: number) => void;
199
+ readonly gpu_ready: () => number;
200
+ readonly image_auto_enhance_params: (a: number) => [number, number, number];
201
+ readonly image_histogram: (a: number) => [number, number, number];
202
+ readonly image_tile_rgba8: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
203
+ readonly image_tile_rgba8_level: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
204
+ readonly ingest_rgba8: (a: number, b: number, c: number, d: number) => [number, number, number];
205
+ readonly init: () => void;
206
+ readonly init_gpu: () => any;
207
+ readonly kernel_count: () => number;
208
+ readonly qcms_enable_iccv4: () => void;
209
+ readonly qcms_profile_precache_output_transform: (a: number) => void;
210
+ readonly qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
211
+ readonly qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
212
+ readonly qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
213
+ readonly qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
214
+ readonly qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
215
+ readonly qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
216
+ readonly qcms_transform_release: (a: number) => void;
217
+ readonly qcms_profile_is_bogus: (a: number) => number;
218
+ readonly qcms_white_point_sRGB: (a: number) => void;
219
+ readonly lut_inverse_interp16: (a: number, b: number, c: number) => number;
220
+ readonly lut_interp_linear16: (a: number, b: number, c: number) => number;
221
+ readonly wasm_bindgen__convert__closures_____invoke__he648930bce69cfe3: (a: number, b: number, c: any) => [number, number];
222
+ readonly wasm_bindgen__convert__closures_____invoke__h00b15b9462eedc12: (a: number, b: number, c: any, d: any) => void;
223
+ readonly wasm_bindgen__convert__closures_____invoke__hdc46c4a5196cac7a: (a: number, b: number, c: any) => void;
224
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
225
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
226
+ readonly __wbindgen_exn_store: (a: number) => void;
227
+ readonly __externref_table_alloc: () => number;
228
+ readonly __wbindgen_externrefs: WebAssembly.Table;
229
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
230
+ readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
231
+ readonly __externref_table_dealloc: (a: number) => void;
232
+ readonly __wbindgen_start: () => void;
233
+ }
234
+
235
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
236
+
237
+ /**
238
+ * Instantiates the given `module`, which can either be bytes or
239
+ * a precompiled `WebAssembly.Module`.
240
+ *
241
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
242
+ *
243
+ * @returns {InitOutput}
244
+ */
245
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
246
+
247
+ /**
248
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
249
+ * for everything else, calls `WebAssembly.instantiate` directly.
250
+ *
251
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
252
+ *
253
+ * @returns {Promise<InitOutput>}
254
+ */
255
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;