Commit 21098208 authored by lafabregue's avatar lafabregue

fixed tansparency problem, need to be commented while not compatible

parent 139de79d
......@@ -30,12 +30,12 @@ import jcl.learning.methods.monostrategy.SingleClassification;
import jcl.learning.methods.monostrategy.ahc.LearningResultAHC;
import jcl.learning.methods.monostrategy.ahc.ParametersAHC;
//<<<< TRANSPARENCE
//import jcl.utils.Images.StreamedImageReaderWrapper;
import jcl.utils.Images.StreamedImageReaderWrapper;
//>>>> TRANSPARENCE
import jsl.Segmentation;
import jsl.regionalisation.vectorisation.Filters;
//<<<< TRANSPARENCE
//import loci.formats.FormatException;
import loci.formats.FormatException;
//>>>> TRANSPARENCE
import mustic.gui.*;
import mustic.gui.dialog.FilterDialog;
......@@ -131,19 +131,19 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
//<<<< TRANSPARENCE
// clusters' opacity
// up to 0 - 1
// public static float opacity = 1;
//
// public static float opacityCluster = 1;
//
// public float getOpacity()
// {
// return opacity;
// }
//
// public float getOpacityCluster()
// {
// return opacityCluster;
// }
public static float opacity = 1;
public static float opacityCluster = 1;
public float getOpacity()
{
return opacity;
}
public float getOpacityCluster()
{
return opacityCluster;
}
//>>>> TRANSPARENCE
/**
......@@ -1385,7 +1385,7 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
this.colored = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
// <<<< TRANSPARENCE
// StreamedImageReaderWrapper wrapper = new StreamedImageReaderWrapper(imgData.getDataFilesName().get(0));
StreamedImageReaderWrapper wrapper = new StreamedImageReaderWrapper(imgData.getDataFilesName().get(0));
// >>>> TRANSPARENCE
int current = 0;
for (int i = 0; i < width * height; i++) {
......@@ -1396,67 +1396,64 @@ public class ImageResultPanel extends ResultPanel implements TreeSelectionListen
if (x >= 0 && x < w) {
if (y >= 0 && y < h) {
Cluster c = this.classification.getClusteringResult().getCluster(map[current]);
if (c != null) {
if (c.isVisible()) // cluster's color
{
if (x >= 0 && x < w && y >= 0 && y < h) {
Cluster c = this.classification.getClusteringResult().getCluster(map[current]);
if (c != null) {
if (c.isVisible()) // cluster's color
{
// <<<< TRANSPARENCE
// if (getOpacityCluster() == 1.0)
if (getOpacityCluster() == 1.0) {
// >>>> TRANSPARENCE
couleur = c.getColor().getRGB();
couleur = c.getColor().getRGB();
} else {
// couleur = Color.black.getRGB();
// <<<< TRANSPARENCE
try
{
int r = (int)wrapper.getPixel(x, y)[0];
int g = (int)wrapper.getPixel(x, y)[1];
int b = (int)wrapper.getPixel(x, y)[2];
Color couleurFont = new Color(r, g, b);
couleurFont = blend(Color.black, couleurFont, getOpacity());
couleur = blend(couleurFont, c.getColor(), getOpacityCluster()).getRGB();
}
else
couleur = Color.black.getRGB();
// <<<< TRANSPARENCE
// try
// {
// int r = (int)wrapper.getPixel(x, y)[0];
// int g = (int)wrapper.getPixel(x, y)[1];
// int b = (int)wrapper.getPixel(x, y)[2];
//
// Color couleurFont = new Color(r, g, b);
// couleurFont = blend(Color.black, couleurFont, getOpacity());
//
// couleur = blend(couleurFont, c.getColor(), getOpacityCluster()).getRGB();
// }
// catch (FormatException e)
// {
// e.printStackTrace();
// }
// catch (IOException e)
// {
// e.printStackTrace();
// }
// }
// }
// else // font image's color
// {
// try
// {
// int r = (int)wrapper.getPixel(x, y)[0];
// int g = (int)wrapper.getPixel(x, y)[1];
// int b = (int)wrapper.getPixel(x, y)[2];
//
// Color couleurFont = new Color(r, g, b);
//
// couleur = blend(Color.black, couleurFont, getOpacity()).getRGB();
// }
// catch (FormatException e)
// {
// e.printStackTrace();
// }
// catch (IOException e)
// {
// e.printStackTrace();
// }
// }
catch (FormatException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
else // font image's color
{
try
{
int r = (int)wrapper.getPixel(x, y)[0];
int g = (int)wrapper.getPixel(x, y)[1];
int b = (int)wrapper.getPixel(x, y)[2];
Color couleurFont = new Color(r, g, b);
couleur = blend(Color.black, couleurFont, getOpacity()).getRGB();
}
catch (FormatException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
// >>>> TRANSPARENCE
}
this.colored.setRGB(x, y, couleur);
}
}
this.colored.setRGB(x, y, couleur);
}
current++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment