Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Added DrawList.AddRectFilledMultiColor
Browse files Browse the repository at this point in the history
  • Loading branch information
neclepsio committed Oct 22, 2021
1 parent 85798e9 commit 1f320f9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DrawList.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ func (list DrawList) AddRectFilled(min Vec2, max Vec2, col PackedColor) {
list.AddRectFilledV(min, max, col, 1.0, DrawCornerFlagsAll)
}

// AddRectFilledMultiColor adds a multicolor filled rectangle to the draw list.
// min is the upper-left corner of the rectangle, and max is the lower right
// corner. rectangles with dimensions of 1 pixel are not rendered properly.
func (list DrawList) AddRectFilledMultiColor(min Vec2, max Vec2, colUpperLeft, colUpperRight, colBottomRight, colBottomLeft PackedColor) {
minArg, _ := min.wrapped()
maxArg, _ := max.wrapped()
C.iggAddRectFilledMultiColor(list.handle(), minArg, maxArg, C.IggPackedColor(colUpperLeft), C.IggPackedColor(colUpperRight), C.IggPackedColor(colBottomRight), C.IggPackedColor(colBottomLeft))
}

// AddRectFilledV adds a filled rectangle to the draw list. min is the
// upper-left corner of the rectangle, and max is the lower right corner.
// rectangles with dimensions of 1 pixel are not rendered properly.
Expand Down
9 changes: 9 additions & 0 deletions wrapper/DrawList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ void iggAddRectFilled(IggDrawList handle, IggVec2 const *min, IggVec2 const *max
list->AddRectFilled(*minArg, *maxArg, col, rounding, flags);
}

void iggAddRectFilledMultiColor(IggDrawList handle, IggVec2 const *min, IggVec2 const *max, IggPackedColor col_upper_left, IggPackedColor col_upper_right, IggPackedColor col_bottom_right, IggPackedColor col_bottom_left)
{
Vec2Wrapper minArg(min);
Vec2Wrapper maxArg(max);

ImDrawList *list = reinterpret_cast<ImDrawList *>(handle);
list->AddRectFilledMultiColor(*minArg, *maxArg, col_upper_left, col_upper_right, col_bottom_right, col_bottom_left);
}

void iggAddCircle(IggDrawList handle, IggVec2 const *center, float radius, IggPackedColor col, int numSegments, float thickness)
{
Vec2Wrapper centerArg(center);
Expand Down
1 change: 1 addition & 0 deletions wrapper/DrawList.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extern void iggGetVertexBufferLayout(size_t *entrySize, size_t *posOffset, size_
extern void iggAddLine(IggDrawList handle, IggVec2 const *p1, IggVec2 const *p2, IggPackedColor col, float thickness);
extern void iggAddRect(IggDrawList handle, IggVec2 const *min, IggVec2 const *max, IggPackedColor col, float rounding, int flags, float thickness);
extern void iggAddRectFilled(IggDrawList handle, IggVec2 const *min, IggVec2 const *max, IggPackedColor col, float rounding, int flags);
extern void iggAddRectFilledMultiColor(IggDrawList handle, IggVec2 const *min, IggVec2 const *max, IggPackedColor col_upper_left, IggPackedColor col_upper_right, IggPackedColor col_bottom_right, IggPackedColor col_bottom_left);
extern void iggAddCircle(IggDrawList handle, IggVec2 const *center, float radius, IggPackedColor col, int numSegments, float thickness);
extern void iggAddCircleFilled(IggDrawList handle, IggVec2 const *center, float radius, IggPackedColor col, int numSegments);
extern void iggAddTriangle(IggDrawList handle, IggVec2 *p1, IggVec2 *p2, IggVec2 *p3, IggPackedColor col, float thickness);
Expand Down

0 comments on commit 1f320f9

Please sign in to comment.