From 91c173b6e51a711d67090afa0ec0215f177627ce Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 17 Jan 2003 00:41:49 +0000 Subject: [PATCH] added commented out method that caused me trouble, but we may want it or a varient someday. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2169 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/image/ImageUtil.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/media/image/ImageUtil.java b/src/java/com/threerings/media/image/ImageUtil.java index e404dfceb..de7bdc0cf 100644 --- a/src/java/com/threerings/media/image/ImageUtil.java +++ b/src/java/com/threerings/media/image/ImageUtil.java @@ -1,5 +1,5 @@ // -// $Id: ImageUtil.java,v 1.24 2003/01/16 21:38:11 ray Exp $ +// $Id: ImageUtil.java,v 1.25 2003/01/17 00:41:49 ray Exp $ package com.threerings.media.image; @@ -22,6 +22,8 @@ import java.awt.image.IndexColorModel; import java.awt.image.Raster; import java.awt.image.WritableRaster; +import java.awt.geom.Area; + import java.util.Arrays; import java.util.Iterator; @@ -184,6 +186,41 @@ public class ImageUtil } } + // Not fully added because we're not using it anywhere, plus + // it's probably a little sketchy to create Area objects with all + // this pixely data. + // Also, the Area was getting zeroed out when it was translated. Something + // to look into someday if anyone wants to use this method. +// /** +// * Creates a mask that is opaque in the non-transparent areas of the +// * source image. +// */ +// public static Area createImageMask (BufferedImage src) +// { +// Raster srcdata = src.getData(); +// if (srcdata.getNumBands() != 4) { +// throw new IllegalArgumentException( +// "Can't create a mask of an image with no transparency " + +// "[image=" + src + "]."); +// } +// +// int wid = src.getWidth(), hei = src.getHeight(); +// Log.info("creating area of (" + wid + ", " + hei + ")"); +// Area a = new Area(new Rectangle(wid, hei)); +// Rectangle r = new Rectangle(1, 1); +// +// for (int yy=0; yy < hei; yy++) { +// for (int xx=0; xx < wid; xx++) { +// if (srcdata.getSample(xx, yy, 0) == 0) { +// r.setLocation(xx, yy); +// a.subtract(new Area(r)); +// } +// } +// } +// +// return a; +// } + /** * Creates and returns a new image consisting of the supplied image * traced with the given color and thickness.