package htm.input.image;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import javax.imageio.ImageIO;

/**
 *
 * @author david.charubini
 */
public class ImageUtil {

    public static void writeImage(int width, int height, Collection<PixelInput> pixels, String filepath) throws IOException {

        BufferedImage img = new BufferedImage(width + 1, height + 1, BufferedImage.TYPE_INT_BGR);

        for (int y = 0; y < img.getHeight(); y++) {
            for (int x = 0; x < img.getWidth(); x++) {
                img.setRGB(x, y, 0xFFFFFFFF);
            }
        }
        
//        ArrayList<PixelInput> hulled = new FastConvexHull().execute(new ArrayList<PixelInput>(pixels));
        
        for (PixelInput pixel : pixels) {
            int[] value = pixel.getValue();
            int rgb = ImageInputSet.getValue(value);
            try {
                img.setRGB(pixel.getX(), pixel.getY(), rgb);
            } catch (RuntimeException re) {
                re.printStackTrace();
            }
        }
        
        File outputfile = new File(filepath);
        ImageIO.write(img, "png", outputfile);
    }
}

@@ -645,123 +645,8 @@
    %0A
-//        ArrayList%3CPixelInput%3E hulled = new FastConvexHull().execute(new ArrayList%3CPixelInput%3E(pixels));%0A        %0A
     

remove some random convex hull code - where'd that come from?