#include <palette_editor_widget.h>

Public Member Functions | |
| PaletteEditorWidget ()=default | |
| void | Initialize (zelda3::GameData *game_data) |
| void | Initialize (Rom *rom) |
| void | Draw () |
| void | ShowPaletteEditor (gfx::SnesPalette &palette, const std::string &title="Palette Editor") |
| void | ShowROMPaletteManager () |
| void | ShowColorAnalysis (const gfx::Bitmap &bitmap, const std::string &title="Color Analysis") |
| bool | ApplyROMPalette (gfx::Bitmap *bitmap, int group_index, int palette_index) |
| const gfx::SnesPalette * | GetSelectedROMPalette () const |
| void | SavePaletteBackup (const gfx::SnesPalette &palette) |
| bool | RestorePaletteBackup (gfx::SnesPalette &palette) |
| void | SetOnPaletteChanged (std::function< void(int palette_id)> callback) |
| int | GetCurrentPaletteId () const |
| void | SetCurrentPaletteId (int id) |
| bool | IsROMLoaded () const |
| int | GetCurrentGroupIndex () const |
| void | DrawROMPaletteSelector () |
Private Member Functions | |
| void | DrawPaletteGrid (gfx::SnesPalette &palette, int cols=15) |
| void | DrawColorEditControls (gfx::SnesColor &color, int color_index) |
| void | DrawPaletteAnalysis (const gfx::SnesPalette &palette) |
| void | LoadROMPalettes () |
| void | DrawPaletteSelector () |
| void | DrawColorPicker () |
Private Attributes | |
| zelda3::GameData * | game_data_ = nullptr |
| 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 | current_palette_id_ = 0 |
| int | selected_color_index_ = -1 |
| ImVec4 | editing_color_ {0, 0, 0, 1} |
| std::function< void(int palette_id)> | on_palette_changed_ |
| int | editing_color_index_ = -1 |
| ImVec4 | temp_color_ = ImVec4(0, 0, 0, 1) |
Definition at line 17 of file palette_editor_widget.h.
|
default |
| void yaze::gui::PaletteEditorWidget::Initialize | ( | zelda3::GameData * | game_data | ) |
Definition at line 19 of file palette_editor_widget.cc.
References current_palette_id_, game_data_, LoadROMPalettes(), rom_, rom_palettes_loaded_, and selected_color_index_.
Referenced by yaze::editor::DungeonEditorV2::Load().

| void yaze::gui::PaletteEditorWidget::Initialize | ( | Rom * | rom | ) |
Definition at line 30 of file palette_editor_widget.cc.
References current_palette_id_, game_data_, rom_, rom_palettes_loaded_, and selected_color_index_.
| void yaze::gui::PaletteEditorWidget::Draw | ( | ) |
Definition at line 40 of file palette_editor_widget.cc.
References current_palette_id_, DrawColorPicker(), DrawPaletteGrid(), DrawPaletteSelector(), yaze::gfx::PaletteGroupMap::dungeon_main, game_data_, yaze::zelda3::GameData::palette_groups, and selected_color_index_.
Referenced by yaze::editor::DungeonPaletteEditorPanel::Draw().

| void yaze::gui::PaletteEditorWidget::ShowPaletteEditor | ( | gfx::SnesPalette & | palette, |
| const std::string & | title = "Palette Editor" ) |
Definition at line 143 of file palette_editor_widget.cc.
References current_group_index_, DrawPaletteAnalysis(), DrawPaletteGrid(), DrawROMPaletteSelector(), RestorePaletteBackup(), rom_, rom_palette_groups_, and SavePaletteBackup().
| void yaze::gui::PaletteEditorWidget::ShowROMPaletteManager | ( | ) |
Definition at line 186 of file palette_editor_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::PaletteEditorWidget::ShowColorAnalysis | ( | const gfx::Bitmap & | bitmap, |
| const std::string & | title = "Color Analysis" ) |
Definition at line 215 of file palette_editor_widget.cc.
References yaze::gui::ThemeManager::Get(), yaze::gfx::Bitmap::height(), yaze::gui::plotting::PlotConfig::id, yaze::gfx::Bitmap::is_active(), show_color_analysis_, yaze::gfx::Bitmap::vector(), and yaze::gfx::Bitmap::width().
| bool yaze::gui::PaletteEditorWidget::ApplyROMPalette | ( | gfx::Bitmap * | bitmap, |
| int | group_index, | ||
| int | palette_index ) |
Definition at line 269 of file palette_editor_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::PaletteEditorWidget::GetSelectedROMPalette | ( | ) | const |
Definition at line 297 of file palette_editor_widget.cc.
References current_group_index_, rom_palette_groups_, and rom_palettes_loaded_.
| void yaze::gui::PaletteEditorWidget::SavePaletteBackup | ( | const gfx::SnesPalette & | palette | ) |
Definition at line 305 of file palette_editor_widget.cc.
References backup_palette_.
Referenced by ApplyROMPalette(), and ShowPaletteEditor().
| bool yaze::gui::PaletteEditorWidget::RestorePaletteBackup | ( | gfx::SnesPalette & | palette | ) |
Definition at line 309 of file palette_editor_widget.cc.
References backup_palette_, and yaze::gfx::SnesPalette::size().
Referenced by ShowPaletteEditor().

|
inline |
Definition at line 40 of file palette_editor_widget.h.
References on_palette_changed_.
Referenced by yaze::editor::DungeonEditorV2::Load().
|
inline |
Definition at line 45 of file palette_editor_widget.h.
References current_palette_id_.
|
inline |
Definition at line 46 of file palette_editor_widget.h.
References current_palette_id_.
Referenced by yaze::editor::DungeonEditorV2::OnRoomSelected(), and yaze::editor::DungeonPaletteEditorPanel::SetCurrentRoomPalette().
|
inline |
Definition at line 48 of file palette_editor_widget.h.
References rom_.
|
inline |
Definition at line 49 of file palette_editor_widget.h.
References current_group_index_.
| void yaze::gui::PaletteEditorWidget::DrawROMPaletteSelector | ( | ) |
Definition at line 388 of file palette_editor_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 318 of file palette_editor_widget.cc.
References editing_color_, editing_color_index_, yaze::gui::MakePopupIdWithInstance(), selected_color_index_, yaze::gfx::SnesPalette::size(), and temp_color_.
Referenced by Draw(), ShowPaletteEditor(), and ShowROMPaletteManager().

|
private |
Definition at line 430 of file palette_editor_widget.cc.
References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesColor::snes().

|
private |
Definition at line 464 of file palette_editor_widget.cc.
References yaze::gui::ThemeManager::Get(), yaze::gui::plotting::PlotConfig::id, yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesPalette::size().
Referenced by ShowPaletteEditor(), and ShowROMPaletteManager().

|
private |
Definition at line 541 of file palette_editor_widget.cc.
References yaze::gfx::PaletteGroupMap::clear(), game_data_, LOG_ERROR, palette_group_names_, yaze::zelda3::GameData::palette_groups, rom_palette_groups_, and rom_palettes_loaded_.
Referenced by DrawROMPaletteSelector(), Initialize(), and ShowROMPaletteManager().

|
private |
Definition at line 70 of file palette_editor_widget.cc.
References current_palette_id_, yaze::gfx::PaletteGroupMap::dungeon_main, game_data_, yaze::zelda3::GameData::palette_groups, selected_color_index_, and yaze::gfx::PaletteGroup::size().
Referenced by Draw().

|
private |
Definition at line 96 of file palette_editor_widget.cc.
References yaze::gui::ConvertSnesColorToImVec4(), current_palette_id_, yaze::gfx::PaletteGroupMap::dungeon_main, editing_color_, game_data_, on_palette_changed_, yaze::zelda3::GameData::palette_groups, selected_color_index_, and yaze::gui::SnesColorEdit4().
Referenced by Draw().

|
private |
Definition at line 62 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawPaletteSelector(), Initialize(), Initialize(), and LoadROMPalettes().
|
private |
Definition at line 63 of file palette_editor_widget.h.
Referenced by Initialize(), Initialize(), IsROMLoaded(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 64 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), LoadROMPalettes(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 65 of file palette_editor_widget.h.
Referenced by DrawROMPaletteSelector(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 66 of file palette_editor_widget.h.
Referenced by RestorePaletteBackup(), and SavePaletteBackup().
|
private |
Definition at line 68 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetCurrentGroupIndex(), GetSelectedROMPalette(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 69 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), and DrawROMPaletteSelector().
|
private |
Definition at line 70 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), Initialize(), Initialize(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 71 of file palette_editor_widget.h.
Referenced by ShowColorAnalysis().
|
private |
Definition at line 72 of file palette_editor_widget.h.
Referenced by ShowROMPaletteManager().
|
private |
Definition at line 75 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawPaletteSelector(), GetCurrentPaletteId(), Initialize(), Initialize(), and SetCurrentPaletteId().
|
private |
Definition at line 76 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawPaletteGrid(), DrawPaletteSelector(), Initialize(), and Initialize().
|
private |
Definition at line 77 of file palette_editor_widget.h.
Referenced by DrawColorPicker(), and DrawPaletteGrid().
|
private |
Definition at line 80 of file palette_editor_widget.h.
Referenced by DrawColorPicker(), and SetOnPaletteChanged().
|
private |
Definition at line 83 of file palette_editor_widget.h.
Referenced by DrawPaletteGrid().
|
private |
Definition at line 84 of file palette_editor_widget.h.
Referenced by DrawPaletteGrid().