package sig; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import java.awt.Color; import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; public class Texture{ int[] tex; int width; int height; public boolean hasTransparency=false; public boolean hasTranslucency=false; TextureType type; public Texture(File f) { try { BufferedImage i = ImageIO.read(f); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); width=i.getWidth(); height=i.getHeight(); tex = new int[width*height]; WritableRaster r = i.getRaster(); for (int x=0;x=width||sy<0||sy>=height) { return 0; } else { int indice = (int)(u*width-1)+(int)(v*height-1)*width; //return tex[indice]; return (int)((tex[indice]&0xFF)*mult) + ((int)(((tex[indice]&0xFF00)>>>8)*mult)<<8) + ((int)(((tex[indice]&0xFF0000)>>>16)*mult)<<16) + ((((tex[indice]&0xFF000000)>>>24))<<24); /*Color newCol = new Color(tex.getRGB(sx,sy)); return new Color((newCol.getRed()/255f)*mult,(newCol.getGreen()/255f)*mult,(newCol.getBlue()/255f)*mult);*/ } } }