You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by tk...@apache.org on 2001/05/02 17:41:46 UTC
cvs commit: xml-batik/sources/org/apache/batik/ext/awt/image/renderable AbstractColorInterpolationRable.java FilterColorInterpolation.java ColorMatrixRable.java ColorMatrixRable8Bit.java ComponentTransferRable.java ComponentTransferRable8Bit.java CompositeRable.java CompositeRable8Bit.java ConvolveMatrixRable.java ConvolveMatrixRable8Bit.java DisplacementMapRable.java DisplacementMapRable8Bit.java GaussianBlurRable.java GaussianBlurRable8Bit.java TurbulenceRable.java TurbulenceRable8Bit.java AbstractColorInterpRable.java FilterColorInterp.java
tkormann 01/05/02 08:41:44
Modified: sources/org/apache/batik/ext/awt/image/renderable
ColorMatrixRable.java ColorMatrixRable8Bit.java
ComponentTransferRable.java
ComponentTransferRable8Bit.java CompositeRable.java
CompositeRable8Bit.java ConvolveMatrixRable.java
ConvolveMatrixRable8Bit.java
DisplacementMapRable.java
DisplacementMapRable8Bit.java
GaussianBlurRable.java GaussianBlurRable8Bit.java
TurbulenceRable.java TurbulenceRable8Bit.java
Added: sources/org/apache/batik/ext/awt/image/renderable
AbstractColorInterpolationRable.java
FilterColorInterpolation.java
Removed: sources/org/apache/batik/ext/awt/image/renderable
AbstractColorInterpRable.java
FilterColorInterp.java
Log:
rename the Color Interpolation related class.
color-interpolation-filter property should come soon.
Revision Changes Path
1.3 +6 -5 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ColorMatrixRable.java
Index: ColorMatrixRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ColorMatrixRable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ColorMatrixRable.java 2001/04/27 19:53:45 1.2
+++ ColorMatrixRable.java 2001/05/02 15:41:02 1.3
@@ -13,9 +13,10 @@
* operation
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: ColorMatrixRable.java,v 1.2 2001/04/27 19:53:45 deweese Exp $
+ * @version $Id: ColorMatrixRable.java,v 1.3 2001/05/02 15:41:02 tkormann Exp $
*/
-public interface ColorMatrixRable extends FilterColorInterp {
+public interface ColorMatrixRable extends FilterColorInterpolation {
+
/**
* Identifier used to refer to predefined matrices
*/
@@ -28,7 +29,7 @@
* Returns the source to be offset.
*/
public Filter getSource();
-
+
/**
* Sets the source to be offset.
* @param src image to offset.
@@ -36,7 +37,7 @@
public void setSource(Filter src);
/**
- * Returns the type of this color matrix.
+ * Returns the type of this color matrix.
* @return one of TYPE_MATRIX, TYPE_SATURATE, TYPE_HUE_ROTATE,
* TYPE_LUMINANCE_TO_ALPHA
*/
@@ -47,5 +48,5 @@
* the same convention as BandCombineOp.
*/
public float[][] getMatrix();
-
+
}
1.5 +2 -2 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ColorMatrixRable8Bit.java
Index: ColorMatrixRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ColorMatrixRable8Bit.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ColorMatrixRable8Bit.java 2001/04/27 19:53:46 1.4
+++ ColorMatrixRable8Bit.java 2001/05/02 15:41:04 1.5
@@ -19,10 +19,10 @@
* operation
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: ColorMatrixRable8Bit.java,v 1.4 2001/04/27 19:53:46 deweese Exp $
+ * @version $Id: ColorMatrixRable8Bit.java,v 1.5 2001/05/02 15:41:04 tkormann Exp $
*/
public class ColorMatrixRable8Bit
- extends AbstractColorInterpRable
+ extends AbstractColorInterpolationRable
implements ColorMatrixRable {
/**
* Predefined luminanceToAlpha matrix
1.4 +6 -5 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ComponentTransferRable.java
Index: ComponentTransferRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ComponentTransferRable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ComponentTransferRable.java 2001/04/27 19:53:46 1.3
+++ ComponentTransferRable.java 2001/05/02 15:41:05 1.4
@@ -11,24 +11,25 @@
import org.apache.batik.ext.awt.image.ComponentTransferFunction;
/**
- * Defines the interface expected from a component
+ * Defines the interface expected from a component
* transfer operation.
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: ComponentTransferRable.java,v 1.3 2001/04/27 19:53:46 deweese Exp $
+ * @version $Id: ComponentTransferRable.java,v 1.4 2001/05/02 15:41:05 tkormann Exp $
*/
-public interface ComponentTransferRable extends FilterColorInterp {
+public interface ComponentTransferRable extends FilterColorInterpolation {
+
/**
* Returns the source to be offset.
*/
public Filter getSource();
-
+
/**
* Sets the source to be offset.
* @param src image to offset.
*/
public void setSource(Filter src);
-
+
/**
* Returns the transfer function for the alpha channel
*/
1.4 +9 -9 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ComponentTransferRable8Bit.java
Index: ComponentTransferRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ComponentTransferRable8Bit.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ComponentTransferRable8Bit.java 2001/04/27 19:53:47 1.3
+++ ComponentTransferRable8Bit.java 2001/05/02 15:41:08 1.4
@@ -27,14 +27,14 @@
import org.apache.batik.ext.awt.image.GammaTransfer;
/**
- * This class implements the interface expected from a component
+ * This class implements the interface expected from a component
* transfer operation.
- *
+ *
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: ComponentTransferRable8Bit.java,v 1.3 2001/04/27 19:53:47 deweese Exp $
+ * @version $Id: ComponentTransferRable8Bit.java,v 1.4 2001/05/02 15:41:08 tkormann Exp $
*/
-public class ComponentTransferRable8Bit
- extends AbstractColorInterpRable
+public class ComponentTransferRable8Bit
+ extends AbstractColorInterpolationRable
implements ComponentTransferRable {
public static final int ALPHA = 0;
@@ -46,14 +46,14 @@
* Array of transfer functions. There are four
* elements. Elements may be null.
*/
- private ComponentTransferFunction
+ private ComponentTransferFunction
functions[] = new ComponentTransferFunction[4];
/**
* Array of transfer functions. Elements are computed
* lazily.
*/
- private TransferFunction
+ private TransferFunction
txfFunc[] = new TransferFunction[4];
public ComponentTransferRable8Bit(Filter src,
@@ -151,13 +151,13 @@
if(srcRI == null)
return null;
- return new ComponentTransferRed(convertSourceCS(srcRI),
+ return new ComponentTransferRed(convertSourceCS(srcRI),
getTransferFunctions(),
rc.getRenderingHints());
}
/**
- * Builds an array of transfer functions for the
+ * Builds an array of transfer functions for the
* ComponentTransferOp.
*/
private TransferFunction[] getTransferFunctions(){
1.5 +15 -14 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/CompositeRable.java
Index: CompositeRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/CompositeRable.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CompositeRable.java 2001/03/29 13:52:32 1.4
+++ CompositeRable.java 2001/05/02 15:41:09 1.5
@@ -18,24 +18,25 @@
* the image are applied in the order they are in the List given.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: CompositeRable.java,v 1.4 2001/03/29 13:52:32 deweese Exp $
+ * @version $Id: CompositeRable.java,v 1.5 2001/05/02 15:41:09 tkormann Exp $
*/
-public interface CompositeRable extends FilterColorInterp {
- /**
- * The sources to be composited togeather.
- * @param srcs The list of images to be composited by the composite rule.
- */
+public interface CompositeRable extends FilterColorInterpolation {
+
+ /**
+ * The sources to be composited togeather.
+ * @param srcs The list of images to be composited by the composite rule.
+ */
public void setSources(List srcs);
- /**
- * Set the composite rule to use for combining the sources.
- * @param cr Composite rule to use.
- */
+ /**
+ * Set the composite rule to use for combining the sources.
+ * @param cr Composite rule to use.
+ */
public void setCompositeRule(CompositeRule cr);
- /**
- * Get the composite rule in use for combining the sources.
- * @return Composite rule currently in use.
- */
+ /**
+ * Get the composite rule in use for combining the sources.
+ * @return Composite rule currently in use.
+ */
public CompositeRule getCompositeRule();
}
1.10 +13 -13 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/CompositeRable8Bit.java
Index: CompositeRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/CompositeRable8Bit.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- CompositeRable8Bit.java 2001/03/29 13:52:32 1.9
+++ CompositeRable8Bit.java 2001/05/02 15:41:11 1.10
@@ -39,10 +39,10 @@
* the image are applied in the order they are in the List given.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: CompositeRable8Bit.java,v 1.9 2001/03/29 13:52:32 deweese Exp $
+ * @version $Id: CompositeRable8Bit.java,v 1.10 2001/05/02 15:41:11 tkormann Exp $
*/
public class CompositeRable8Bit
- extends AbstractColorInterpRable
+ extends AbstractColorInterpolationRable
implements CompositeRable, PaintRable {
protected CompositeRule rule;
@@ -52,7 +52,7 @@
boolean csIsLinear) {
super(srcs);
- setCSLinear(csIsLinear);
+ setColorSpaceLinear(csIsLinear);
this.rule = rule;
}
@@ -83,13 +83,13 @@
}
/**
- * Should perform the equivilent action as
- * createRendering followed by drawing the RenderedImage to
+ * Should perform the equivilent action as
+ * createRendering followed by drawing the RenderedImage to
* Graphics2D, or return false.
*
* @param g2d The Graphics2D to draw to.
* @return true if the paint call succeeded, false if
- * for some reason the paint failed (in which
+ * for some reason the paint failed (in which
* case a createRendering should be used).
*/
public boolean paintRable(Graphics2D g2d) {
@@ -98,9 +98,9 @@
Composite c = g2d.getComposite();
if (!SVGComposite.OVER.equals(c))
return false;
-
+
// For the over mode we can just draw them in order...
- if (getCompositeRule() != CompositeRule.OVER)
+ if (getCompositeRule() != CompositeRule.OVER)
return false;
ColorSpace crCS = getOperationColorSpace();
@@ -130,14 +130,14 @@
Shape aoi = rc.getAreaOfInterest();
Rectangle2D aoiR;
- if (aoi == null)
+ if (aoi == null)
aoiR = getBounds2D();
else {
aoiR = aoi.getBounds2D();
Rectangle2D bounds2d = getBounds2D();
if (bounds2d.intersects(aoiR) == false)
return null;
-
+
Rectangle2D.intersect(aoiR, bounds2d, aoiR);
}
@@ -146,7 +146,7 @@
rc = new RenderContext(at, aoiR, rh);
Vector srcs = new Vector();
-
+
Iterator i = getSources().iterator();
while (i.hasNext()) {
// Get the source to work with...
@@ -159,7 +159,7 @@
cr = convertSourceCS(ri);
srcs.add(cr);
} else {
-
+
// Blank image...
switch (rule.getRule()) {
case CompositeRule.RULE_IN:
@@ -168,7 +168,7 @@
return null;
case CompositeRule.RULE_OUT:
- // For mode OUT blank image clears output
+ // For mode OUT blank image clears output
// up to this point, so ignore inputs to this point.
srcs.clear();
break;
1.4 +5 -5 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable.java
Index: ConvolveMatrixRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ConvolveMatrixRable.java 2001/04/27 19:53:47 1.3
+++ ConvolveMatrixRable.java 2001/05/02 15:41:12 1.4
@@ -17,15 +17,15 @@
* Convolves an image with a convolution matrix.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: ConvolveMatrixRable.java,v 1.3 2001/04/27 19:53:47 deweese Exp $
+ * @version $Id: ConvolveMatrixRable.java,v 1.4 2001/05/02 15:41:12 tkormann Exp $
*/
-public interface ConvolveMatrixRable extends FilterColorInterp {
+public interface ConvolveMatrixRable extends FilterColorInterpolation {
/**
* Returns the source to be Convolved
*/
public Filter getSource();
-
+
/**
* Sets the source to be Convolved
* @param src image to Convolved.
@@ -60,7 +60,7 @@
* Returns the shift value to apply to the result of convolution
*/
public double getBias();
-
+
/**
* Sets the shift value to apply to the result of convolution
*/
@@ -70,7 +70,7 @@
* Returns the current edge handling mode.
*/
public PadMode getEdgeMode();
-
+
/**
* Sets the current edge handling mode.
*/
1.4 +33 -34 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java
Index: ConvolveMatrixRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ConvolveMatrixRable8Bit.java 2001/04/27 19:53:48 1.3
+++ ConvolveMatrixRable8Bit.java 2001/05/02 15:41:14 1.4
@@ -46,12 +46,11 @@
* Does not support edgeMode="wrap" - pending Tile code.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: ConvolveMatrixRable8Bit.java,v 1.3 2001/04/27 19:53:48 deweese Exp $
+ * @version $Id: ConvolveMatrixRable8Bit.java,v 1.4 2001/05/02 15:41:14 tkormann Exp $
*/
-public class ConvolveMatrixRable8Bit
- extends AbstractColorInterpRable
- implements ConvolveMatrixRable
-{
+public class ConvolveMatrixRable8Bit
+ extends AbstractColorInterpolationRable
+ implements ConvolveMatrixRable {
Kernel kernel;
Point target;
@@ -104,7 +103,7 @@
public double getBias() {
return bias;
}
-
+
/**
* Returns the shift value to apply to the result of convolution
*/
@@ -119,7 +118,7 @@
public PadMode getEdgeMode() {
return edgeMode;
}
-
+
/**
* Sets the current edge handling mode.
*/
@@ -132,7 +131,7 @@
* Returns the [x,y] distance in user space between kernel values
*/
public double [] getKernelUnitLength() {
- if (kernelUnitLength == null)
+ if (kernelUnitLength == null)
return null;
double [] ret = new double[2];
@@ -154,7 +153,7 @@
if (this.kernelUnitLength == null)
this.kernelUnitLength = new float[2];
-
+
this.kernelUnitLength[0] = (float)kernelUnitLength[0];
this.kernelUnitLength[1] = (float)kernelUnitLength[1];
}
@@ -207,13 +206,13 @@
// These values represent the scale factor to the intermediate
// coordinate system where we will apply our convolution.
if (kernelUnitLength != null) {
- if (kernelUnitLength[0] > 0.0)
+ if (kernelUnitLength[0] > 0.0)
scaleX = 1/kernelUnitLength[0];
-
- if (kernelUnitLength[1] > 0.0)
+
+ if (kernelUnitLength[1] > 0.0)
scaleY = 1/kernelUnitLength[1];
}
-
+
Shape aoi = rc.getAreaOfInterest();
if(aoi == null)
aoi = getBounds2D();
@@ -226,7 +225,7 @@
int ky = target.y;
// Grow the region in usr space.
- {
+ {
double rx0 = r.getX() -(kx/scaleX);
double ry0 = r.getY() -(ky/scaleY);
double rx1 = rx0 + r.getWidth() + (kw-1)/scaleX;
@@ -240,7 +239,7 @@
// an intermediate space which is scaled according to
// kernelUnitLength and is axially aligned with our user
// space.
- AffineTransform srcAt
+ AffineTransform srcAt
= AffineTransform.getScaleInstance(scaleX, scaleY);
// This is the affine transform between our intermediate
@@ -260,7 +259,7 @@
return null;
// org.apache.batik.test.gvt.ImageDisplay.printImage
- // ("Padded Image", ri,
+ // ("Padded Image", ri,
// new Rectangle(ri.getMinX()+22,ri.getMinY()+38,5,5));
CachableRed cr = convertSourceCS(ri);
@@ -268,10 +267,10 @@
Shape devShape = srcAt.createTransformedShape(aoi);
Rectangle2D devRect = devShape.getBounds2D();
r = devRect;
- r = new Rectangle2D.Double(Math.floor(r.getX()-kx),
+ r = new Rectangle2D.Double(Math.floor(r.getX()-kx),
Math.floor(r.getY()-ky),
Math.ceil (r.getX()+r.getWidth())-
- Math.floor(r.getX())+(kw-1),
+ Math.floor(r.getX())+(kw-1),
Math.ceil (r.getY()+r.getHeight())-
Math.floor(r.getY())+(kh-1));
@@ -283,14 +282,14 @@
}
// org.apache.batik.test.gvt.ImageDisplay.printImage
- // ("Padded Image", cr,
+ // ("Padded Image", cr,
// new Rectangle(cr.getMinX()+23,cr.getMinY()+39,5,5));
if (bias != 0.0)
throw new IllegalArgumentException
("Only bias equal to zero is supported in ConvolveMatrix.");
-
- BufferedImageOp op = new ConvolveOp(kernel,
+
+ BufferedImageOp op = new ConvolveOp(kernel,
ConvolveOp.EDGE_NO_OP,
rh);
@@ -301,7 +300,7 @@
// build a WritableRaster. This avoids a copy of the data.
Raster rr = cr.getData();
WritableRaster wr = GraphicsUtil.makeRasterWritable(rr, 0, 0);
-
+
// Here we update the translate to account for the phase shift
// (if any) introduced by setting targetX, targetY in SVG.
int phaseShiftX = target.x - kernel.getXOrigin();
@@ -328,19 +327,19 @@
// Construct a linear sRGB cm without alpha...
cm = new DirectColorModel(ColorSpace.getInstance
(ColorSpace.CS_LINEAR_RGB), 24,
- 0x00FF0000, 0x0000FF00,
- 0x000000FF, 0x0, false,
+ 0x00FF0000, 0x0000FF00,
+ 0x000000FF, 0x0, false,
DataBuffer.TYPE_INT);
-
+
// Create an image with that color model
BufferedImage tmpSrcBI = new BufferedImage
(cm, cm.createCompatibleWritableRaster(wr.getWidth(),
- wr.getHeight()),
+ wr.getHeight()),
cm.isAlphaPremultiplied(), null);
- // Copy the color data (no alpha) to that image
+ // Copy the color data (no alpha) to that image
// (dividing out alpha if needed).
GraphicsUtil.copyData(srcBI, tmpSrcBI);
@@ -359,7 +358,7 @@
// an alpha channel.
// Create the Raster (note we are using 'cm' again).
- WritableRaster dstWR =
+ WritableRaster dstWR =
Raster.createWritableRaster
(cm.createCompatibleSampleModel(wr.getWidth(), wr.getHeight()),
destBI.getRaster().getDataBuffer(),
@@ -368,7 +367,7 @@
// Create the BufferedImage.
BufferedImage tmpDstBI = new BufferedImage
(cm, dstWR, cm.isAlphaPremultiplied(), null);
-
+
// Filter between the two image without alpha.
tmpDstBI = op.filter(tmpSrcBI, tmpDstBI);
@@ -385,12 +384,12 @@
destBI.getRaster(), dstRect,
destBI.getRaster().getNumBands()-1);
}
-
+
// Wrap it as a CachableRed
cr = new BufferedImageCachableRed(destBI, destX, destY);
-
+
// org.apache.batik.test.gvt.ImageDisplay.printImage
- // ("Cropped Image", cr,
+ // ("Cropped Image", cr,
// new Rectangle(cr.getMinX()+22,cr.getMinY()+38,5,5));
// org.apache.batik.test.gvt.ImageDisplay.printImage
// ("Cropped sRGB", GraphicsUtil.convertTosRGB(cr),
@@ -402,9 +401,9 @@
// If we need to scale/rotate/translate the result do so now...
if (!resAt.isIdentity())
cr = new AffineRed(cr, resAt, null);
-
+
// return the result.
return cr;
}
-
+
}
1.4 +3 -2 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable.java
Index: DisplacementMapRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DisplacementMapRable.java 2001/04/27 19:53:49 1.3
+++ DisplacementMapRable.java 2001/05/02 15:41:15 1.4
@@ -17,9 +17,10 @@
* another image to spatially displace the input image
*
* @author <a href="mailto:sheng.pei@eng.sun.com>Sheng Pei</a>
- * @version $Id: DisplacementMapRable.java,v 1.3 2001/04/27 19:53:49 deweese Exp $
+ * @version $Id: DisplacementMapRable.java,v 1.4 2001/05/02 15:41:15 tkormann Exp $
*/
-public interface DisplacementMapRable extends FilterColorInterp {
+public interface DisplacementMapRable extends FilterColorInterpolation {
+
public static final int CHANNEL_R = 1;
public static final int CHANNEL_G = 2;
public static final int CHANNEL_B = 3;
1.7 +16 -15 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java
Index: DisplacementMapRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/DisplacementMapRable8Bit.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DisplacementMapRable8Bit.java 2001/04/27 19:53:49 1.6
+++ DisplacementMapRable8Bit.java 2001/05/02 15:41:17 1.7
@@ -38,11 +38,12 @@
* another image to spatially displace the input image
*
* @author <a href="mailto:sheng.pei@eng.sun.com>Sheng Pei</a>
- * @version $Id: DisplacementMapRable8Bit.java,v 1.6 2001/04/27 19:53:49 deweese Exp $
+ * @version $Id: DisplacementMapRable8Bit.java,v 1.7 2001/05/02 15:41:17 tkormann Exp $
*/
-public class DisplacementMapRable8Bit
- extends AbstractColorInterpRable
- implements DisplacementMapRable{
+public class DisplacementMapRable8Bit
+ extends AbstractColorInterpolationRable
+ implements DisplacementMapRable {
+
/**
* Displacement scale factor
*/
@@ -61,9 +62,9 @@
private ARGBChannel yChannelSelector;
public DisplacementMapRable8Bit(List sources,
- double scale,
- ARGBChannel xChannelSelector,
- ARGBChannel yChannelSelector){
+ double scale,
+ ARGBChannel xChannelSelector,
+ ARGBChannel yChannelSelector){
setSources(sources);
setScale(scale);
setXChannelSelector(xChannelSelector);
@@ -90,7 +91,7 @@
}
/**
- * Sets this filter sources.
+ * Sets this filter sources.
*/
public void setSources(List sources){
if(sources.size() != 2){
@@ -153,8 +154,8 @@
// update the current affine transform
AffineTransform at = rc.getTransform();
- // This splits out the scale from the rest of
- // the transformation.
+ // This splits out the scale from the rest of
+ // the transformation.
double sx = at.getScaleX();
double sy = at.getScaleY();
@@ -177,8 +178,8 @@
// affect the source image so just return it...
if ((scaleX == 0) && (scaleY == 0))
return displaced.createRendering(rc);
+
-
AffineTransform srcAt
= AffineTransform.getScaleInstance(atScaleX, atScaleY);
@@ -236,9 +237,9 @@
ColorModel mapCM = mapRed.getColorModel();
// ensure map isn't pre-multiplied.
GraphicsUtil.coerceData((WritableRaster)mapRas, mapCM, false);
+
-
- DisplacementMapOp op
+ DisplacementMapOp op
= new DisplacementMapOp(xChannelSelector,
yChannelSelector,
scaleX, scaleY,
@@ -247,7 +248,7 @@
WritableRaster destRas = op.filter(displacedRas, null);
destRas = destRas.createWritableTranslatedChild(0,0);
- BufferedImage destBI = new BufferedImage(disCM, destRas,
+ BufferedImage destBI = new BufferedImage(disCM, destRas,
disCM.isAlphaPremultiplied(),
null);
//
@@ -262,7 +263,7 @@
final int minX = mapRed.getMinX();
final int minY = mapRed.getMinY();
- CachableRed cr
+ CachableRed cr
= new BufferedImageCachableRed(destBI, minX, minY);
if(!resAt.isIdentity()){
1.3 +4 -3 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable.java
Index: GaussianBlurRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GaussianBlurRable.java 2001/04/27 19:53:49 1.2
+++ GaussianBlurRable.java 2001/05/02 15:41:20 1.3
@@ -13,14 +13,15 @@
* defined by standard deviations along the x and y axis.
*
* @author <a href="mailto:vincent.hardy@eng.sun.com>Vincent Hardy</a>
- * @version $Id: GaussianBlurRable.java,v 1.2 2001/04/27 19:53:49 deweese Exp $
+ * @version $Id: GaussianBlurRable.java,v 1.3 2001/05/02 15:41:20 tkormann Exp $
*/
-public interface GaussianBlurRable extends FilterColorInterp {
+public interface GaussianBlurRable extends FilterColorInterpolation {
+
/**
* Returns the source to be Blurred
*/
public Filter getSource();
-
+
/**
* Sets the source to be blurred.
* @param src image to blurred.
1.6 +10 -9 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java
Index: GaussianBlurRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/GaussianBlurRable8Bit.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GaussianBlurRable8Bit.java 2001/04/27 19:53:50 1.5
+++ GaussianBlurRable8Bit.java 2001/05/02 15:41:22 1.6
@@ -36,11 +36,12 @@
* GaussianBlurRable implementation
*
* @author <a href="mailto:vincent.hardy@eng.sun.com>Vincent Hardy</a>
- * @version $Id: GaussianBlurRable8Bit.java,v 1.5 2001/04/27 19:53:50 deweese Exp $
+ * @version $Id: GaussianBlurRable8Bit.java,v 1.6 2001/05/02 15:41:22 tkormann Exp $
*/
public class GaussianBlurRable8Bit
- extends AbstractColorInterpRable
+ extends AbstractColorInterpolationRable
implements GaussianBlurRable {
+
/**
* Deviation along the x-axis
*/
@@ -181,7 +182,7 @@
AffineTransform resAt;
int outsetX, outsetY;
- if ((sdx < 10) &&
+ if ((sdx < 10) &&
(sdy < 10) &&
eps_eq (sdx, sdy) &&
eps_abs_eq(sx/scaleX, sy/scaleY)) {
@@ -202,7 +203,7 @@
// Limit std dev to 10. Put any extra into our
// residual matrix. This will effectively linearly
- // interpolate, but with such a large StdDev the
+ // interpolate, but with such a large StdDev the
// function is fairly smooth anyway...
if (sdx > 10) {
scaleX = scaleX*10/sdx;
@@ -249,12 +250,12 @@
} catch (NoninvertibleTransformException nte) {
// Grow the region in usr space.
r = aoi.getBounds2D();
- r = new Rectangle2D.Double(r.getX()-outsetX/scaleX,
+ r = new Rectangle2D.Double(r.getX()-outsetX/scaleX,
r.getY()-outsetY/scaleY,
- r.getWidth() +2*outsetX/scaleX,
+ r.getWidth() +2*outsetX/scaleX,
r.getHeight()+2*outsetY/scaleY);
}
-
+
RenderedImage ri;
ri = getSource().createRendering(new RenderContext(srcAt, r, rh));
if (ri == null)
@@ -269,12 +270,12 @@
// System.out.println(" CR :" + cr.getBounds());
cr = new PadRed(cr, devRect, PadMode.ZERO_PAD, rh);
}
-
+
cr = new GaussianBlurRed8Bit(cr, sdx, sdy, rh);
if ((resAt != null) && (!resAt.isIdentity()))
cr = new AffineRed(cr, resAt, rh);
-
+
return cr;
}
1.3 +12 -12 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/TurbulenceRable.java
Index: TurbulenceRable.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/TurbulenceRable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbulenceRable.java 2001/04/27 19:53:51 1.2
+++ TurbulenceRable.java 2001/05/02 15:41:23 1.3
@@ -14,9 +14,9 @@
* Creates a sourceless image from a turbulence function.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: TurbulenceRable.java,v 1.2 2001/04/27 19:53:51 deweese Exp $
+ * @version $Id: TurbulenceRable.java,v 1.3 2001/05/02 15:41:23 tkormann Exp $
*/
-public interface TurbulenceRable extends FilterColorInterp {
+public interface TurbulenceRable extends FilterColorInterpolation {
/**
* Sets the turbulence region
@@ -25,30 +25,30 @@
public void setTurbulenceRegion(Rectangle2D turbulenceRegion);
/**
- * Get the turbulence region
+ * Gets the turbulence region
*/
public Rectangle2D getTurbulenceRegion();
/**
- * Get the current seed value for the pseudo random number generator.
+ * Gets the current seed value for the pseudo random number generator.
* @return The current seed value for the pseudo random number generator.
*/
public int getSeed();
/**
- * Get the current base fequency in x direction.
+ * Gets the current base fequency in x direction.
* @return The current base fequency in x direction.
*/
public double getBaseFrequencyX();
/**
- * Get the current base fequency in y direction.
+ * Gets the current base fequency in y direction.
* @return The current base fequency in y direction.
*/
public double getBaseFrequencyY();
/**
- * Get the current number of octaves for the noise function .
+ * Gets the current number of octaves for the noise function .
* @return The current number of octaves for the noise function .
*/
public int getNumOctaves();
@@ -68,31 +68,31 @@
public boolean isFractalNoise();
/**
- * Set the seed value for the pseudo random number generator.
+ * Sets the seed value for the pseudo random number generator.
* @param seed The new seed value for the pseudo random number generator.
*/
public void setSeed(int seed);
/**
- * Set the base fequency in x direction.
+ * Sets the base fequency in x direction.
* @param xfreq The new base fequency in x direction.
*/
public void setBaseFrequencyX(double xfreq);
/**
- * Set the base fequency in y direction.
+ * Sets the base fequency in y direction.
* @param yfreq The new base fequency in y direction.
*/
public void setBaseFrequencyY(double yfreq);
/**
- * Set the number of octaves for the noise function .
+ * Sets the number of octaves for the noise function .
* @param numOctaves The new number of octaves for the noise function .
*/
public void setNumOctaves(int numOctaves);
/**
- * Set stitching state for tiles.
+ * Sets stitching state for tiles.
* @param stitched true if the turbulence operator should stitch tiles.
*/
public void setStitched(boolean stitched);
1.5 +10 -10 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/TurbulenceRable8Bit.java
Index: TurbulenceRable8Bit.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/TurbulenceRable8Bit.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TurbulenceRable8Bit.java 2001/04/27 19:53:51 1.4
+++ TurbulenceRable8Bit.java 2001/05/02 15:41:25 1.5
@@ -43,12 +43,12 @@
* Creates a sourceless image from a turbulence function.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id: TurbulenceRable8Bit.java,v 1.4 2001/04/27 19:53:51 deweese Exp $
+ * @version $Id: TurbulenceRable8Bit.java,v 1.5 2001/05/02 15:41:25 tkormann Exp $
*/
public class TurbulenceRable8Bit
- extends AbstractColorInterpRable
+ extends AbstractColorInterpolationRable
implements TurbulenceRable {
-
+
/**
* Paint used to clear the area outside the area of interest
*/
@@ -232,7 +232,7 @@
// System.out.println("Turbulence aoi : " + aoi);
// System.out.println("Scale X : " + usr2dev.getScaleX() + " scaleY : " + usr2dev.getScaleY());
// System.out.println("Turbulence aoi dev : " + usr2dev.createTransformedShape(aoi).getBounds());
- final Rectangle rasterRect
+ final Rectangle rasterRect
= usr2dev.createTransformedShape(aoiRect).getBounds();
if ((rasterRect.width <= 0) ||
@@ -241,21 +241,21 @@
ColorSpace cs = getOperationColorSpace();
ColorModel cm = new DirectColorModel
- (cs, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
+ (cs, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
false, DataBuffer.TYPE_INT);
// Create a raster for the turbulence pattern
WritableRaster wr, twr;
- wr = cm.createCompatibleWritableRaster(rasterRect.width,
+ wr = cm.createCompatibleWritableRaster(rasterRect.width,
rasterRect.height);
- twr = wr.createWritableTranslatedChild(rasterRect.x,
+ twr = wr.createWritableTranslatedChild(rasterRect.x,
rasterRect.y);
// Create a TurbulencePatternGenerator that will do the job
// <!> FIX ME. The tile is not propagated properly to the turbulence op
// <!> FIX ME. SHOULD OPTIMIZE THE CHANNELS REQUIRED FROM THE
// FILTER. THIS COULD BE ADDED TO THE RENDER CONTEXT.
- TurbulencePatternGenerator turbGenerator
+ TurbulencePatternGenerator turbGenerator
= new TurbulencePatternGenerator
(baseFreqX, baseFreqY, numOctaves,
seed, stitched, fractalNoise,
@@ -271,7 +271,7 @@
turbGenerator.generatePattern(twr, patternTxf);
// Wrap raster in buffered image
- BufferedImage bi = new BufferedImage(cm, wr,
+ BufferedImage bi = new BufferedImage(cm, wr,
cm.isAlphaPremultiplied(),
null);
@@ -284,7 +284,7 @@
}
g.setRenderingHints(hints);
g.setComposite(AlphaComposite.Src);
-
+
Area nonAoi = new Area(rasterRect);
nonAoi.subtract(new Area(usr2dev.createTransformedShape(aoi)));
g.setPaint(CLEAR_PAINT);
1.1 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/AbstractColorInterpolationRable.java
Index: AbstractColorInterpolationRable.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.ext.awt.image.renderable;
import java.util.List;
import java.util.Map;
import java.awt.color.ColorSpace;
import java.awt.image.RenderedImage;
import org.apache.batik.ext.awt.image.GraphicsUtil;
import org.apache.batik.ext.awt.image.rendered.CachableRed;
/**
* This is an abstract base class that adds the ability to specify the
* Color Space that the operation should take place in (linear sRGB or
* gamma corrected sRBG).
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
* @version $Id: AbstractColorInterpolationRable.java,v 1.1 2001/05/02 15:41:02 tkormann Exp $
*/
public abstract class AbstractColorInterpolationRable extends AbstractRable {
/**
* Indicates if the operation should be done in linear or gamma
* corrected sRGB.
*/
protected boolean csLinear = true;
/**
* void constructor. The subclass must call one of the
* flavors of init before the object becomes usable.
* This is useful when the proper parameters to the init
* method need to be computed in the subclasses constructor. */
protected AbstractColorInterpolationRable() {
super();
}
/**
* Construct an Abstract Rable from src.
* @param src will be the first (and only) member of the srcs
* Vector. The bounds of src are also used to set the bounds of
* this renderable.
*/
protected AbstractColorInterpolationRable(Filter src) {
super(src);
}
/**
* Construct an Abstract Rable from src and props.
* @param src will also be set as the first (and only) member of
* the srcs Vector.
* @param props use to initialize the properties on this renderable image.
*/
protected AbstractColorInterpolationRable(Filter src, Map props) {
super(src, props);
}
/**
* Construct an Abstract Rable from a list of sources.
* @param srcs This is used to initialize the srcs Vector.
* The bounds of this renderable will be the union of the bounds
* of all the sources in srcs. All the members of srcs must be
* CachableRable otherwise an error will be thrown.
*/
protected AbstractColorInterpolationRable(List srcs) {
super(srcs);
}
/**
* Construct an Abstract Rable from a list of sources, and bounds.
* @param srcs This is used to initialize the srcs Vector. All
* the members of srcs must be CachableRable otherwise an error
* will be thrown.
* @param props use to initialize the properties on this renderable image.
*/
protected AbstractColorInterpolationRable(List srcs, Map props) {
super(srcs, props);
}
/**
* Returns true if this operation is to be performed in
* the linear sRGB colorspace, returns false if the
* operation is performed in gamma corrected sRGB.
*/
public boolean isColorSpaceLinear() { return csLinear; }
/**
* Sets the colorspace the operation will be performed in.
* @param csLinear if true this operation will be performed in the
* linear sRGB colorspace, if false the operation will be performed in
* gamma corrected sRGB.
*/
public void setColorSpaceLinear(boolean csLinear) {
touch();
this.csLinear = csLinear;
}
public ColorSpace getOperationColorSpace() {
if (csLinear)
return ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
else
return ColorSpace.getInstance(ColorSpace.CS_sRGB);
}
protected CachableRed convertSourceCS(CachableRed cr) {
if (csLinear)
return GraphicsUtil.convertToLsRGB(cr);
else
return GraphicsUtil.convertTosRGB(cr);
}
protected CachableRed convertSourceCS(RenderedImage ri) {
return convertSourceCS(GraphicsUtil.wrap(ri));
}
}
1.1 xml-batik/sources/org/apache/batik/ext/awt/image/renderable/FilterColorInterpolation.java
Index: FilterColorInterpolation.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.ext.awt.image.renderable;
import java.awt.color.ColorSpace;
/**
* This is an extension of our Filter interface that adds support for
* a color-interpolation specification which indicates what colorspace the
* operation should take place in.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
* @version $Id: FilterColorInterpolation.java,v 1.1 2001/05/02 15:41:20 tkormann Exp $
*/
public interface FilterColorInterpolation extends Filter {
/**
* Returns true if this operation is to be performed in
* the linear sRGB colorspace, returns false if the
* operation is performed in gamma corrected sRGB.
*/
public boolean isColorSpaceLinear();
/**
* Sets the colorspace the operation will be performed in.
* @param csLinear if true this operation will be performed in the
* linear sRGB colorspace, if false the operation will be performed in
* gamma corrected sRGB.
*/
public void setColorSpaceLinear(boolean csLinear);
/**
* Returns the ColorSpace that the object will perform
* it's work in.
*/
public ColorSpace getOperationColorSpace();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org