Skip to content

Commit

Permalink
transparent moodbar
Browse files Browse the repository at this point in the history
  • Loading branch information
vonqo committed Aug 14, 2022
1 parent 3e77a0e commit 77a889a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ public BufferedImage vanilla4Bar(ArrayList<BufferedImage> moodbarList, ArrayList
BufferedImage canvas = new BufferedImage(width, moodbarList.size() * newHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D ctx2D = canvas.createGraphics();
ctx2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
ctx2D.setComposite(AlphaComposite.Clear);
ctx2D.setPaint (ImageSupporter.backgroundColor);
ctx2D.fillRect(0,0,canvas.getWidth(),canvas.getHeight());
ctx2D.setComposite(AlphaComposite.Src);
for(int i = 0; i < moodbarList.size(); i++) {
ctx2D.setColor(ImageSupporter.fontColor);
ctx2D.setFont(new Font(ImageSupporter.fontName, Font.BOLD, ImageSupporter.fontSize));
ctx2D.setFont(new Font(ImageSupporter.fontName, Font.PLAIN, ImageSupporter.fontSize));
ctx2D.drawString(moodbarTitle.get(i), 10, (i * newHeight) + (newHeight - height - (fontSize / 2)));
ctx2D.drawImage(moodbarList.get(i),0, (i * newHeight) + (newHeight - height - 2), null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void buildImage() {
}

private Double noiseFilter(Double threshold) {
threshold -= 0.81;
threshold -= 0.85;
if(threshold < 0) threshold = 0.0;
threshold *= 8.0;
if(threshold > 1) threshold = 1.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public static void RGB2WV_Generate_LossyExhaustingTable() {
}

public static BufferedImage addTitle (BufferedImage image, String title) {
BufferedImage canvas = new BufferedImage(image.getWidth(), image.getHeight() + fontSize+20, BufferedImage.TYPE_INT_ARGB);
BufferedImage canvas = new BufferedImage(image.getWidth(), image.getHeight() + fontSize+50, BufferedImage.TYPE_INT_ARGB);
Graphics2D ctx2D = canvas.createGraphics();
ctx2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
ctx2D.setPaint (ImageSupporter.backgroundColor);
ctx2D.fillRect(0,0,canvas.getWidth(),canvas.getHeight());
ctx2D.setFont(new Font(fontName, Font.PLAIN, fontSize));
ctx2D.setColor(ImageSupporter.fontColor);
ctx2D.drawString(title, fontSize+5, fontSize+10);
ctx2D.drawImage(image, 0 , fontSize+20, null);
ctx2D.drawString(title, fontSize+5, fontSize+30);
ctx2D.drawImage(image, 0 , fontSize+50, null);
return canvas;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ public static BufferedImage qrStringWithMoodbar(Vector<Color> moodbar, BitMatrix
return destination;
}

public static BufferedImage invert(BufferedImage loadImg) {
for (int x = 0; x < loadImg.getWidth(); x++) {
for (int y = 0; y < loadImg.getHeight(); y++) {
int rgba = loadImg.getRGB(x, y);
Color col = new Color(rgba, true);
col = new Color(255 - col.getRed(),
255 - col.getGreen(),
255 - col.getBlue());
loadImg.setRGB(x, y, col.getRGB());
}
}

return loadImg;
}


public static BufferedImage tint(BufferedImage loadImg, Color COLOR, int h1) {
for(int x = 0; x < loadImg.getWidth(); x++)
Expand Down

0 comments on commit 77a889a

Please sign in to comment.