use of com.github.jakz.romlib.data.assets.AssetData in project rom-manager by Jakz.
the class InfoPanel method setImage.
void setImage(Game rom, Asset asset, JLabel dest) {
AssetData data = rom.getAssetData(asset);
if (data.isPresent()) {
Asset.Image imageAsset = (Asset.Image) asset;
Dimension size = imageAsset.getSize();
ImageIcon i = data.asImage();
Image img = i.getImage();
BufferedImage bi = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
g.drawImage(img, 0, 0, size.width, size.height, null);
dest.setText("");
dest.setIcon(new ImageIcon(bi));
} else {
dest.setText("Asset Missing");
dest.setIcon(null);
}
}