add new DrawBitmap overload to Canvas
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user