Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void glitchHeightMap(double intensity, String outputName){
- Pixel pixel2;
- VectorFunctions v = new VectorFunctions();
- Color c;
- try{
- BufferedImage img = new BufferedImage(picture.getWidth(), picture.getHeight(), BufferedImage.TYPE_INT_RGB);
- for(int j=0; j<picture.getWidth(); j++){
- for(int k=0; k<picture.getHeight(); k++){
- pixel1 = picture.getPixel(j,k);
- v.setVectorV(pixel1.getRed(),pixel1.getGreen(),pixel1.getBlue());
- if((k-v.getmagV())>0){
- for(int i=0;i<(Math.toIntExact(Math.round((v.getmagV()/intensity))));i++){
- //if((i+2)>(Math.toIntExact(Math.round((v.getmagV()/intensity))))){ //only paints the top pixel
- c = new Color(pixel1.getRed(), pixel1.getGreen(), pixel1.getBlue());
- img.setRGB(j,k-i,c.getRGB());
- //}
- }
- }
- }
- }f = new File("C:\\...."+outputName+".png");
- ImageIO.write(img, "PNG", f);
- }catch(IOException e){
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement