diff options
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl')
| -rw-r--r-- | src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java index 87e3d03..e9bbf47 100644 --- a/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java +++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java @@ -193,6 +193,20 @@ public final class RenderManager { } } + public static void drawImage(long vg, String fileName, float x, float y, float width, float height, int color) { + if (ImageLoader.INSTANCE.loadImage(vg, fileName)) { + NVGPaint imagePaint = NVGPaint.calloc(); + Image image = ImageLoader.INSTANCE.getImage(fileName); + nvgBeginPath(vg); + nvgImagePattern(vg, x, y, width, height, 0, image.getReference(), 1, imagePaint); + nvgRGBA((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF), (byte) (color >> 24 & 0xFF), imagePaint.innerColor()); + nvgRect(vg, x, y, width, height); + nvgFillPaint(vg, imagePaint); + nvgFill(vg); + imagePaint.free(); + } + } + public static void drawSVGImage(long vg, String fileName, float x, float y, float width, float height) { if (ImageLoader.INSTANCE.loadSVGImage(fileName)) { try { |
