diff --git a/src/gui/canvas.cc b/src/gui/canvas.cc index 1ac36094..c6e52d93 100644 --- a/src/gui/canvas.cc +++ b/src/gui/canvas.cc @@ -78,6 +78,13 @@ void Canvas::DrawBitmap(const Bitmap &bitmap, int border_offset) { canvas_p0_.y + (bitmap.GetHeight() * 2))); } +void Canvas::DrawBitmap(const Bitmap &bitmap, int x_offset, int y_offset) { + draw_list_->AddImage((void *)bitmap.GetTexture(), + ImVec2(canvas_p0_.x + x_offset, canvas_p0_.y + y_offset), + ImVec2(canvas_p0_.x + x_offset + (bitmap.GetWidth()), + canvas_p0_.y + y_offset + (bitmap.GetHeight()))); +} + void Canvas::DrawGrid(float grid_step) { // Draw grid + all lines in the canvas draw_list_->PushClipRect(canvas_p0_, canvas_p1_, true); diff --git a/src/gui/canvas.h b/src/gui/canvas.h index d81de5b5..bb13c72c 100644 --- a/src/gui/canvas.h +++ b/src/gui/canvas.h @@ -22,6 +22,8 @@ class Canvas { void DrawBackground(ImVec2 canvas_size = ImVec2(0, 0)); void DrawContextMenu(); void DrawBitmap(const Bitmap& bitmap, int border_offset = 0); + void DrawBitmap(const Bitmap& bitmap, int x_offset, int y_offset); + // void DrawLargeBitmap(const Bitmap& tl, const Bitmap& tr, const Bitmap& bl, const Bitmap& br); void DrawGrid(float grid_step = 64.0f); void DrawOverlay(); // last