1 package jp.nyatla.utils.j2se;
\r
3 import java.awt.image.*;
\r
4 import jp.nyatla.nyartoolkit.*;
\r
5 import jp.nyatla.nyartoolkit.core.raster.rgb.*;
\r
6 import jp.nyatla.nyartoolkit.core.rasterreader.*;
\r
8 public class BufferedImageSink extends BufferedImage
\r
10 public BufferedImageSink(int i_width,int i_height)
\r
12 super(i_width,i_height,TYPE_INT_RGB);
\r
14 public void sinkFromRaster(INyARRgbRaster i_in) throws NyARException
\r
16 assert i_in.getSize().isEqualSize(this.getWidth(), this.getHeight());
\r
19 INyARRgbPixelReader reader=i_in.getRgbPixelReader();
\r
20 int[] rgb=new int[3];
\r
22 for(int y=this.getHeight()-1;y>=0;y--){
\r
23 for(int x=this.getWidth()-1;x>=0;x--){
\r
24 reader.getPixel(x,y,rgb);
\r
25 this.setRGB(x,y,(rgb[0]<<16)|(rgb[1]<<8)|rgb[2]);
\r