BPP format selection and conversion UI component. More...
#include <bpp_format_ui.h>
Public Member Functions | |
BppFormatUI (const std::string &id) | |
Constructor. | |
bool | RenderFormatSelector (gfx::Bitmap *bitmap, const gfx::SnesPalette &palette, std::function< void(gfx::BppFormat)> on_format_changed) |
Render the BPP format selection UI. | |
void | RenderAnalysisPanel (const gfx::Bitmap &bitmap, const gfx::SnesPalette &palette) |
Render format analysis panel. | |
void | RenderConversionPreview (const gfx::Bitmap &bitmap, gfx::BppFormat target_format, const gfx::SnesPalette &palette) |
Render conversion preview. | |
void | RenderSheetAnalysis (const std::vector< uint8_t > &sheet_data, int sheet_id, const gfx::SnesPalette &palette) |
Render graphics sheet analysis. | |
gfx::BppFormat | GetSelectedFormat () const |
Get currently selected BPP format. | |
void | SetSelectedFormat (gfx::BppFormat format) |
Set the selected BPP format. | |
bool | IsConversionAvailable (gfx::BppFormat from_format, gfx::BppFormat to_format) const |
Check if format conversion is available. | |
int | GetConversionEfficiency (gfx::BppFormat from_format, gfx::BppFormat to_format) const |
Get conversion efficiency score. | |
Private Member Functions | |
void | RenderFormatInfo (const gfx::BppFormatInfo &info) |
void | RenderColorUsageChart (const std::vector< int > &color_usage) |
void | RenderConversionHistory (const std::string &history) |
std::string | GetFormatDescription (gfx::BppFormat format) const |
ImVec4 | GetFormatColor (gfx::BppFormat format) const |
void | UpdateAnalysisCache (int sheet_id, const gfx::GraphicsSheetAnalysis &analysis) |
Private Attributes | |
std::string | id_ |
gfx::BppFormat | selected_format_ |
gfx::BppFormat | preview_format_ |
bool | show_analysis_ |
bool | show_preview_ |
bool | show_sheet_analysis_ |
std::unordered_map< int, gfx::GraphicsSheetAnalysis > | cached_analysis_ |
bool | format_changed_ |
std::string | last_analysis_sheet_ |
BPP format selection and conversion UI component.
Provides a comprehensive UI for BPP format management in the YAZE ROM hacking editor. Includes format selection, conversion preview, and analysis tools.
Definition at line 21 of file bpp_format_ui.h.
|
explicit |
Constructor.
id | Unique identifier for this UI component |
Definition at line 14 of file bpp_format_ui.cc.
bool yaze::gui::BppFormatUI::RenderFormatSelector | ( | gfx::Bitmap * | bitmap, |
const gfx::SnesPalette & | palette, | ||
std::function< void(gfx::BppFormat)> | on_format_changed | ||
) |
Render the BPP format selection UI.
bitmap | Current bitmap being edited |
palette | Current palette |
on_format_changed | Callback when format is changed |
Definition at line 20 of file bpp_format_ui.cc.
References yaze::gfx::BppFormatManager::DetectFormat(), format_changed_, yaze::gfx::BppFormatManager::Get(), GetConversionEfficiency(), yaze::gui::GetErrorColor(), yaze::gfx::BppFormatManager::GetFormatInfo(), yaze::gui::GetSuccessColor(), yaze::gui::GetWarningColor(), yaze::gfx::Bitmap::height(), preview_format_, RenderAnalysisPanel(), RenderConversionPreview(), selected_format_, show_analysis_, show_preview_, yaze::gfx::Bitmap::vector(), and yaze::gfx::Bitmap::width().
void yaze::gui::BppFormatUI::RenderAnalysisPanel | ( | const gfx::Bitmap & | bitmap, |
const gfx::SnesPalette & | palette | ||
) |
Render format analysis panel.
bitmap | Bitmap to analyze |
palette | Palette to analyze |
Definition at line 109 of file bpp_format_ui.cc.
References yaze::gfx::BppFormatManager::DetectFormat(), yaze::gfx::BppFormatManager::Get(), yaze::gfx::BppFormatManager::GetAvailableFormats(), yaze::gfx::BppFormatManager::GetFormatInfo(), yaze::gui::GetSuccessColor(), yaze::gui::GetWarningColor(), yaze::gfx::Bitmap::height(), RenderColorUsageChart(), show_analysis_, yaze::gfx::SnesPalette::size(), yaze::gfx::Bitmap::vector(), and yaze::gfx::Bitmap::width().
Referenced by RenderFormatSelector().
void yaze::gui::BppFormatUI::RenderConversionPreview | ( | const gfx::Bitmap & | bitmap, |
gfx::BppFormat | target_format, | ||
const gfx::SnesPalette & | palette | ||
) |
Render conversion preview.
bitmap | Source bitmap |
target_format | Target BPP format |
palette | Source palette |
Definition at line 174 of file bpp_format_ui.cc.
References yaze::gfx::BppFormatManager::ConvertFormat(), yaze::gfx::Bitmap::depth(), yaze::gfx::BppFormatManager::DetectFormat(), yaze::gfx::BppFormatManager::Get(), yaze::gfx::BppFormatManager::GetFormatInfo(), yaze::gfx::Bitmap::height(), yaze::gfx::BppFormatInfo::name, show_preview_, yaze::gfx::Bitmap::texture(), yaze::gfx::Bitmap::vector(), and yaze::gfx::Bitmap::width().
Referenced by RenderFormatSelector().
void yaze::gui::BppFormatUI::RenderSheetAnalysis | ( | const std::vector< uint8_t > & | sheet_data, |
int | sheet_id, | ||
const gfx::SnesPalette & | palette | ||
) |
Render graphics sheet analysis.
sheet_data | Graphics sheet data |
sheet_id | Sheet identifier |
palette | Sheet palette |
Definition at line 236 of file bpp_format_ui.cc.
References yaze::gfx::BppFormatManager::AnalyzeGraphicsSheet(), cached_analysis_, yaze::gfx::BppFormatManager::Get(), yaze::gui::GetSuccessColor(), yaze::gui::GetWarningColor(), last_analysis_sheet_, show_sheet_analysis_, yaze::gfx::SnesPalette::size(), and UpdateAnalysisCache().
|
inline |
Get currently selected BPP format.
Definition at line 68 of file bpp_format_ui.h.
References selected_format_.
|
inline |
Set the selected BPP format.
format | BPP format to select |
Definition at line 74 of file bpp_format_ui.h.
References selected_format_.
bool yaze::gui::BppFormatUI::IsConversionAvailable | ( | gfx::BppFormat | from_format, |
gfx::BppFormat | to_format | ||
) | const |
Check if format conversion is available.
from_format | Source format |
to_format | Target format |
Definition at line 312 of file bpp_format_ui.cc.
int yaze::gui::BppFormatUI::GetConversionEfficiency | ( | gfx::BppFormat | from_format, |
gfx::BppFormat | to_format | ||
) | const |
Get conversion efficiency score.
from_format | Source format |
to_format | Target format |
Definition at line 317 of file bpp_format_ui.cc.
Referenced by RenderFormatSelector().
|
private |
|
private |
Definition at line 340 of file bpp_format_ui.cc.
Referenced by RenderAnalysisPanel().
|
private |
Definition at line 359 of file bpp_format_ui.cc.
|
private |
Definition at line 364 of file bpp_format_ui.cc.
References yaze::gfx::BppFormatInfo::description, yaze::gfx::BppFormatManager::Get(), and yaze::gfx::BppFormatManager::GetFormatInfo().
|
private |
Definition at line 368 of file bpp_format_ui.cc.
References yaze::gfx::kBpp2, yaze::gfx::kBpp3, yaze::gfx::kBpp4, and yaze::gfx::kBpp8.
|
private |
Definition at line 378 of file bpp_format_ui.cc.
References cached_analysis_.
Referenced by RenderSheetAnalysis().
|
private |
Definition at line 93 of file bpp_format_ui.h.
|
private |
Definition at line 94 of file bpp_format_ui.h.
Referenced by GetSelectedFormat(), RenderFormatSelector(), and SetSelectedFormat().
|
private |
Definition at line 95 of file bpp_format_ui.h.
Referenced by RenderFormatSelector().
|
private |
Definition at line 96 of file bpp_format_ui.h.
Referenced by RenderAnalysisPanel(), and RenderFormatSelector().
|
private |
Definition at line 97 of file bpp_format_ui.h.
Referenced by RenderConversionPreview(), and RenderFormatSelector().
|
private |
Definition at line 98 of file bpp_format_ui.h.
Referenced by RenderSheetAnalysis().
|
private |
Definition at line 101 of file bpp_format_ui.h.
Referenced by RenderSheetAnalysis(), and UpdateAnalysisCache().
|
private |
Definition at line 104 of file bpp_format_ui.h.
Referenced by RenderFormatSelector().
|
private |
Definition at line 105 of file bpp_format_ui.h.
Referenced by RenderSheetAnalysis().