#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) |
| void | SetDungeonRenderPaletteMode (bool enabled) |
| 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 () |
| float | ComputeSwatchSize (int columns, float min_size, float max_size) const |
| void | DrawPaletteSelector () |
| void | DrawColorPicker () |
| void | DrawDungeonRenderPalette () |
| void | DrawDungeonRenderColorPicker () |
| bool | ResolveDungeonRenderSelection (gfx::SnesPalette **palette, int *color_index, std::string *source_label) |
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) |
| bool | dungeon_render_palette_mode_ = false |
Definition at line 17 of file palette_editor_widget.h.
|
default |
| void yaze::gui::PaletteEditorWidget::Initialize | ( | zelda3::GameData * | game_data | ) |
Definition at line 35 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 46 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 56 of file palette_editor_widget.cc.
References current_palette_id_, DrawColorPicker(), DrawDungeonRenderColorPicker(), DrawDungeonRenderPalette(), DrawPaletteGrid(), DrawPaletteSelector(), yaze::gfx::PaletteGroupMap::dungeon_main, dungeon_render_palette_mode_, game_data_, yaze::zelda3::GameData::palette_groups, and selected_color_index_.
Referenced by yaze::editor::PaletteEditorContent::Draw().
| void yaze::gui::PaletteEditorWidget::ShowPaletteEditor | ( | gfx::SnesPalette & | palette, |
| const std::string & | title = "Palette Editor" ) |
Definition at line 368 of file palette_editor_widget.cc.
References current_group_index_, DrawPaletteAnalysis(), DrawPaletteGrid(), DrawROMPaletteSelector(), yaze::gui::PrimaryButton(), RestorePaletteBackup(), rom_, rom_palette_groups_, SavePaletteBackup(), and yaze::gui::ThemedButton().
| void yaze::gui::PaletteEditorWidget::ShowROMPaletteManager | ( | ) |
Definition at line 411 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 441 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 496 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 524 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 532 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 536 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::PaletteEditorContent::SetCurrentRoomPalette().
|
inline |
Definition at line 47 of file palette_editor_widget.h.
References dungeon_render_palette_mode_.
Referenced by yaze::editor::DungeonEditorV2::Load().
|
inline |
Definition at line 51 of file palette_editor_widget.h.
References rom_.
|
inline |
Definition at line 52 of file palette_editor_widget.h.
References current_group_index_.
| void yaze::gui::PaletteEditorWidget::DrawROMPaletteSelector | ( | ) |
Definition at line 628 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 545 of file palette_editor_widget.cc.
References ComputeSwatchSize(), current_palette_id_, editing_color_, editing_color_index_, yaze::gui::MakePopupIdWithInstance(), on_palette_changed_, yaze::gui::PrimaryButton(), selected_color_index_, yaze::gfx::SnesPalette::size(), temp_color_, and yaze::gui::ThemedButton().
Referenced by Draw(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 663 of file palette_editor_widget.cc.
References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesColor::snes().

|
private |
Definition at line 697 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 774 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 315 of file palette_editor_widget.cc.
Referenced by DrawDungeonRenderPalette(), and DrawPaletteGrid().
|
private |
Definition at line 103 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 137 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_, yaze::gui::SnesColorEdit4(), and yaze::gui::ThemedButton().
Referenced by Draw().

|
private |
Definition at line 233 of file palette_editor_widget.cc.
References ComputeSwatchSize(), current_palette_id_, yaze::gfx::PaletteGroupMap::dungeon_main, editing_color_, editing_color_index_, yaze::gfx::PaletteGroup::empty(), game_data_, yaze::gfx::PaletteGroupMap::hud, yaze::gfx::PaletteGroup::mutable_palette(), yaze::zelda3::GameData::palette_groups, yaze::gfx::SnesColor::rgb(), selected_color_index_, yaze::gfx::SnesPalette::size(), yaze::gfx::PaletteGroup::size(), yaze::gfx::SnesColor::snes(), and temp_color_.
Referenced by Draw().
|
private |
Definition at line 324 of file palette_editor_widget.cc.
References yaze::gui::ConvertSnesColorToImVec4(), current_palette_id_, editing_color_, editing_color_index_, on_palette_changed_, ResolveDungeonRenderSelection(), selected_color_index_, yaze::gfx::SnesPalette::size(), yaze::gui::SnesColorEdit4(), and yaze::gui::ThemedButton().
Referenced by Draw().
|
private |
Definition at line 193 of file palette_editor_widget.cc.
References current_palette_id_, yaze::gfx::PaletteGroupMap::dungeon_main, yaze::gfx::PaletteGroup::empty(), game_data_, yaze::gfx::PaletteGroupMap::hud, yaze::gfx::PaletteGroup::mutable_palette(), yaze::zelda3::GameData::palette_groups, and selected_color_index_.
Referenced by DrawDungeonRenderColorPicker().

|
private |
Definition at line 72 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawDungeonRenderPalette(), DrawPaletteSelector(), Initialize(), Initialize(), LoadROMPalettes(), and ResolveDungeonRenderSelection().
|
private |
Definition at line 73 of file palette_editor_widget.h.
Referenced by Initialize(), Initialize(), IsROMLoaded(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 74 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), LoadROMPalettes(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 75 of file palette_editor_widget.h.
Referenced by DrawROMPaletteSelector(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 76 of file palette_editor_widget.h.
Referenced by RestorePaletteBackup(), and SavePaletteBackup().
|
private |
Definition at line 78 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetCurrentGroupIndex(), GetSelectedROMPalette(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 79 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), and DrawROMPaletteSelector().
|
private |
Definition at line 80 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), Initialize(), Initialize(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 81 of file palette_editor_widget.h.
Referenced by ShowColorAnalysis().
|
private |
Definition at line 82 of file palette_editor_widget.h.
Referenced by ShowROMPaletteManager().
|
private |
Definition at line 85 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawDungeonRenderColorPicker(), DrawDungeonRenderPalette(), DrawPaletteGrid(), DrawPaletteSelector(), GetCurrentPaletteId(), Initialize(), Initialize(), ResolveDungeonRenderSelection(), and SetCurrentPaletteId().
|
private |
Definition at line 86 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawDungeonRenderColorPicker(), DrawDungeonRenderPalette(), DrawPaletteGrid(), DrawPaletteSelector(), Initialize(), Initialize(), and ResolveDungeonRenderSelection().
|
private |
Definition at line 87 of file palette_editor_widget.h.
Referenced by DrawColorPicker(), DrawDungeonRenderColorPicker(), DrawDungeonRenderPalette(), and DrawPaletteGrid().
|
private |
Definition at line 90 of file palette_editor_widget.h.
Referenced by DrawColorPicker(), DrawDungeonRenderColorPicker(), DrawPaletteGrid(), and SetOnPaletteChanged().
|
private |
Definition at line 93 of file palette_editor_widget.h.
Referenced by DrawDungeonRenderColorPicker(), DrawDungeonRenderPalette(), and DrawPaletteGrid().
|
private |
Definition at line 94 of file palette_editor_widget.h.
Referenced by DrawDungeonRenderPalette(), and DrawPaletteGrid().
|
private |
Definition at line 95 of file palette_editor_widget.h.
Referenced by Draw(), and SetDungeonRenderPaletteMode().