diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-05-29 15:26:36 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-05-29 15:26:36 +0700 |
commit | 98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315 (patch) | |
tree | a26d876b223229a35d05ef93c81a429ea1d877cd /src/main/java/cc/polyfrost/oneconfig/lwjgl | |
parent | ce370c8e2768383b57212fccd4018f92f88b8847 (diff) | |
download | OneConfig-98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315.tar.gz OneConfig-98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315.tar.bz2 OneConfig-98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315.zip |
kotlin dsl
RenderManager reorganization
fix build error in CommandHelper
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java | 530 |
1 files changed, 286 insertions, 244 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java index 2215499..f366648 100644 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java +++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java @@ -6,6 +6,7 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.libs.universal.UGraphics; import cc.polyfrost.oneconfig.libs.universal.UMinecraft; import cc.polyfrost.oneconfig.libs.universal.UResolution; +import cc.polyfrost.oneconfig.lwjgl.font.Font; import cc.polyfrost.oneconfig.lwjgl.font.FontManager; import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.ImageLoader; @@ -15,7 +16,8 @@ import cc.polyfrost.oneconfig.utils.InputUtils; import cc.polyfrost.oneconfig.utils.NetworkUtils; import net.minecraft.client.gui.Gui; import net.minecraft.client.shader.Framebuffer; -import org.lwjgl.nanovg.*; +import org.lwjgl.nanovg.NVGColor; +import org.lwjgl.nanovg.NVGPaint; import org.lwjgl.opengl.GL11; import java.util.function.LongConsumer; @@ -28,19 +30,19 @@ import static org.lwjgl.nanovg.NanoVGGL2.nvgCreate; * Handles NanoVG rendering and wraps it in a more convenient interface. */ public final class RenderManager { - private RenderManager() { - - } + private static long vg = -1; //nanovg - private static long vg = -1; + private RenderManager() { + + } /** * Sets up rendering, calls the consumer with the NanoVG context, and then cleans up. * - * @see RenderManager#setupAndDraw(boolean, LongConsumer) * @param consumer The consumer to call. + * @see RenderManager#setupAndDraw(boolean, LongConsumer) */ public static void setupAndDraw(LongConsumer consumer) { setupAndDraw(false, consumer); @@ -50,7 +52,7 @@ public final class RenderManager { * Sets up rendering, calls the consumer with the NanoVG context, and then cleans up. * * @param mcScaling Whether to render with Minecraft's scaling. - * @param consumer The consumer to call. + * @param consumer The consumer to call. */ public static void setupAndDraw(boolean mcScaling, LongConsumer consumer) { if (vg == -1) { @@ -85,12 +87,12 @@ public final class RenderManager { /** * Draws a rectangle with the given parameters. * - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param width The width. + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param width The width. * @param height The height. - * @param color The color. + * @param color The color. */ public static void drawRectangle(long vg, float x, float y, float width, float height, int color) { // TODO make everything use this one day if (OneConfigConfig.ROUNDED_CORNERS) { @@ -101,72 +103,99 @@ public final class RenderManager { } /** - * Draws a rounded gradient rectangle with the given parameters. + * Draws a rectangle with the given parameters. * - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param width The width. + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param width The width. * @param height The height. - * @param color The first color of the gradient. - * @param color2 The second color of the gradient. - * @param radius The corner radius. + * @param color The color. */ - public static void drawGradientRoundedRect(long vg, float x, float y, float width, float height, int color, int color2, float radius) { - NVGPaint bg = NVGPaint.create(); + public static void drawRect(long vg, float x, float y, float width, float height, int color) { nvgBeginPath(vg); - nvgRoundedRect(vg, x, y, width, height, radius); + nvgRect(vg, x, y, width, height); NVGColor nvgColor = color(vg, color); - NVGColor nvgColor2 = color(vg, color2); - nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x + width, y, nvgColor, nvgColor2, bg)); nvgFill(vg); nvgColor.free(); - nvgColor2.free(); } /** - * Draw a HSB box + * Draws a rounded rectangle with the given parameters. * - * @param vg The NanoVG context. - * @param x The x coordinate. - * @param y The y coordinate - * @param width The width. + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param width The width. * @param height The height. - * @param colorTarget Hue color + * @param color The color. + * @param radius The radius. */ - public static void drawHSBBox(long vg, float x, float y, float width, float height, int colorTarget) { - drawRoundedRect(vg, x, y, width, height, colorTarget, 8f); - - NVGPaint bg = NVGPaint.create(); + public static void drawRoundedRect(long vg, float x, float y, float width, float height, int color, float radius) { nvgBeginPath(vg); - nvgRoundedRect(vg, x, y, width, height, 8f); - NVGColor nvgColor = color(vg, -1); - NVGColor nvgColor2 = color(vg, OneConfigConfig.TRANSPARENT); - nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x + width, y, nvgColor, nvgColor2, bg)); + nvgRoundedRect(vg, x, y, width, height, radius); + color(vg, color); + NVGColor nvgColor = color(vg, color); nvgFill(vg); nvgColor.free(); - nvgColor2.free(); + } - NVGPaint bg2 = NVGPaint.create(); + /** + * Draw a rounded rectangle where every corner has a different radius + * + * @param vg The NanoVG context + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. + * @param color The color. + * @param radiusTL Top left corner radius. + * @param radiusTR Top right corner radius. + * @param radiusBR Bottom right corner radius. + * @param radiusBL Bottom left corner radius + */ + public static void drawRoundedRectVaried(long vg, float x, float y, float width, float height, int color, float radiusTL, float radiusTR, float radiusBR, float radiusBL) { nvgBeginPath(vg); - nvgRoundedRect(vg, x, y, width, height, 8f); - NVGColor nvgColor3 = color(vg, OneConfigConfig.TRANSPARENT); - NVGColor nvgColor4 = color(vg, OneConfigConfig.BLACK); - nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x, y + height, nvgColor3, nvgColor4, bg2)); + nvgRoundedRectVarying(vg, x, y, width, height, radiusTL, radiusTR, radiusBR, radiusBL); + color(vg, color); + NVGColor nvgColor = color(vg, color); nvgFill(vg); - nvgColor3.free(); - nvgColor4.free(); + nvgColor.free(); + } + + /** + * Draws a hollow rounded rectangle with the given parameters. + * + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. + * @param color The color. + * @param radius The radius. + * @param thickness The thickness. + */ + public static void drawHollowRoundRect(long vg, float x, float y, float width, float height, int color, float radius, float thickness) { + nvgBeginPath(vg); + nvgRoundedRect(vg, x + thickness, y + thickness, width - thickness, height - thickness, radius); + nvgStrokeWidth(vg, thickness + 0.5f); + nvgPathWinding(vg, NVG_HOLE); + color(vg, color); + NVGColor nvgColor = color(vg, color); + nvgStrokeColor(vg, nvgColor); + nvgStroke(vg); + nvgColor.free(); } /** * Draws a gradient rectangle with the given parameters. * - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param width The width. + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param width The width. * @param height The height. - * @param color The first color of the gradient. + * @param color The first color of the gradient. * @param color2 The second color of the gradient. */ public static void drawGradientRect(long vg, float x, float y, float width, float height, int color, int color2) { @@ -183,125 +212,154 @@ public final class RenderManager { } /** - * Draws a rectangle with the given parameters. + * Draws a rounded gradient rectangle with the given parameters. * - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param width The width. + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param width The width. * @param height The height. - * @param color The color. + * @param color The first color of the gradient. + * @param color2 The second color of the gradient. + * @param radius The corner radius. */ - public static void drawRect(long vg, float x, float y, float width, float height, int color) { + public static void drawGradientRoundedRect(long vg, float x, float y, float width, float height, int color, int color2, float radius) { + NVGPaint bg = NVGPaint.create(); nvgBeginPath(vg); - nvgRect(vg, x, y, width, height); + nvgRoundedRect(vg, x, y, width, height, radius); NVGColor nvgColor = color(vg, color); + NVGColor nvgColor2 = color(vg, color2); + nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x + width, y, nvgColor, nvgColor2, bg)); nvgFill(vg); nvgColor.free(); + nvgColor2.free(); } /** - * Draws a rounded rectangle with the given parameters. + * Draw a HSB box * - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. - * @param color The color. - * @param radius The radius. + * @param vg The NanoVG context. + * @param x The x coordinate. + * @param y The y coordinate + * @param width The width. + * @param height The height. + * @param colorTarget Hue color */ - public static void drawRoundedRect(long vg, float x, float y, float width, float height, int color, float radius) { + public static void drawHSBBox(long vg, float x, float y, float width, float height, int colorTarget) { + drawRoundedRect(vg, x, y, width, height, colorTarget, 8f); + + NVGPaint bg = NVGPaint.create(); nvgBeginPath(vg); - nvgRoundedRect(vg, x, y, width, height, radius); - color(vg, color); - NVGColor nvgColor = color(vg, color); + nvgRoundedRect(vg, x, y, width, height, 8f); + NVGColor nvgColor = color(vg, -1); + NVGColor nvgColor2 = color(vg, OneConfigConfig.TRANSPARENT); + nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x + width, y, nvgColor, nvgColor2, bg)); nvgFill(vg); nvgColor.free(); + nvgColor2.free(); + + NVGPaint bg2 = NVGPaint.create(); + nvgBeginPath(vg); + nvgRoundedRect(vg, x, y, width, height, 8f); + NVGColor nvgColor3 = color(vg, OneConfigConfig.TRANSPARENT); + NVGColor nvgColor4 = color(vg, OneConfigConfig.BLACK); + nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x, y + height, nvgColor3, nvgColor4, bg2)); + nvgFill(vg); + nvgColor3.free(); + nvgColor4.free(); } /** - * Draw a rounded rectangle where every corner has a different radius + * Draws a circle with the given parameters. * - * @param vg The NanoVG context - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. - * @param color The color. - * @param radiusTL Top left corner radius. - * @param radiusTR Top right corner radius. - * @param radiusBR Bottom right corner radius. - * @param radiusBL Bottom left corner radius + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param radius The radius. + * @param color The color. */ - public static void drawRoundedRectVaried(long vg, float x, float y, float width, float height, int color, float radiusTL, float radiusTR, float radiusBR, float radiusBL) { + public static void drawCircle(long vg, float x, float y, float radius, int color) { nvgBeginPath(vg); - nvgRoundedRectVarying(vg, x, y, width, height, radiusTL, radiusTR, radiusBR, radiusBL); - color(vg, color); + nvgCircle(vg, x, y, radius); NVGColor nvgColor = color(vg, color); nvgFill(vg); nvgColor.free(); } /** - * Draws a hollow rounded rectangle with the given parameters. + * Draws a String with the given parameters. * - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. + * @param vg The NanoVG context. + * @param text The text. + * @param x The x position. + * @param y The y position. * @param color The color. - * @param radius The radius. - * @param thickness The thickness. + * @param size The size. + * @param font The font. + * @see cc.polyfrost.oneconfig.lwjgl.font.Font */ - public static void drawHollowRoundRect(long vg, float x, float y, float width, float height, int color, float radius, float thickness) { - nvgBeginPath(vg); - nvgRoundedRect(vg, x + thickness, y + thickness, width - thickness, height - thickness, radius); - nvgStrokeWidth(vg, thickness + 0.5f); - nvgPathWinding(vg, NVG_HOLE); - color(vg, color); - NVGColor nvgColor = color(vg, color); - nvgStrokeColor(vg, nvgColor); - nvgStroke(vg); - nvgColor.free(); + public static void drawText(long vg, String text, float x, float y, int color, float size, Fonts font) { + drawText(vg, text, x, y, color, size, font.font); } /** - * Draws a circle with the given parameters. - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param radius The radius. + * Draws a String with the given parameters. + * + * @param vg The NanoVG context. + * @param text The text. + * @param x The x position. + * @param y The y position. * @param color The color. + * @param size The size. + * @param font The font. + * @see cc.polyfrost.oneconfig.lwjgl.font.Font */ - public static void drawCircle(long vg, float x, float y, float radius, int color) { + public static void drawText(long vg, String text, float x, float y, int color, float size, Font font) { nvgBeginPath(vg); - nvgCircle(vg, x, y, radius); + nvgFontSize(vg, size); + nvgFontFace(vg, font.getName()); + nvgTextAlign(vg, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE); NVGColor nvgColor = color(vg, color); + nvgText(vg, x, y, text); nvgFill(vg); nvgColor.free(); } /** - * Draws a String with the given parameters. - * @param vg The NanoVG context. - * @param text The text. - * @param x The x position. - * @param y The y position. + * Draws a String wrapped at the given width, with the given parameters. + * + * @param vg The NanoVG context. + * @param text The text. + * @param x The x position. + * @param y The y position. + * @param width The width. * @param color The color. - * @param size The size. - * @param font The font. + * @param size The size. + * @param font The font. + */ + public static void drawWrappedString(long vg, String text, float x, float y, float width, int color, float size, Fonts font) { + drawWrappedString(vg, text, x, y, width, color, size, font.font); + } + + /** + * Draws a String wrapped at the given width, with the given parameters. * - * @see cc.polyfrost.oneconfig.lwjgl.font.Font + * @param vg The NanoVG context. + * @param text The text. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param color The color. + * @param size The size. + * @param font The font. */ - public static void drawString(long vg, String text, float x, float y, int color, float size, Fonts font) { + public static void drawWrappedString(long vg, String text, float x, float y, float width, int color, float size, Font font) { nvgBeginPath(vg); nvgFontSize(vg, size); - nvgFontFace(vg, font.font.getName()); + nvgFontFace(vg, font.getName()); nvgTextAlign(vg, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE); NVGColor nvgColor = color(vg, color); - nvgText(vg, x, y, text); + nvgTextBox(vg, x, y, width, text); nvgFill(vg); nvgColor.free(); } @@ -311,11 +369,23 @@ public final class RenderManager { * * <p><b>This does NOT scale to Minecraft's GUI scale!</b></p> * - * @see RenderManager#drawString(long, String, float, float, int, float, Fonts) + * @see RenderManager#drawText(long, String, float, float, int, float, Font) * @see InputUtils#isAreaClicked(int, int, int, int) */ public static void drawURL(long vg, String url, float x, float y, float size, Fonts font) { - drawString(vg, url, x, y, OneConfigConfig.PRIMARY_500, size, font); + drawURL(vg, url, x, y, size, font.font); + } + + /** + * Draw a formatted URL (a string in blue with an underline) that when clicked, opens the given text. + * + * <p><b>This does NOT scale to Minecraft's GUI scale!</b></p> + * + * @see RenderManager#drawText(long, String, float, float, int, float, Font) + * @see InputUtils#isAreaClicked(int, int, int, int) + */ + public static void drawURL(long vg, String url, float x, float y, float size, Font font) { + drawText(vg, url, x, y, OneConfigConfig.PRIMARY_500, size, font); float length = getTextWidth(vg, url, size, font); drawRectangle(vg, x, y + size / 2, length, 1, OneConfigConfig.PRIMARY_500); if (InputUtils.isAreaClicked((int) (x - 2), (int) (y - 1), (int) (length + 4), (int) (size / 2 + 3))) { @@ -324,36 +394,14 @@ public final class RenderManager { } /** - * Draws a String wrapped at the given width, with the given parameters. - * @param vg The NanoVG context. - * @param text The text. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param color The color. - * @param size The size. - * @param font The font. - */ - public static void drawWrappedString(long vg, String text, float x, float y, float width, int color, float size, Fonts font) { - nvgBeginPath(vg); - nvgFontSize(vg, size); - nvgFontFace(vg, font.font.getName()); - nvgTextAlign(vg, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE); - NVGColor nvgColor = color(vg, color); - nvgTextBox(vg, x, y, width, text); - nvgFill(vg); - nvgColor.free(); - } - - /** * Draws an image with the provided file path. - * @param vg The NanoVG context. - * @param filePath The file path. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. * + * @param vg The NanoVG context. + * @param filePath The file path. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. * @see RenderManager#drawImage(long, String, float, float, float, float, int) */ public static void drawImage(long vg, String filePath, float x, float y, float width, float height) { @@ -371,13 +419,14 @@ public final class RenderManager { /** * Draws an image with the provided file path. - * @param vg The NanoVG context. + * + * @param vg The NanoVG context. * @param filePath The file path. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. - * @param color The color. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. + * @param color The color. */ public static void drawImage(long vg, String filePath, float x, float y, float width, float height, int color) { if (ImageLoader.INSTANCE.loadImage(vg, filePath)) { @@ -394,14 +443,33 @@ public final class RenderManager { } /** + * Draws an image with the provided file path and parameters. + * + * @see RenderManager#drawImage(long, String, float, float, float, float) + */ + public static void drawImage(long vg, Images filePath, float x, float y, float width, float height) { + drawImage(vg, filePath.filePath, x, y, width, height); + } + + /** + * Draws an image with the provided file path and parameters. + * + * @see RenderManager#drawImage(long, String, float, float, float, float, int) + */ + public static void drawImage(long vg, Images filePath, float x, float y, float width, float height, int color) { + drawImage(vg, filePath.filePath, x, y, width, height, color); + } + + /** * Draws a rounded image with the provided file path and parameters. - * @param vg The NanoVG context. + * + * @param vg The NanoVG context. * @param filePath The file path. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. - * @param radius The radius. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. + * @param radius The radius. */ public static void drawRoundImage(long vg, String filePath, float x, float y, float width, float height, float radius) { if (ImageLoader.INSTANCE.loadImage(vg, filePath)) { @@ -425,46 +493,34 @@ public final class RenderManager { drawRoundImage(vg, filePath.filePath, x, y, width, height, radius); } - /** - * Draws an image with the provided file path and parameters. - * - * @see RenderManager#drawImage(long, String, float, float, float, float) - */ - public static void drawImage(long vg, Images filePath, float x, float y, float width, float height) { - drawImage(vg, filePath.filePath, x, y, width, height); - } - - /** - * Draws an image with the provided file path and parameters. - * - * @see RenderManager#drawImage(long, String, float, float, float, float, int) - */ - public static void drawImage(long vg, Images filePath, float x, float y, float width, float height, int color) { - drawImage(vg, filePath.filePath, x, y, width, height, color); + public static float getTextWidth(long vg, String text, float fontSize, Fonts font) { + return getTextWidth(vg, text, fontSize, font.font); } /** * Get the width of the provided String. - * @param vg The NanoVG context. - * @param text The text. + * + * @param vg The NanoVG context. + * @param text The text. * @param fontSize The font size. - * @param font The font. + * @param font The font. * @return The width of the text. */ - public static float getTextWidth(long vg, String text, float fontSize, Fonts font) { + public static float getTextWidth(long vg, String text, float fontSize, Font font) { float[] bounds = new float[4]; nvgFontSize(vg, fontSize); - nvgFontFace(vg, font.font.getName()); + nvgFontFace(vg, font.getName()); return nvgTextBounds(vg, 0, 0, text, bounds); } /** * Draws a line with the provided parameters. - * @param vg The NanoVG context. - * @param x The x position. - * @param y The y position. - * @param endX The end x position. - * @param endY The end y position. + * + * @param vg The NanoVG context. + * @param x The x position. + * @param y The y position. + * @param endX The end x position. + * @param endY The end y position. * @param width The width. * @param color The color. */ @@ -484,43 +540,27 @@ public final class RenderManager { * * <a href="https://github.com/SpinyOwl/legui/blob/develop/LICENSE">Adapted from legui under MIT license</a> * - * @param vg The NanoVG context. - * @param x The x coordinate. - * @param y The y coordinate. - * @param w The width. - * @param h The height. - * @param blur The blur (feather). - * @param spread The spread. + * @param vg The NanoVG context. + * @param x The x coordinate. + * @param y The y coordinate. + * @param w The width. + * @param h The height. + * @param blur The blur (feather). + * @param spread The spread. * @param cornerRadius The radius of the corner */ public static void drawDropShadow(long vg, float x, float y, float w, float h, float blur, float spread, float cornerRadius) { - try ( - NVGPaint shadowPaint = NVGPaint.calloc(); // allocating memory to pass color to nanovg wrapper - NVGColor firstColor = NVGColor.calloc(); // allocating memory to pass color to nanovg wrapper - NVGColor secondColor = NVGColor.calloc() // allocating memory to pass color to nanovg wrapper + try (NVGPaint shadowPaint = NVGPaint.calloc(); // allocating memory to pass color to nanovg wrapper + NVGColor firstColor = NVGColor.calloc(); // allocating memory to pass color to nanovg wrapper + NVGColor secondColor = NVGColor.calloc() // allocating memory to pass color to nanovg wrapper ) { - fillNvgColorWithRGBA(0, 0, 0, 0.5f, firstColor); // filling allocated memory - fillNvgColorWithRGBA(0, 0, 0, 0, secondColor); // filling allocated memory + fillNVGColorWithRGBA(0, 0, 0, 0.5f, firstColor); // filling allocated memory + fillNVGColorWithRGBA(0, 0, 0, 0, secondColor); // filling allocated memory // creating gradient and put it to shadowPaint - nvgBoxGradient(vg, - x - spread, - y - spread, - w + 2 * spread, - h + 2 * spread, - cornerRadius + spread, - blur, - firstColor, - secondColor, - shadowPaint); + nvgBoxGradient(vg, x - spread, y - spread, w + 2 * spread, h + 2 * spread, cornerRadius + spread, blur, firstColor, secondColor, shadowPaint); nvgBeginPath(vg); - nvgRoundedRect(vg, - x - spread - blur, - y - spread - blur, - w + 2 * spread + 2 * blur, - h + 2 * spread + 2 * blur, - cornerRadius + spread - ); + nvgRoundedRect(vg, x - spread - blur, y - spread - blur, w + 2 * spread + 2 * blur, h + 2 * spread + 2 * blur, cornerRadius + spread); nvgRoundedRect(vg, x, y, w, h, cornerRadius); nvgPathWinding(vg, NVG_HOLE); nvgFillPaint(vg, shadowPaint); @@ -530,13 +570,14 @@ public final class RenderManager { /** * Fills the provided {@link NVGColor} with the provided RGBA values. - * @param r The red value. - * @param g The green value. - * @param b The blue value. - * @param a The alpha value. + * + * @param r The red value. + * @param g The green value. + * @param b The blue value. + * @param a The alpha value. * @param color The {@link NVGColor} to fill. */ - public static void fillNvgColorWithRGBA(float r, float g, float b, float a, NVGColor color) { + public static void fillNVGColorWithRGBA(float r, float g, float b, float a, NVGColor color) { color.r(r); color.g(g); color.b(b); @@ -546,7 +587,7 @@ public final class RenderManager { /** * Create a {@link NVGColor} from the provided RGBA values. * - * @param vg The NanoVG context. + * @param vg The NanoVG context. * @param color The color. * @return The {@link NVGColor} created. */ @@ -559,9 +600,10 @@ public final class RenderManager { /** * Scales all rendering by the provided scale. + * * @param vg The NanoVG context. - * @param x The x scale. - * @param y The y scale. + * @param x The x scale. + * @param y The y scale. */ public static void scale(long vg, float x, float y) { nvgScale(vg, x, y); @@ -570,7 +612,7 @@ public final class RenderManager { /** * Sets the global alpha value to render with. * - * @param vg The NanoVG context. + * @param vg The NanoVG context. * @param alpha The alpha value. */ public static void setAlpha(long vg, float alpha) { @@ -580,12 +622,12 @@ public final class RenderManager { /** * Draws a SVG with the provided file path and parameters. * - * @param vg The NanoVG context. + * @param vg The NanoVG context. * @param filePath The file path. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. */ public static void drawSvg(long vg, String filePath, float x, float y, float width, float height) { float w = width; @@ -609,13 +651,13 @@ public final class RenderManager { /** * Draws a SVG with the provided file path and parameters. * - * @param vg The NanoVG context. + * @param vg The NanoVG context. * @param filePath The file path. - * @param x The x position. - * @param y The y position. - * @param width The width. - * @param height The height. - * @param color The color. + * @param x The x position. + * @param y The y position. + * @param width The width. + * @param height The height. + * @param color The color. */ public static void drawSvg(long vg, String filePath, float x, float y, float width, float height, int color) { float w = width; @@ -658,10 +700,10 @@ public final class RenderManager { /** * Draw a circle with an info icon inside of it * - * @param vg The NanoVG context. + * @param vg The NanoVG context. * @param type The icon type. - * @param x The x position. - * @param y The y position. + * @param x The x position. + * @param y The y position. * @param size The diameter. */ public static void drawInfo(long vg, InfoType type, float x, float y, float size) { |