diff --git a/src/java/com/threerings/media/image/ColorPository.java b/src/java/com/threerings/media/image/ColorPository.java index bf56b74e..4a063ba9 100644 --- a/src/java/com/threerings/media/image/ColorPository.java +++ b/src/java/com/threerings/media/image/ColorPository.java @@ -351,6 +351,29 @@ public class ColorPository implements Serializable return null; } + /** + * Looks up a colorization by class and color names. + */ + public Colorization getColorization (String className, String colorName) + { + ClassRecord crec = getClassRecord(className); + if (crec != null) { + int colorId = 0; + try { + colorId = crec.getColorId(colorName); + } catch (ParseException pe) { + Log.info("Error getting colorization by name. [error=" + pe + "]"); + return null; + } + + ColorRecord color = (ColorRecord)crec.colors.get(colorId); + if (color != null) { + return color.getColorization(); + } + } + return null; + } + /** * Loads up a colorization class by name and logs a warning if it * doesn't exist. @@ -389,6 +412,30 @@ public class ColorPository implements Serializable return (ColorRecord)record.colors.get(colorId); } + /** + * Looks up the requested color record by class & color names. + */ + public ColorRecord getColorRecord (String className, String colorName) + { + ClassRecord record = getClassRecord(className); + if (record == null) { + Log.warning("Requested unknown color class " + + "[className=" + className + ", colorName=" + colorName + "]."); + Thread.dumpStack(); + return null; + } + + int colorId = 0; + try { + colorId = record.getColorId(colorName); + } catch (ParseException pe) { + Log.info("Error getting color record by name. [error=" + pe + "]"); + return null; + } + + return (ColorRecord)record.colors.get(colorId); + } + /** * Adds a fully configured color class record to the pository. This is * only called by the XML parsing code, so pay it no mind.