Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static BufferedImage lgbtify(final BufferedImage img)
- {
- final int[] chunks = new int[]{
- 0xE40303,
- 0xFF8C00,
- 0xFFED00,
- 0x008026,
- 0x004DFF,
- 0x750787
- };
- final BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);
- final Graphics2D g = newImage.createGraphics();
- g.drawImage(img, 0, 0, null);
- g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.35f));
- final int chunkSize = newImage.getHeight() / chunks.length;
- for (int chunk = 0; chunk < chunks.length; chunk++)
- {
- final int startY = chunk * chunkSize;
- final int endY = startY + chunkSize;
- g.setColor(new Color(chunks[chunk]));
- g.fillRect(0, startY, newImage.getWidth(), endY);
- }
- g.dispose();
- return newImage;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement