Удалены лишние сервисы

This commit is contained in:
2026-04-08 01:58:19 +03:00
parent 0ab6b54dff
commit e0c4287e25
10 changed files with 6 additions and 501 deletions

View File

@@ -199,24 +199,20 @@ For a 64×64 image, 1 document, 1 layer, 16-color palette:
| Interface | Methods (key) |
|------------------------|--------------------------------------------------|
| `ICompositor` | `uint[] Composite(MinintDocument, int w, int h)` |
| `IPaletteService` | `int EnsureColor(doc, RgbaColor)`, `void CompactPalette(doc)` |
| `IDrawingService` | `void ApplyBrush(layer, x, y, radius, colorIdx, w, h)` |
| `IFloodFillService` | `void Fill(layer, x, y, newColorIdx, w, h)` |
| `IImageEffectService` | `void AdjustContrast(doc, float factor)`, `void ToGrayscale(doc)` |
| `IPatternGenerator` | `MinintDocument Generate(PatternParams)` |
| `IFragmentService` | `void CopyFragment(src, dst, rect, destPoint)` |
### 4.3 Core — Service Implementations
| Class | Implements | Notes |
|------------------------|-------------------------|------------------------------------|
| `Compositor` | `ICompositor` | Alpha-blends layers bottom→top |
| `PaletteService` | `IPaletteService` | Color lookup, add, compact |
| `DrawingService` | `IDrawingService` | Circle mask brush/eraser |
| `FloodFillService` | `IFloodFillService` | BFS flood fill on index array |
| `ImageEffectService` | `IImageEffectService` | Palette-based contrast/grayscale |
| `PatternGenerator` | `IPatternGenerator` | Checkerboard, gradient, stripes… |
| `FragmentService` | `IFragmentService` | Copy rect with palette merging |
### 4.4 Infrastructure
@@ -294,7 +290,7 @@ while queue not empty:
### 5.4 Palette Compaction
On save (or on demand):
Optional optimization (not implemented as a separate service; could be applied on save or on demand):
1. Scan all layers, collect used indices into a `HashSet<int>`.
2. Build new palette = only used colors (keep index 0 = transparent).
3. Build old→new index mapping.
@@ -306,12 +302,12 @@ On save (or on demand):
for each pixel (sx, sy) in source rect:
srcIdx = srcLayer.Pixels[sy * W + sx]
srcColor = srcDoc.Palette[srcIdx]
dstIdx = dstDoc.PaletteService.EnsureColor(srcColor)
dstIdx = dstDoc.EnsureColorCached(srcColor)
dstLayer.Pixels[destY * W + destX] = dstIdx
destX++; ...
```
`EnsureColor` checks if color exists in target palette; if not, appends it and returns the new index.
`EnsureColorCached` checks if color exists in target palette; if not, appends it and returns the new index.
### 5.6 Contrast (A1)