#include <palette_editor_widget.h>

Public Member Functions | |
| PaletteEditorWidget ()=default | |
| 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 | |
| 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 16 of file palette_editor_widget.h.
|
default |
| void yaze::gui::PaletteEditorWidget::Initialize | ( | Rom * | rom | ) |
Definition at line 16 of file palette_editor_widget.cc.
References current_palette_id_, LoadROMPalettes(), rom_, rom_palettes_loaded_, and selected_color_index_.
Referenced by yaze::editor::DungeonEditorV2::Load().

| void yaze::gui::PaletteEditorWidget::Draw | ( | ) |
Definition at line 27 of file palette_editor_widget.cc.
References current_palette_id_, DrawColorPicker(), DrawPaletteGrid(), DrawPaletteSelector(), yaze::Rom::is_loaded(), yaze::Rom::mutable_palette_group(), rom_, and selected_color_index_.
Referenced by yaze::editor::DungeonEditorV2::DrawLayout().
| void yaze::gui::PaletteEditorWidget::ShowPaletteEditor | ( | gfx::SnesPalette & | palette, |
| const std::string & | title = "Palette Editor" |
||
| ) |
Definition at line 119 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 162 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 191 of file palette_editor_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::PaletteEditorWidget::ApplyROMPalette | ( | gfx::Bitmap * | bitmap, |
| int | group_index, | ||
| int | palette_index | ||
| ) |
Definition at line 247 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 275 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 283 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 287 of file palette_editor_widget.cc.
References backup_palette_, and yaze::gfx::SnesPalette::size().
Referenced by ShowPaletteEditor().

|
inline |
Definition at line 38 of file palette_editor_widget.h.
References on_palette_changed_.
Referenced by yaze::editor::DungeonEditorV2::Load().
|
inline |
Definition at line 43 of file palette_editor_widget.h.
References current_palette_id_.
|
inline |
Definition at line 44 of file palette_editor_widget.h.
References current_palette_id_.
|
inline |
Definition at line 46 of file palette_editor_widget.h.
References rom_.
|
inline |
Definition at line 47 of file palette_editor_widget.h.
References current_group_index_.
| void yaze::gui::PaletteEditorWidget::DrawROMPaletteSelector | ( | ) |
Definition at line 362 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 296 of file palette_editor_widget.cc.
References editing_color_, editing_color_index_, selected_color_index_, yaze::gfx::SnesPalette::size(), and temp_color_.
Referenced by Draw(), ShowPaletteEditor(), and ShowROMPaletteManager().

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

|
private |
Definition at line 437 of file palette_editor_widget.cc.
References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesPalette::size().
Referenced by ShowPaletteEditor(), and ShowROMPaletteManager().

|
private |
Definition at line 489 of file palette_editor_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 57 of file palette_editor_widget.cc.
References current_palette_id_, yaze::Rom::mutable_palette_group(), rom_, and selected_color_index_.
Referenced by Draw().

|
private |
Definition at line 82 of file palette_editor_widget.cc.
References current_palette_id_, editing_color_, yaze::Rom::mutable_palette_group(), on_palette_changed_, rom_, and selected_color_index_.
Referenced by Draw().

|
private |
Definition at line 60 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawPaletteSelector(), Initialize(), IsROMLoaded(), LoadROMPalettes(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 61 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), LoadROMPalettes(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 62 of file palette_editor_widget.h.
Referenced by DrawROMPaletteSelector(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 63 of file palette_editor_widget.h.
Referenced by RestorePaletteBackup(), and SavePaletteBackup().
|
private |
Definition at line 65 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetCurrentGroupIndex(), GetSelectedROMPalette(), ShowPaletteEditor(), and ShowROMPaletteManager().
|
private |
Definition at line 66 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), and DrawROMPaletteSelector().
|
private |
Definition at line 67 of file palette_editor_widget.h.
Referenced by ApplyROMPalette(), DrawROMPaletteSelector(), GetSelectedROMPalette(), Initialize(), LoadROMPalettes(), and ShowROMPaletteManager().
|
private |
Definition at line 68 of file palette_editor_widget.h.
Referenced by ShowColorAnalysis().
|
private |
Definition at line 69 of file palette_editor_widget.h.
Referenced by ShowROMPaletteManager().
|
private |
Definition at line 72 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawPaletteSelector(), GetCurrentPaletteId(), Initialize(), and SetCurrentPaletteId().
|
private |
Definition at line 73 of file palette_editor_widget.h.
Referenced by Draw(), DrawColorPicker(), DrawPaletteGrid(), DrawPaletteSelector(), and Initialize().
|
private |
Definition at line 74 of file palette_editor_widget.h.
Referenced by DrawColorPicker(), and DrawPaletteGrid().
|
private |
Definition at line 77 of file palette_editor_widget.h.
Referenced by DrawColorPicker(), and SetOnPaletteChanged().
|
private |
Definition at line 80 of file palette_editor_widget.h.
Referenced by DrawPaletteGrid().
|
private |
Definition at line 81 of file palette_editor_widget.h.
Referenced by DrawPaletteGrid().