Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.awt.*;
- import java.awt.image.*;
- public class Vodovky {
- public BufferedImage rozmaz(BufferedImage bi) {
- int width = bi.getWidth(), height = bi.getHeight(), rgb;
- BufferedImage out = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
- Graphics g = out.getGraphics();
- g.drawImage(bi, 0, 0, null);
- for (int i = 0; i < width; i++) {
- for (int j = 0; j < height; j++) {
- rgb = bi.getRGB(i, j);
- g.setColor(new Color(rgb | (128<<24), true));
- g.drawRect(i-1, j-1, 2, 2);
- g.setColor(new Color(rgb | (64<<24), true));
- g.drawRect(i-2, j-2, 4, 4);
- g.setColor(new Color(rgb | (32<<24), true));
- g.drawRect(i-3, j-3, 6, 6);
- g.setColor(new Color(rgb | (16<<24), true));
- g.drawRect(i-4, j-4, 8, 8);
- g.setColor(new Color(rgb | (8<<24), true));
- g.drawRect(i-5, j-5, 10, 10);
- }
- }
- return out;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement