yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
bpp_format_ui.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GUI_BPP_FORMAT_UI_H
2#define YAZE_APP_GUI_BPP_FORMAT_UI_H
3
4#include <functional>
5#include <string>
6#include <vector>
7
11
12namespace yaze {
13namespace gui {
14
22 public:
27 explicit BppFormatUI(const std::string& id);
28
37 gfx::Bitmap* bitmap, const gfx::SnesPalette& palette,
38 std::function<void(gfx::BppFormat)> on_format_changed);
39
45 void RenderAnalysisPanel(const gfx::Bitmap& bitmap,
46 const gfx::SnesPalette& palette);
47
54 void RenderConversionPreview(const gfx::Bitmap& bitmap,
55 gfx::BppFormat target_format,
56 const gfx::SnesPalette& palette);
57
64 void RenderSheetAnalysis(const std::vector<uint8_t>& sheet_data, int sheet_id,
65 const gfx::SnesPalette& palette);
66
72
78
86 gfx::BppFormat to_format) const;
87
95 gfx::BppFormat to_format) const;
96
97 private:
98 std::string id_;
104
105 // Analysis cache
106 std::unordered_map<int, gfx::GraphicsSheetAnalysis> cached_analysis_;
107
108 // UI state
111
112 // Helper methods
113 void RenderFormatInfo(const gfx::BppFormatInfo& info);
114 void RenderColorUsageChart(const std::vector<int>& color_usage);
115 void RenderConversionHistory(const std::string& history);
116 std::string GetFormatDescription(gfx::BppFormat format) const;
117 ImVec4 GetFormatColor(gfx::BppFormat format) const;
118 void UpdateAnalysisCache(int sheet_id,
119 const gfx::GraphicsSheetAnalysis& analysis);
120};
121
126 public:
131 explicit BppConversionDialog(const std::string& id);
132
139 void Show(const gfx::Bitmap& bitmap, const gfx::SnesPalette& palette,
140 std::function<void(gfx::BppFormat, bool)> on_convert);
141
146 bool Render();
147
152 bool IsOpen() const { return is_open_; }
153
157 void Close() { is_open_ = false; }
158
159 private:
160 std::string id_;
166 std::function<void(gfx::BppFormat, bool)> convert_callback_;
167
168 // Preview data
169 std::vector<uint8_t> preview_data_;
172
173 // UI state
176
177 // Helper methods
178 void UpdatePreview();
180 void RenderPreview();
181 void RenderOptions();
182 void RenderButtons();
183};
184
189 public:
194 explicit BppComparisonTool(const std::string& id);
195
201 void SetSource(const gfx::Bitmap& bitmap, const gfx::SnesPalette& palette);
202
206 void Render();
207
212 bool IsOpen() const { return is_open_; }
213
217 void Open() { is_open_ = true; }
218
222 void Close() { is_open_ = false; }
223
224 private:
225 std::string id_;
227
228 // Source data
232
233 // Comparison data
234 std::unordered_map<gfx::BppFormat, gfx::Bitmap> comparison_bitmaps_;
235 std::unordered_map<gfx::BppFormat, gfx::SnesPalette> comparison_palettes_;
236 std::unordered_map<gfx::BppFormat, bool> comparison_valid_;
237
238 // UI state
242
243 // Helper methods
244 void GenerateComparisons();
246 void RenderMetrics();
248 std::string CalculateMetrics(gfx::BppFormat format) const;
249};
250
251} // namespace gui
252} // namespace yaze
253
254#endif // YAZE_APP_GUI_BPP_FORMAT_UI_H
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
BPP format comparison tool.
gfx::BppFormat selected_comparison_
std::string CalculateMetrics(gfx::BppFormat format) const
void Close()
Close the tool.
std::unordered_map< gfx::BppFormat, gfx::Bitmap > comparison_bitmaps_
gfx::SnesPalette source_palette_
bool IsOpen() const
Check if tool is open.
void Render()
Render the comparison tool.
void SetSource(const gfx::Bitmap &bitmap, const gfx::SnesPalette &palette)
Set source bitmap for comparison.
std::unordered_map< gfx::BppFormat, gfx::SnesPalette > comparison_palettes_
std::unordered_map< gfx::BppFormat, bool > comparison_valid_
void Open()
Open the tool.
BppComparisonTool(const std::string &id)
Constructor.
BPP format conversion dialog.
std::function< void(gfx::BppFormat, bool)> convert_callback_
BppConversionDialog(const std::string &id)
Constructor.
bool Render()
Render the dialog.
bool IsOpen() const
Check if dialog is open.
std::vector< uint8_t > preview_data_
void Show(const gfx::Bitmap &bitmap, const gfx::SnesPalette &palette, std::function< void(gfx::BppFormat, bool)> on_convert)
Show the conversion dialog.
void Close()
Close the dialog.
BPP format selection and conversion UI component.
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 SetSelectedFormat(gfx::BppFormat format)
Set the selected BPP format.
int GetConversionEfficiency(gfx::BppFormat from_format, gfx::BppFormat to_format) const
Get conversion efficiency score.
void RenderSheetAnalysis(const std::vector< uint8_t > &sheet_data, int sheet_id, const gfx::SnesPalette &palette)
Render graphics sheet analysis.
BppFormatUI(const std::string &id)
Constructor.
ImVec4 GetFormatColor(gfx::BppFormat format) const
std::string GetFormatDescription(gfx::BppFormat format) const
std::string last_analysis_sheet_
gfx::BppFormat GetSelectedFormat() const
Get currently selected BPP format.
bool IsConversionAvailable(gfx::BppFormat from_format, gfx::BppFormat to_format) const
Check if format conversion is available.
void RenderConversionHistory(const std::string &history)
void RenderFormatInfo(const gfx::BppFormatInfo &info)
void UpdateAnalysisCache(int sheet_id, const gfx::GraphicsSheetAnalysis &analysis)
std::unordered_map< int, gfx::GraphicsSheetAnalysis > cached_analysis_
void RenderConversionPreview(const gfx::Bitmap &bitmap, gfx::BppFormat target_format, const gfx::SnesPalette &palette)
Render conversion preview.
gfx::BppFormat preview_format_
gfx::BppFormat selected_format_
void RenderColorUsageChart(const std::vector< int > &color_usage)
BppFormat
BPP format enumeration for SNES graphics.
BPP format metadata and conversion information.
Graphics sheet analysis result.