@pixerate/editor 0.217.0 → 0.218.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/dist/{chunk-WJ2RBZMM.js → chunk-HLBTRSQJ.js} +24 -0
- package/dist/{chunk-KWNMBMKG.cjs → chunk-XFYLA3ZO.cjs} +25 -1
- package/dist/image-editor/index.cjs +424 -379
- package/dist/image-editor/index.js +54 -9
- package/dist/image-editor/selection/overlay.d.cts +7 -0
- package/dist/image-editor/selection/overlay.d.ts +7 -0
- package/dist/paint/index.cjs +4 -2
- package/dist/paint/index.js +3 -1
- package/dist/paint/wet/world.d.cts +19 -0
- package/dist/paint/wet/world.d.ts +19 -0
- package/dist/paint-editor/controller.d.cts +5 -3
- package/dist/paint-editor/controller.d.ts +5 -3
- package/dist/paint-editor/index.cjs +203 -148
- package/dist/paint-editor/index.js +72 -17
- package/dist/paint-editor/wet.d.cts +14 -0
- package/dist/paint-editor/wet.d.ts +14 -0
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +1 -1
|
@@ -2241,6 +2241,29 @@ var WetWorld = class {
|
|
|
2241
2241
|
return slot < 0 ? -1 : this.slotBase(slot);
|
|
2242
2242
|
}
|
|
2243
2243
|
};
|
|
2244
|
+
function moveWetSnapshot(snap, from, to, dx, dy, lane = () => ({})) {
|
|
2245
|
+
if (!Number.isInteger(dx / WET_TILE) || !Number.isInteger(dy / WET_TILE)) throw new WetWorldError(`Wet paint moves by whole ${WET_TILE} px tiles, not (${dx}, ${dy}).`);
|
|
2246
|
+
const a = makeLayout(from.width, from.height);
|
|
2247
|
+
const b = makeLayout(to.width, to.height);
|
|
2248
|
+
const tx0 = dx / WET_TILE;
|
|
2249
|
+
const ty0 = dy / WET_TILE;
|
|
2250
|
+
const slots = /* @__PURE__ */ new Map();
|
|
2251
|
+
let bytes = 0;
|
|
2252
|
+
for (const [key, slot] of snap.slots) {
|
|
2253
|
+
const index = Math.floor(key / a.perLane);
|
|
2254
|
+
const t = key % a.perLane;
|
|
2255
|
+
const tx = t % a.tilesX + tx0;
|
|
2256
|
+
const ty = Math.floor(t / a.tilesX) + ty0;
|
|
2257
|
+
if (tx < 0 || ty < 0 || tx >= b.tilesX || ty >= b.tilesY) continue;
|
|
2258
|
+
slots.set(index * b.perLane + ty * b.tilesX + tx, slot);
|
|
2259
|
+
bytes += slot.planes.byteLength;
|
|
2260
|
+
}
|
|
2261
|
+
const lanes = snap.lanes.map((l) => {
|
|
2262
|
+
const moved = lane(l);
|
|
2263
|
+
return { ...l, base: moved.base ?? l.base, flow: moved.flow === void 0 ? l.flow : moved.flow };
|
|
2264
|
+
});
|
|
2265
|
+
return { clock: snap.clock, tilt: { ...snap.tilt }, lanes, slots, bytes };
|
|
2266
|
+
}
|
|
2244
2267
|
function unionRect(a, b) {
|
|
2245
2268
|
if (!a) return { ...b };
|
|
2246
2269
|
const x = Math.min(a.x, b.x);
|
|
@@ -3179,6 +3202,7 @@ export {
|
|
|
3179
3202
|
MAX_WET_SLOTS,
|
|
3180
3203
|
WetWorldError,
|
|
3181
3204
|
WetWorld,
|
|
3205
|
+
moveWetSnapshot,
|
|
3182
3206
|
WET_FLOW_KINDS,
|
|
3183
3207
|
DEFAULT_FLOW,
|
|
3184
3208
|
dsincos,
|
|
@@ -2241,6 +2241,29 @@ var WetWorld = (_class = class {
|
|
|
2241
2241
|
return slot < 0 ? -1 : this.slotBase(slot);
|
|
2242
2242
|
}
|
|
2243
2243
|
}, _class);
|
|
2244
|
+
function moveWetSnapshot(snap, from, to, dx, dy, lane = () => ({})) {
|
|
2245
|
+
if (!Number.isInteger(dx / WET_TILE) || !Number.isInteger(dy / WET_TILE)) throw new WetWorldError(`Wet paint moves by whole ${WET_TILE} px tiles, not (${dx}, ${dy}).`);
|
|
2246
|
+
const a = makeLayout(from.width, from.height);
|
|
2247
|
+
const b = makeLayout(to.width, to.height);
|
|
2248
|
+
const tx0 = dx / WET_TILE;
|
|
2249
|
+
const ty0 = dy / WET_TILE;
|
|
2250
|
+
const slots = /* @__PURE__ */ new Map();
|
|
2251
|
+
let bytes = 0;
|
|
2252
|
+
for (const [key, slot] of snap.slots) {
|
|
2253
|
+
const index = Math.floor(key / a.perLane);
|
|
2254
|
+
const t = key % a.perLane;
|
|
2255
|
+
const tx = t % a.tilesX + tx0;
|
|
2256
|
+
const ty = Math.floor(t / a.tilesX) + ty0;
|
|
2257
|
+
if (tx < 0 || ty < 0 || tx >= b.tilesX || ty >= b.tilesY) continue;
|
|
2258
|
+
slots.set(index * b.perLane + ty * b.tilesX + tx, slot);
|
|
2259
|
+
bytes += slot.planes.byteLength;
|
|
2260
|
+
}
|
|
2261
|
+
const lanes = snap.lanes.map((l) => {
|
|
2262
|
+
const moved = lane(l);
|
|
2263
|
+
return { ...l, base: _nullishCoalesce(moved.base, () => ( l.base)), flow: moved.flow === void 0 ? l.flow : moved.flow };
|
|
2264
|
+
});
|
|
2265
|
+
return { clock: snap.clock, tilt: { ...snap.tilt }, lanes, slots, bytes };
|
|
2266
|
+
}
|
|
2244
2267
|
function unionRect(a, b) {
|
|
2245
2268
|
if (!a) return { ...b };
|
|
2246
2269
|
const x = Math.min(a.x, b.x);
|
|
@@ -3195,4 +3218,5 @@ function pointerStrokeSamples(e, toPoint) {
|
|
|
3195
3218
|
|
|
3196
3219
|
|
|
3197
3220
|
|
|
3198
|
-
|
|
3221
|
+
|
|
3222
|
+
exports.createPigmentTools = createPigmentTools; exports.WET_TILE = WET_TILE; exports.SLOT_SIDE = SLOT_SIDE; exports.PLANE = PLANE; exports.PLANE_BYTES = PLANE_BYTES; exports.SET_PLANES = SET_PLANES; exports.P_RHO = P_RHO; exports.P_UX = P_UX; exports.P_UY = P_UY; exports.P_SW = P_SW; exports.P_P0 = P_P0; exports.P_EDGE = P_EDGE; exports.P_D0 = P_D0; exports.P_H = P_H; exports.P_FX = P_FX; exports.P_FY = P_FY; exports.SLOT_PLANES = SLOT_PLANES; exports.SLOT_BYTES = SLOT_BYTES; exports.PIGMENT_CHANNELS = PIGMENT_CHANNELS; exports.EX = EX; exports.EY = EY; exports.OPP = OPP; exports.W9 = W9; exports.DRY_EPS = DRY_EPS; exports.U_MAX = U_MAX; exports.STRIP = STRIP; exports.MAX_BATCH = MAX_BATCH; exports.FREE_INTERVAL = FREE_INTERVAL; exports.FLAG_ALIVE = FLAG_ALIVE; exports.FLAG_LEFT = FLAG_LEFT; exports.FLAG_RIGHT = FLAG_RIGHT; exports.FLAG_TOP = FLAG_TOP; exports.FLAG_BOTTOM = FLAG_BOTTOM; exports.FLAG_WET = FLAG_WET; exports.PARAM_FLOATS = PARAM_FLOATS; exports.PARAM = PARAM; exports.DEFAULT_WET_PARAMS = DEFAULT_WET_PARAMS; exports.WET_PARAM_KEYS = WET_PARAM_KEYS; exports.DEFAULT_WET_PAPER = DEFAULT_WET_PAPER; exports.FLAT = FLAT; exports.normalizeWetParams = normalizeWetParams; exports.normalizeTilt = normalizeTilt; exports.latticeViscosity = latticeViscosity; exports.PAPER_CAPACITY = PAPER_CAPACITY; exports.MAX_TILT_ACCEL = MAX_TILT_ACCEL; exports.packWetParams = packWetParams; exports.edgeBits = edgeBits; exports.PIGMENT_UNIT = PIGMENT_UNIT; exports.HIDE = HIDE; exports.BODY_SCATTER = BODY_SCATTER; exports.dexp = dexp; exports.dlog = dlog; exports.dpow = dpow; exports.SRGB_TO_LINEAR = SRGB_TO_LINEAR; exports.srgbByteToLinear = srgbByteToLinear; exports.linearToSrgb8 = linearToSrgb8; exports.pigmentOf = pigmentOf; exports.expNeg = expNeg; exports.filmReflectance = filmReflectance; exports.pigmentColor = pigmentColor; exports.filmPixel = filmPixel; exports.pixelPigment = pixelPigment; exports.shadeTile = shadeTile; exports.stepSlotTs = stepSlotTs; exports.loadWetKernel = loadWetKernel; exports.canShareMemory = canShareMemory; exports.wetSimdSupported = wetSimdSupported; exports.wetSupport = wetSupport; exports.WetWorkerPool = WetWorkerPool; exports.MAX_WET_LANES = MAX_WET_LANES; exports.MAX_WET_SLOTS = MAX_WET_SLOTS; exports.WetWorldError = WetWorldError; exports.WetWorld = WetWorld; exports.moveWetSnapshot = moveWetSnapshot; exports.WET_FLOW_KINDS = WET_FLOW_KINDS; exports.DEFAULT_FLOW = DEFAULT_FLOW; exports.dsincos = dsincos; exports.normalizeFlow = normalizeFlow; exports.flowField = flowField; exports.WetMedium = WetMedium; exports.WGSL_STEP = WGSL_STEP; exports.WGSL_HALO = WGSL_HALO; exports.WGSL_SHADE = WGSL_SHADE; exports.findWebGpu = findWebGpu; exports.createWetGpuEngine = createWetGpuEngine; exports.wetGpuSupport = wetGpuSupport; exports.WetGpuEngine = WetGpuEngine; exports.pointerPressure = pointerPressure; exports.pointerStrokeSample = pointerStrokeSample; exports.pointerStrokeSamples = pointerStrokeSamples;
|