feat(photos): добавить эффекты и настройки панели редактора

- текстура, чёткость, дымка, виньетка и зерно в неразрушающем редакторе
- живой WebGL2-предпросмотр эффектов и CPU-фолбэк
- секции редактора свёрнуты по умолчанию, состояние в localStorage
- вкладка «Редактирование» доступна только из просмотрщика
This commit is contained in:
iu
2026-10-24 22:57:30 +03:00
parent 4cc5c0f340
commit c953008a86
18 changed files with 3548 additions and 173 deletions
+11 -6
View File
@@ -90,19 +90,24 @@ func applyLightRows(dst *image.NRGBA, from, to int, adj lightAdjuster, master, r
}
}
// decodeAndAdjust decodes the original and applies the light and color
// decodeAndAdjust decodes the original and applies the light, color and effect
// adjustments to it, so the variants and the full-size version share one
// decode. Color is applied after light.
func decodeAndAdjust(data []byte, p EditParams) (*image.NRGBA, error) {
// decode. The passes run in a fixed order: light, color, then the effects
// (dehaze, texture, clarity, vignette, grain). The seed makes the grain render
// deterministic; it comes from the photo id.
func decodeAndAdjust(data []byte, p EditParams, seed uint64) (*image.NRGBA, error) {
img, err := imaging.Decode(bytes.NewReader(data), imaging.AutoOrientation(true))
if err != nil {
return nil, err
}
edited := applyLight(img, p.Light)
if p.Color.IsEmpty() {
return edited, nil
if !p.Color.IsEmpty() {
edited = applyColor(edited, p.Color)
}
return applyColor(edited, p.Color), nil
if !p.Effects.IsEmpty() {
edited = applyEffects(edited, p.Effects, seed)
}
return edited, nil
}
// applyColor applies the color adjustments in place to an image that already