yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gui::CanvasUtils Namespace Reference

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 (zelda3::GameData *game_data, 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)
 

Detailed Description

Utility functions for canvas operations.

Function Documentation

◆ AlignToGrid()

ImVec2 yaze::gui::CanvasUtils::AlignToGrid ( ImVec2 pos,
float grid_step )

Definition at line 13 of file canvas_utils.cc.

◆ CalculateEffectiveScale()

float yaze::gui::CanvasUtils::CalculateEffectiveScale ( ImVec2 canvas_size,
ImVec2 content_size,
float global_scale )

Definition at line 18 of file canvas_utils.cc.

◆ GetTileIdFromPosition()

int yaze::gui::CanvasUtils::GetTileIdFromPosition ( ImVec2 mouse_pos,
float tile_size,
float scale,
int tiles_per_row )

Definition at line 28 of file canvas_utils.cc.

◆ LoadROMPaletteGroups()

◆ ApplyPaletteGroup()

◆ DrawCanvasRect()

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 130 of file canvas_utils.cc.

Referenced by yaze::gui::DrawRect(), and yaze::gui::Canvas::DrawRect().

◆ DrawCanvasText()

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 154 of file canvas_utils.cc.

Referenced by yaze::gui::DrawText(), and yaze::gui::Canvas::DrawText().

◆ DrawCanvasOutline()

void yaze::gui::CanvasUtils::DrawCanvasOutline ( ImDrawList * draw_list,
ImVec2 canvas_p0,
ImVec2 scrolling,
int x,
int y,
int w,
int h,
uint32_t color )

◆ DrawCanvasOutlineWithColor()

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 178 of file canvas_utils.cc.

References DrawCanvasOutline().

Referenced by yaze::gui::Canvas::DrawOutlineWithColor().

Here is the call graph for this function:

◆ DrawCanvasGridLines()

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 187 of file canvas_utils.cc.

Referenced by DrawCanvasGrid(), and yaze::gui::Canvas::DrawGridLines().

◆ DrawCustomHighlight()

void yaze::gui::CanvasUtils::DrawCustomHighlight ( ImDrawList * draw_list,
ImVec2 canvas_p0,
ImVec2 scrolling,
int highlight_tile_id,
float grid_step )

Definition at line 210 of file canvas_utils.cc.

Referenced by DrawCanvasGrid(), and yaze::gui::Canvas::DrawCustomHighlight().

◆ DrawHexTileLabels()

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 225 of file canvas_utils.cc.

Referenced by DrawCanvasGrid().

◆ CalculateCanvasSize()

ImVec2 yaze::gui::CanvasUtils::CalculateCanvasSize ( ImVec2 content_region,
ImVec2 custom_size,
bool use_custom )

Definition at line 249 of file canvas_utils.cc.

Referenced by yaze::gui::CalculateCanvasGeometry().

◆ CalculateScaledCanvasSize()

ImVec2 yaze::gui::CanvasUtils::CalculateScaledCanvasSize ( ImVec2 canvas_size,
float global_scale )

Definition at line 254 of file canvas_utils.cc.

Referenced by yaze::gui::CalculateCanvasGeometry().

◆ IsPointInCanvas()

bool yaze::gui::CanvasUtils::IsPointInCanvas ( ImVec2 point,
ImVec2 canvas_p0,
ImVec2 canvas_p1 )

Definition at line 258 of file canvas_utils.cc.

◆ CalculateMinimumCanvasSize()

ImVec2 yaze::gui::CanvasUtils::CalculateMinimumCanvasSize ( ImVec2 content_size,
float global_scale,
float padding )

Definition at line 264 of file canvas_utils.cc.

Referenced by yaze::gui::Canvas::GetMinimumSize().

◆ CalculatePreferredCanvasSize()

ImVec2 yaze::gui::CanvasUtils::CalculatePreferredCanvasSize ( ImVec2 content_size,
float global_scale,
float min_scale )

◆ ReserveCanvasSpace()

void yaze::gui::CanvasUtils::ReserveCanvasSpace ( ImVec2 canvas_size,
const std::string & label )

Definition at line 291 of file canvas_utils.cc.

Referenced by yaze::gui::Canvas::ReserveTableSpace().

◆ SetNextCanvasSize()

void yaze::gui::CanvasUtils::SetNextCanvasSize ( ImVec2 size,
bool auto_resize )

◆ DrawCanvasGrid()

◆ DrawCanvasOverlay()

void yaze::gui::CanvasUtils::DrawCanvasOverlay ( const CanvasRenderContext & ctx,
const ImVector< ImVec2 > & points,
const ImVector< ImVec2 > & selected_points )

◆ DrawCanvasLabels()

◆ ApplyPendingPaletteUpdates()

void yaze::gui::CanvasUtils::ApplyPendingPaletteUpdates ( gfx::IRenderer * renderer,
gfx::Bitmap * bitmap,
CanvasPaletteManager & palette_manager )
inline

Apply pending palette updates (when live_update is disabled)

Definition at line 137 of file canvas_utils.h.

References yaze::gfx::Arena::Get(), yaze::gui::CanvasPaletteManager::palette_dirty, yaze::gfx::Arena::QueueTextureCommand(), and yaze::gfx::Arena::UPDATE.

Here is the call graph for this function: