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

Palette widget with ROM integration, analysis tools, and AI tool call support. More...

#include <palette_widget.h>

Collaboration diagram for yaze::gui::PaletteWidget:

Public Member Functions

 PaletteWidget ()=default
 
void Initialize (Rom *rom)
 Initialize the palette editor with ROM data.
 
void ShowPaletteEditor (gfx::SnesPalette &palette, const std::string &title="Palette Editor")
 Show the main palette editor window.
 
void ShowROMPaletteManager ()
 Show the ROM palette manager window.
 
void ShowColorAnalysis (const gfx::Bitmap &bitmap, const std::string &title="Color Analysis")
 Show color analysis window for a bitmap.
 
bool ApplyROMPalette (gfx::Bitmap *bitmap, int group_index, int palette_index)
 Apply a ROM palette group to a bitmap.
 
const gfx::SnesPaletteGetSelectedROMPalette () const
 Get the currently selected ROM palette.
 
void SavePaletteBackup (const gfx::SnesPalette &palette)
 Save current palette as backup.
 
bool RestorePaletteBackup (gfx::SnesPalette &palette)
 Restore palette from backup.
 
bool IsROMLoaded () const
 
int GetCurrentGroupIndex () const
 
int GetCurrentPaletteIndex () const
 
void DrawROMPaletteSelector ()
 

Private Member Functions

void DrawPaletteGrid (gfx::SnesPalette &palette, int cols=8)
 
void DrawColorEditControls (gfx::SnesColor &color, int color_index)
 
void DrawPaletteAnalysis (const gfx::SnesPalette &palette)
 
void LoadROMPalettes ()
 

Private Attributes

Romrom_ = nullptr
 
std::vector< gfx::SnesPaletterom_palette_groups_
 
std::vector< std::string > palette_group_names_
 
gfx::SnesPalette backup_palette_
 
int current_group_index_ = 0
 
int current_palette_index_ = 0
 
bool rom_palettes_loaded_ = false
 
bool show_color_analysis_ = false
 
bool show_rom_manager_ = false
 
int editing_color_index_ = -1
 
ImVec4 temp_color_ = ImVec4(0, 0, 0, 1)
 

Detailed Description

Palette widget with ROM integration, analysis tools, and AI tool call support.

This widget provides comprehensive palette editing capabilities including:

  • Grid-based color editing with preview
  • ROM palette browser and manager
  • Color analysis and statistics
  • Export/import functionality
  • AI agent tool call integration for programmatic palette access

Definition at line 24 of file palette_widget.h.

Constructor & Destructor Documentation

◆ PaletteWidget()

yaze::gui::PaletteWidget::PaletteWidget ( )
default

Member Function Documentation

◆ Initialize()

void yaze::gui::PaletteWidget::Initialize ( Rom rom)

Initialize the palette editor with ROM data.

Definition at line 12 of file palette_widget.cc.

References LoadROMPalettes(), rom_, and rom_palettes_loaded_.

Here is the call graph for this function:

◆ ShowPaletteEditor()

void yaze::gui::PaletteWidget::ShowPaletteEditor ( gfx::SnesPalette palette,
const std::string &  title = "Palette Editor" 
)

◆ ShowROMPaletteManager()

void yaze::gui::PaletteWidget::ShowROMPaletteManager ( )

Show the ROM palette manager window.

Definition at line 64 of file palette_widget.cc.

References current_group_index_, DrawPaletteAnalysis(), DrawPaletteGrid(), DrawROMPaletteSelector(), LoadROMPalettes(), palette_group_names_, rom_, rom_palette_groups_, rom_palettes_loaded_, and show_rom_manager_.

Here is the call graph for this function:

◆ ShowColorAnalysis()

void yaze::gui::PaletteWidget::ShowColorAnalysis ( const gfx::Bitmap bitmap,
const std::string &  title = "Color Analysis" 
)

◆ ApplyROMPalette()

◆ GetSelectedROMPalette()

const gfx::SnesPalette * yaze::gui::PaletteWidget::GetSelectedROMPalette ( ) const

Get the currently selected ROM palette.

Definition at line 184 of file palette_widget.cc.

References current_group_index_, rom_palette_groups_, and rom_palettes_loaded_.

◆ SavePaletteBackup()

void yaze::gui::PaletteWidget::SavePaletteBackup ( const gfx::SnesPalette palette)

Save current palette as backup.

Definition at line 193 of file palette_widget.cc.

References backup_palette_.

Referenced by ApplyROMPalette(), and ShowPaletteEditor().

◆ RestorePaletteBackup()

bool yaze::gui::PaletteWidget::RestorePaletteBackup ( gfx::SnesPalette palette)

Restore palette from backup.

Definition at line 197 of file palette_widget.cc.

References backup_palette_, and yaze::gfx::SnesPalette::size().

Referenced by ShowPaletteEditor().

Here is the call graph for this function:

◆ IsROMLoaded()

bool yaze::gui::PaletteWidget::IsROMLoaded ( ) const
inline

Definition at line 69 of file palette_widget.h.

References rom_.

◆ GetCurrentGroupIndex()

int yaze::gui::PaletteWidget::GetCurrentGroupIndex ( ) const
inline

Definition at line 70 of file palette_widget.h.

References current_group_index_.

◆ GetCurrentPaletteIndex()

int yaze::gui::PaletteWidget::GetCurrentPaletteIndex ( ) const
inline

Definition at line 71 of file palette_widget.h.

References current_palette_index_.

◆ DrawROMPaletteSelector()

void yaze::gui::PaletteWidget::DrawROMPaletteSelector ( )

Definition at line 284 of file palette_widget.cc.

References current_group_index_, current_palette_index_, LoadROMPalettes(), palette_group_names_, rom_palette_groups_, and rom_palettes_loaded_.

Referenced by ShowPaletteEditor(), and ShowROMPaletteManager().

Here is the call graph for this function:

◆ DrawPaletteGrid()

void yaze::gui::PaletteWidget::DrawPaletteGrid ( gfx::SnesPalette palette,
int  cols = 8 
)
private

Definition at line 206 of file palette_widget.cc.

References editing_color_index_, yaze::gfx::SnesPalette::size(), and temp_color_.

Referenced by ShowPaletteEditor(), and ShowROMPaletteManager().

Here is the call graph for this function:

◆ DrawColorEditControls()

void yaze::gui::PaletteWidget::DrawColorEditControls ( gfx::SnesColor color,
int  color_index 
)
private

Definition at line 326 of file palette_widget.cc.

References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesColor::snes().

Here is the call graph for this function:

◆ DrawPaletteAnalysis()

void yaze::gui::PaletteWidget::DrawPaletteAnalysis ( const gfx::SnesPalette palette)
private

Definition at line 362 of file palette_widget.cc.

References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesPalette::size().

Referenced by ShowPaletteEditor(), and ShowROMPaletteManager().

Here is the call graph for this function:

◆ LoadROMPalettes()

void yaze::gui::PaletteWidget::LoadROMPalettes ( )
private

Definition at line 416 of file palette_widget.cc.

References LOG_ERROR, yaze::Rom::palette_group(), palette_group_names_, rom_, rom_palette_groups_, and rom_palettes_loaded_.

Referenced by DrawROMPaletteSelector(), Initialize(), and ShowROMPaletteManager().

Here is the call graph for this function:

Member Data Documentation

◆ rom_

Rom* yaze::gui::PaletteWidget::rom_ = nullptr
private

◆ rom_palette_groups_

std::vector<gfx::SnesPalette> yaze::gui::PaletteWidget::rom_palette_groups_
private

◆ palette_group_names_

std::vector<std::string> yaze::gui::PaletteWidget::palette_group_names_
private

Definition at line 82 of file palette_widget.h.

Referenced by DrawROMPaletteSelector(), LoadROMPalettes(), and ShowROMPaletteManager().

◆ backup_palette_

gfx::SnesPalette yaze::gui::PaletteWidget::backup_palette_
private

Definition at line 83 of file palette_widget.h.

Referenced by RestorePaletteBackup(), and SavePaletteBackup().

◆ current_group_index_

int yaze::gui::PaletteWidget::current_group_index_ = 0
private

◆ current_palette_index_

int yaze::gui::PaletteWidget::current_palette_index_ = 0
private

◆ rom_palettes_loaded_

bool yaze::gui::PaletteWidget::rom_palettes_loaded_ = false
private

◆ show_color_analysis_

bool yaze::gui::PaletteWidget::show_color_analysis_ = false
private

Definition at line 88 of file palette_widget.h.

Referenced by ShowColorAnalysis().

◆ show_rom_manager_

bool yaze::gui::PaletteWidget::show_rom_manager_ = false
private

Definition at line 89 of file palette_widget.h.

Referenced by ShowROMPaletteManager().

◆ editing_color_index_

int yaze::gui::PaletteWidget::editing_color_index_ = -1
private

Definition at line 92 of file palette_widget.h.

Referenced by DrawPaletteGrid().

◆ temp_color_

ImVec4 yaze::gui::PaletteWidget::temp_color_ = ImVec4(0, 0, 0, 1)
private

Definition at line 93 of file palette_widget.h.

Referenced by DrawPaletteGrid().


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