を使用して簡単なsmile.png画像を開こうとしたとき
package com.java3d.java3d.graphics;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class Texture {
public static Render floor = loadBitMap("smile.png");
public Texture(){}
public static Render loadBitMap(String fileName) {
try {
BufferedImage image = ImageIO.read(Thread.currentThread().getContextClassLoader().getResource(fileName));
System.out.print(image==null);
int width = image.getWidth();
System.out.println(width);
int height = image.getHeight();
System.out.println(height);
System.out.println(image.getRGB(4, 4));
Render result = new Render(width, height);
image.getRGB(0, 0, width, height, result.pixels, 0, width);
return result;
} catch (Exception e) {
System.out.println("CRASH!");
throw new RuntimeException(e);
}
}
}
すべてのピクセルを-1として返します。この問題の原因は何ですか?これが画像です: