aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
index 37466b2..1ccafaf 100644
--- a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
+++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
@@ -1,22 +1,14 @@
package io.polyfrost.oneconfig.lwjgl.image;
import io.polyfrost.oneconfig.lwjgl.IOUtil;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.ResourceLocation;
-import org.lwjgl.nanovg.NSVGImage;
-import org.lwjgl.nanovg.NanoSVG;
import org.lwjgl.nanovg.NanoVG;
import org.lwjgl.stb.STBImage;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.util.HashMap;
public class ImageLoader {
private final HashMap<String, Image> imageHashMap = new HashMap<>();
- private final HashMap<String, NSVGImage> NSVGImageHashMap = new HashMap<>();
public static ImageLoader INSTANCE = new ImageLoader();
public boolean loadImage(long vg, String fileName) {
@@ -41,32 +33,6 @@ public class ImageLoader {
return true;
}
- public boolean loadSVGImage(String fileName) {
- if (!NSVGImageHashMap.containsKey(fileName)) {
- try {
- InputStream inputStream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream();
- StringBuilder resultStringBuilder = new StringBuilder();
- try (BufferedReader br
- = new BufferedReader(new InputStreamReader(inputStream))) {
- String line;
- while ((line = br.readLine()) != null) {
- resultStringBuilder.append(line);
- }
- }
- CharSequence s = resultStringBuilder.toString();
- System.out.println(s);
- NSVGImage image = NanoSVG.nsvgParse(s, "px", 96f);
- NSVGImageHashMap.put(fileName, image);
- System.out.println("Loaded SVG: " + fileName);
- } catch (Exception e) { // just in case
- System.err.println("Failed to parse SVG file");
- e.printStackTrace();
- return false;
- }
- return true;
- }
- return true;
- }
public void removeImage(String fileName) {
imageHashMap.remove(fileName);
@@ -76,7 +42,4 @@ public class ImageLoader {
return imageHashMap.get(fileName);
}
- public NSVGImage getSVG(String fileName) {
- return NSVGImageHashMap.get(fileName);
- }
}