Skip to content

Commit 7fe31c3

Browse files
committed
Add native methods to ImDrawList
- pushClipRect - pushClipRectFullScreen - popClipRect - pushTextureId - popTextureId - getClipRectMin - getClipRectMax
1 parent 73a8b53 commit 7fe31c3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

imgui-binding/src/main/java/imgui/ImDrawList.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public final class ImDrawList {
1616
public static final int TYPE_BACKGROUND = 1;
1717
public static final int TYPE_FOREGROUND = 2;
1818

19+
@SuppressWarnings({"FieldCanBeLocal", "unused"})
1920
private final int drawListType;
2021

2122
ImDrawList(final int drawListType) {
@@ -60,6 +61,48 @@ public final class ImDrawList {
6061
getDrawList(env->GetIntField(object, drawListTypeID))->Flags = imDrawListFlags;
6162
*/
6263

64+
/**
65+
* Render-level scissoring.
66+
* This is passed down to your render function but not used for CPU-side coarse clipping.
67+
* Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
68+
*/
69+
public native void pushClipRect(float clipRectMinX, float clipRectMinY, float clipRectMaxX, float clipRectMaxY); /*
70+
getDrawList(env->GetIntField(object, drawListTypeID))->PushClipRect(ImVec2(clipRectMinX, clipRectMinY), ImVec2(clipRectMaxX, clipRectMaxY));
71+
*/
72+
73+
/**
74+
* Render-level scissoring.
75+
* This is passed down to your render function but not used for CPU-side coarse clipping.
76+
* Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
77+
*/
78+
public native void pushClipRect(float clipRectMinX, float clipRectMinY, float clipRectMaxX, float clipRectMaxY, boolean intersectWithCurrentClipRect); /*
79+
getDrawList(env->GetIntField(object, drawListTypeID))->PushClipRect(ImVec2(clipRectMinX, clipRectMinY), ImVec2(clipRectMaxX, clipRectMaxY), intersectWithCurrentClipRect);
80+
*/
81+
82+
public native void pushClipRectFullScreen(); /*
83+
getDrawList(env->GetIntField(object, drawListTypeID))->PushClipRectFullScreen();
84+
*/
85+
86+
public native void popClipRect(); /*
87+
getDrawList(env->GetIntField(object, drawListTypeID))->PopClipRect();
88+
*/
89+
90+
public native void pushTextureId(int textureId); /*
91+
getDrawList(env->GetIntField(object, drawListTypeID))->PushTextureID((ImTextureID)textureId);
92+
*/
93+
94+
public native void popTextureId(); /*
95+
getDrawList(env->GetIntField(object, drawListTypeID))->PopTextureID();
96+
*/
97+
98+
public native void getClipRectMin(ImVec2 dstImVec2); /*
99+
Jni::ImVec2Cpy(env, getDrawList(env->GetIntField(object, drawListTypeID))->GetClipRectMin(), dstImVec2);
100+
*/
101+
102+
public native void getClipRectMax(ImVec2 dstImVec2); /*
103+
Jni::ImVec2Cpy(env, getDrawList(env->GetIntField(object, drawListTypeID))->GetClipRectMax(), dstImVec2);
104+
*/
105+
63106
// Primitives
64107
// - For rectangular primitives, "pMin" and "pMax" represent the upper-left and lower-right corners.
65108

0 commit comments

Comments
 (0)