Palette widget with ROM integration, analysis tools, and AI tool call support. More...
#include <palette_widget.h>
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::SnesPalette * | GetSelectedROMPalette () 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 | |
Rom * | rom_ = nullptr |
std::vector< gfx::SnesPalette > | rom_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) |
Palette widget with ROM integration, analysis tools, and AI tool call support.
This widget provides comprehensive palette editing capabilities including:
Definition at line 24 of file palette_widget.h.
|
default |
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_.
void yaze::gui::PaletteWidget::ShowPaletteEditor | ( | gfx::SnesPalette & | palette, |
const std::string & | title = "Palette Editor" |
||
) |
Show the main palette editor window.
Definition at line 20 of file palette_widget.cc.
References current_group_index_, DrawPaletteAnalysis(), DrawPaletteGrid(), DrawROMPaletteSelector(), RestorePaletteBackup(), rom_, rom_palette_groups_, and SavePaletteBackup().
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_.
void yaze::gui::PaletteWidget::ShowColorAnalysis | ( | const gfx::Bitmap & | bitmap, |
const std::string & | title = "Color Analysis" |
||
) |
Show color analysis window for a bitmap.
Definition at line 93 of file palette_widget.cc.
References yaze::gfx::Bitmap::height(), yaze::gfx::Bitmap::is_active(), yaze::gfx::Bitmap::palette(), show_color_analysis_, yaze::gfx::SnesPalette::size(), yaze::gfx::Bitmap::vector(), and yaze::gfx::Bitmap::width().
bool yaze::gui::PaletteWidget::ApplyROMPalette | ( | gfx::Bitmap * | bitmap, |
int | group_index, | ||
int | palette_index | ||
) |
Apply a ROM palette group to a bitmap.
Definition at line 151 of file palette_widget.cc.
References current_group_index_, current_palette_index_, yaze::gfx::Arena::Get(), yaze::gfx::Bitmap::palette(), yaze::gfx::Arena::QueueTextureCommand(), rom_palette_groups_, rom_palettes_loaded_, SavePaletteBackup(), yaze::gfx::Bitmap::SetPalette(), yaze::gfx::Bitmap::SetPaletteWithTransparent(), and yaze::gfx::Arena::UPDATE.
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_.
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().
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().
|
inline |
Definition at line 69 of file palette_widget.h.
References rom_.
|
inline |
Definition at line 70 of file palette_widget.h.
References current_group_index_.
|
inline |
Definition at line 71 of file palette_widget.h.
References current_palette_index_.
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().
|
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().
|
private |
Definition at line 326 of file palette_widget.cc.
References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesColor::snes().
|
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().
|
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().
|
private |
Definition at line 80 of file palette_widget.h.
Referenced by Initialize(), IsROMLoaded(), LoadROMPalettes(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 81 of file palette_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), LoadROMPalettes(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 82 of file palette_widget.h.
Referenced by DrawROMPaletteSelector(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 83 of file palette_widget.h.
Referenced by RestorePaletteBackup(), and SavePaletteBackup().
|
private |
Definition at line 85 of file palette_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetCurrentGroupIndex(), GetSelectedROMPalette(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 86 of file palette_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), and GetCurrentPaletteIndex().
|
private |
Definition at line 87 of file palette_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), Initialize(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 88 of file palette_widget.h.
Referenced by ShowColorAnalysis().
|
private |
Definition at line 89 of file palette_widget.h.
Referenced by ShowROMPaletteManager().
|
private |
Definition at line 92 of file palette_widget.h.
Referenced by DrawPaletteGrid().
|
private |
Definition at line 93 of file palette_widget.h.
Referenced by DrawPaletteGrid().