/* * Texture.java * * Alex S. */ import java.awt.*; import java.awt.image.*; public class Texture { public int[] map; public int width,height; public Texture(Image img,ImageObserver o) throws InterruptedException { width = img.getWidth(o); height = img.getHeight(o); map = new int[width * height]; PixelGrabber pg = new PixelGrabber(img,0,0,width,height,map,0,width); pg.grabPixels(); } public int get(float i,float j){ int x = (int)(j * width) % width; int y = (int)(i * height) % height; return map[y * width + x]; } }