[Polycasso-commit] SF.net SVN: polycasso:[134] trunk/polycasso/src/com/mebigfatguy/polycasso/ Image
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-12-02 05:53:08
|
Revision: 134
http://polycasso.svn.sourceforge.net/polycasso/?rev=134&view=rev
Author: dbrosius
Date: 2009-12-02 05:52:59 +0000 (Wed, 02 Dec 2009)
Log Message:
-----------
need to cache the candidateImage, and need to fire the event synchronously
Modified Paths:
--------------
trunk/polycasso/src/com/mebigfatguy/polycasso/ImageGenerator.java
Modified: trunk/polycasso/src/com/mebigfatguy/polycasso/ImageGenerator.java
===================================================================
--- trunk/polycasso/src/com/mebigfatguy/polycasso/ImageGenerator.java 2009-12-01 15:31:35 UTC (rev 133)
+++ trunk/polycasso/src/com/mebigfatguy/polycasso/ImageGenerator.java 2009-12-02 05:52:59 UTC (rev 134)
@@ -42,6 +42,7 @@
private BufferedImage targetImage;
private PolygonData[] bestData;
private double bestScore = Double.MAX_VALUE;
+ private BufferedImage candidateImage;
private PolygonData[] candidateData;
private double candidateScore = Double.MAX_VALUE;
private int candidateStart = 0;
@@ -200,6 +201,7 @@
wasSuccessful = true;
candidateData = data.toArray(new PolygonData[data.size()]);
candidateScore = delta;
+ candidateImage = image;
if (Polycasso.DEBUG)
message = "Attempt: " + attempt + " CandidateScore: " + candidateScore + " BestScore: " + bestScore + " type: " + type.name();
@@ -210,6 +212,7 @@
bestData = candidateData;
bestScore = candidateScore;
newBest = true;
+ fireImageGenerated(candidateImage);
}
candidateStart = attempt;
}
@@ -220,8 +223,7 @@
System.out.println(message);
}
- if (newBest) {
- fireImageGenerated(image);
+ if (wasSuccessful) {
image = new BufferedImage(imageSize.width, imageSize.height, BufferedImage.TYPE_4BYTE_ABGR);
g2d = (Graphics2D)image.getGraphics();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|