Supprimé code pour rendre plus foncé les couches précédentes (à voir

pour plus tard pour y réimplémenter)
This commit is contained in:
galaxyoyo 2015-01-11 12:37:18 +01:00
parent fb10d14f8c
commit c745571cc9
1 changed files with 7 additions and 32 deletions

View File

@ -2,9 +2,7 @@ package galaxyoyo.unknown.editor;
import galaxyoyo.unknown.api.editor.Case; import galaxyoyo.unknown.api.editor.Case;
import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -47,60 +45,37 @@ public class MapPanel extends JPanel
if (isEmpty(c.getCoucheOne().getImage())) if (isEmpty(c.getCoucheOne().getImage()))
continue; continue;
BufferedImage image; // BufferedImage image;
g.drawImage(c.getCoucheOne().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null); g.drawImage(c.getCoucheOne().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
if (frame.getSelectedLayerIndex() != 0) if (frame.getSelectedLayerIndex() != 0)
{ /* {
image = recalculateAplha(c.getCoucheOne().getImage(), 0); image = recalculateAplha(c.getCoucheOne().getImage(), 0);
g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null); g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
} }*/
if (isEmpty(c.getCoucheTwo().getImage()) || (frame.getSelectedLayerIndex() != 1 && frame.getSelectedLayerIndex() != 2)) if (isEmpty(c.getCoucheTwo().getImage()) || (frame.getSelectedLayerIndex() != 1 && frame.getSelectedLayerIndex() != 2))
continue; continue;
g.drawImage(c.getCoucheTwo().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null); g.drawImage(c.getCoucheTwo().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
if (frame.getSelectedLayerIndex() != 1) /* if (frame.getSelectedLayerIndex() != 1)
{ {
image = recalculateAplha(c.getCoucheTwo().getImage(), 1); image = recalculateAplha(c.getCoucheTwo().getImage(), 1);
g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null); g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
} }*/
if (isEmpty(c.getCoucheThree().getImage()) || frame.getSelectedLayerIndex() != 2) if (isEmpty(c.getCoucheThree().getImage()) || frame.getSelectedLayerIndex() != 2)
continue; continue;
g.drawImage(c.getCoucheThree().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null); g.drawImage(c.getCoucheThree().getImage(), x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
if (frame.getSelectedLayerIndex() != 2) /* if (frame.getSelectedLayerIndex() != 2)
{ {
image = recalculateAplha(c.getCoucheThree().getImage(), 2); image = recalculateAplha(c.getCoucheThree().getImage(), 2);
g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null); g.drawImage(image, x + c.getPosX() * 34 + 2, y + c.getPosY() * 34 + 2, 32, 32, null);
} }*/
} }
} }
private BufferedImage recalculateAplha(BufferedImage image, int couche)
{
BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
for (int x = 0; x < image.getWidth(); ++x)
{
for (int y = 0; y < image.getHeight(); ++y)
{
Color ref = new Color(image.getRGB(x, y));
int red = ref.getRed() / 2;
int green = ref.getGreen() / 2;
int blue = ref.getBlue() / 2;
if (image.getRGB(x, y) == 0xFFFFFF)
continue;
Graphics2D g = img.createGraphics();
g.setColor(new Color(red / 3 * couche == 2 ? 1 : 2, green / 3 * couche == 2 ? 1 : 2, blue / 3 * couche == 2 ? 1 : 2, 100));
g.drawLine(x, y, x, y);
}
}
return img;
}
private boolean isEmpty(BufferedImage image) private boolean isEmpty(BufferedImage image)
{ {
int allrgba = 0; int allrgba = 0;