1#ifndef YAZE_APP_EDITOR_GRAPHICS_PIXEL_EDITOR_PANEL_H
2#define YAZE_APP_EDITOR_GRAPHICS_PIXEL_EDITOR_PANEL_H
7#include "absl/status/status.h"
38 std::string
GetId()
const override {
return "graphics.pixel_editor"; }
61 std::function<
void(
bool)> set_visible) {
69 void Draw(
bool* p_open)
override;
89 std::function<absl::Status()> redo) {
90 undo_ = std::move(undo);
91 redo_ = std::move(redo);
98 std::function<absl::Status()>
undo_;
99 std::function<absl::Status()>
redo_;
177 void DrawLine(
int x1,
int y1,
int x2,
int y2);
182 void DrawRectangle(
int x1,
int y1,
int x2,
int y2,
bool filled);
288 std::optional<zelda3::GraphicsSheetStore::Edit>
stroke_;
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Shared state between GraphicsEditor panel components.
std::function< absl::Status(const std::vector< size_t > &, const PalettePermutation &)> Apply
Main pixel editing panel for graphics sheets.
bool HasActiveStroke() const
UndoManager * undo_manager_
std::string GetId() const override
Unique identifier for this panel.
bool show_source_preview_
void EndSelection()
Finalize the selection.
PaletteReorderControl palette_reorder_
gfx::Bitmap & DisplaySheet()
void SetSheetBrowserCallbacks(std::function< bool()> visible, std::function< void(bool)> set_visible)
void DrawLine(int x1, int y1, int x2, int y2)
Draw line from start to end.
void DrawColorPicker()
Draw the color palette picker.
void ApplyEraser(int x, int y)
Apply eraser tool at position.
std::optional< zelda3::GraphicsSheetStore::Edit > stroke_
void DrawPixelInfoTooltip(const gfx::Bitmap &sheet)
Draw tooltip with pixel information.
void ClampFloatingPaste()
bool HandleFloatingPasteInput()
void SetHistoryCallbacks(std::function< absl::Status()> undo, std::function< absl::Status()> redo)
void DrawCursorCrosshair()
Draw crosshair at cursor position.
void DrawMiniMap()
Draw the mini navigation map.
void Draw(bool *p_open) override
Draw the pixel editor UI (WindowContent interface)
std::string GetEditorCategory() const override
Editor category this panel belongs to.
void HandleCanvasInput()
Handle canvas mouse input for current tool.
void HandleFloatingPasteKeys()
bool fit_canvas_requested_
ImVec2 ScreenToPixel(ImVec2 screen_pos)
Convert screen coordinates to pixel coordinates.
std::function< void(bool)> set_sheet_browser_visible_
void DrawBrushPreview()
Draw brush size preview circle.
void ApplyEyedropper(int x, int y)
Apply eyedropper tool at position.
void CopySelection()
Copy selection to clipboard.
void UpdateSelection(int x, int y)
Update selection during drag.
void FlipSelectionVertical()
Flip selection vertically.
void ApplyBrush(int x, int y)
Apply brush tool at position.
void Initialize()
Initialize the panel.
void FlipSelectionHorizontal()
Flip selection horizontally.
void DrawViewControls()
Draw zoom and view controls.
void ApplyPencil(int x, int y)
Apply pencil tool at position.
void PasteFromSystemClipboard()
std::string GetIcon() const override
Material Design icon for this panel.
void DrawToolbar()
Draw the toolbar with tool selection.
absl::Status Update()
Legacy Update method for backward compatibility.
void CopyToSystemClipboard()
ImVec2 PixelToScreen(int x, int y)
Convert pixel coordinates to screen coordinates.
void BeginSelection(int x, int y)
Start a new selection.
std::function< absl::Status()> redo_
std::function< absl::Status()> undo_
void DrawStatusBar()
Draw the status bar with cursor position.
void SetSourcePreviewCallback(std::function< void()> draw)
void DrawTransparencyGrid(float canvas_width, float canvas_height)
Draw checkerboard pattern for transparent pixels.
bool clipboard_status_is_error_
void FinishReleasedGesture()
void EndStroke()
Ends the stroke: the sheet's store revision changes once and one GraphicsPixelEditAction (the changed...
void BeginStroke()
Starts a stroke on the current sheet. Pixel writes go to the session's GraphicsSheetStore until EndSt...
void DrawTileHighlight(const gfx::Bitmap &sheet)
Draw a transient highlight for a target tile.
void DrawClipboardControls()
std::string history_error_
std::string clipboard_status_
void DrawPixelGrids(float canvas_width, float canvas_height)
void ShowStrokeChanges(bool changed)
After pixel writes: refresh the Arena copy and mark the sheet modified.
GraphicsEditorState * state_
friend class AuthoringSaveWorkflowTestPeer
std::function< void()> draw_source_preview_
void ApplyFill(int x, int y)
Apply flood fill starting at position.
void PasteSelection(int x, int y)
Paste clipboard at position.
gfx::SnesPalette DisplayPalette() const
void CommitFloatingPaste()
void SetPaletteReorderCallback(PaletteReorderControl::Apply apply)
int GetPriority() const override
Get display priority for menu ordering.
std::function< bool()> sheet_browser_visible_
void CancelFloatingPaste()
gfx::Bitmap context_sheet_
friend class PixelEditorPanelTestPeer
void DrawRectangle(int x1, int y1, int x2, int y2, bool filled)
Draw rectangle from start to end.
PixelEditorPanel(GraphicsEditorState *state, Rom *rom, UndoManager *undo_manager=nullptr)
void CutToSystemClipboard()
SheetColors CurrentSheetColors() const
void DrawCanvas()
Draw the main editing canvas.
PaletteReorderControl::Apply apply_palette_reorder_
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void DrawPaletteRowPicker()
zelda3::GraphicsSheetStore::Edit * StrokeEdit()
Manages undo/redo stacks for a single editor.
Base interface for all logical window content components.
Represents a bitmap image optimized for SNES ROM hacking.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
One ROM session's graphics sheet pixels, with a revision per sheet.
std::array< std::array< uint8_t, 3 >, 8 > SheetColors
The 8 colors a 3bpp sheet shows (index 0 is transparent in game).
PixelTool
Pixel editing tool types for the graphics editor.