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