You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2006/11/23 00:01:15 UTC
svn commit: r478363 - in
/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image: ./
codec/util/ renderable/ rendered/ spi/
Author: dvholten
Date: Wed Nov 22 15:01:13 2006
New Revision: 478363
URL: http://svn.apache.org/viewvc?view=rev&rev=478363
Log:
some contribution to the general cleanup for the next version:
1.) replace some manual copy-loops with System.arraycopy()
2.) add '@version $Id$' to some class-javadoc
3.) trim trailing blanks
4.) bugfix in AbstractRed.java
5.) PointLight should be faster
6.) replace some manual convert-loops to x.toArray()
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/PointLight.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SVGComposite.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/util/SimpleRenderedImage.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/PaintRable.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TranslateRed.java
xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/AbstractRegistryEntry.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java Wed Nov 22 15:01:13 2006
@@ -489,6 +489,7 @@
public static final boolean WARN_DESTINATION;
+
static {
boolean warn = true;
try {
@@ -1393,20 +1394,19 @@
= (db.getOffset() +
sppsm.getOffset(wr.getMinX()-wr.getSampleModelTranslateX(),
wr.getMinY()-wr.getSampleModelTranslateY()));
- int pixel, a, aFP;
+
// Access the pixel data array
final int[] pixels = db.getBankData()[0];
for (int y=0; y<wr.getHeight(); y++) {
int sp = base + y*scanStride;
final int end = sp + width;
while (sp < end) {
- pixel = pixels[sp];
- a = pixel>>>24;
+ int pixel = pixels[sp];
+ int a = pixel>>>24;
if (a<=0) {
pixels[sp] = 0x00FFFFFF;
- }
- else if (a<255) {
- aFP = (0x00FF0000/a);
+ } else if (a<255) {
+ int aFP = (0x00FF0000/a);
pixels[sp] =
((a << 24) |
(((((pixel&0xFF0000)>>16)*aFP)&0xFF0000) ) |
@@ -1439,8 +1439,8 @@
final int end = sp + width;
while (sp < end) {
int pixel = pixels[sp];
- int a = pixel>>>24; // todo ???? signed shift ???
- if ((a>=0) && (a<255)) { // todo does that make sense in the light of a signed shift ??
+ int a = pixel>>>24;
+ if ((a>=0) && (a<255)) { // this does NOT include a == 255 (0xff) !
pixels[sp] = ((a << 24) |
((((pixel&0xFF0000)*a)>>8)&0xFF0000) |
((((pixel&0x00FF00)*a)>>8)&0x00FF00) |
@@ -1470,25 +1470,23 @@
csm.getOffset(wr.getMinX()-wr.getSampleModelTranslateX(),
wr.getMinY()-wr.getSampleModelTranslateY()));
-
- int a=0;
int aOff = bandOff[bandOff.length-1];
int bands = bandOff.length-1;
- int b, i;
+
// Access the pixel data array
final byte[] pixels = db.getBankData()[0];
for (int y=0; y<wr.getHeight(); y++) {
int sp = base + y*scanStride;
final int end = sp + width*pixStride;
while (sp < end) {
- a = pixels[sp+aOff]&0xFF;
+ int a = pixels[sp+aOff]&0xFF;
if (a==0) {
- for (b=0; b<bands; b++)
+ for ( int b=0; b<bands; b++)
pixels[sp+bandOff[b]] = (byte)0xFF;
- } else if (a<255) {
+ } else if (a<255) { // this does NOT include a == 255 (0xff) !
int aFP = (0x00FF0000/a);
- for (b=0; b<bands; b++) {
- i = sp+bandOff[b];
+ for ( int b=0; b<bands; b++) {
+ int i = sp+bandOff[b];
pixels[i] = (byte)(((pixels[i]&0xFF)*aFP)>>>16);
}
}
@@ -1516,10 +1514,8 @@
wr.getMinY()-wr.getSampleModelTranslateY()));
- int a=0;
int aOff = bandOff[bandOff.length-1];
int bands = bandOff.length-1;
- int b, i;
// Access the pixel data array
final byte[] pixels = db.getBankData()[0];
@@ -1527,10 +1523,10 @@
int sp = base + y*scanStride;
final int end = sp + width*pixStride;
while (sp < end) {
- a = pixels[sp+aOff]&0xFF;
+ int a = pixels[sp+aOff]&0xFF;
if (a!=0xFF)
- for (b=0; b<bands; b++) {
- i = sp+bandOff[b];
+ for ( int b=0; b<bands; b++) {
+ int i = sp+bandOff[b];
pixels[i] = (byte)(((pixels[i]&0xFF)*a)>>8);
}
sp+=pixStride;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/PointLight.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/PointLight.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/PointLight.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/PointLight.java Wed Nov 22 15:01:13 2006
@@ -78,20 +78,24 @@
*/
public final void getLight(final double x, final double y, final double z,
final double[] L){
- L[0] = lightX - x;
- L[1] = lightY - y;
- L[2] = lightZ - z;
- final double norm = Math.sqrt(L[0]*L[0] +
- L[1]*L[1] +
- L[2]*L[2]);
+ double L0 = lightX - x;
+ double L1 = lightY - y;
+ double L2 = lightZ - z;
+
+ final double norm = Math.sqrt( L0*L0 + L1*L1 + L2*L2 );
if(norm > 0){
final double invNorm = 1.0/norm;
- L[0] *= invNorm;
- L[1] *= invNorm;
- L[2] *= invNorm;
+ L0 *= invNorm;
+ L1 *= invNorm;
+ L2 *= invNorm;
}
+
+ // copy the work-variables into return-array
+ L[ 0 ] = L0;
+ L[ 1 ] = L1;
+ L[ 2 ] = L2;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SVGComposite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SVGComposite.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SVGComposite.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SVGComposite.java Wed Nov 22 15:01:13 2006
@@ -1049,22 +1049,18 @@
final int [] dstInPixels, final int dstInAdjust, int dstInSp,
final int [] dstOutPixels, final int dstOutAdjust, int dstOutSp) {
+ byte[] workTbl = lut; // local is cheaper
int srcP, dstP;
- int a, r, g, b;
for (int y = 0; y<height; y++) {
final int end = dstOutSp+width;
while (dstOutSp<end) {
srcP = srcPixels [srcSp++];
dstP = dstInPixels[dstInSp++];
- a = lut[(((srcP>> 16)&0xFF00)|((dstP>>>24) ))];
- a &= 0xFF;
- r = lut[(((srcP>> 8)&0xFF00)|((dstP>> 16)&0x00FF))];
- r &= 0xFF;
- g = lut[(((srcP )&0xFF00)|((dstP>> 8)&0x00FF))];
- g &= 0xFF;
- b = lut[(((srcP<< 8)&0xFF00)|((dstP )&0x00FF))];
- b &= 0xFF;
+ int a = 0xFF & workTbl[(((srcP>> 16)&0xFF00)|((dstP>>>24) ))];
+ int r = 0xFF & workTbl[(((srcP>> 8)&0xFF00)|((dstP>> 16)&0x00FF))];
+ int g = 0xFF & workTbl[(((srcP )&0xFF00)|((dstP>> 8)&0x00FF))];
+ int b = 0xFF & workTbl[(((srcP<< 8)&0xFF00)|((dstP )&0x00FF))];
if (r>a) a = r;
if (g>a) a = g;
if (b>a) a = b;
@@ -1213,17 +1209,27 @@
int sp = 0;
int end = w*4;
while(sp<end) {
- dstPix[sp] = (srcPix[sp] + dstPix[sp] -
- ((dstPix[sp]*srcPix[sp]*norm + pt5)>>>24));
- ++sp;
- dstPix[sp] = (srcPix[sp] + dstPix[sp] -
- ((dstPix[sp]*srcPix[sp]*norm + pt5)>>>24));
- ++sp;
- dstPix[sp] = (srcPix[sp] + dstPix[sp] -
- ((dstPix[sp]*srcPix[sp]*norm + pt5)>>>24));
+
+ int iSrcPix = srcPix[ sp ];
+ int iDstPix = dstPix[ sp ];
+
+ dstPix[sp] = ( iSrcPix + iDstPix -
+ ((iDstPix*iSrcPix*norm + pt5)>>>24));
++sp;
- dstPix[sp] = (srcPix[sp] + dstPix[sp] -
- ((dstPix[sp]*srcPix[sp]*norm + pt5)>>>24));
+ iSrcPix = srcPix[ sp ];
+ iDstPix = dstPix[ sp ];
+ dstPix[sp] = ( iSrcPix + iDstPix -
+ ((iDstPix*iSrcPix*norm + pt5)>>>24));
+ ++sp;
+ iSrcPix = srcPix[ sp ];
+ iDstPix = dstPix[ sp ];
+ dstPix[sp] = ( iSrcPix + iDstPix -
+ ((iDstPix*iSrcPix*norm + pt5)>>>24));
+ ++sp;
+ iSrcPix = srcPix[ sp ];
+ iDstPix = dstPix[ sp ];
+ dstPix[sp] = ( iSrcPix + iDstPix -
+ ((iDstPix*iSrcPix*norm + pt5)>>>24));
++sp;
}
dstOut.setPixels(x, y, w, 1, dstPix);
@@ -1387,6 +1393,11 @@
tmp = ((dstM*dstV + pt5)>>>24) + srcV;
if (dstB > tmp) dstB = tmp;
+ dstA &= 0xFF; // trim to 8 bit
+ dstR &= 0xFF;
+ dstG &= 0xFF;
+ dstB &= 0xFF;
+
dstOutPixels[dstOutSp++] =
((dstA<<24) | (dstR<<16) | (dstG<< 8) | dstB);
}
@@ -1506,6 +1517,11 @@
dstB = ((srcM*srcV + pt5)>>>24) + dstV;
tmp = ((dstM*dstV + pt5)>>>24) + srcV;
if (dstB < tmp) dstB = tmp;
+
+ dstA &= 0xFF; // trim to 8 bit
+ dstR &= 0xFF;
+ dstG &= 0xFF;
+ dstB &= 0xFF;
dstOutPixels[dstOutSp++] =
((dstA<<24) | (dstR<<16) | (dstG<< 8) | dstB);
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/SpotLight.java Wed Nov 22 15:01:13 2006
@@ -122,7 +122,7 @@
this.pointAtZ = pointAtZ;
this.specularExponent = specularExponent;
this.limitingConeAngle = limitingConeAngle;
- this.limitingCos = Math.cos(limitingConeAngle*Math.PI/180.);
+ this.limitingCos = Math.cos(limitingConeAngle*Math.PI/180.0);
S[0] = pointAtX - lightX;
S[1] = pointAtY - lightY;
@@ -155,19 +155,22 @@
final double z,
final double[] L){
// Light Vector, L
- L[0] = lightX - x;
- L[1] = lightY - y;
- L[2] = lightZ - z;
-
- final double invNorm = 1/Math.sqrt(L[0]*L[0] +
- L[1]*L[1] +
- L[2]*L[2]);
-
- L[0] *= invNorm;
- L[1] *= invNorm;
- L[2] *= invNorm;
-
- double LS = -(L[0]*S[0] + L[1]*S[1] + L[2]*S[2]);
+ double L0 = lightX - x;
+ double L1 = lightY - y;
+ double L2 = lightZ - z;
+
+ final double invNorm = 1.0/Math.sqrt( L0*L0 + L1*L1 + L2*L2 );
+
+ L0 *= invNorm;
+ L1 *= invNorm;
+ L2 *= invNorm;
+
+ double LS = -(L0*S[0] + L1*S[1] + L2*S[2]);
+
+ // copy the work-variables into return-array
+ L[0] = L0;
+ L[1] = L1;
+ L[2] = L2;
if(LS <= limitingCos){
return 0;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/util/SimpleRenderedImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/util/SimpleRenderedImage.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/util/SimpleRenderedImage.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/util/SimpleRenderedImage.java Wed Nov 22 15:01:13 2006
@@ -25,10 +25,11 @@
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
-import java.util.Enumeration;
+
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
/**
* A simple class implemented the <code>RenderedImage</code>
@@ -39,6 +40,8 @@
* <p> Normally in JAI <code>PlanarImage</code> is used for this
* purpose, but in the interest of modularity the
* use of <code>PlanarImage</code> has been avoided.
+ *
+ * @version $Id$
*/
public abstract class SimpleRenderedImage implements RenderedImage {
@@ -241,14 +244,14 @@
*/
public String[] getPropertyNames() {
String[] names = new String[properties.size()];
- int index = 0;
-
- Enumeration e = properties.keys();
- while (e.hasMoreElements()) {
- String name = (String)e.nextElement();
- names[index++] = name;
- }
-
+// int index = 0;
+//
+// Enumeration e = properties.keys();
+// while (e.hasMoreElements()) {
+// String name = (String)e.nextElement();
+// names[index++] = name;
+// }
+ properties.keySet().toArray( names );
return names;
}
@@ -273,10 +276,10 @@
prefix = prefix.toLowerCase();
- Vector names = new Vector();
+ List names = new ArrayList();
for (int i = 0; i < propertyNames.length; i++) {
if (propertyNames[i].startsWith(prefix)) {
- names.addElement(propertyNames[i]);
+ names.add(propertyNames[i]);
}
}
@@ -286,10 +289,12 @@
// Copy the strings from the Vector over to a String array.
String[] prefixNames = new String[names.size()];
- int count = 0;
- for (Iterator it = names.iterator(); it.hasNext(); ) { // todo xx.toArray()
- prefixNames[count++] = (String)it.next();
- }
+
+// int count = 0;
+// for (Iterator it = names.iterator(); it.hasNext(); ) { // todo xx.toArray()
+// prefixNames[count++] = (String)it.next();
+// }
+ names.toArray( prefixNames );
return prefixNames;
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/ConvolveMatrixRable8Bit.java Wed Nov 22 15:01:13 2006
@@ -223,7 +223,7 @@
final int end = sp + width;
while (sp < end) {
int pixel = pixels[sp];
- int a = pixel>>>24; // todo check signed shift ??
+ int a = pixel>>>24;
int v = (pixel>>16)&0xFF;
if (a < v) a = v;
v = (pixel>> 8)&0xFF;
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/DeferRable.java Wed Nov 22 15:01:13 2006
@@ -35,8 +35,9 @@
* This is actually a particular instance of a very general pattern
* this is probably best represented using the Proxy class in the
* Reflection APIs.
+ *
+ * @version $Id$
*/
-
public class DeferRable implements Filter {
Filter src;
Rectangle2D bounds;
@@ -44,7 +45,7 @@
/**
* Constructor takes nothing
*/
- public DeferRable() {
+ public DeferRable() {
}
/**
@@ -56,7 +57,7 @@
// Wait for someone to set src.
wait();
}
- catch(InterruptedException ie) {
+ catch(InterruptedException ie) {
// Loop around again see if src is set now...
}
}
@@ -91,7 +92,7 @@
notifyAll();
}
- public long getTimeStamp() {
+ public long getTimeStamp() {
return getSource().getTimeStamp();
}
@@ -102,7 +103,7 @@
/**
* Forward the call (blocking until source is set if need be).
*/
- public boolean isDynamic() {
+ public boolean isDynamic() {
return getSource().isDynamic();
}
@@ -117,7 +118,7 @@
// Wait for someone to set bounds.
wait();
}
- catch(InterruptedException ie) {
+ catch(InterruptedException ie) {
// Loop around again see if src is set now...
}
}
@@ -187,7 +188,7 @@
/**
* Forward the call (blocking until source is set if need be).
*/
- public RenderedImage createScaledRendering(int w, int h,
+ public RenderedImage createScaledRendering(int w, int h,
RenderingHints hints) {
return getSource().createScaledRendering(w, h, hints);
}
@@ -202,7 +203,7 @@
/**
* Forward the call (blocking until source is set if need be).
*/
- public Shape getDependencyRegion(int srcIndex,
+ public Shape getDependencyRegion(int srcIndex,
Rectangle2D outputRgn) {
return getSource().getDependencyRegion(srcIndex, outputRgn);
}
@@ -210,7 +211,7 @@
/**
* Forward the call (blocking until source is set if need be).
*/
- public Shape getDirtyRegion(int srcIndex,
+ public Shape getDirtyRegion(int srcIndex,
Rectangle2D inputRgn) {
return getSource().getDirtyRegion(srcIndex, inputRgn);
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/PaintRable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/PaintRable.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/PaintRable.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/renderable/PaintRable.java Wed Nov 22 15:01:13 2006
@@ -24,8 +24,11 @@
* Interface for Rable's that can more efficently represent there
* action as a paint method instead of a RenderedImage when going to a
* Graphics2D anyways.
+ *
+ * @version $Id$
*/
public interface PaintRable {
+
/**
* Should perform the equivilent action as
* createRendering followed by drawing the RenderedImage.
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/AbstractRed.java Wed Nov 22 15:01:13 2006
@@ -445,21 +445,24 @@
public String [] getPropertyNames() {
Set keys = props.keySet();
- Iterator iter = keys.iterator();
String[] ret = new String[keys.size()];
- int i=0;
- while (iter.hasNext()) {
- ret[i++] = (String)iter.next();
- }
+ keys.toArray( ret );
+
+// Iterator iter = keys.iterator();
+// int i=0;
+// while (iter.hasNext()) {
+// ret[i++] = (String)iter.next();
+// }
- iter = srcs.iterator();
+ Iterator iter = srcs.iterator();
while (iter.hasNext()) {
RenderedImage ri = (RenderedImage)iter.next();
String [] srcProps = ri.getPropertyNames();
if (srcProps.length != 0) {
String [] tmp = new String[ret.length+srcProps.length];
System.arraycopy(ret,0,tmp,0,ret.length);
- System.arraycopy(tmp,ret.length,srcProps,0,srcProps.length);
+ /// ??? System.arraycopy((tmp,ret.length,srcProps,0,srcProps.length);
+ System.arraycopy( srcProps, 0, tmp, ret.length, srcProps.length);
ret = tmp;
}
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/FormatRed.java Wed Nov 22 15:01:13 2006
@@ -43,7 +43,8 @@
* alpha=1. In all other cases bands are simply copied.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id$ */
+ * @version $Id$
+ */
public class FormatRed extends AbstractRed {
public static CachableRed construct(CachableRed src, ColorModel cm) {
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/RenderedImageCachableRed.java Wed Nov 22 15:01:13 2006
@@ -36,7 +36,8 @@
* It essentially ignores the dependency and dirty region methods.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id$ */
+ * @version $Id$
+ */
public class RenderedImageCachableRed implements CachableRed {
public static CachableRed wrap(RenderedImage ri) {
@@ -61,8 +62,8 @@
return srcs; // should always be empty...
}
- public Rectangle getBounds() {
- return new Rectangle(getMinX(),
+ public Rectangle getBounds() {
+ return new Rectangle(getMinX(), // could we cache the rectangle??
getMinY(),
getWidth(),
getHeight());
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TranslateRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TranslateRed.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TranslateRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/rendered/TranslateRed.java Wed Nov 22 15:01:13 2006
@@ -22,15 +22,17 @@
import java.awt.Rectangle;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
+
/**
* This is a special case of an Affine that only contains integer
* translations, this allows it to do it's work by simply changing
* the coordinate system of the tiles.
*
* @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id$ */
+ * @version $Id$
+ */
public class TranslateRed extends AbstractRed {
-
+
protected int deltaX;
protected int deltaY;
@@ -42,14 +44,14 @@
public TranslateRed(CachableRed cr, int xloc, int yloc) {
super(cr, new Rectangle(xloc, yloc,
cr.getWidth(), cr.getHeight()),
- cr.getColorModel(), cr.getSampleModel(),
- cr.getTileGridXOffset()+xloc-cr.getMinX(),
- cr.getTileGridYOffset()+yloc-cr.getMinY(),
+ cr.getColorModel(), cr.getSampleModel(),
+ cr.getTileGridXOffset()+xloc-cr.getMinX(),
+ cr.getTileGridYOffset()+yloc-cr.getMinY(),
null);
deltaX = xloc-cr.getMinX();
deltaY = yloc-cr.getMinY();
}
-
+
/**
* The delata translation in x (absolute loc is available from getMinX())
*/
@@ -77,7 +79,7 @@
public Raster getTile(int tileX, int tileY) {
Raster r = getSource().getTile(tileX, tileY);
-
+
return r.createTranslatedChild(r.getMinX()+deltaX,
r.getMinY()+deltaY);
}
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/AbstractRegistryEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/AbstractRegistryEntry.java?view=diff&rev=478363&r1=478362&r2=478363
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/AbstractRegistryEntry.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/AbstractRegistryEntry.java Wed Nov 22 15:01:13 2006
@@ -22,7 +22,11 @@
import java.util.Collections;
import java.util.List;
-public abstract class AbstractRegistryEntry
+/**
+ *
+ * @version $Id$
+ */
+public abstract class AbstractRegistryEntry
implements RegistryEntry, ErrorConstants {
/**
@@ -37,7 +41,7 @@
float priority;
List exts;
List mimeTypes;
-
+
public AbstractRegistryEntry(String name,
float priority,
String [] exts,
@@ -55,7 +59,7 @@
this.mimeTypes.add(mimeTypes[i]);
this.mimeTypes = Collections.unmodifiableList(this.mimeTypes);
}
-
+
public AbstractRegistryEntry(String name,
float priority,
String ext,
@@ -71,7 +75,7 @@
this.mimeTypes.add(mimeType);
this.mimeTypes = Collections.unmodifiableList(mimeTypes);
}
-
+
public String getFormatName() {
return name;