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 (Rom *rom, CanvasPaletteManager &palette_manager)
 
bool ApplyPaletteGroup (gfx::IRenderer *renderer, gfx::Bitmap *bitmap, const 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)
 

Detailed Description

Utility functions for canvas operations.

Function Documentation

◆ AlignToGrid()

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

Definition at line 12 of file canvas_utils.cc.

◆ CalculateEffectiveScale()

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

Definition at line 17 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 27 of file canvas_utils.cc.

◆ LoadROMPaletteGroups()

bool yaze::gui::CanvasUtils::LoadROMPaletteGroups ( Rom rom,
CanvasPaletteManager palette_manager 
)

◆ ApplyPaletteGroup()

bool yaze::gui::CanvasUtils::ApplyPaletteGroup ( gfx::IRenderer renderer,
gfx::Bitmap bitmap,
const CanvasPaletteManager palette_manager,
int  group_index,
int  palette_index 
)

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

Referenced by 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 146 of file canvas_utils.cc.

Referenced by 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 170 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 179 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 202 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 217 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 241 of file canvas_utils.cc.

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

◆ CalculateScaledCanvasSize()

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

Definition at line 246 of file canvas_utils.cc.

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

◆ IsPointInCanvas()

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

Definition at line 250 of file canvas_utils.cc.

◆ CalculateMinimumCanvasSize()

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

Definition at line 256 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 283 of file canvas_utils.cc.

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

◆ SetNextCanvasSize()

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

Definition at line 294 of file canvas_utils.cc.

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

◆ DrawCanvasGrid()

◆ DrawCanvasOverlay()

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

◆ DrawCanvasLabels()