Pass a color rather than an integer to the recoloration routine.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1100 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-03-08 01:38:12 +00:00
parent ad5a5c4e6d
commit 87c4c756e4
2 changed files with 7 additions and 8 deletions
@@ -1,5 +1,5 @@
//
// $Id: ImageUtil.java,v 1.5 2002/02/25 07:14:56 mdb Exp $
// $Id: ImageUtil.java,v 1.6 2002/03/08 01:38:12 mdb Exp $
package com.threerings.media.util;
@@ -98,7 +98,7 @@ public class ImageUtil
* and modifying it.
*/
public static BufferedImage recolorImage (
BufferedImage image, int rootColor, float[] dists, float[] offsets)
BufferedImage image, Color rootColor, float[] dists, float[] offsets)
{
ColorModel cm = image.getColorModel();
if (!(cm instanceof IndexColorModel)) {
@@ -108,9 +108,8 @@ public class ImageUtil
}
// first convert the root color to HSV for later comparison
Color rcolor = new Color(rootColor);
float[] rHSV = Color.RGBtoHSB(rcolor.getRed(), rcolor.getGreen(),
rcolor.getBlue(), null);
float[] rHSV = Color.RGBtoHSB(rootColor.getRed(), rootColor.getGreen(),
rootColor.getBlue(), null);
int[] frHSV = toFixedHSV(rHSV, null);
// now process the image
@@ -1,5 +1,5 @@
//
// $Id: RecolorImage.java,v 1.1 2002/02/25 07:28:34 mdb Exp $
// $Id: RecolorImage.java,v 1.2 2002/03/08 01:38:12 mdb Exp $
package com.threerings.media.tools;
@@ -141,8 +141,8 @@ public class RecolorImage extends JPanel
float valO = Float.parseFloat(_valueO.getText());
float[] offsets = new float[] { hueO, satO, valO };
BufferedImage image =
ImageUtil.recolorImage(_image, color, dists, offsets);
BufferedImage image = ImageUtil.recolorImage(
_image, new Color(color), dists, offsets);
_newImage.setIcon(new ImageIcon(image));
_status.setText("Recolored image.");
repaint();