yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
bpp_format_ui.cc
Go to the documentation of this file.
1#include "bpp_format_ui.h"
2#include "util/i18n/tr.h"
3
4#include <algorithm>
5#include <sstream>
6
10#include "imgui/imgui.h"
11
12namespace yaze {
13namespace gui {
14
15BppFormatUI::BppFormatUI(const std::string& id)
16 : id_(id),
17 selected_format_(gfx::BppFormat::kBpp8),
18 preview_format_(gfx::BppFormat::kBpp8),
19 show_analysis_(false),
20 show_preview_(false),
21 show_sheet_analysis_(false),
22 format_changed_(false),
23 last_analysis_sheet_("") {}
24
26 gfx::Bitmap* bitmap, const gfx::SnesPalette& palette,
27 std::function<void(gfx::BppFormat)> on_format_changed) {
28 if (!bitmap)
29 return false;
30
31 format_changed_ = false;
32
33 ImGui::BeginGroup();
34 ImGui::Text(tr("BPP Format Selection"));
35 ImGui::Separator();
36
37 // Current format detection
39 bitmap->vector(), bitmap->width(), bitmap->height());
40
41 ImGui::Text(
42 tr("Current Format: %s"),
43 gfx::BppFormatManager::Get().GetFormatInfo(current_format).name.c_str());
44
45 // Format selection
46 ImGui::Text(tr("Target Format:"));
47 ImGui::SameLine();
48
49 const char* format_names[] = {"2BPP", "3BPP", "4BPP", "8BPP"};
50 int current_selection =
51 static_cast<int>(selected_format_) - 2; // Convert to 0-based index
52
53 if (ImGui::Combo("##BppFormat", &current_selection, format_names, 4)) {
54 selected_format_ = static_cast<gfx::BppFormat>(current_selection + 2);
55 format_changed_ = true;
56 }
57
58 // Format information
59 const auto& format_info =
61 ImGui::Text(tr("Max Colors: %d"), format_info.max_colors);
62 ImGui::Text(tr("Bytes per Tile: %d"), format_info.bytes_per_tile);
63 ImGui::Text(tr("Description: %s"), format_info.description.c_str());
64
65 // Conversion efficiency
66 if (current_format != selected_format_) {
67 int efficiency = GetConversionEfficiency(current_format, selected_format_);
68 ImGui::Text(tr("Conversion Efficiency: %d%%"), efficiency);
69
70 ImVec4 efficiency_color;
71 if (efficiency >= 80) {
72 efficiency_color = GetSuccessColor(); // Green
73 } else if (efficiency >= 60) {
74 efficiency_color = GetWarningColor(); // Yellow
75 } else {
76 efficiency_color = GetErrorColor(); // Red
77 }
78 ImGui::TextColored(efficiency_color, tr("Quality: %s"),
79 efficiency >= 80 ? "Excellent"
80 : efficiency >= 60 ? "Good"
81 : "Poor");
82 }
83
84 // Action buttons
85 ImGui::Separator();
86
87 if (ImGui::Button(tr("Convert Format"))) {
88 if (on_format_changed) {
89 on_format_changed(selected_format_);
90 }
91 format_changed_ = true;
92 }
93
94 ImGui::SameLine();
95 if (ImGui::Button(tr("Show Analysis"))) {
97 }
98
99 ImGui::SameLine();
100 if (ImGui::Button(tr("Preview Conversion"))) {
103 }
104
105 ImGui::EndGroup();
106
107 // Analysis panel
108 if (show_analysis_) {
109 RenderAnalysisPanel(*bitmap, palette);
110 }
111
112 // Preview panel
113 if (show_preview_) {
114 RenderConversionPreview(*bitmap, preview_format_, palette);
115 }
116
117 return format_changed_;
118}
119
121 const gfx::SnesPalette& palette) {
122 ImGui::Begin("BPP Format Analysis", &show_analysis_);
123
124 // Basic analysis
126 bitmap.vector(), bitmap.width(), bitmap.height());
127
128 ImGui::Text(
129 tr("Detected Format: %s"),
130 gfx::BppFormatManager::Get().GetFormatInfo(detected_format).name.c_str());
131
132 // Color usage analysis
133 std::vector<int> color_usage(256, 0);
134 for (uint8_t pixel : bitmap.vector()) {
135 color_usage[pixel]++;
136 }
137
138 int used_colors = 0;
139 for (int count : color_usage) {
140 if (count > 0)
141 used_colors++;
142 }
143
144 ImGui::Text(tr("Colors Used: %d / %d"), used_colors,
145 static_cast<int>(palette.size()));
146 ImGui::Text(tr("Color Efficiency: %.1f%%"),
147 (static_cast<float>(used_colors) / palette.size()) * 100.0f);
148
149 // Color usage chart
150 if (ImGui::CollapsingHeader(tr("Color Usage Chart"))) {
151 RenderColorUsageChart(color_usage);
152 }
153
154 // Format recommendations
155 ImGui::Separator();
156 ImGui::Text(tr("Format Recommendations:"));
157
158 if (used_colors <= 4) {
159 ImGui::TextColored(GetSuccessColor(), tr("✓ 2BPP format would be optimal"));
160 } else if (used_colors <= 8) {
161 ImGui::TextColored(GetSuccessColor(), tr("✓ 3BPP format would be optimal"));
162 } else if (used_colors <= 16) {
163 ImGui::TextColored(GetSuccessColor(), tr("✓ 4BPP format would be optimal"));
164 } else {
165 ImGui::TextColored(GetWarningColor(), tr("⚠ 8BPP format is necessary"));
166 }
167
168 // Memory usage comparison
169 if (ImGui::CollapsingHeader(tr("Memory Usage Comparison"))) {
170 const auto& current_info =
171 gfx::BppFormatManager::Get().GetFormatInfo(detected_format);
172 int current_bytes =
173 (bitmap.width() * bitmap.height() * current_info.bits_per_pixel) / 8;
174
175 ImGui::Text(tr("Current Format (%s): %d bytes"), current_info.name.c_str(),
176 current_bytes);
177
178 for (auto format : gfx::BppFormatManager::Get().GetAvailableFormats()) {
179 if (format == detected_format)
180 continue;
181
182 const auto& info = gfx::BppFormatManager::Get().GetFormatInfo(format);
183 int format_bytes =
184 (bitmap.width() * bitmap.height() * info.bits_per_pixel) / 8;
185 float ratio = static_cast<float>(format_bytes) / current_bytes;
186
187 ImGui::Text(tr("%s: %d bytes (%.1fx)"), info.name.c_str(), format_bytes,
188 ratio);
189 }
190 }
191
192 ImGui::End();
193}
194
196 gfx::BppFormat target_format,
197 const gfx::SnesPalette& palette) {
198 ImGui::Begin("BPP Conversion Preview", &show_preview_);
199
201 bitmap.vector(), bitmap.width(), bitmap.height());
202
203 if (current_format == target_format) {
204 ImGui::Text(tr("No conversion needed - formats are identical"));
205 ImGui::End();
206 return;
207 }
208
209 // Convert the bitmap
210 auto converted_data = gfx::BppFormatManager::Get().ConvertFormat(
211 bitmap.vector(), current_format, target_format, bitmap.width(),
212 bitmap.height());
213
214 // Create preview bitmap
215 gfx::Bitmap preview_bitmap(bitmap.width(), bitmap.height(), bitmap.depth(),
216 converted_data, palette);
217
218 // Render side-by-side comparison
219 ImGui::Text(
220 tr("Original (%s) vs Converted (%s)"),
221 gfx::BppFormatManager::Get().GetFormatInfo(current_format).name.c_str(),
222 gfx::BppFormatManager::Get().GetFormatInfo(target_format).name.c_str());
223
224 ImGui::Columns(2, "PreviewColumns");
225
226 // Original
227 ImGui::Text(tr("Original"));
228 if (bitmap.texture()) {
229 ImGui::Image((ImTextureID)(intptr_t)bitmap.texture(),
230 ImVec2(256, 256 * bitmap.height() / bitmap.width()));
231 }
232
233 ImGui::NextColumn();
234
235 // Converted
236 ImGui::Text(tr("Converted"));
237 if (preview_bitmap.texture()) {
238 ImGui::Image(
239 (ImTextureID)(intptr_t)preview_bitmap.texture(),
240 ImVec2(256, 256 * preview_bitmap.height() / preview_bitmap.width()));
241 }
242
243 ImGui::Columns(1);
244
245 // Conversion statistics
246 ImGui::Separator();
247 ImGui::Text(tr("Conversion Statistics:"));
248
249 const auto& from_info =
251 const auto& to_info =
253
254 int from_bytes =
255 (bitmap.width() * bitmap.height() * from_info.bits_per_pixel) / 8;
256 int to_bytes =
257 (bitmap.width() * bitmap.height() * to_info.bits_per_pixel) / 8;
258
259 ImGui::Text(tr("Size: %d bytes -> %d bytes"), from_bytes, to_bytes);
260 ImGui::Text(tr("Compression Ratio: %.2fx"),
261 static_cast<float>(from_bytes) / to_bytes);
262
263 ImGui::End();
264}
265
266void BppFormatUI::RenderSheetAnalysis(const std::vector<uint8_t>& sheet_data,
267 int sheet_id,
268 const gfx::SnesPalette& palette) {
269 std::string analysis_key = "sheet_" + std::to_string(sheet_id);
270
271 // Check if we need to update analysis
272 if (last_analysis_sheet_ != analysis_key) {
274 sheet_data, sheet_id, palette);
275 UpdateAnalysisCache(sheet_id, analysis);
276 last_analysis_sheet_ = analysis_key;
277 }
278
279 auto it = cached_analysis_.find(sheet_id);
280 if (it == cached_analysis_.end())
281 return;
282
283 const auto& analysis = it->second;
284
285 ImGui::Begin("Graphics Sheet Analysis", &show_sheet_analysis_);
286
287 ImGui::Text(tr("Sheet ID: %d"), analysis.sheet_id);
288 ImGui::Text(tr("Original Format: %s"),
290 .GetFormatInfo(analysis.original_format)
291 .name.c_str());
292 ImGui::Text(tr("Current Format: %s"),
294 .GetFormatInfo(analysis.current_format)
295 .name.c_str());
296
297 if (analysis.was_converted) {
298 ImGui::TextColored(GetWarningColor(), tr("⚠ This sheet was converted"));
299 ImGui::Text(tr("Conversion History: %s"),
300 analysis.conversion_history.c_str());
301 } else {
302 ImGui::TextColored(GetSuccessColor(), tr("✓ Original format preserved"));
303 }
304
305 ImGui::Separator();
306 ImGui::Text(tr("Color Usage: %d / %d colors used"),
307 analysis.palette_entries_used, static_cast<int>(palette.size()));
308 ImGui::Text(tr("Compression Ratio: %.2fx"), analysis.compression_ratio);
309 ImGui::Text(tr("Size: %zu -> %zu bytes"), analysis.original_size,
310 analysis.current_size);
311
312 // Tile usage pattern
313 if (ImGui::CollapsingHeader(tr("Tile Usage Pattern"))) {
314 int total_tiles = analysis.tile_usage_pattern.size();
315 int used_tiles = 0;
316 int empty_tiles = 0;
317
318 for (int usage : analysis.tile_usage_pattern) {
319 if (usage > 0) {
320 used_tiles++;
321 } else {
322 empty_tiles++;
323 }
324 }
325
326 ImGui::Text(tr("Total Tiles: %d"), total_tiles);
327 ImGui::Text(tr("Used Tiles: %d (%.1f%%)"), used_tiles,
328 (static_cast<float>(used_tiles) / total_tiles) * 100.0f);
329 ImGui::Text(tr("Empty Tiles: %d (%.1f%%)"), empty_tiles,
330 (static_cast<float>(empty_tiles) / total_tiles) * 100.0f);
331 }
332
333 // Recommendations
334 ImGui::Separator();
335 ImGui::Text(tr("Recommendations:"));
336
337 if (analysis.was_converted && analysis.palette_entries_used <= 16) {
338 ImGui::TextColored(
340 tr("✓ Consider reverting to %s format for better compression"),
342 .GetFormatInfo(analysis.original_format)
343 .name.c_str());
344 }
345
346 if (analysis.palette_entries_used < static_cast<int>(palette.size()) / 2) {
347 ImGui::TextColored(
349 tr("⚠ Palette is underutilized - consider optimization"));
350 }
351
352 ImGui::End();
353}
354
356 gfx::BppFormat to_format) const {
357 // All conversions are available in our implementation
358 return from_format != to_format;
359}
360
362 gfx::BppFormat to_format) const {
363 // Calculate efficiency based on format compatibility
364 if (from_format == to_format)
365 return 100;
366
367 // Higher BPP to lower BPP conversions may lose quality
368 if (static_cast<int>(from_format) > static_cast<int>(to_format)) {
369 int bpp_diff = static_cast<int>(from_format) - static_cast<int>(to_format);
370 return std::max(
371 20, 100 - (bpp_diff * 20)); // Reduce efficiency by 20% per BPP level
372 }
373
374 // Lower BPP to higher BPP conversions are lossless
375 return 100;
376}
377
379 ImGui::Text(tr("Format: %s"), info.name.c_str());
380 ImGui::Text(tr("Bits per Pixel: %d"), info.bits_per_pixel);
381 ImGui::Text(tr("Max Colors: %d"), info.max_colors);
382 ImGui::Text(tr("Bytes per Tile: %d"), info.bytes_per_tile);
383 ImGui::Text(tr("Compressed: %s"), info.is_compressed ? "Yes" : "No");
384 ImGui::Text(tr("Description: %s"), info.description.c_str());
385}
386
387void BppFormatUI::RenderColorUsageChart(const std::vector<int>& color_usage) {
388 // Find maximum usage for scaling
389 int max_usage = *std::max_element(color_usage.begin(), color_usage.end());
390 if (max_usage == 0)
391 return;
392
393 // Render simple bar chart
394 ImGui::Text(tr("Color Usage Distribution:"));
395
396 for (size_t i = 0; i < std::min(color_usage.size(), size_t(16)); ++i) {
397 if (color_usage[i] > 0) {
398 float usage_ratio = static_cast<float>(color_usage[i]) / max_usage;
399 ImGui::Text(tr("Color %zu: %d pixels (%.1f%%)"), i, color_usage[i],
400 (static_cast<float>(color_usage[i]) / (16 * 16)) * 100.0f);
401 ImGui::SameLine();
402 ImGui::ProgressBar(usage_ratio, ImVec2(100, 0));
403 }
404 }
405}
406
407void BppFormatUI::RenderConversionHistory(const std::string& history) {
408 ImGui::Text(tr("Conversion History:"));
409 ImGui::TextWrapped("%s", history.c_str());
410}
411
415
417 switch (format) {
419 return ImVec4(1, 0, 0, 1); // Red
421 return ImVec4(1, 1, 0, 1); // Yellow
423 return ImVec4(0, 1, 0, 1); // Green
425 return ImVec4(0, 0, 1, 1); // Blue
426 default:
427 return ImVec4(1, 1, 1, 1); // White
428 }
429}
430
432 int sheet_id, const gfx::GraphicsSheetAnalysis& analysis) {
433 cached_analysis_[sheet_id] = analysis;
434}
435
436// BppConversionDialog implementation
437
439 : id_(id),
440 is_open_(false),
441 target_format_(gfx::BppFormat::kBpp8),
442 preserve_palette_(true),
443 preview_valid_(false),
444 show_preview_(true),
445 preview_scale_(1.0f) {}
446
448 const gfx::Bitmap& bitmap, const gfx::SnesPalette& palette,
449 std::function<void(gfx::BppFormat, bool)> on_convert) {
450 source_bitmap_ = bitmap;
451 source_palette_ = palette;
452 convert_callback_ = on_convert;
453 is_open_ = true;
454 preview_valid_ = false;
455}
456
458 if (!is_open_)
459 return false;
460
461 ImGui::OpenPopup("BPP Format Conversion");
462
463 if (ImGui::BeginPopupModal("BPP Format Conversion", &is_open_,
464 ImGuiWindowFlags_AlwaysAutoResize)) {
466 ImGui::Separator();
468 ImGui::Separator();
469
470 if (show_preview_) {
472 ImGui::Separator();
473 }
474
476
477 ImGui::EndPopup();
478 }
479
480 return is_open_;
481}
482
484 if (preview_valid_)
485 return;
486
489
490 if (current_format == target_format_) {
492 preview_valid_ = true;
493 return;
494 }
495
496 auto converted_data = gfx::BppFormatManager::Get().ConvertFormat(
497 source_bitmap_.vector(), current_format, target_format_,
499
502 source_bitmap_.depth(), converted_data, source_palette_);
503 preview_valid_ = true;
504}
505
507 ImGui::Text(tr("Convert to BPP Format:"));
508
509 const char* format_names[] = {"2BPP", "3BPP", "4BPP", "8BPP"};
510 int current_selection = static_cast<int>(target_format_) - 2;
511
512 if (ImGui::Combo("##TargetFormat", &current_selection, format_names, 4)) {
513 target_format_ = static_cast<gfx::BppFormat>(current_selection + 2);
514 preview_valid_ = false; // Invalidate preview
515 }
516
517 const auto& format_info =
519 ImGui::Text(tr("Max Colors: %d"), format_info.max_colors);
520 ImGui::Text(tr("Description: %s"), format_info.description.c_str());
521}
522
524 if (ImGui::Button(tr("Update Preview"))) {
525 preview_valid_ = false;
526 }
527
529
531 ImGui::Text(tr("Preview:"));
532 ImGui::Image((ImTextureID)(intptr_t)preview_bitmap_.texture(),
533 ImVec2(128 * preview_scale_, 128 * preview_scale_));
534
535 ImGui::SliderFloat(tr("Scale"), &preview_scale_, 0.5f, 3.0f);
536 }
537}
538
540 ImGui::Checkbox(tr("Preserve Palette"), &preserve_palette_);
541 ImGui::SameLine();
542 ImGui::Checkbox(tr("Show Preview"), &show_preview_);
543}
544
546 if (ImGui::Button(tr("Convert"))) {
547 if (convert_callback_) {
549 }
550 is_open_ = false;
551 }
552
553 ImGui::SameLine();
554 if (ImGui::Button(tr("Cancel"))) {
555 is_open_ = false;
556 }
557}
558
559// BppComparisonTool implementation
560
562 : id_(id),
563 is_open_(false),
564 has_source_(false),
565 comparison_scale_(1.0f),
566 show_metrics_(true),
567 selected_comparison_(gfx::BppFormat::kBpp8) {}
568
570 const gfx::SnesPalette& palette) {
571 source_bitmap_ = bitmap;
572 source_palette_ = palette;
573 has_source_ = true;
575}
576
578 if (!is_open_ || !has_source_)
579 return;
580
581 ImGui::Begin("BPP Format Comparison", &is_open_);
582
584 ImGui::Separator();
586
587 if (show_metrics_) {
588 ImGui::Separator();
590 }
591
592 ImGui::End();
593}
594
598
599 for (auto format : gfx::BppFormatManager::Get().GetAvailableFormats()) {
600 if (format == source_format) {
603 comparison_valid_[format] = true;
604 continue;
605 }
606
607 try {
608 auto converted_data = gfx::BppFormatManager::Get().ConvertFormat(
609 source_bitmap_.vector(), source_format, format,
611
612 comparison_bitmaps_[format] =
614 source_bitmap_.depth(), converted_data, source_palette_);
616 comparison_valid_[format] = true;
617 } catch (...) {
618 comparison_valid_[format] = false;
619 }
620 }
621}
622
624 ImGui::Text(tr("Format Comparison (Scale: %.1fx)"), comparison_scale_);
625 ImGui::SliderFloat("##Scale", &comparison_scale_, 0.5f, 3.0f);
626
627 ImGui::Columns(2, "ComparisonColumns");
628
629 for (auto format : gfx::BppFormatManager::Get().GetAvailableFormats()) {
630 auto it = comparison_bitmaps_.find(format);
631 if (it == comparison_bitmaps_.end() || !comparison_valid_[format])
632 continue;
633
634 const auto& bitmap = it->second;
635 const auto& format_info =
637
638 ImGui::Text("%s", format_info.name.c_str());
639
640 if (bitmap.texture()) {
641 ImGui::Image((ImTextureID)(intptr_t)bitmap.texture(),
642 ImVec2(128 * comparison_scale_, 128 * comparison_scale_));
643 }
644
645 ImGui::NextColumn();
646 }
647
648 ImGui::Columns(1);
649}
650
652 ImGui::Text(tr("Format Metrics:"));
653
654 for (auto format : gfx::BppFormatManager::Get().GetAvailableFormats()) {
655 if (!comparison_valid_[format])
656 continue;
657
658 const auto& format_info =
660 std::string metrics = CalculateMetrics(format);
661
662 ImGui::Text("%s: %s", format_info.name.c_str(), metrics.c_str());
663 }
664}
665
667 ImGui::Text(tr("Selected for Analysis: "));
668 ImGui::SameLine();
669
670 const char* format_names[] = {"2BPP", "3BPP", "4BPP", "8BPP"};
671 int selection = static_cast<int>(selected_comparison_) - 2;
672
673 if (ImGui::Combo("##SelectedFormat", &selection, format_names, 4)) {
674 selected_comparison_ = static_cast<gfx::BppFormat>(selection + 2);
675 }
676
677 ImGui::SameLine();
678 ImGui::Checkbox(tr("Show Metrics"), &show_metrics_);
679}
680
682 const auto& format_info = gfx::BppFormatManager::Get().GetFormatInfo(format);
683 int bytes = (source_bitmap_.width() * source_bitmap_.height() *
684 format_info.bits_per_pixel) /
685 8;
686
687 std::ostringstream metrics;
688 metrics << bytes << " bytes, " << format_info.max_colors << " colors";
689
690 return metrics.str();
691}
692
693} // namespace gui
694} // namespace yaze
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
TextureHandle texture() const
Definition bitmap.h:401
const std::vector< uint8_t > & vector() const
Definition bitmap.h:402
int height() const
Definition bitmap.h:395
int width() const
Definition bitmap.h:394
int depth() const
Definition bitmap.h:396
BppFormat DetectFormat(const std::vector< uint8_t > &data, int width, int height)
Detect BPP format from bitmap data.
std::vector< BppFormat > GetAvailableFormats() const
Get all available BPP formats.
GraphicsSheetAnalysis AnalyzeGraphicsSheet(const std::vector< uint8_t > &sheet_data, int sheet_id, const SnesPalette &palette)
Analyze graphics sheet to determine original and current BPP formats.
std::vector< uint8_t > ConvertFormat(const std::vector< uint8_t > &data, BppFormat from_format, BppFormat to_format, int width, int height)
Convert bitmap data between BPP formats.
static BppFormatManager & Get()
const BppFormatInfo & GetFormatInfo(BppFormat format) const
Get BPP format information.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
gfx::BppFormat selected_comparison_
std::string CalculateMetrics(gfx::BppFormat format) const
std::unordered_map< gfx::BppFormat, gfx::Bitmap > comparison_bitmaps_
gfx::SnesPalette source_palette_
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_
BppComparisonTool(const std::string &id)
Constructor.
std::function< void(gfx::BppFormat, bool)> convert_callback_
BppConversionDialog(const std::string &id)
Constructor.
bool Render()
Render the dialog.
void Show(const gfx::Bitmap &bitmap, const gfx::SnesPalette &palette, std::function< void(gfx::BppFormat, bool)> on_convert)
Show the conversion dialog.
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.
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_
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.
@ kBpp4
4 bits per pixel (16 colors)
@ kBpp3
3 bits per pixel (8 colors)
@ kBpp2
2 bits per pixel (4 colors)
@ kBpp8
8 bits per pixel (256 colors)
ImVec4 GetSuccessColor()
Definition ui_helpers.cc:49
ImVec4 GetErrorColor()
Definition ui_helpers.cc:59
ImVec4 GetWarningColor()
Definition ui_helpers.cc:54
BPP format metadata and conversion information.
Graphics sheet analysis result.