yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
palette_pixel_command.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_PALETTE_PIXEL_COMMAND_H_
2#define YAZE_APP_EDITOR_GRAPHICS_PALETTE_PIXEL_COMMAND_H_
3
4#include <array>
5#include <functional>
6#include <vector>
7
11
12namespace yaze::editor {
13class UndoManager;
14using PalettePermutation = std::array<uint8_t, 8>;
15
16// Pure, inspectable plan. Selected artwork is preserved; other uses of the
17// same physical tiles/palettes are intentionally affected, not duplicated.
20 std::vector<size_t> targets;
21 std::vector<gfx::PaletteColorChange> colors;
22 std::vector<SheetPixelDiff> sheets;
23 size_t physical_tiles = 0;
24};
25absl::StatusOr<PalettePixelPlan> PlanPalettePixelPermutation(
26 const GraphicsEditContext& source, const std::vector<size_t>& targets,
27 const PalettePermutation& permutation);
28
29// Low-level atomic executor used by the single Graphics undo action.
30// after_sheet_write is a failure-injection seam; production callers omit it.
31absl::Status ExecutePalettePixelPlan(
32 GraphicsEditorState& state, const PalettePixelPlan& plan, bool redo,
33 const std::function<absl::Status(size_t)>& after_sheet_write = {});
34
35// Product command: plan, authoritative live-source preflight, atomic apply,
36// and exactly one push to the existing Graphics editor history.
38 GraphicsEditorState& state, UndoManager& history,
39 const std::vector<size_t>& targets, const PalettePermutation& permutation);
40} // namespace yaze::editor
41#endif
Shared state between GraphicsEditor panel components.
The Graphics editor's path for sheet pixel writes.
Editors are the view controllers for the application.
absl::Status ExecutePalettePixelPlan(GraphicsEditorState &state, const PalettePixelPlan &plan, bool redo, const std::function< absl::Status(size_t)> &after_sheet_write)
std::array< uint8_t, 8 > PalettePermutation
absl::StatusOr< PalettePixelPlan > PlanPalettePixelPermutation(const GraphicsEditContext &source, const std::vector< size_t > &targets, const PalettePermutation &permutation)
absl::Status ApplyPalettePixelPermutation(GraphicsEditorState &state, UndoManager &history, const std::vector< size_t > &targets, const PalettePermutation &permutation)
std::vector< SheetPixelDiff > sheets
std::vector< gfx::PaletteColorChange > colors