Commit 5e4c454
Fix/origin mode palette quantization (#309)
* fix(preview): palette quantization in origin mode for CPC Plus
- Add quantizationSourceImageAtom to use cropped image (before padding) in origin mode
- Prevents black padding pixels from dominating the palette
- Also fix raster auto-clear when switching resize mode (auto/origin)
- Add resizeMode and centerImage to raster input signature
* test: add regression tests for origin mode fixes
- Add raster-signature.spec.ts: tests for resizeMode/centerImage tracking
- Add quantization-source.spec.ts: tests for palette source image selection
- Ensures origin mode uses cropped image (before padding)
- Prevents CPC Plus palette bug where black padding dominated
* feat(editor): auto-scroll when cursor reaches viewport edge
Add useEffect that scrolls the canvas container to keep the keyboard
cursor visible when it moves near the edges (50px margin). Uses smooth
scrolling for better UX.
* fix(preview): disable smoothing for accurate CPC pixel rendering
- Set smoothingAtom default to false (was true)
- Add imageRendering: 'pixelated' to preview canvas
- Preview now matches PNG export and real CPC output
* feat(filters): add GPU sharpen and blur convolution filters
- Add generic 3x3 convolution fragment shader (convolution-fragment.glsl)
- Create convolution-kernels.ts with reusable kernels (sharpen, blur, emboss)
- Implement CPU fallback convolution (cpu-convolution.ts)
- Extend ReGLProcessor with 2-pass GPU pipeline (adjustments → convolution)
- Add sharpen/blur to AdjustmentConfig interface
- Add sharpen/blur atoms to config store
- Update image-adjustments UI with new filter sliders
- Update all related tests for new parameters
* feat(filters): improve blur with multi-pass and combinable filters
- Increase blur slider range from 0-1 to 0-3 for stronger effect
- Implement multi-pass blur: blur 1 = 1 pass, blur 2 = 2 passes, blur 3 = 3 passes
- Allow blur and sharpen to be combined (blur applied first, then sharpen)
- Simplify createBlurKernel to always return full Gaussian (passes control intensity)
- Add getBlurPassCount helper for discrete pass calculation
- Update GPU and CPU pipelines to support sequential blur + sharpen
* feat(filters): add Sobel edge detection filter
- Add sobel-fragment.glsl shader for GPU edge detection
- Implement applySobelEdgeDetection CPU fallback
- Add edges parameter (0-1) to adjustment config
- Pipeline: adjustments → convolution → Sobel edges
- UI slider in Effects section
* feat(filters): add median filter for denoising
- Add applyMedianFilter CPU implementation (3x3, 5x5, 7x7 kernels)
- Median filter preserves edges better than blur for noise removal
- Pipeline: adjustments → median → convolution → Sobel edges
- UI slider in Effects section (0 = off, 1-3 = radius)
* fix(filters): apply median filter before GPU pipeline
Median filter requires pixel sorting which can't be done efficiently
in a simple shader. Now applied in CPU before GPU adjustments pass.
* perf(filters): optimize median filter with sorting network and quickselect
- Use optimized sorting network for 3x3 kernel (25 comparisons)
- Use QuickSelect O(n) average for larger kernels (5x5, 7x7)
- ~3-5x faster than previous Array.sort() implementation
* fix(blur): make blur progressive from 0 to 1
- First pass now interpolates between identity and Gaussian kernel
- Blur 0.1 = 10% blur, 0.5 = 50% blur, 1.0 = 100% Gaussian
- Additional passes (blur > 1) use full Gaussian
- Eliminates the harsh jump at blur = 0.5
* feat(adjustments): add convolution filters (median, sharpen, blur, edges)
- Add median filter (radius 1-3) for edge-preserving denoising
- Add sharpen filter with adjustable strength (0-2)
- Add blur filter with progressive multi-pass gaussian (0-3)
- Add Sobel edge detection with blend strength (0-1)
- Implement CPU convolution fallback in cpu-convolution.ts
- Add GPU convolution shader for sharpen/blur
- Add GPU Sobel shader for edge detection
- Update pipeline: Median → Adjustments → Convolution → Sobel
- Add UI controls in Effects section with translations (en, de, es)
- Add chroma key infrastructure (code only, UI hidden)
- Remove unused src/app/components/adjustements/ folder
---------
Co-authored-by: Ivan Duchauffour <iduchauffour@welcomr.com>1 parent 89dba22 commit 5e4c454
File tree
38 files changed
+1833
-686
lines changed- src
- app
- components/adjustements
- store
- config
- __tests__
- image
- preview/pipeline
- raster
- components
- image-preview
- preview-editor/editor-canvas
- settings-panel/sections/image-adjustments
- hooks
- libs/pixsaur-adapter
- adapters
- shaders
- locales
- de
- en
- es
- fr
38 files changed
+1833
-686
lines changedThis file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
373 | 380 | | |
374 | 381 | | |
375 | 382 | | |
| |||
394 | 401 | | |
395 | 402 | | |
396 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
397 | 411 | | |
398 | 412 | | |
399 | 413 | | |
| |||
0 commit comments