Advertisement
sci4me

LGBTIfy

Oct 29th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. public static BufferedImage lgbtify(final BufferedImage img)
  2.     {
  3.         final int[] chunks = new int[]{
  4.                 0xE40303,
  5.                 0xFF8C00,
  6.                 0xFFED00,
  7.                 0x008026,
  8.                 0x004DFF,
  9.                 0x750787
  10.         };
  11.  
  12.         final BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);
  13.         final Graphics2D g = newImage.createGraphics();
  14.         g.drawImage(img, 0, 0, null);
  15.  
  16.         g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.35f));
  17.         final int chunkSize = newImage.getHeight() / chunks.length;
  18.         for (int chunk = 0; chunk < chunks.length; chunk++)
  19.         {
  20.             final int startY = chunk * chunkSize;
  21.             final int endY = startY + chunkSize;
  22.  
  23.             g.setColor(new Color(chunks[chunk]));
  24.             g.fillRect(0, startY, newImage.getWidth(), endY);
  25.         }
  26.  
  27.         g.dispose();
  28.  
  29.         return newImage;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement