1#ifndef YAZE_APP_GUI_CANVAS_UTILS_H
2#define YAZE_APP_GUI_CANVAS_UTILS_H
8#include "imgui/imgui.h"
83namespace CanvasUtils {
93 int group_index,
int palette_index);
96void DrawCanvasRect(ImDrawList* draw_list, ImVec2 canvas_p0, ImVec2 scrolling,
97 int x,
int y,
int w,
int h, ImVec4 color,
float global_scale);
98void DrawCanvasText(ImDrawList* draw_list, ImVec2 canvas_p0, ImVec2 scrolling,
99 const std::string& text,
int x,
int y,
float global_scale);
101 int x,
int y,
int w,
int h, uint32_t color = IM_COL32(255, 255, 255, 200));
103 int x,
int y,
int w,
int h, ImVec4 color);
107 ImVec2 scrolling,
float grid_step,
float global_scale);
109 int highlight_tile_id,
float grid_step);
111 ImVec2 canvas_sz,
float grid_step,
float global_scale);
139 const ImVector<ImVec2>& selected_points);
141 int current_labels,
int tile_id_offset);
The Rom class is used to load, save, and modify Rom data.
Represents a bitmap image optimized for SNES ROM hacking.
Defines an abstract interface for all rendering operations.
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
void ReserveCanvasSpace(ImVec2 canvas_size, const std::string &label)
void SetNextCanvasSize(ImVec2 size, bool auto_resize)
void DrawCanvasRect(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int x, int y, int w, int h, ImVec4 color, float global_scale)
void DrawCanvasLabels(const CanvasRenderContext &ctx, const ImVector< ImVector< std::string > > &labels, int current_labels, int tile_id_offset)
bool IsPointInCanvas(ImVec2 point, ImVec2 canvas_p0, ImVec2 canvas_p1)
void DrawCanvasOverlay(const CanvasRenderContext &ctx, const ImVector< ImVec2 > &points, const ImVector< ImVec2 > &selected_points)
ImVec2 CalculateCanvasSize(ImVec2 content_region, ImVec2 custom_size, bool use_custom)
bool LoadROMPaletteGroups(Rom *rom, CanvasPaletteManager &palette_manager)
ImVec2 CalculateMinimumCanvasSize(ImVec2 content_size, float global_scale, float padding)
bool ApplyPaletteGroup(gfx::IRenderer *renderer, gfx::Bitmap *bitmap, const CanvasPaletteManager &palette_manager, int group_index, int palette_index)
float CalculateEffectiveScale(ImVec2 canvas_size, ImVec2 content_size, float global_scale)
void DrawCanvasOutline(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int x, int y, int w, int h, uint32_t color)
int GetTileIdFromPosition(ImVec2 mouse_pos, float tile_size, float scale, int tiles_per_row)
void DrawCanvasOutlineWithColor(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int x, int y, int w, int h, ImVec4 color)
void DrawCanvasGrid(const CanvasRenderContext &ctx, int highlight_tile_id)
ImVec2 CalculatePreferredCanvasSize(ImVec2 content_size, float global_scale, float min_scale)
void DrawCanvasText(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, const std::string &text, int x, int y, float global_scale)
ImVec2 CalculateScaledCanvasSize(ImVec2 canvas_size, float global_scale)
void DrawCustomHighlight(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int highlight_tile_id, float grid_step)
void DrawCanvasGridLines(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 canvas_p1, ImVec2 scrolling, float grid_step, float global_scale)
ImVec2 AlignToGrid(ImVec2 pos, float grid_step)
void DrawHexTileLabels(ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, ImVec2 canvas_sz, float grid_step, float global_scale)
Main namespace for the application.
Configuration for canvas display and interaction.
bool clamp_rect_to_local_maps
bool enable_custom_labels
Palette management state for canvas.
int current_palette_index
std::vector< gfx::SnesPalette > rom_palette_groups
gfx::SnesPalette original_palette
std::vector< std::string > palette_group_names
Selection state for canvas interactions.
std::vector< ImVec2 > selected_tiles
std::vector< ImVec2 > selected_points