Undoable action for pixel edits on a graphics sheet. More...
#include <graphics_undo_actions.h>
Public Types | |
| using | MarkDirtyFn = std::function<void(uint16_t)> |
Public Member Functions | |
| GraphicsPixelEditAction (uint16_t sheet_id, std::vector< uint8_t > before_data, std::vector< uint8_t > after_data, std::string description, MarkDirtyFn mark_dirty) | |
| absl::Status | Undo () override |
| absl::Status | Redo () override |
| std::string | Description () const override |
| Human-readable description (e.g., "Paint 12 tiles on map 5") | |
| size_t | MemoryUsage () const override |
| Approximate memory footprint for budget enforcement. | |
| bool | CanMergeWith (const UndoAction &) const override |
Public Member Functions inherited from yaze::editor::UndoAction | |
| virtual | ~UndoAction ()=default |
| virtual void | MergeWith (UndoAction &) |
Private Member Functions | |
| void | MarkDirty () |
Private Attributes | |
| uint16_t | sheet_id_ |
| std::vector< uint8_t > | before_data_ |
| std::vector< uint8_t > | after_data_ |
| std::string | description_ |
| MarkDirtyFn | mark_dirty_ |
Undoable action for pixel edits on a graphics sheet.
Captures a full snapshot of the sheet pixel data before and after the edit stroke so that Undo restores the before-state and Redo restores the after-state.
Definition at line 27 of file graphics_undo_actions.h.
| using yaze::editor::GraphicsPixelEditAction::MarkDirtyFn = std::function<void(uint16_t)> |
Definition at line 29 of file graphics_undo_actions.h.
|
inline |
Definition at line 31 of file graphics_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 40 of file graphics_undo_actions.h.
References before_data_, yaze::gfx::Arena::Get(), MarkDirty(), yaze::gfx::Arena::mutable_gfx_sheets(), yaze::gfx::Arena::NotifySheetModified(), and sheet_id_.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 53 of file graphics_undo_actions.h.
References after_data_, yaze::gfx::Arena::Get(), MarkDirty(), yaze::gfx::Arena::mutable_gfx_sheets(), yaze::gfx::Arena::NotifySheetModified(), and sheet_id_.
|
inlineoverridevirtual |
Human-readable description (e.g., "Paint 12 tiles on map 5")
Implements yaze::editor::UndoAction.
Definition at line 66 of file graphics_undo_actions.h.
References description_.
|
inlineoverridevirtual |
Approximate memory footprint for budget enforcement.
Reimplemented from yaze::editor::UndoAction.
Definition at line 68 of file graphics_undo_actions.h.
References after_data_, and before_data_.
|
inlineoverridevirtual |
Whether this action can merge with the previous action on the stack. Called only when both actions have the same concrete type.
Reimplemented from yaze::editor::UndoAction.
Definition at line 72 of file graphics_undo_actions.h.
|
inlineprivate |
Definition at line 79 of file graphics_undo_actions.h.
References mark_dirty_, and sheet_id_.
|
private |
Definition at line 85 of file graphics_undo_actions.h.
Referenced by MarkDirty(), Redo(), and Undo().
|
private |
Definition at line 86 of file graphics_undo_actions.h.
Referenced by MemoryUsage(), and Undo().
|
private |
Definition at line 87 of file graphics_undo_actions.h.
Referenced by MemoryUsage(), and Redo().
|
private |
Definition at line 88 of file graphics_undo_actions.h.
Referenced by Description().
|
private |
Definition at line 89 of file graphics_undo_actions.h.
Referenced by MarkDirty().