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 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_
 

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 26 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 )
inline

Definition at line 28 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 61 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 63 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 67 of file graphics_undo_actions.h.

Member Data Documentation

◆ sheet_id_

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

Definition at line 74 of file graphics_undo_actions.h.

Referenced by Redo(), and Undo().

◆ before_data_

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

Definition at line 75 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 76 of file graphics_undo_actions.h.

Referenced by MemoryUsage(), and Redo().

◆ description_

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

Definition at line 77 of file graphics_undo_actions.h.

Referenced by Description().


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