1 package com.insanityengine.ghia.pixels; 2 3 /*** 4 * 5 * <P> 6 * This PixelGetter maps coordinates to indices by using the 7 * modulo of x % width and y % height. 8 * </P> 9 * 10 * <P> 11 * The effect is to "clamp" the texture. 12 * </P> 13 * 14 * @author BrianHammond 15 * 16 * $Header: /usr/local/cvsroot/ghia/src/java/com/insanityengine/ghia/pixels/WrapPixelGetter.java,v 1.2 2005/03/19 17:50:02 brian Exp $ 17 * 18 */ 19 20 public class WrapPixelGetter extends PixelGetter { 21 /*** 22 * 23 * Constructor 24 * 25 */ 26 public WrapPixelGetter() { } 27 28 /*** 29 * 30 * Map the (x,y) into the pixels buffer and return 31 * the appropriate value via wrapping 32 * 33 * @param x coordinate 34 * @param y coordinate 35 * 36 * @return appropriate pixel value for (x,y) 37 * 38 */ 39 public int getPixelAt( int x, int y ) { 40 while ( x < 0 ) x += w; 41 while ( y < 0 ) y += h; 42 while ( x >= w ) x -= w; 43 while ( y >= h ) y -= h; 44 return super.getPixelAt( x, y ); 45 } 46 }; 47 48 /*** 49 * 50 * $Log: WrapPixelGetter.java,v $ 51 * Revision 1.2 2005/03/19 17:50:02 brian 52 * repackaging 53 * 54 * Revision 1.1 2004/09/02 13:17:16 brian 55 * the big reorg 56 * 57 * Revision 1.3 2004/09/01 01:10:42 brian 58 * fix class level javadoc placement 59 * 60 * Revision 1.2 2004/09/01 00:11:06 brian 61 * author, log and header stuff 62 * 63 * 64 */