1 package com.insanityengine.ghia.pixels;
2
3 /***
4 *
5 * <P>
6 * Near trivial implementaton of the PixelGetterInterface interface
7 * </P>
8 *
9 * @author BrianHammond
10 *
11 */
12
13 public class PixelGetter implements PixelGetterInterface {
14
15 /***
16 *
17 * Constructor
18 *
19 */
20 public PixelGetter() { }
21
22 /***
23 *
24 * Set the pixels and information for the getPixelAt method
25 *
26 * @param width of the image
27 * @param height of the image
28 * @param pixels of the image
29 *
30 */
31 public final void setPixels( int width, int height, int pixels[] ) {
32 this.w = width;
33 this.h = height;
34 this.pixels = pixels;
35 }
36
37 /***
38 *
39 * Map the (x,y) into the pixels buffer and return
40 * the appropriate value
41 *
42 * @param x coordinate
43 * @param y coordinate
44 *
45 * @return appropriate pixel value for (x,y)
46 *
47 */
48 public int getPixelAt( int x, int y ) {
49 return pixels[ x + y * w ];
50 }
51
52
53
54 protected int w = 1, h = 1;
55 protected int [] pixels = nonPixels;
56
57 protected final static int [] nonPixels = { 0xABADFEED };
58
59 };
60
61 /***
62 *
63 * $Log: PixelGetter.java,v $
64 * Revision 1.2 2005/03/19 17:50:02 brian
65 * repackaging
66 *
67 * Revision 1.1 2004/09/02 13:17:16 brian
68 * the big reorg
69 *
70 * Revision 1.3 2004/09/01 01:10:42 brian
71 * fix class level javadoc placement
72 *
73 * Revision 1.2 2004/09/01 00:11:06 brian
74 * author, log and header stuff
75 *
76 *
77 */