Advertisement
kajacx

Rozmazani

Dec 16th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package test;
  2.  
  3. import java.awt.*;
  4. import java.awt.image.*;
  5.  
  6. public class Vodovky {
  7.  
  8.     public BufferedImage rozmaz(BufferedImage bi) {
  9.         int width = bi.getWidth(), height = bi.getHeight(), rgb;
  10.         BufferedImage out = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  11.         Graphics g = out.getGraphics();
  12.         g.drawImage(bi, 0, 0, null);
  13.         for (int i = 0; i < width; i++) {
  14.             for (int j = 0; j < height; j++) {
  15.                 rgb = bi.getRGB(i, j);
  16.                 g.setColor(new Color(rgb | (128<<24), true));
  17.                 g.drawRect(i-1, j-1, 2, 2);
  18.                
  19.                 g.setColor(new Color(rgb | (64<<24), true));
  20.                 g.drawRect(i-2, j-2, 4, 4);
  21.                
  22.                 g.setColor(new Color(rgb | (32<<24), true));
  23.                 g.drawRect(i-3, j-3, 6, 6);
  24.                
  25.                 g.setColor(new Color(rgb | (16<<24), true));
  26.                 g.drawRect(i-4, j-4, 8, 8);
  27.                
  28.                 g.setColor(new Color(rgb | (8<<24), true));
  29.                 g.drawRect(i-5, j-5, 10, 10);
  30.             }
  31.         }
  32.  
  33.         return out;
  34.     }
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement