yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::GraphicsPixelEditAction Class Reference

Undoable action for pixel edits on a graphics sheet. More...

#include <graphics_undo_actions.h>

Inheritance diagram for yaze::editor::GraphicsPixelEditAction:
Collaboration diagram for yaze::editor::GraphicsPixelEditAction:

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_
 

Detailed 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 27 of file graphics_undo_actions.h.

Member Typedef Documentation

◆ MarkDirtyFn

using yaze::editor::GraphicsPixelEditAction::MarkDirtyFn = std::function<void(uint16_t)>

Definition at line 29 of file graphics_undo_actions.h.

Constructor & Destructor Documentation

◆ GraphicsPixelEditAction()

yaze::editor::GraphicsPixelEditAction::GraphicsPixelEditAction ( uint16_t sheet_id,
std::vector< uint8_t > before_data,
std::vector< uint8_t > after_data,
std::string description,
MarkDirtyFn mark_dirty )
inline

Definition at line 31 of file graphics_undo_actions.h.

Member Function Documentation

◆ Undo()

absl::Status yaze::editor::GraphicsPixelEditAction::Undo ( )
inlineoverridevirtual

◆ Redo()

absl::Status yaze::editor::GraphicsPixelEditAction::Redo ( )
inlineoverridevirtual

◆ Description()

std::string yaze::editor::GraphicsPixelEditAction::Description ( ) const
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_.

◆ MemoryUsage()

size_t yaze::editor::GraphicsPixelEditAction::MemoryUsage ( ) const
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_.

◆ CanMergeWith()

bool yaze::editor::GraphicsPixelEditAction::CanMergeWith ( const UndoAction & ) const
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.

◆ MarkDirty()

void yaze::editor::GraphicsPixelEditAction::MarkDirty ( )
inlineprivate

Definition at line 79 of file graphics_undo_actions.h.

References mark_dirty_, and sheet_id_.

Referenced by Redo(), and Undo().

Member Data Documentation

◆ sheet_id_

uint16_t yaze::editor::GraphicsPixelEditAction::sheet_id_
private

Definition at line 85 of file graphics_undo_actions.h.

Referenced by MarkDirty(), Redo(), and Undo().

◆ before_data_

std::vector<uint8_t> yaze::editor::GraphicsPixelEditAction::before_data_
private

Definition at line 86 of file graphics_undo_actions.h.

Referenced by MemoryUsage(), and Undo().

◆ after_data_

std::vector<uint8_t> yaze::editor::GraphicsPixelEditAction::after_data_
private

Definition at line 87 of file graphics_undo_actions.h.

Referenced by MemoryUsage(), and Redo().

◆ description_

std::string yaze::editor::GraphicsPixelEditAction::description_
private

Definition at line 88 of file graphics_undo_actions.h.

Referenced by Description().

◆ mark_dirty_

MarkDirtyFn yaze::editor::GraphicsPixelEditAction::mark_dirty_
private

Definition at line 89 of file graphics_undo_actions.h.

Referenced by MarkDirty().


The documentation for this class was generated from the following file: