mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-16 11:52:25 +02:00
feat(photo-editor): Ajax Image Editor client (Photoshop-parity tools)
Photoshop-parity editor client: layers, selection/masking, brushes,
smart filters, LUT import, Quick Edit, mobile gestures, workspaces,
batch operations, and the service-worker versioning (v978->v1006).
Source: vendor/photocraft (ad1cff44) photo-editor client files, merged
onto upstream/dev (a8c147b2). Conflict resolution documented in
pr_work/A_conflicts.md; editor files taken from vendor/photocraft
(upstream's editor is an earlier snapshot of the same feature).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c74f475679
commit
5fac693c1c
@@ -65,6 +65,42 @@ function renderEffects(source, effects, masks) {
|
||||
ctx.filter = 'none';
|
||||
} else if (effect.type === 'sharpen') {
|
||||
ctx.drawImage(sharpenCanvas(current, effect.params.amount), 0, 0);
|
||||
} else if (effect.type === 'motion-blur') {
|
||||
const dist = effect.params.distance;
|
||||
const rad = (effect.params.angle || 0) * Math.PI / 180;
|
||||
const dx = Math.cos(rad);
|
||||
const dy = Math.sin(rad);
|
||||
const samples = Math.max(1, Math.min(64, Math.round(dist) || 1));
|
||||
ctx.globalAlpha = 1 / samples;
|
||||
for (let s = 0; s < samples; s += 1) {
|
||||
const t = (samples > 1 ? (s / (samples - 1) - 0.5) : 0) * dist;
|
||||
ctx.drawImage(current, dx * t, dy * t);
|
||||
}
|
||||
ctx.globalAlpha = 1;
|
||||
} else if (effect.type === 'zoom-blur') {
|
||||
const amt = effect.params.amount / 100;
|
||||
const samples = Math.max(1, Math.min(48, Math.round(amt * 48) || 1));
|
||||
const cx = next.width / 2;
|
||||
const cy = next.height / 2;
|
||||
ctx.globalAlpha = 1 / samples;
|
||||
for (let s = 0; s < samples; s += 1) {
|
||||
const scale = 1 + (s / samples) * amt * 0.5;
|
||||
const dw = next.width * scale;
|
||||
const dh = next.height * scale;
|
||||
ctx.drawImage(current, cx - dw / 2, cy - dh / 2, dw, dh);
|
||||
}
|
||||
ctx.globalAlpha = 1;
|
||||
} else if (effect.type === 'pixelate') {
|
||||
const size = Math.max(1, effect.params.size);
|
||||
const sw = Math.max(1, Math.round(next.width / size));
|
||||
const sh = Math.max(1, Math.round(next.height / size));
|
||||
const tiny = new OffscreenCanvas(sw, sh);
|
||||
const tctx = tiny.getContext('2d');
|
||||
tctx.imageSmoothingEnabled = false;
|
||||
tctx.drawImage(current, 0, 0, sw, sh);
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.drawImage(tiny, 0, 0, next.width, next.height);
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
} else if (effect.type === 'color-overlay') {
|
||||
ctx.drawImage(current, 0, 0);
|
||||
ctx.globalAlpha = effect.params.opacity;
|
||||
|
||||
Reference in New Issue
Block a user