Utility functions for canvas operations. More...
Classes | |
| struct | CanvasRenderContext |
Functions | |
| ImVec2 | AlignToGrid (ImVec2 pos, float grid_step) |
| float | CalculateEffectiveScale (ImVec2 canvas_size, ImVec2 content_size, float global_scale) |
| int | GetTileIdFromPosition (ImVec2 mouse_pos, float tile_size, float scale, int tiles_per_row) |
| bool | LoadROMPaletteGroups (Rom *rom, CanvasPaletteManager &palette_manager) |
| bool | ApplyPaletteGroup (gfx::IRenderer *renderer, gfx::Bitmap *bitmap, CanvasPaletteManager &palette_manager, int group_index, int palette_index) |
| void | DrawCanvasRect (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int x, int y, int w, int h, ImVec4 color, float global_scale) |
| void | DrawCanvasText (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, const std::string &text, int x, int y, float global_scale) |
| void | DrawCanvasOutline (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int x, int y, int w, int h, uint32_t color) |
| void | DrawCanvasOutlineWithColor (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int x, int y, int w, int h, ImVec4 color) |
| void | DrawCanvasGridLines (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 canvas_p1, ImVec2 scrolling, float grid_step, float global_scale) |
| void | DrawCustomHighlight (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, int highlight_tile_id, float grid_step) |
| void | DrawHexTileLabels (ImDrawList *draw_list, ImVec2 canvas_p0, ImVec2 scrolling, ImVec2 canvas_sz, float grid_step, float global_scale) |
| ImVec2 | CalculateCanvasSize (ImVec2 content_region, ImVec2 custom_size, bool use_custom) |
| ImVec2 | CalculateScaledCanvasSize (ImVec2 canvas_size, float global_scale) |
| bool | IsPointInCanvas (ImVec2 point, ImVec2 canvas_p0, ImVec2 canvas_p1) |
| ImVec2 | CalculateMinimumCanvasSize (ImVec2 content_size, float global_scale, float padding) |
| ImVec2 | CalculatePreferredCanvasSize (ImVec2 content_size, float global_scale, float min_scale) |
| void | ReserveCanvasSpace (ImVec2 canvas_size, const std::string &label) |
| void | SetNextCanvasSize (ImVec2 size, bool auto_resize) |
| void | DrawCanvasGrid (const CanvasRenderContext &ctx, int highlight_tile_id) |
| void | DrawCanvasOverlay (const CanvasRenderContext &ctx, const ImVector< ImVec2 > &points, const ImVector< ImVec2 > &selected_points) |
| void | DrawCanvasLabels (const CanvasRenderContext &ctx, const ImVector< ImVector< std::string > > &labels, int current_labels, int tile_id_offset) |
| void | ApplyPendingPaletteUpdates (gfx::IRenderer *renderer, gfx::Bitmap *bitmap, CanvasPaletteManager &palette_manager) |
| Apply pending palette updates (when live_update is disabled) | |
Utility functions for canvas operations.
| ImVec2 yaze::gui::CanvasUtils::AlignToGrid | ( | ImVec2 | pos, |
| float | grid_step | ||
| ) |
Definition at line 12 of file canvas_utils.cc.
| float yaze::gui::CanvasUtils::CalculateEffectiveScale | ( | ImVec2 | canvas_size, |
| ImVec2 | content_size, | ||
| float | global_scale | ||
| ) |
Definition at line 17 of file canvas_utils.cc.
| int yaze::gui::CanvasUtils::GetTileIdFromPosition | ( | ImVec2 | mouse_pos, |
| float | tile_size, | ||
| float | scale, | ||
| int | tiles_per_row | ||
| ) |
Definition at line 27 of file canvas_utils.cc.
| bool yaze::gui::CanvasUtils::LoadROMPaletteGroups | ( | Rom * | rom, |
| CanvasPaletteManager & | palette_manager | ||
| ) |
Definition at line 36 of file canvas_utils.cc.
References LOG_DEBUG, LOG_ERROR, yaze::Rom::palette_group(), yaze::gui::CanvasPaletteManager::palette_group_names, yaze::gui::CanvasPaletteManager::palettes_loaded, and yaze::gui::CanvasPaletteManager::rom_palette_groups.

| bool yaze::gui::CanvasUtils::ApplyPaletteGroup | ( | gfx::IRenderer * | renderer, |
| gfx::Bitmap * | bitmap, | ||
| CanvasPaletteManager & | palette_manager, | ||
| int | group_index, | ||
| int | palette_index | ||
| ) |
Definition at line 96 of file canvas_utils.cc.
References yaze::gfx::Arena::Get(), yaze::gui::CanvasPaletteManager::live_update_enabled, yaze::gui::CanvasPaletteManager::palette_dirty, yaze::gfx::Arena::QueueTextureCommand(), yaze::gui::CanvasPaletteManager::rom_palette_groups, yaze::gfx::Bitmap::set_modified(), yaze::gfx::Bitmap::SetPalette(), yaze::gfx::Bitmap::SetPaletteWithTransparent(), and yaze::gfx::Arena::UPDATE.
| void yaze::gui::CanvasUtils::DrawCanvasRect | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | scrolling, | ||
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| ImVec4 | color, | ||
| float | global_scale | ||
| ) |
Definition at line 125 of file canvas_utils.cc.
Referenced by yaze::gui::Canvas::DrawRect().
| void yaze::gui::CanvasUtils::DrawCanvasText | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | scrolling, | ||
| const std::string & | text, | ||
| int | x, | ||
| int | y, | ||
| float | global_scale | ||
| ) |
Definition at line 148 of file canvas_utils.cc.
Referenced by yaze::gui::Canvas::DrawText().
| void yaze::gui::CanvasUtils::DrawCanvasOutline | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | scrolling, | ||
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| uint32_t | color | ||
| ) |
Definition at line 163 of file canvas_utils.cc.
Referenced by DrawCanvasOutlineWithColor(), yaze::gui::Canvas::DrawOutline(), and yaze::gui::Canvas::DrawOutlineWithColor().
| void yaze::gui::CanvasUtils::DrawCanvasOutlineWithColor | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | scrolling, | ||
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h, | ||
| ImVec4 | color | ||
| ) |
Definition at line 172 of file canvas_utils.cc.
References DrawCanvasOutline().
Referenced by yaze::gui::Canvas::DrawOutlineWithColor().

| void yaze::gui::CanvasUtils::DrawCanvasGridLines | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | canvas_p1, | ||
| ImVec2 | scrolling, | ||
| float | grid_step, | ||
| float | global_scale | ||
| ) |
Definition at line 181 of file canvas_utils.cc.
Referenced by DrawCanvasGrid(), and yaze::gui::Canvas::DrawGridLines().
| void yaze::gui::CanvasUtils::DrawCustomHighlight | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | scrolling, | ||
| int | highlight_tile_id, | ||
| float | grid_step | ||
| ) |
Definition at line 204 of file canvas_utils.cc.
Referenced by DrawCanvasGrid(), and yaze::gui::Canvas::DrawCustomHighlight().
| void yaze::gui::CanvasUtils::DrawHexTileLabels | ( | ImDrawList * | draw_list, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | scrolling, | ||
| ImVec2 | canvas_sz, | ||
| float | grid_step, | ||
| float | global_scale | ||
| ) |
Definition at line 219 of file canvas_utils.cc.
Referenced by DrawCanvasGrid().
| ImVec2 yaze::gui::CanvasUtils::CalculateCanvasSize | ( | ImVec2 | content_region, |
| ImVec2 | custom_size, | ||
| bool | use_custom | ||
| ) |
Definition at line 243 of file canvas_utils.cc.
Referenced by yaze::gui::CalculateCanvasGeometry().
| ImVec2 yaze::gui::CanvasUtils::CalculateScaledCanvasSize | ( | ImVec2 | canvas_size, |
| float | global_scale | ||
| ) |
Definition at line 248 of file canvas_utils.cc.
Referenced by yaze::gui::CalculateCanvasGeometry().
| bool yaze::gui::CanvasUtils::IsPointInCanvas | ( | ImVec2 | point, |
| ImVec2 | canvas_p0, | ||
| ImVec2 | canvas_p1 | ||
| ) |
Definition at line 252 of file canvas_utils.cc.
| ImVec2 yaze::gui::CanvasUtils::CalculateMinimumCanvasSize | ( | ImVec2 | content_size, |
| float | global_scale, | ||
| float | padding | ||
| ) |
Definition at line 258 of file canvas_utils.cc.
Referenced by yaze::gui::Canvas::GetMinimumSize().
| ImVec2 yaze::gui::CanvasUtils::CalculatePreferredCanvasSize | ( | ImVec2 | content_size, |
| float | global_scale, | ||
| float | min_scale | ||
| ) |
Definition at line 271 of file canvas_utils.cc.
Referenced by yaze::gui::Canvas::GetPreferredSize(), and yaze::gui::TableCanvasPipeline().
| void yaze::gui::CanvasUtils::ReserveCanvasSpace | ( | ImVec2 | canvas_size, |
| const std::string & | label | ||
| ) |
Definition at line 285 of file canvas_utils.cc.
Referenced by yaze::gui::Canvas::ReserveTableSpace().
| void yaze::gui::CanvasUtils::SetNextCanvasSize | ( | ImVec2 | size, |
| bool | auto_resize | ||
| ) |
Definition at line 296 of file canvas_utils.cc.
Referenced by yaze::gui::Canvas::BeginTableCanvas().
| void yaze::gui::CanvasUtils::DrawCanvasGrid | ( | const CanvasRenderContext & | ctx, |
| int | highlight_tile_id | ||
| ) |
Definition at line 307 of file canvas_utils.cc.
References yaze::gui::CanvasUtils::CanvasRenderContext::canvas_p0, yaze::gui::CanvasUtils::CanvasRenderContext::canvas_p1, yaze::gui::CanvasUtils::CanvasRenderContext::draw_list, DrawCanvasGridLines(), DrawCustomHighlight(), DrawHexTileLabels(), yaze::gui::CanvasUtils::CanvasRenderContext::enable_grid, yaze::gui::CanvasUtils::CanvasRenderContext::enable_hex_labels, yaze::gui::CanvasUtils::CanvasRenderContext::global_scale, yaze::gui::CanvasUtils::CanvasRenderContext::grid_step, and yaze::gui::CanvasUtils::CanvasRenderContext::scrolling.
Referenced by yaze::gui::Canvas::DrawGrid(), and yaze::gui::RenderCanvasGrid().

| void yaze::gui::CanvasUtils::DrawCanvasOverlay | ( | const CanvasRenderContext & | ctx, |
| const ImVector< ImVec2 > & | points, | ||
| const ImVector< ImVec2 > & | selected_points | ||
| ) |
Definition at line 334 of file canvas_utils.cc.
References yaze::gui::CanvasUtils::CanvasRenderContext::canvas_p0, yaze::gui::CanvasUtils::CanvasRenderContext::draw_list, and yaze::gui::CanvasUtils::CanvasRenderContext::scrolling.
Referenced by yaze::gui::Canvas::DrawOverlay(), and yaze::gui::RenderCanvasOverlay().
| void yaze::gui::CanvasUtils::DrawCanvasLabels | ( | const CanvasRenderContext & | ctx, |
| const ImVector< ImVector< std::string > > & | labels, | ||
| int | current_labels, | ||
| int | tile_id_offset | ||
| ) |
Definition at line 360 of file canvas_utils.cc.
References yaze::gui::CanvasUtils::CanvasRenderContext::canvas_p0, yaze::gui::CanvasUtils::CanvasRenderContext::canvas_p1, yaze::gui::CanvasUtils::CanvasRenderContext::draw_list, yaze::gui::CanvasUtils::CanvasRenderContext::global_scale, yaze::gui::CanvasUtils::CanvasRenderContext::grid_step, and yaze::gui::CanvasUtils::CanvasRenderContext::scrolling.
Referenced by yaze::gui::Canvas::DrawGrid(), and yaze::gui::RenderCanvasLabels().
|
inline |
Apply pending palette updates (when live_update is disabled)
Definition at line 127 of file canvas_utils.h.
References yaze::gfx::Arena::Get(), yaze::gui::CanvasPaletteManager::palette_dirty, yaze::gfx::Arena::QueueTextureCommand(), and yaze::gfx::Arena::UPDATE.
