예제 #1
0
 // returns a value specifying some kind of average brightness in the image.
 protected int getAverageBrightness(BufferedImage img) {
   Raster r = img.getData();
   int total = 0;
   for (int y = 0; y < r.getHeight(); y++) {
     for (int x = 0; x < r.getWidth(); x++) {
       total += r.getSample(r.getMinX() + x, r.getMinY() + y, 0);
     }
   }
   return (int) (total / ((r.getWidth() / factorD) * (r.getHeight() / factorD)));
 }
예제 #2
0
파일: CA.java 프로젝트: jkwhite/nausicaa
 public Raster getData() {
   return _i.getData();
 }
예제 #3
0
 public static BufferedImage getImageFromArray(int[] pixels, int width, int height) {
   BufferedImage imageBI = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
   WritableRaster raster = (WritableRaster) imageBI.getData();
   raster.setPixels(0, 0, width, height, pixels);
   return imageBI;
 }