Undoable action for pixel edits on a graphics sheet. More...
#include <graphics_undo_actions.h>
Public Member Functions | |
| GraphicsPixelEditAction (uint16_t sheet_id, std::vector< uint8_t > before_data, std::vector< uint8_t > after_data, std::string description) | |
| 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 Attributes | |
| uint16_t | sheet_id_ |
| std::vector< uint8_t > | before_data_ |
| std::vector< uint8_t > | after_data_ |
| std::string | description_ |
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 26 of file graphics_undo_actions.h.
|
inline |
Definition at line 28 of file graphics_undo_actions.h.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 37 of file graphics_undo_actions.h.
References before_data_, yaze::gfx::Arena::Get(), yaze::gfx::Arena::mutable_gfx_sheets(), yaze::gfx::Arena::NotifySheetModified(), and sheet_id_.
|
inlineoverridevirtual |
Implements yaze::editor::UndoAction.
Definition at line 49 of file graphics_undo_actions.h.
References after_data_, yaze::gfx::Arena::Get(), 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 61 of file graphics_undo_actions.h.
References description_.
|
inlineoverridevirtual |
Approximate memory footprint for budget enforcement.
Reimplemented from yaze::editor::UndoAction.
Definition at line 63 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 67 of file graphics_undo_actions.h.
|
private |
Definition at line 74 of file graphics_undo_actions.h.
|
private |
Definition at line 75 of file graphics_undo_actions.h.
Referenced by MemoryUsage(), and Undo().
|
private |
Definition at line 76 of file graphics_undo_actions.h.
Referenced by MemoryUsage(), and Redo().
|
private |
Definition at line 77 of file graphics_undo_actions.h.
Referenced by Description().