Rename ImColor methods

This commit is contained in:
SpaiR committed 2020-06-16 16:53:42 +03:00
1 parent 1e95024702
commit 2ba2216957
2 files changed
+14 -14

No files matched your search

+11 -11
View File
@@ -7,27 +7,27 @@ public final class ImColor {
private ImColor() { private ImColor() {
} }
public static int get32(final int r, final int g, final int b, final int a) { public static int intToColor(final int r, final int g, final int b, final int a) {
return a << 24 | b << 16 | g << 8 | r; return a << 24 | b << 16 | g << 8 | r;
} }
public static int get32(final int r, final int g, final int b) { public static int intToColor(final int r, final int g, final int b) {
return get32(r, g, b, 255); return intToColor(r, g, b, 255);
} }
public static int get32(final float r, final float g, final float b, final float a) { public static int floatToColor(final float r, final float g, final float b, final float a) {
return get32((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255)); return intToColor((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255));
} }
public static int get32(final float r, final float g, final float b) { public static int floatToColor(final float r, final float g, final float b) {
return get32(r, g, b, 1f); return floatToColor(r, g, b, 1f);
} }
/** /**
* @param hex e.g. "#FFFFFF" * @param hex e.g. "#FFFFFF"
*/ */
public static int get32RGBHex(final String hex) { public static int rgbToColor(final String hex) {
return get32( return intToColor(
Integer.parseInt(hex.substring(1, 3), 16), Integer.parseInt(hex.substring(1, 3), 16),
Integer.parseInt(hex.substring(3, 5), 16), Integer.parseInt(hex.substring(3, 5), 16),
Integer.parseInt(hex.substring(5, 7), 16) Integer.parseInt(hex.substring(5, 7), 16)
@@ -37,8 +37,8 @@ public final class ImColor {
/** /**
* @param hex e.g. "#FFFFFFFF" * @param hex e.g. "#FFFFFFFF"
*/ */
public static int get32RGBAHex(final String hex) { public static int rgbaToColor(final String hex) {
return get32( return intToColor(
Integer.parseInt(hex.substring(1, 3), 16), Integer.parseInt(hex.substring(1, 3), 16),
Integer.parseInt(hex.substring(3, 5), 16), Integer.parseInt(hex.substring(3, 5), 16),
Integer.parseInt(hex.substring(5, 7), 16), Integer.parseInt(hex.substring(5, 7), 16),
+3 -3
View File
@@ -19,9 +19,9 @@ import static org.lwjgl.opengl.GL32.*;
final class ExampleUi { final class ExampleUi {
private static final String IMGUI_DEMO_LINK = "https://raw.githubusercontent.com/ocornut/imgui/v1.76/imgui_demo.cpp"; private static final String IMGUI_DEMO_LINK = "https://raw.githubusercontent.com/ocornut/imgui/v1.76/imgui_demo.cpp";
private static final int DODGERBLUE_COLOR = ImColor.get32RGBHex("#1E90FF"); private static final int DODGERBLUE_COLOR = ImColor.rgbToColor("#1E90FF");
private static final int CORAL_COLOR = ImColor.get32RGBHex("#FF7F50"); private static final int CORAL_COLOR = ImColor.rgbToColor("#FF7F50");
private static final int LIMEGREEN_COLOR = ImColor.get32RGBHex("#32CD32"); private static final int LIMEGREEN_COLOR = ImColor.rgbToColor("#32CD32");
// Test data for payload // Test data for payload
private final byte[] testPayload = "Test Payload".getBytes(); private final byte[] testPayload = "Test Payload".getBytes();