//
// $Id: Colorization.java,v 1.1 2002/03/08 07:50:32 mdb Exp $

package com.threerings.cast;

import java.awt.Color;

/**
 * Used to support colorization of character component images.
 */
public class Colorization
{
    /** Every colorization must have a unique name that can be used to
     * compare a particular colorization record with another. */
    public String name;

    /** The root color for the colorization. */
    public Color rootColor;

    /** The range around the root color that will be colorized (in
     * delta-hue, delta-saturation, delta-value. */
    public float[] range;

    /** The adjustments to make to hue, saturation and value. */
    public float[] offsets;

    /**
     * Constructs a colorization record with the specified name.
     */
    public Colorization (String name, Color rootColor,
                         float[] range, float[] offsets)
    {
        this.name = name;
        this.rootColor = rootColor;
        this.range = range;
        this.offsets = offsets;
    }

    /**
     * Compares this colorization to another based on name.
     */
    public boolean equals (Object other)
    {
        if (other instanceof Colorization) {
            return ((Colorization)other).name.equals(name);
        } else {
            return false;
        }
    }

    /**
     * Returns a string representation of this colorization.
     */
    public String toString ()
    {
        return name;
    }
}

@@ -26,17 +26,17 @@
 ava,v 1.
-1
+2
  2002/03
@@ -43,16 +43,16 @@
 /08 
-07:50:32
+21:16:07
  mdb
@@ -111,16 +111,60 @@
 t.Color;
+%0Aimport com.threerings.media.util.ImageUtil;
 %0A%0A/**%0A *
@@ -1054,32 +1054,366 @@
 offsets;%0A    %7D%0A%0A
+    /**%0A     * Returns the root color adjusted by the colorization.%0A     */%0A    public Color getColorizedRoot ()%0A    %7B%0A        float%5B%5D hsv = Color.RGBtoHSB(rootColor.getRed(), rootColor.getGreen(),%0A                                     rootColor.getBlue(), null);%0A        return new Color(ImageUtil.recolorColor(hsv, offsets));%0A    %7D%0A%0A
     /**%0A     * C

Provide a mechanism for getting the root color adjusted by the colorization offsets.