/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.awt;

import java.awt.Image;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.ranides.assira.annotations.Meta;
import net.ranides.assira.trace.LoggerUtils;

public final class ImageLoader {
    
    private static final org.slf4j.Logger LOGGER = LoggerUtils.getLogger();
    
    private ImageLoader() {
        // utility class
    }

    @Meta.Unsafe()
    public static Image res(Object context, String path) {
        try {
            return ImageIO.read(context.getClass().getResource(path));
        } catch (IOException cause) {
            LOGGER.warn("Incorrect resource: " + path, cause);
            return null;
        }
    }

}
