Public Methods | |
| ImageBuffer (int[] pixels, int w, int h) | |
| ImageBuffer (Image img, int w, int h) | |
| int[] | getPixels () |
| int | getWidth () |
| int | getHeight () |
| void | fill (int[] pixels, int width, int height) |
| void | fill (Image img, int width, int height) |
| Image | toImage () |
| int | getPixelIntValue (int x, int y) |
| int[] | getPixelARGBValue (int x, int y) |
|
||||||||||||||||
|
00031 {
00032 fill(pixels, w, h);
00033 }
|
|
||||||||||||||||
|
00037 {
00038 fill(img, w, h);
00039 }
|
|
|
00046 {
00047 return pixels;
00048 }
|
|
|
00052 {
00053 return width;
00054 }
|
|
|
00058 {
00059 return height;
00060 }
|
|
||||||||||||||||
|
00064 {
00065 this.pixels = pixels;
00066 this.width = width;
00067 this.height = height;
00068 }
|
|
||||||||||||||||
|
00072 {
00073 this.width = width;
00074 this.height = height;
00075 pixels = new int[width * height];
00076
00077 PixelGrabber pg =
00078 new PixelGrabber(img, 0, 0, width, height, pixels, 0, width);
00079
00080 try {
00081 pg.grabPixels();
00082 } catch (InterruptedException e) {
00083 pixels = null;
00084 return;
00085 }
00086
00087 if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
00088 pixels = null;
00089 }
00090 }
|
|
|
00094 {
00095 return createImage(new MemoryImageSource(width, height,
00096 pixels, 0, width));
00097 }
|
|
||||||||||||
|
00101 {
00102 if (pixels == null || x < 0
00103 || y < 0 || x >= width || y >= height ) {
00104 return -1;
00105 }
00106 return (pixels[width*y + x]);
00107 }
|
|
||||||||||||
|
00111 {
00112 if (pixels == null || x < 0
00113 || y < 0 || x >= width || y >= height ) {
00114 return null;
00115 }
00116
00117 int[] value = new int[4];
00118
00119 value[0] = (pixels[width*y + x] >> 24) & 0xff;
00120 value[1] = (pixels[width*y + x] >> 16) & 0xff;
00121 value[2] = (pixels[width*y + x] >> 8) & 0xff;
00122 value[3] = (pixels[width*y + x] ) & 0xff;
00123 return value;
00124 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001