feat: introduce binding generator

A squash of hundreds of commits with a binding API generator.

The API generator works with a hybrid model:
1. We define methods and fields in the code.
2. Mark them with API annotations.
3. For specific use cases, we use the old approach with JNI generation comments.

There is also an API to generate an AST tree, which is saved to JSON.
This JSON can be used for full API generation by declaring only field/method names.
Currently, it is used to generate constants.

By eyeballing, 95% of the API has been converted to the new approach.
This is sufficient for the current moment. Only edge cases with specific API calls are left.

fix: ambiguous call for ImGui::GetColorU32

build: disable checkstyle for imgui-binding module

Since the module is heavily generated, checkstyle for it doesn't make sense.

build: make buildSrc to use JDK 11

build: make generateApi optional when compiling project

Initially generated module was not included to the project VCS.
Since it's now in the separate src folder, we don't need to call generator every time.
Only when a new generation result is required.
This commit is contained in:
SpaiR committed 2024-08-08 14:46:23 +03:00
1 parent e64df5a433
commit 8a8cd22ed6
323 files changed
+113518 -15318

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -1,119 +1,93 @@
package imgui.extension.implot;
import imgui.ImVec2;
import imgui.binding.ImGuiStructDestroyable;
public final class ImPlotLimits extends ImGuiStructDestroyable {
public ImPlotLimits(final long ptr) {
super(ptr);
}
import java.util.Objects;
public final class ImPlotLimits implements Cloneable {
public final ImPlotRange x = new ImPlotRange();
public final ImPlotRange y = new ImPlotRange();
public ImPlotLimits() {
this(0, 0, 0, 0);
}
public ImPlotLimits(final double xMin, final double xMax, final double yMin, final double yMax) {
this(0);
ptr = create(xMin, xMax, yMin, yMax);
public ImPlotLimits(final double xMin, final double yMin, final double xMax, final double yMax) {
set(xMin, yMin, xMax, yMax);
}
/*JNI
#include "_common.h"
#include "_implot.h"
public ImPlotLimits(final ImVec2 min, final ImVec2 max) {
set(min, max);
}
#define IMPLOT_LIMITS ((ImPlotLimits*)STRUCT_PTR)
*/
public ImPlotLimits(final ImPlotLimits value) {
set(value);
}
public boolean contains(final double x, final double y) {
return this.x.contains(x) && this.y.contains(y);
}
public boolean contains(final ImPlotPoint value) {
return contains(value.x, value.y);
}
public ImPlotPoint min() {
return new ImPlotPoint(x.min, y.min);
}
public ImPlotPoint max() {
return new ImPlotPoint(x.max, y.max);
}
public void set(final double xMin, final double yMin, final double xMax, final double yMax) {
this.x.min = xMin;
this.x.max = xMax;
this.y.min = yMin;
this.y.max = yMax;
}
public void set(final ImVec2 min, final ImVec2 max) {
set(min.x, min.y, max.x, max.y);
}
public void set(final ImPlotRange x, final ImPlotRange y) {
set(x.min, y.min, x.max, y.max);
}
public void set(final ImPlotLimits value) {
set(value.x, value.y);
}
@Override
protected native long create(); /*
return (intptr_t)(new ImPlotLimits(0, 0, 0, 0));
*/
protected native long create(double xMin, double xMax, double yMin, double yMax); /*
return (intptr_t)(new ImPlotLimits(xMin, xMax, yMin, yMax));
*/
public boolean contains(final ImPlotPoint plotPoint) {
return contains(plotPoint.getX(), plotPoint.getY());
public String toString() {
return "ImPlotLimits{"
+ "x=" + x
+ ", y=" + y
+ '}';
}
public native boolean contains(double x, double y); /*
return IMPLOT_LIMITS->Contains(x, y);
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
/**
* Returns the same as min(), but instead as an ImVec2.
*/
public ImVec2 minVec() {
final ImPlotPoint val = min();
final ImVec2 vec = new ImVec2((float) val.getX(), (float) val.getY());
val.destroy();
return vec;
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImPlotLimits imPlotLimits = (ImPlotLimits) o;
return Objects.equals(x, imPlotLimits.x) && Objects.equals(y, imPlotLimits.y);
}
/**
* The returned ImPlotPoint should be manually deallocated with destroy()!
*/
public ImPlotPoint min() {
return new ImPlotPoint(nMin());
@Override
public int hashCode() {
return Objects.hash(x, y);
}
private native long nMin(); /*
ImPlotPoint* p = new ImPlotPoint(IMPLOT_LIMITS->Min());
return (intptr_t)p;
*/
/**
* The returned ImPlotPoint should be manually deallocated with destroy()!
*/
public ImPlotPoint max() {
return new ImPlotPoint(nMax());
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotLimits clone() {
return new ImPlotLimits(this);
}
/**
* Returns the same as max(), but instead as an ImVec2.
*/
public ImVec2 maxVec() {
final ImPlotPoint val = max();
final ImVec2 vec = new ImVec2((float) val.getX(), (float) val.getY());
val.destroy();
return vec;
}
private native long nMax(); /*
ImPlotPoint* p = new ImPlotPoint(IMPLOT_LIMITS->Max());
return (intptr_t)p;
*/
public ImPlotRange getX() {
return new ImPlotRange(nGetX(this.ptr));
}
private native long nGetX(long ptr); /*
return (intptr_t)&(IMPLOT_LIMITS->X);
*/
public ImPlotRange getY() {
return new ImPlotRange(nGetY(this.ptr));
}
private native long nGetY(long ptr); /*
return (intptr_t)&(IMPLOT_LIMITS->Y);
*/
public void setX(final ImPlotRange value) {
nSetX(value.ptr);
}
private native void nSetX(long valueptr); /*
IMPLOT_LIMITS->X = *((ImPlotRange*)valueptr);
*/
public void setY(final ImPlotRange value) {
nSetY(value.ptr);
}
private native void nSetY(long valueptr); /*
IMPLOT_LIMITS->Y = *((ImPlotRange*)valueptr);
*/
}
@@ -1,55 +1,100 @@
package imgui.extension.implot;
import imgui.ImVec2;
import imgui.binding.ImGuiStructDestroyable;
public final class ImPlotPoint extends ImGuiStructDestroyable {
public ImPlotPoint(final long ptr) {
super(ptr);
}
import java.util.Objects;
public final class ImPlotPoint implements Cloneable {
public double x;
public double y;
public ImPlotPoint() {
this(0, 0);
}
public ImPlotPoint(final ImVec2 vec) {
this(vec.x, vec.y);
}
public ImPlotPoint(final double x, final double y) {
this(0);
ptr = create(x, y);
set(x, y);
}
/*JNI
#include "_common.h"
#include "_implot.h"
public ImPlotPoint(final ImVec2 value) {
set(value.x, value.y);
}
#define IMPLOT_POINT ((ImPlotPoint*)STRUCT_PTR)
*/
public ImPlotPoint(final ImPlotPoint value) {
set(value.x, value.y);
}
public ImPlotPoint set(final double x, final double y) {
this.x = x;
this.y = y;
return this;
}
public ImPlotPoint set(final ImPlotPoint value) {
return set(value.x, value.y);
}
public ImPlotPoint set(final ImVec2 value) {
return set(value.x, value.y);
}
public ImPlotPoint plus(final double x, final double y) {
this.x += x;
this.y += y;
return this;
}
public ImPlotPoint plus(final ImPlotPoint value) {
return plus(value.x, value.y);
}
public ImPlotPoint minus(final double x, final double y) {
this.x -= x;
this.y -= y;
return this;
}
public ImPlotPoint minus(final ImPlotPoint value) {
return minus(value.x, value.y);
}
public ImPlotPoint times(final double x, final double y) {
this.x *= x;
this.y *= y;
return this;
}
public ImPlotPoint times(final ImPlotPoint value) {
return times(value.x, value.y);
}
@Override
protected native long create(); /*
return (intptr_t)(new ImPlotPoint(0, 0));
*/
public String toString() {
return "ImPlotPoint{"
+ "x=" + x
+ ", y=" + y
+ '}';
}
protected native long create(double x, double y); /*
return (intptr_t)(new ImPlotPoint(x, y));
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImPlotPoint imPlotPoint = (ImPlotPoint) o;
return Double.compare(imPlotPoint.x, x) == 0 && Double.compare(imPlotPoint.y, y) == 0;
}
public native double getX(); /*
return IMPLOT_POINT->x;
*/
@Override
public int hashCode() {
return Objects.hash(x, y);
}
public native double getY(); /*
return IMPLOT_POINT->y;
*/
public native void setX(double value); /*
IMPLOT_POINT->x = value;
*/
public native void setY(double value); /*
IMPLOT_POINT->y = value;
*/
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotPoint clone() {
return new ImPlotPoint(this);
}
}
@@ -1,58 +1,98 @@
package imgui.extension.implot;
import imgui.binding.ImGuiStructDestroyable;
import java.util.Objects;
public final class ImPlotRange extends ImGuiStructDestroyable {
public ImPlotRange(final long ptr) {
super(ptr);
}
public final class ImPlotRange implements Cloneable {
public double min;
public double max;
public ImPlotRange() {
this(0, 0);
}
public ImPlotRange(final double min, final double max) {
this(0);
ptr = create(min, max);
set(min, max);
}
/*JNI
#include "_common.h"
#include "_implot.h"
public ImPlotRange(final ImPlotRange value) {
set(value.min, value.max);
}
#define IMPLOT_RANGE ((ImPlotRange*)STRUCT_PTR)
*/
public boolean contains(final double value) {
return value >= min && value <= max;
}
public double size() {
return max - min;
}
public ImPlotRange set(final double min, final double max) {
this.min = min;
this.max = max;
return this;
}
public ImPlotRange set(final ImPlotRange value) {
return set(value.min, value.max);
}
public ImPlotRange plus(final double min, final double max) {
this.min += min;
this.max += max;
return this;
}
public ImPlotRange plus(final ImPlotRange value) {
return plus(value.min, value.max);
}
public ImPlotRange minus(final double min, final double max) {
this.min -= min;
this.max -= max;
return this;
}
public ImPlotRange minus(final ImPlotRange value) {
return minus(value.min, value.max);
}
public ImPlotRange times(final double min, final double max) {
this.min *= min;
this.max *= max;
return this;
}
public ImPlotRange times(final ImPlotRange value) {
return times(value.min, value.max);
}
@Override
protected native long create(); /*
return (intptr_t)(new ImPlotRange(0, 0));
*/
public String toString() {
return "ImPlotRange{"
+ "min=" + min
+ ", max=" + max
+ '}';
}
protected native long create(double min, double max); /*
return (intptr_t)(new ImPlotRange(min, max));
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImPlotRange ImPlotRange = (ImPlotRange) o;
return Double.compare(ImPlotRange.min, min) == 0 && Double.compare(ImPlotRange.max, max) == 0;
}
public native boolean contains(double value); /*
return IMPLOT_RANGE->Contains(value);
*/
@Override
public int hashCode() {
return Objects.hash(min, max);
}
public native double size(); /*
return IMPLOT_RANGE->Size();
*/
public native double getMin(); /*
return IMPLOT_RANGE->Min;
*/
public native double getMax(); /*
return IMPLOT_RANGE->Max;
*/
public native void setMin(double min); /*
IMPLOT_RANGE->Min = min;
*/
public native void nSetMax(double max); /*
IMPLOT_RANGE->Max = max;
*/
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImPlotRange clone() {
return new ImPlotRange(this);
}
}
@@ -2,524 +2,135 @@ package imgui.extension.implot;
import imgui.ImVec2;
import imgui.ImVec4;
import imgui.binding.ImGuiStruct;
import imgui.extension.implot.flag.ImPlotCol;
import imgui.binding.ImGuiStructDestroyable;
import imgui.binding.annotation.BindingField;
import imgui.binding.annotation.BindingSource;
import imgui.binding.annotation.TypeArray;
@BindingSource
public final class ImPlotStyle extends ImGuiStructDestroyable {
public ImPlotStyle() {
}
public final class ImPlotStyle extends ImGuiStruct {
public ImPlotStyle(final long ptr) {
super(ptr);
}
@Override
protected long create() {
return nCreate();
}
/*JNI
#include "_common.h"
#include "_implot.h"
#define IMPLOT_STYLE ((ImPlotStyle*)STRUCT_PTR)
#define THIS ((ImPlotStyle*)STRUCT_PTR)
*/
//Line weight
public native float getLineWeight(); /*
return IMPLOT_STYLE->LineWeight;
private native long nCreate(); /*
return (intptr_t)(new ImPlotStyle());
*/
public native void setLineWeight(float lineWeight); /*
IMPLOT_STYLE->LineWeight = lineWeight;
*/
//Marker
public native int getMarker(); /*
return IMPLOT_STYLE->Marker;
*/
public native void setMarker(float input); /*
IMPLOT_STYLE->Marker = input;
*/
//Marker size
public native float getMarkerSize(); /*
return IMPLOT_STYLE->MarkerSize;
*/
public native void setMarkerSize(float input); /*
IMPLOT_STYLE->MarkerSize = input;
*/
//Marker weight
public native float getMarkerWeight(); /*
return IMPLOT_STYLE->MarkerWeight;
*/
public native void setMarkerWeight(float input); /*
IMPLOT_STYLE->MarkerWeight = input;
*/
//Fill alpha
public native float getFillAlpha(); /*
return IMPLOT_STYLE->FillAlpha;
*/
public native void setFillAlpha(float input); /*
IMPLOT_STYLE->FillAlpha = input;
*/
//Error bar size
public native float getErrorBarSize(); /*
return IMPLOT_STYLE->ErrorBarSize;
*/
public native void setErrorBarSize(float input); /*
IMPLOT_STYLE->ErrorBarSize = input;
*/
//Error bar weight
public native float getErrorBarWeight(); /*
return IMPLOT_STYLE->ErrorBarWeight;
*/
public native void setErrorBarWeight(float input); /*
IMPLOT_STYLE->ErrorBarWeight = input;
*/
//Digital big height
public native float getDigitalBitHeight(); /*
return IMPLOT_STYLE->DigitalBitHeight;
*/
public native void setDigitalBitHeight(float input); /*
IMPLOT_STYLE->DigitalBitHeight = input;
*/
//Digital bit gap
public native float getDigitalBitGap(); /*
return IMPLOT_STYLE->DigitalBitGap;
*/
public native void setDigitalBitGap(float input); /*
IMPLOT_STYLE->DigitalBitGap = input;
*/
//Plot border size
public native float getPlotBorderSize(); /*
return IMPLOT_STYLE->PlotBorderSize;
*/
public native void setPlotBorderSize(float input); /*
IMPLOT_STYLE->PlotBorderSize = input;
*/
//Minor alpha
public native float getMinorAlpha(); /*
return IMPLOT_STYLE->MinorAlpha;
*/
public native void setMinorAlpha(float input); /*
IMPLOT_STYLE->MinorAlpha = input;
*/
//Major tick length
public ImVec2 getMajorTickLen() {
final ImVec2 vec = new ImVec2();
nGetMajorTickLen(vec);
return vec;
}
private native void nGetMajorTickLen(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MajorTickLen, vec);
*/
public void setMajorTickLen(final ImVec2 majorTickLen) {
nSetMajorTickLen(majorTickLen.x, majorTickLen.y);
}
private native void nSetMajorTickLen(float x, float y); /*
IMPLOT_STYLE->MajorTickLen = ImVec2(x, y);
*/
//Minor tick length
public ImVec2 getMinorTickLen() {
final ImVec2 vec = new ImVec2();
nGetMinorTickLen(vec);
return vec;
}
private native void nGetMinorTickLen(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MinorTickLen, vec);
*/
public void setMinorTickLen(final ImVec2 minorTickLen) {
nSetMinorTickLen(minorTickLen.x, minorTickLen.y);
}
private native void nSetMinorTickLen(float x, float y); /*
IMPLOT_STYLE->MinorTickLen = ImVec2(x, y);
*/
//Major tick size
public ImVec2 getMajorTickSize() {
final ImVec2 vec = new ImVec2();
nGetMajorTickSize(vec);
return vec;
}
private native void nGetMajorTickSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MajorTickSize, vec);
*/
public void setMajorTickSize(final ImVec2 majorTickSize) {
nSetMajorTickSize(majorTickSize.x, majorTickSize.y);
}
private native void nSetMajorTickSize(float x, float y); /*
IMPLOT_STYLE->MajorTickSize = ImVec2(x, y);
*/
//Minor tick size
public ImVec2 getMinorTickSize() {
final ImVec2 vec = new ImVec2();
nGetMinorTickSize(vec);
return vec;
}
private native void nGetMinorTickSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MinorTickSize, vec);
*/
public void setMinorTickSize(final ImVec2 minorTickSize) {
nSetMinorTickSize(minorTickSize.x, minorTickSize.y);
}
private native void nSetMinorTickSize(float x, float y); /*
IMPLOT_STYLE->MinorTickSize = ImVec2(x, y);
*/
//Major grid size
public ImVec2 getMajorGridSize() {
final ImVec2 vec = new ImVec2();
nGetMajorGridSize(vec);
return vec;
}
private native void nGetMajorGridSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MajorGridSize, vec);
*/
public void setMajorGridSize(final ImVec2 majorGridSize) {
nSetMajorGridSize(majorGridSize.x, majorGridSize.y);
}
private native void nSetMajorGridSize(float x, float y); /*
IMPLOT_STYLE->MajorGridSize = ImVec2(x, y);
*/
//Minor grid size
public ImVec2 getMinorGridSize() {
final ImVec2 vec = new ImVec2();
nGetMinorGridSize(vec);
return vec;
}
private native void nGetMinorGridSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MinorGridSize, vec);
*/
public void setMinorGridSize(final ImVec2 minorGridSize) {
nSetMinorGridSize(minorGridSize.x, minorGridSize.y);
}
private native void nSetMinorGridSize(float x, float y); /*
IMPLOT_STYLE->MinorGridSize = ImVec2(x, y);
*/
//Plot padding
public ImVec2 getPlotPadding() {
final ImVec2 vec = new ImVec2();
nGetPlotPadding(vec);
return vec;
}
private native void nGetPlotPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->PlotPadding, vec);
*/
public void setPlotPadding(final ImVec2 plotPadding) {
nSetPlotPadding(plotPadding.x, plotPadding.y);
}
private native void nSetPlotPadding(float x, float y); /*
IMPLOT_STYLE->PlotPadding = ImVec2(x, y);
*/
//Label padding
public ImVec2 getLabelPadding() {
final ImVec2 vec = new ImVec2();
nGetLabelPadding(vec);
return vec;
}
private native void nGetLabelPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LabelPadding, vec);
*/
public void setLabelPadding(final ImVec2 labelPadding) {
nSetLabelPadding(labelPadding.x, labelPadding.y);
}
private native void nSetLabelPadding(float x, float y); /*
IMPLOT_STYLE->LabelPadding = ImVec2(x, y);
*/
//Legend padding
public ImVec2 getLegendPadding() {
final ImVec2 vec = new ImVec2();
nGetLegendPadding(vec);
return vec;
}
private native void nGetLegendPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LegendPadding, vec);
*/
public void setLegendPadding(final ImVec2 legendPadding) {
nSetLegendPadding(legendPadding.x, legendPadding.y);
}
private native void nSetLegendPadding(float x, float y); /*
IMPLOT_STYLE->LegendPadding = ImVec2(x, y);
*/
//Legend inner padding
public ImVec2 getLegendInnerPadding() {
final ImVec2 vec = new ImVec2();
nGetLegendInnerPadding(vec);
return vec;
}
private native void nGetLegendInnerPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LegendInnerPadding, vec);
*/
public void setLegendInnerPadding(final ImVec2 legendInnerPadding) {
nSetLegendInnerPadding(legendInnerPadding.x, legendInnerPadding.y);
}
private native void nSetLegendInnerPadding(float x, float y); /*
IMPLOT_STYLE->LegendInnerPadding = ImVec2(x, y);
*/
//Legend spacing
public ImVec2 getLegendSpacing() {
final ImVec2 vec = new ImVec2();
nGetLegendSpacing(vec);
return vec;
}
private native void nGetLegendSpacing(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->LegendSpacing, vec);
*/
public void setLegendSpacing(final ImVec2 legendSpacing) {
nSetLegendSpacing(legendSpacing.x, legendSpacing.y);
}
private native void nSetLegendSpacing(float x, float y); /*
IMPLOT_STYLE->LegendSpacing = ImVec2(x, y);
*/
//Mouse position padding
public ImVec2 getMousePosPadding() {
final ImVec2 vec = new ImVec2();
nGetMousePosPadding(vec);
return vec;
}
private native void nGetMousePosPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->MousePosPadding, vec);
*/
public void setMousePosPadding(final ImVec2 mousePosPadding) {
nSetMousePosPadding(mousePosPadding.x, mousePosPadding.y);
}
private native void nSetMousePosPadding(float x, float y); /*
IMPLOT_STYLE->MousePosPadding = ImVec2(x, y);
*/
//Annotation padding
public ImVec2 getAnnotationPadding() {
final ImVec2 vec = new ImVec2();
nGetAnnotationPadding(vec);
return vec;
}
private native void nGetAnnotationPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->AnnotationPadding, vec);
*/
public void setAnnotationPadding(final ImVec2 annotationPadding) {
nSetAnnotationPadding(annotationPadding.x, annotationPadding.y);
}
private native void nSetAnnotationPadding(float x, float y); /*
IMPLOT_STYLE->AnnotationPadding = ImVec2(x, y);
*/
//Fit padding
public ImVec2 getFitPadding() {
final ImVec2 vec = new ImVec2();
nGetFitPadding(vec);
return vec;
}
private native void nGetFitPadding(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->FitPadding, vec);
*/
public void setFitPadding(final ImVec2 fitPadding) {
nSetFitPadding(fitPadding.x, fitPadding.y);
}
private native void nSetFitPadding(float x, float y); /*
IMPLOT_STYLE->FitPadding = ImVec2(x, y);
*/
//Plot default size
public ImVec2 getPlotDefaultSize() {
final ImVec2 vec = new ImVec2();
nGetPlotDefaultSize(vec);
return vec;
}
private native void nGetPlotDefaultSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->PlotDefaultSize, vec);
*/
public void setPlotDefaultSize(final ImVec2 plotDefaultSize) {
nSetPlotDefaultSize(plotDefaultSize.x, plotDefaultSize.y);
}
private native void nSetPlotDefaultSize(float x, float y); /*
IMPLOT_STYLE->PlotDefaultSize = ImVec2(x, y);
*/
//Plot minimum size
public ImVec2 getPlotMinSize() {
final ImVec2 vec = new ImVec2();
nGetPlotMinSize(vec);
return vec;
}
private native void nGetPlotMinSize(ImVec2 vec); /*
Jni::ImVec2Cpy(env, IMPLOT_STYLE->PlotMinSize, vec);
*/
public void setPlotMinSize(final ImVec2 plotMinSize) {
nSetPlotMinSize(plotMinSize.x, plotMinSize.y);
}
private native void nSetPlotMinSize(float x, float y); /*
IMPLOT_STYLE->PlotMinSize = ImVec2(x, y);
*/
//Colors
public ImVec4[] getColors() {
final float[] w = new float[ImPlotCol.COUNT];
final float[] x = new float[ImPlotCol.COUNT];
final float[] y = new float[ImPlotCol.COUNT];
final float[] z = new float[ImPlotCol.COUNT];
nGetColors(w, x, y, z, ImPlotCol.COUNT);
final ImVec4[] colors = new ImVec4[ImPlotCol.COUNT];
for (int i = 0; i < ImPlotCol.COUNT; i++) {
colors[i] = new ImVec4(w[i], x[i], y[i], z[i]);
}
return colors;
}
private native void nGetColors(float[] w, float[] x, float[] y, float[] z, int count); /*
ImVec4* colors = IMPLOT_STYLE->Colors;
for (int i = 0; i < count; i++) {
w[i] = colors->w;
x[i] = colors->x;
y[i] = colors->y;
z[i] = colors->z;
colors++;
}
*/
public void setColors(final ImVec4[] colors) {
final float[] w = new float[ImPlotCol.COUNT];
final float[] x = new float[ImPlotCol.COUNT];
final float[] y = new float[ImPlotCol.COUNT];
final float[] z = new float[ImPlotCol.COUNT];
for (int i = 0; i < ImPlotCol.COUNT; i++) {
w[i] = colors[i].w;
x[i] = colors[i].x;
y[i] = colors[i].y;
z[i] = colors[i].z;
}
nSetColors(w, x, y, z, ImPlotCol.COUNT);
}
private native void nSetColors(float[] w, float[] x, float[] y, float[] z, int count); /*
ImVec4* colors = IMPLOT_STYLE->Colors;
for (int i = 0; i < count; i++) {
colors->w = w[i];
colors->x = x[i];
colors->y = y[i];
colors->z = z[i];
colors++;
}
*/
//Colormap
public native int getColormap(); /*
return IMPLOT_STYLE->Colormap;
*/
public native void setColormap(int input); /*
IMPLOT_STYLE->Colormap = input;
*/
//Antialiasing
public native boolean isAntiAliasedLines(); /*
return IMPLOT_STYLE->AntiAliasedLines;
*/
public native void setAntiAliasedLines(boolean input); /*
IMPLOT_STYLE->AntiAliasedLines = input;
*/
//Local time
public native boolean isUseLocalTime(); /*
return IMPLOT_STYLE->UseLocalTime;
*/
public native void setUseLocalTime(boolean input); /*
IMPLOT_STYLE->UseLocalTime = input;
*/
//ISO 8601
public native boolean isUseISO8601(); /*
return IMPLOT_STYLE->UseISO8601;
*/
public native void setUseISO8601(boolean input); /*
IMPLOT_STYLE->UseISO8601 = input;
*/
//24HR clock
public native boolean isUse24HourClock(); /*
return IMPLOT_STYLE->Use24HourClock;
*/
public native void setUse24HourClock(boolean input); /*
IMPLOT_STYLE->Use24HourClock = input;
@BindingField
public float LineWeight;
@BindingField
public int Marker;
@BindingField
public float MarkerSize;
@BindingField
public float MarkerWeight;
@BindingField
public float FillAlpha;
@BindingField
public float ErrorBarSize;
@BindingField
public float ErrorBarWeight;
@BindingField
public float DigitalBitHeight;
@BindingField
public float DigitalBitGap;
@BindingField
public float PlotBorderSize;
@BindingField
public float MinorAlpha;
@BindingField
public ImVec2 MajorTickLen;
@BindingField
public ImVec2 MinorTickLen;
@BindingField
public ImVec2 MajorTickSize;
@BindingField
public ImVec2 MinorTickSize;
@BindingField
public ImVec2 MajorGridSize;
@BindingField
public ImVec2 MinorGridSize;
@BindingField
public ImVec2 PlotPadding;
@BindingField
public ImVec2 LabelPadding;
@BindingField
public ImVec2 LegendPadding;
@BindingField
public ImVec2 LegendInnerPadding;
@BindingField
public ImVec2 LegendSpacing;
@BindingField
public ImVec2 MousePosPadding;
@BindingField
public ImVec2 AnnotationPadding;
@BindingField
public ImVec2 FitPadding;
@BindingField
public ImVec2 PlotDefaultSize;
@BindingField
public ImVec2 PlotMinSize;
@BindingField
@TypeArray(type = "ImVec4", size = "ImPlotCol_COUNT")
public ImVec4[] Colors;
@BindingField
public int Colormap;
@BindingField
public boolean AntiAliasedLines;
@BindingField
public boolean UseLocalTime;
@BindingField
public boolean UseISO8601;
@BindingField
public boolean Use24HourClock;
/*JNI
#undef THIS
*/
}
@@ -1,37 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotAxisFlags {
private ImPlotAxisFlags() {
}
/** default */
public static final int None = 0;
/** the axis label will not be displayed (axis labels also hidden if the supplied string name is NULL) */
public static final int NoLabel = 1;
/** no grid lines will be displayed */
public static final int NoGridLines = 1 << 1;
/** no tick marks will be displayed */
public static final int NoTickMarks = 1 << 2;
/** no text labels will be displayed */
public static final int NoTickLabels = 1 << 3;
/** grid lines will be displayed in the foreground (i.e. on top of data) in stead of the background */
public static final int Foreground = 1 << 4;
/** a logartithmic (base 10) axis scale will be used (mutually exclusive with ImPlotAxisFlags_Time) */
public static final int LogScale = 1 << 5;
/** axis will display date/time formatted labels (mutually exclusive with ImPlotAxisFlags_LogScale) */
public static final int Time = 1 << 6;
/** the axis will be inverted */
public static final int Invert = 1 << 7;
/** axis will not be initially fit to data extents on the first rendered frame (also the case if SetNextPlotLimits explicitly called) */
public static final int NoInitialFit = 1 << 8;
/** axis will be auto-fitting to data extents */
public static final int AutoFit = 1 << 9;
/** axis will only fit points if the point is in the visible range of the **orthoganol** axis */
public static final int RangeFit = 1 << 10;
/** the axis minimum value will be locked when panning/zooming */
public static final int LockMin = 1 << 11;
/** the axis maximum value will be locked when panning/zooming */
public static final int LockMax = 1 << 12;
public static final int Lock = LockMin | LockMax;
public static final int NoDecorations = NoLabel | NoGridLines | NoTickMarks | NoTickLabels;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotAxisFlags_")
public Void __;
}
@@ -1,15 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotBin {
private ImPlotBin() {
}
/** k = sqrt(n) */
public static final int Sqrt = -1;
/** k = 1 + log2(n) */
public static final int Sturges = -2;
/** k = 2 * cbrt(n) */
public static final int Rice = -3;
/** w = 3.49 * sigma / cbrt(n) */
public static final int Scott = -4;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotBin_")
public Void __;
}
@@ -1,57 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotCol {
private ImPlotCol() {
}
/** plot line/outline color (defaults to next unused color in current colormap)*/
public static final int Line = 0;
/** plot fill color for bars (defaults to the current line color)*/
public static final int Fill = 1;
/** marker outline color (defaults to the current line color)*/
public static final int MarkerOutline = 2;
/** marker fill color (defaults to the current line color)*/
public static final int MarkerFill = 3;
/** error bar color (defaults to ImGuiCol_Text)*/
public static final int ErrorBar = 4;
// plot styling colors
/** plot frame background color (defaults to ImGuiCol_FrameBg) */
public static final int FrameBg = 5;
/** plot area background color (defaults to ImGuiCol_WindowBg) */
public static final int PlotBg = 6;
/** plot area border color (defaults to ImGuiCol_Border) */
public static final int PlotBorder = 7;
/** legend background color (defaults to ImGuiCol_PopupBg) */
public static final int LegendBg = 8;
/** legend border color (defaults to ImPlotCol_PlotBorder) */
public static final int LegendBorder = 9;
/** legend text color (defaults to ImPlotCol_InlayText) */
public static final int LegendText = 10;
/** plot title text color (defaults to ImGuiCol_Text) */
public static final int TitleText = 11;
/** color of text appearing inside of plots (defaults to ImGuiCol_Text) */
public static final int InlayText = 12;
/** x-axis label and tick lables color (defaults to ImGuiCol_Text) */
public static final int XAxis = 13;
/** x-axis grid color (defaults to 25% ImPlotCol_XAxis) */
public static final int XAxisGrid = 14;
/** y-axis label and tick labels color (defaults to ImGuiCol_Text) */
public static final int YAxis = 15;
/** y-axis grid color (defaults to 25% ImPlotCol_YAxis) */
public static final int YAxisGrid = 16;
/** 2nd y-axis label and tick labels color (defaults to ImGuiCol_Text) */
public static final int YAxis2 = 17;
/** 2nd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis2) */
public static final int YAxisGrid2 = 18;
/** 3rd y-axis label and tick labels color (defaults to ImGuiCol_Text) */
public static final int YAxis3 = 19;
/** 3rd y-axis grid/label color (defaults to 25% ImPlotCol_YAxis3) */
public static final int YAxisGrid3 = 21;
/** box-selection color (defaults to yellow) */
public static final int Selection = 22;
/** box-query color (defaults to green) */
public static final int Query = 23;
/** crosshairs color (defaults to ImPlotCol_PlotBorder) */
public static final int Crosshairs = 24;
public static final int COUNT = 25;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotCol_")
public Void __;
}
@@ -1,39 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotColormap {
private ImPlotColormap() {
}
/** a.k.a. seaborn deep (qual=true, n=10) (default) */
public static final int Deep = 0;
/** a.k.a. matplotlib "Set1" (qual=true, n=9 ) */
public static final int Dark = 1;
/** a.k.a. matplotlib "Pastel1" (qual=true, n=9 ) */
public static final int Pastel = 2;
/** a.k.a. matplotlib "Paired" (qual=true, n=12) */
public static final int Paired = 3;
/** a.k.a. matplotlib "viridis" (qual=false, n=11) */
public static final int Viridis = 4;
/** a.k.a. matplotlib "plasma" (qual=false, n=11) */
public static final int Plasma = 5;
/** a.k.a. matplotlib/MATLAB "hot" (qual=false, n=11) */
public static final int Hot = 6;
/** a.k.a. matplotlib/MATLAB "cool" (qual=false, n=11) */
public static final int Cool = 7;
/** a.k.a. matplotlib/MATLAB "pink" (qual=false, n=11) */
public static final int Pink = 8;
/** a.k.a. MATLAB "jet" (qual=false, n=11) */
public static final int Jet = 9;
/** a.k.a. matplotlib "twilight" (qual=false, n=11) */
public static final int Twilight = 10;
/** red/blue, Color Brewer (qual=false, n=11) */
public static final int RdBu = 11;
/** brown/blue-green, Color Brewer (qual=false, n=11) */
public static final int BrBG = 12;
/** pink/yellow-green, Color Brewer (qual=false, n=11) */
public static final int PiYG = 13;
/** color spectrum, Color Brewer (qual=false, n=11) */
public static final int Spectral = 14;
/** white/black (qual=false, n=2 ) */
public static final int Greys = 15;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotColormap_")
public Void __;
}
@@ -1,36 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotFlags {
private ImPlotFlags() {
}
/** default */
public static final int None = 0;
/** the plot title will not be displayed (titles are also hidden if preceeded by double hashes, e.g. "##MyPlot") */
public static final int NoTitle = 1;
/** the legend will not be displayed */
public static final int NoLegend = 1 << 1;
/** the user will not be able to open context menus with right-click */
public static final int NoMenus = 1 << 2;
/** the user will not be able to box-select with right-click drag */
public static final int NoBoxSelect = 1 << 3;
/** the mouse position, in plot coordinates, will not be displayed inside of the plot */
public static final int NoMousePos = 1 << 4;
/** plot items will not be highlighted when their legend entry is hovered */
public static final int NoHighlight = 1 << 5;
/** a child window region will not be used to capture mouse scroll (can boost performance for single ImGui window applications) */
public static final int NoChild = 1 << 6;
/** primary x and y axes will be constrained to have the same units/pixel (does not apply to auxiliary y-axes) */
public static final int Equal = 1 << 7;
/** enable a 2nd y-axis on the right side */
public static final int YAxis2 = 1 << 8;
/** enable a 3rd y-axis on the right side */
public static final int YAxis3 = 1 << 9;
/** the user will be able to draw query rects with middle-mouse or CTRL + right-click drag */
public static final int Query = 1 << 1;
/** the default mouse cursor will be replaced with a crosshair when hovered */
public static final int Crosshairs = 1 << 1;
/** plot lines will be software anti-aliased (not recommended for high density plots, prefer MSAA) */
public static final int AntiAliased = 1 << 1;
public static final int CanvasOnly = NoTitle | NoLegend | NoMenus | NoBoxSelect | NoMousePos;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotFlags_")
public Void __;
}
@@ -1,25 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotLocation {
private ImPlotLocation() {
}
/** center-center */
public static final int Center = 0;
/** top-center */
public static final int North = 1;
/** bottom-center */
public static final int South = 1 << 1;
/** center-left */
public static final int West = 1 << 2;
/** center-right */
public static final int East = 1 << 3;
/** top-left */
public static final int NorthWest = North | West;
/** top-right */
public static final int NorthEast = North | East;
/** bottom-left */
public static final int SouthWest = South | West;
/** bottom-right */
public static final int SouthEast = South | East;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotLocation_")
public Void __;
}
@@ -1,30 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotMarker {
private ImPlotMarker() {
}
/** no marker */
public static final int None = -1;
/** a circle marker */
public static final int Circle = 0;
/** a square maker */
public static final int Square = 1;
/** a diamond marker */
public static final int Diamond = 2;
/** an upward-pointing triangle marker */
public static final int Up = 3;
/** an downward-pointing triangle marker */
public static final int Down = 4;
/** an leftward-pointing triangle marker */
public static final int Left = 5;
/** an rightward-pointing triangle marker */
public static final int Right = 6;
/** a cross marker (not fillable) */
public static final int Cross = 7;
/** a plus marker (not fillable) */
public static final int Plus = 8;
/** a asterisk marker (not fillable) */
public static final int Asterisk = 9;
public static final int COUNT = 10;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotMarker_")
public Void __;
}
@@ -1,11 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotOrientation {
private ImPlotOrientation() {
}
/** left/right */
public static final int Horizontal = 0;
/** up/down */
public static final int Vertical = 1;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotOrientation_")
public Void __;
}
@@ -1,62 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotStyleVar {
private ImPlotStyleVar() {
}
/** float, plot item line weight in pixels */
public static final int LineWeight = 0;
/** int, marker specification */
public static final int Marker = 1;
/** float, marker size in pixels (roughly the marker's "radius") */
public static final int MarkerSize = 2;
/** float, plot outline weight of markers in pixels */
public static final int MarkerWeight = 3;
/** float, alpha modifier applied to all plot item fills */
public static final int FillAlpha = 4;
/** float, error bar whisker width in pixels */
public static final int ErrorBarSize = 5;
/** float, error bar whisker weight in pixels */
public static final int ErrorBarWeight = 6;
/** float, digital channels bit height (at 1) in pixels */
public static final int DigitalBitHeight = 7;
/** float, digital channels bit padding gap in pixels */
public static final int DigitalBitGap = 8;
/** float, thickness of border around plot area */
public static final int PlotBorderSize = 9;
/** float, alpha multiplier applied to minor axis grid lines */
public static final int MinorAlpha = 10;
/** ImVec2, major tick lengths for X and Y axes */
public static final int MajorTickLen = 12;
/** ImVec2, minor tick lengths for X and Y axes */
public static final int MinorTickLen = 13;
/** ImVec2, line thickness of major ticks */
public static final int MajorTickSize = 14;
/** ImVec2, line thickness of minor ticks */
public static final int MinorTickSize = 15;
/** ImVec2, line thickness of major grid lines */
public static final int MajorGridSize = 16;
/** ImVec2, line thickness of minor grid lines */
public static final int MinorGridSize = 17;
/** ImVec2, padding between widget frame and plot area, labels, or outside legends (i.e. main padding) */
public static final int PlotPadding = 18;
/** ImVec2, padding between axes labels, tick labels, and plot edge */
public static final int LabelPadding = 19;
/** ImVec2, legend padding from plot edges */
public static final int LegendPadding = 20;
/** ImVec2, legend inner padding from legend edges */
public static final int LegendInnerPadding = 21;
/** ImVec2, spacing between legend entries */
public static final int LegendSpacing = 22;
/** ImVec2, padding between plot edge and interior info text */
public static final int MousePosPadding = 23;
/** ImVec2, text padding around annotation labels */
public static final int AnnotationPadding = 24;
/** ImVec2, additional fit padding as a percentage of the fit extents (e.g. ImVec2(0.1f,0.1f) adds 10% to the fit extents of X and Y) */
public static final int FitPadding = 25;
/** ImVec2, default size used when ImVec2(0,0) is passed to BeginPlot */
public static final int PlotDefaultSize = 26;
/** ImVec2, minimum size plot frame can be when shrunk */
public static final int PlotMinSize = 27;
public static final int COUNT = 28;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotStyleVar_")
public Void __;
}
@@ -1,13 +1,13 @@
package imgui.extension.implot.flag;
import imgui.binding.annotation.BindingAstEnum;
import imgui.binding.annotation.BindingSource;
@BindingSource
public final class ImPlotYAxis {
private ImPlotYAxis() {
}
/** left (default) */
public static final int YAxis_1 = 0;
/** first on right side */
public static final int YAxis_2 = 1;
/** second on right side */
public static final int YAxis_3 = 2;
@BindingAstEnum(file = "ast-implot.json", qualType = "ImPlotYAxis_", sanitizeName = "ImPlot")
public Void __;
}