cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r509603 - /cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/
Date Tue, 20 Feb 2007 15:21:17 GMT
Author: cziegeler
Date: Tue Feb 20 07:21:16 2007
New Revision: 509603

URL: http://svn.apache.org/viewvc?view=rev&rev=509603
Log:
Just code formatting and Composable -> Serviceable

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/AffineTransformOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ColorOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ConvolveOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/GrayScaleOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOpReader.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/MirrorOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/OffsetOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ResizeOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/RotateOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ScaleOperation.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ShearOperation.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/AffineTransformOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/AffineTransformOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/AffineTransformOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/AffineTransformOperation.java Tue Feb 20 07:21:16 2007
@@ -16,120 +16,109 @@
  */
 package org.apache.cocoon.reading.imageop;
 
-
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import java.util.StringTokenizer;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
 public class AffineTransformOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private float[] m_Matrix;
-    
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private float[] matrix;
+
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
+
     public void setup( Parameters params )
-        throws ProcessingException
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        int size = params.getParameterAsInteger( m_Prefix + "matrix-size", 6 );
-        String values = params.getParameter( m_Prefix + "values", null );
-        
-        if( size != 4 && size != 6 )
+    throws ProcessingException {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        int size = params.getParameterAsInteger( prefix + "matrix-size", 6 );
+        String values = params.getParameter( prefix + "values", null );
+
+        if( size != 4 && size != 6 ) {
             throw new ProcessingException( "Only matrices of 4 or 6 elements can be used." );
-        
-        if( values != null )
-            m_Matrix = getFloatArray( values );
-        else
-            m_Matrix = new float[ size ];
-        
-        if( m_Matrix.length != 4 && m_Matrix.length != 6 )
+        }
+
+        if( values != null ) {
+            matrix = getFloatArray( values );
+        } else {
+            matrix = new float[ size ];
+        }
+
+        if( matrix.length != 4 && matrix.length != 6 ) {
             throw new ProcessingException( "Only matrices of 4 or 6 elements can be used." );
-        
-        float m00 = params.getParameterAsFloat( m_Prefix + "m00", Float.NaN );
-        float m01 = params.getParameterAsFloat( m_Prefix + "m01", Float.NaN );
-        float m02 = params.getParameterAsFloat( m_Prefix + "m02", Float.NaN );
-        float m10 = params.getParameterAsFloat( m_Prefix + "m10", Float.NaN );
-        float m11 = params.getParameterAsFloat( m_Prefix + "m11", Float.NaN );
-        float m12 = params.getParameterAsFloat( m_Prefix + "m12", Float.NaN );
-        
-        if( m_Matrix.length == 4 )
-        {
-            m_Matrix[0] = m00;
-            m_Matrix[1] = m01;
-            m_Matrix[2] = m10;
-            m_Matrix[3] = m11;
-        }
-        else
-        {
-            m_Matrix[0] = m00;
-            m_Matrix[1] = m01;
-            m_Matrix[2] = m02;
-            m_Matrix[3] = m10;
-            m_Matrix[4] = m11;
-            m_Matrix[5] = m12;
+        }
+
+        float m00 = params.getParameterAsFloat( prefix + "m00", Float.NaN );
+        float m01 = params.getParameterAsFloat( prefix + "m01", Float.NaN );
+        float m02 = params.getParameterAsFloat( prefix + "m02", Float.NaN );
+        float m10 = params.getParameterAsFloat( prefix + "m10", Float.NaN );
+        float m11 = params.getParameterAsFloat( prefix + "m11", Float.NaN );
+        float m12 = params.getParameterAsFloat( prefix + "m12", Float.NaN );
+
+        if( matrix.length == 4 ) {
+            matrix[0] = m00;
+            matrix[1] = m01;
+            matrix[2] = m10;
+            matrix[3] = m11;
+        } else {
+            matrix[0] = m00;
+            matrix[1] = m01;
+            matrix[2] = m02;
+            matrix[3] = m10;
+            matrix[4] = m11;
+            matrix[5] = m12;
         }
     }
 
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-        AffineTransform transform = new AffineTransform( m_Matrix );
+        }
+        AffineTransform transform = new AffineTransform( matrix );
         AffineTransformOp op = new AffineTransformOp( transform, AffineTransformOp.TYPE_BILINEAR );
         WritableRaster scaledRaster = op.filter( image, null );
         return scaledRaster;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "affine:" 
-               + ( m_Enabled ? "enable" : "disable" )
+               + ( enabled ? "enable" : "disable" )
                + ":" + getMatrixAsString()
-               + ":" + m_Prefix;
+               + ":" + prefix;
     }
 
-    private float[] getFloatArray( String values )
-    {
+    private float[] getFloatArray( String values ) {
         float[] fvalues = new float[ 30 ];
         int counter = 0;
         StringTokenizer st = new StringTokenizer( values, ",", false );
-        for( int i = 0 ; st.hasMoreTokens() ; i++ )
-        {
+        for( int i = 0 ; st.hasMoreTokens() ; i++ ) {
             String value = st.nextToken().trim();
             fvalues[ i ] = Float.parseFloat( value );
             counter = counter + 1;
         }
         float[] result = new float[ counter ];
-        for( int i = 0 ; i < counter ; i++ )
+        for( int i = 0 ; i < counter ; i++ ) {
             result[i] = fvalues[i];
+        }
         return result;
     }
-    
-    private String getMatrixAsString()
-    {
+
+    private String getMatrixAsString() {
         StringBuffer b = new StringBuffer();
-        for( int i = 0 ; i < m_Matrix.length ; i++ )
-        {
-            if( i != 0 )
+        for( int i = 0 ; i < matrix.length ; i++ ) {
+            if( i != 0 ) {
                 b.append( "," );
-            b.append( m_Matrix[ i ] );
+            }
+            b.append( matrix[ i ] );
         }
         String result = b.toString();
         b.setLength( 0 );
         return result;
     }
-    
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ColorOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ColorOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ColorOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ColorOperation.java Tue Feb 20 07:21:16 2007
@@ -18,49 +18,44 @@
 
 import java.awt.image.RescaleOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
 
 public class ColorOperation
-    implements ImageOperation
-{
-    private RescaleOp m_ColorFilter;
-    private String   m_Prefix;
-    private boolean  m_Enabled;
-     
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private RescaleOp colorFilter;
+    private String   prefix;
+    private boolean  enabled;
+
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
-    public void setup( Parameters params )
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
+
+    public void setup( Parameters params ) {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
         float[] scaleColor = new float[3];
         float[] offsetColor = new float[3];
-        scaleColor[0] = params.getParameterAsFloat( m_Prefix + "scale-red", -1.0f);
-        scaleColor[1] = params.getParameterAsFloat( m_Prefix + "scale-green", -1.0f);
-        scaleColor[2] = params.getParameterAsFloat( m_Prefix + "scale-blue", -1.0f);
-        offsetColor[0] = params.getParameterAsFloat( m_Prefix + "offset-red", 0.0f);
-        offsetColor[1] = params.getParameterAsFloat( m_Prefix + "offset-green", 0.0f);
-        offsetColor[2] = params.getParameterAsFloat( m_Prefix + "offset-blue", 0.0f);
-        m_ColorFilter = new RescaleOp( scaleColor, offsetColor, null );
+        scaleColor[0] = params.getParameterAsFloat( prefix + "scale-red", -1.0f);
+        scaleColor[1] = params.getParameterAsFloat( prefix + "scale-green", -1.0f);
+        scaleColor[2] = params.getParameterAsFloat( prefix + "scale-blue", -1.0f);
+        offsetColor[0] = params.getParameterAsFloat( prefix + "offset-red", 0.0f);
+        offsetColor[1] = params.getParameterAsFloat( prefix + "offset-green", 0.0f);
+        offsetColor[2] = params.getParameterAsFloat( prefix + "offset-blue", 0.0f);
+        colorFilter = new RescaleOp( scaleColor, offsetColor, null );
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-            
-        WritableRaster r = m_ColorFilter.filter( image, null );
+        }
+        WritableRaster r = colorFilter.filter( image, null );
         return r;
     }    
-    
-    public String getKey()
-    {
+
+    public String getKey() {
         return "colorop:"
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_ColorFilter
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + colorFilter
+               + ":" + prefix;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ConvolveOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ConvolveOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ConvolveOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ConvolveOperation.java Tue Feb 20 07:21:16 2007
@@ -19,89 +19,81 @@
 import java.awt.image.ConvolveOp;
 import java.awt.image.Kernel;
 import java.awt.image.WritableRaster;
-
 import java.util.StringTokenizer;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
 public class ConvolveOperation
-    implements ImageOperation
-{
-    private String   m_Prefix;
-    private boolean  m_Enabled;
-    private int      m_ConvolveHeight;
-    private int      m_ConvolveWidth;
-    private float[]  m_Data;
-        
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String   prefix;
+    private boolean  enabled;
+    private int      convolveHeight;
+    private int      convolveWidth;
+    private float[]  data;
+
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
     
     public void setup( Parameters params )
-        throws ProcessingException
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        m_ConvolveWidth = params.getParameterAsInteger( m_Prefix + "width", 3 );
-        m_ConvolveHeight = params.getParameterAsInteger( m_Prefix + "height", 3 );
-        String values = params.getParameter( m_Prefix + "data", "" );
-        m_Data = getFloatArray( values );
-        if( m_Data.length != m_ConvolveWidth * m_ConvolveHeight )
-            throw new ProcessingException( "The width*height must be equal to the number of data elements given: " + (m_ConvolveWidth * m_ConvolveHeight) + " is not compatible with '"  + values + "'" );
+    throws ProcessingException {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        convolveWidth = params.getParameterAsInteger( prefix + "width", 3 );
+        convolveHeight = params.getParameterAsInteger( prefix + "height", 3 );
+        String values = params.getParameter( prefix + "data", "" );
+        data = getFloatArray( values );
+        if( data.length != convolveWidth * convolveHeight ) {
+            throw new ProcessingException( "The width*height must be equal to the number of data elements given: " + (convolveWidth * convolveHeight) + " is not compatible with '"  + values + "'" );
+        }
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-            
-        Kernel kernel = new Kernel( m_ConvolveWidth, m_ConvolveHeight, m_Data );
+        }
+        Kernel kernel = new Kernel( convolveWidth, convolveHeight, data );
         ConvolveOp op = new ConvolveOp( kernel, ConvolveOp.EDGE_NO_OP, null );
         WritableRaster r = op.filter( image, null );
         return r;
     }
 
-    private float[] getFloatArray( String values )
-    {
+    private float[] getFloatArray( String values ) {
         float[] fvalues = new float[ 30 ];
         int counter = 0;
         StringTokenizer st = new StringTokenizer( values, ",", false );
-        for( int i = 0 ; st.hasMoreTokens() ; i++ )
-        {
+        for( int i = 0 ; st.hasMoreTokens() ; i++ ) {
             String value = st.nextToken().trim();
             fvalues[ i ] = Float.parseFloat( value );
             counter = counter + 1;
         }
         float[] result = new float[ counter ];
-        for( int i = 0 ; i < counter ; i++ )
+        for( int i = 0 ; i < counter ; i++ ) {
             result[i] = fvalues[i];
+        }
         return result;
     }
-    
-    private String getDataAsString()
-    {
+
+    private String getDataAsString() {
         StringBuffer b = new StringBuffer();
-        for( int i = 0 ; i < m_Data.length ; i++ )
-        {
-            if( i != 0 )
+        for( int i = 0 ; i < data.length ; i++ ) {
+            if( i != 0 ) {
                 b.append( "," );
-            b.append( m_Data[ i ] );
+            }
+            b.append( data[ i ] );
         }
         String result = b.toString();
         b.setLength( 0 );
         return result;
     }
-    
-    public String getKey()
-    {
+
+    public String getKey() {
         return "convolve:" 
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_ConvolveWidth
-               + ":" + m_ConvolveHeight
+               + ( enabled ? "enable" : "disable" )
+               + ":" + convolveWidth
+               + ":" + convolveHeight
                + ":" + getDataAsString()
-               + ":" + m_Prefix;
+               + ":" + prefix;
     }
 } 
  

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/GrayScaleOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/GrayScaleOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/GrayScaleOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/GrayScaleOperation.java Tue Feb 20 07:21:16 2007
@@ -17,43 +17,37 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.color.ColorSpace;
-
 import java.awt.image.ColorConvertOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
 
 public class GrayScaleOperation
-    implements ImageOperation
-{
-    private String   m_Prefix;
-    private boolean  m_Enabled;
+    implements ImageOperation {
+
+    private String   prefix;
+    private boolean  enabled;
  
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
     
-    public void setup( Parameters params )
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-   }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+    public void setup( Parameters params ) {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+    }
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-            
+        }
         ColorSpace grayspace = ColorSpace.getInstance( ColorSpace.CS_GRAY );
         ColorConvertOp op = new ColorConvertOp( grayspace, null );
         WritableRaster r = op.filter( image, null );
         return r;
     }    
-    
-    public String getKey()
-    {
+
+    public String getKey() {
         return "grayscale:"
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + prefix;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOpReader.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOpReader.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOpReader.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOpReader.java Tue Feb 20 07:21:16 2007
@@ -19,39 +19,31 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.image.WritableRaster;
-
 import javax.imageio.ImageIO;
 import javax.imageio.ImageTypeSpecifier;
 import javax.imageio.ImageWriter;
 import javax.imageio.stream.ImageOutputStream;
 import javax.imageio.spi.ImageWriterSpi;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
-
 import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-
-import org.apache.avalon.framework.component.Composable;
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.ComponentSelector;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.avalon.framework.service.Serviceable;
 import org.apache.cocoon.ProcessingException;
-
 import org.apache.cocoon.environment.SourceResolver;
-
 import org.apache.cocoon.reading.ResourceReader;
-
 import org.xml.sax.SAXException;
 
 /**
@@ -60,63 +52,76 @@
  * the requested resource should be written to the <code>OutputStream</code>
  * or if it can signal that it hasn't changed. 
  */
-final public class ImageOpReader extends ResourceReader
-    implements Configurable, Composable
-{
+final public class ImageOpReader
+    extends ResourceReader
+    implements Configurable, Serviceable, Disposable {
+
     private final static String FORMAT_DEFAULT = "png";
-    
-    private String            m_Format;
-    private ArrayList         m_EffectsStack;
-    private ComponentSelector m_OperationSelector;
-    
+
+    private String          format;
+    private ArrayList       effectsStack;
+    private ServiceSelector operationSelector;
+    private ServiceManager  manager;
+
     /**
      * Read reader configuration
      */
     public void configure(Configuration configuration) 
-        throws ConfigurationException 
-    {
+    throws ConfigurationException {
         super.configure( configuration );
         Configuration effects = configuration.getChild( "effects" );
-        try
-        {
+        try {
             configureEffects( effects );
-        } catch( ComponentException e )
-        {
+        } catch( ServiceException e ) {
             throw new ConfigurationException( "Unable to configure ImageOperations", e );
         }
     }
 
-    public void compose( ComponentManager man )
-        throws ComponentException
-    {
-        m_OperationSelector = (ComponentSelector) man.lookup( "org.apache.cocoon.reading.imageop.ImageOperationSelector" );
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
+    public void service( ServiceManager man )
+    throws ServiceException {
+        this.manager = man;
+        operationSelector = (ServiceSelector) man.lookup( ImageOperation.ROLE + "Selector" );
     }
     
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose() {
+        if ( this.manager != null ) {
+            this.manager.release(this.operationSelector);
+            this.operationSelector = null;
+            this.manager = null;
+        }
+    }
+
+    /**
+     * @see org.apache.cocoon.reading.ResourceReader#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+     */
     public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
-        throws ProcessingException, SAXException, IOException 
-    {
+    throws ProcessingException, SAXException, IOException {
         super.setup(resolver, objectModel, src, par);
-        m_Format = par.getParameter("output-format", FORMAT_DEFAULT);
+        format = par.getParameter("output-format", FORMAT_DEFAULT);
         if(getLogger().isInfoEnabled()) {
-            getLogger().info( src + " --> " + m_Format );
+            getLogger().info( src + " --> " + format );
         }
         setupEffectsStack( par );
     }
 
     protected void processStream( InputStream inputStream ) 
-        throws IOException, ProcessingException 
-    {
-        if( m_EffectsStack.size() > 0 ) 
-        {
+    throws IOException, ProcessingException {
+        if( effectsStack.size() > 0 ) {
             // since we create the image on the fly
             response.setHeader("Accept-Ranges", "none");
 
             BufferedImage image = ImageIO.read( inputStream );
-            if( image == null )
+            if( image == null ) {
                 throw new ProcessingException( "Unable to decode the InputStream. Possibly an unknown format." );                
-
+            }
             image = applyEffectsStack( image );
-                        
+
             write( image );
         } else {
             // only read the resource - no modifications requested
@@ -134,18 +139,16 @@
      * @return The generated key consists of the src and width and height, and the color transform
      * parameters
     */
-    public Serializable getKey() 
-    {
+    public Serializable getKey() {
         StringBuffer b = new StringBuffer( 200 );
         b.append( this.inputSource.getURI() );
         b.append( ':' );
-        b.append( m_Format );
+        b.append( format );
         b.append( ':' );
         b.append( super.getKey() );
         b.append( ':' );
-        Iterator list = m_EffectsStack.iterator();
-        while( list.hasNext() )
-        {
+        Iterator list = effectsStack.iterator();
+        while( list.hasNext() ) {
             ImageOperation op = (ImageOperation) list.next();
             b.append( op.getKey() );
             b.append( ':' );
@@ -157,40 +160,35 @@
     }
     
     private void configureEffects( Configuration conf )
-        throws ConfigurationException, ComponentException
-    {
-        m_EffectsStack = new ArrayList();
-        
+    throws ConfigurationException, ServiceException {
+        effectsStack = new ArrayList();
+
         Configuration[] ops = conf.getChildren( "op" );
-        for( int i=0 ; i < ops.length ; i++ )
-        {
+        for( int i=0 ; i < ops.length ; i++ ) {
             String type = ops[i].getAttribute( "type" );
             String prefix = ops[i].getAttribute( "prefix", type + "-" );
-            ImageOperation op = (ImageOperation) m_OperationSelector.select( type );
+            ImageOperation op = (ImageOperation) operationSelector.select( type );
             op.setPrefix( prefix );
-            m_EffectsStack.add( op );
+            effectsStack.add( op );
         }
     }
 
     private void setupEffectsStack( Parameters params )
-        throws ProcessingException
-    {
-        Iterator list = m_EffectsStack.iterator();
-        while( list.hasNext() )
-        {
+    throws ProcessingException {
+        Iterator list = effectsStack.iterator();
+        while( list.hasNext() ) {
             ImageOperation op = (ImageOperation) list.next();
             op.setup( params );
         }
     }
-    
-    private BufferedImage applyEffectsStack( BufferedImage image )
-    {
-        if( m_EffectsStack.size() == 0 )
+
+    private BufferedImage applyEffectsStack( BufferedImage image ) {
+        if( effectsStack.size() == 0 ) {
             return image;
-        Iterator list = m_EffectsStack.iterator();
+        }
+        Iterator list = effectsStack.iterator();
         WritableRaster src = image.getRaster();
-        while( list.hasNext() )
-        {
+        while( list.hasNext() ) {
             ImageOperation op = (ImageOperation) list.next();
             WritableRaster r = op.apply( src );
             if(getLogger().isDebugEnabled()) {
@@ -199,12 +197,12 @@
             src = r.createWritableTranslatedChild( 0, 0 );
         }
         ColorModel cm = image.getColorModel();
-        if(getLogger().isDebugEnabled()) {
+        if (getLogger().isDebugEnabled()) {
             getLogger().debug( "Out Bounds: " + src.getBounds() );
         }
         BufferedImage newImage = new BufferedImage( cm, src, true, new Hashtable() );
         // Not sure what this should really be --------------^^^^^
-        
+
         int minX = newImage.getMinX();
         int minY = newImage.getMinY();
         int width = newImage.getWidth();
@@ -212,36 +210,33 @@
         if(getLogger().isInfoEnabled()) {
             getLogger().info( "Image: " + minX + ", " + minY + ", " + width + ", " + height );
         }
-        
+
         return newImage;
     }
-    
+
     private void write( BufferedImage image )
-        throws ProcessingException, IOException
-    {
+    throws ProcessingException, IOException {
         ImageTypeSpecifier its = ImageTypeSpecifier.createFromRenderedImage( image );
-        Iterator writers = ImageIO.getImageWriters( its, m_Format );
+        Iterator writers = ImageIO.getImageWriters( its, format );
         ImageWriter writer = null;
-        if( writers.hasNext() ) 
-        {
+        if( writers.hasNext() ) {
             writer = (ImageWriter) writers.next();
         }
-        if( writer == null ) 
-            throw new ProcessingException( "Unable to find a ImageWriter: " + m_Format );
+        if( writer == null ) {
+            throw new ProcessingException( "Unable to find a ImageWriter: " + format );
+        }
 
         ImageWriterSpi spi = writer.getOriginatingProvider();
         String[] mimetypes = spi.getMIMETypes();
-        if(getLogger().isInfoEnabled()) {
+        if (getLogger().isInfoEnabled()) {
             getLogger().info( "Setting content-type: " + mimetypes[0] );
         }
         response.setHeader("Content-Type", mimetypes[0] );
         ImageOutputStream output = ImageIO.createImageOutputStream( out );
-        try
-        {
+        try {
             writer.setOutput( output );
             writer.write( image );
-        } finally
-        {
+        } finally {
             writer.dispose();
             output.close();
             out.flush();

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ImageOperation.java Tue Feb 20 07:21:16 2007
@@ -17,23 +17,20 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.component.Component;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
-public interface ImageOperation extends Component 
-{
+public interface ImageOperation extends Component {
+
     String ROLE = ImageOperation.class.getName();
-    
+
     void setPrefix( String prefix );
-    
+
     void setup( Parameters params ) 
-        throws ProcessingException;
-    
+    throws ProcessingException;
+
     WritableRaster apply( WritableRaster raster );
-    
+
     String getKey();
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/MirrorOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/MirrorOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/MirrorOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/MirrorOperation.java Tue Feb 20 07:21:16 2007
@@ -16,48 +16,39 @@
  */
 package org.apache.cocoon.reading.imageop;
 
-
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
 public class MirrorOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private boolean m_AlongY;
-    
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private boolean alongY;
+
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
+
     public void setup( Parameters params )
-        throws ProcessingException
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        m_AlongY = params.getParameterAsBoolean( m_Prefix + "along-y", false );
+    throws ProcessingException {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        alongY = params.getParameterAsBoolean( prefix + "along-y", false );
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
+        }
         int xScale;
         int yScale;
-        if( m_AlongY )
-        {
+        if( alongY ) {
             xScale = -1;
             yScale = 1;
-        }
-        else
-        {
+        } else {
             xScale = 1;
             yScale = -1;
         }
@@ -67,11 +58,10 @@
         return scaledRaster;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "mirror:"
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + ( m_AlongY ? "along-y" : "along-x" )
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + ( alongY ? "along-y" : "along-x" )
+               + ":" + prefix;
     }
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/OffsetOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/OffsetOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/OffsetOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/OffsetOperation.java Tue Feb 20 07:21:16 2007
@@ -17,51 +17,45 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
 public class OffsetOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private int     m_Up;
-    private int     m_Left;
-    
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private int     up;
+    private int     left;
+
+    public void setPrefix( String prefix ) {
+       this. prefix = prefix;
     }
-    
+
     public void setup( Parameters params )
-        throws ProcessingException
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        m_Up = params.getParameterAsInteger( m_Prefix + "up", 0 );
-        m_Left = params.getParameterAsInteger( m_Prefix + "left", 0 );
+    throws ProcessingException {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        up = params.getParameterAsInteger( prefix + "up", 0 );
+        left = params.getParameterAsInteger( prefix + "left", 0 );
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-        AffineTransform translate = AffineTransform.getTranslateInstance( m_Left, m_Up );
+        }
+        AffineTransform translate = AffineTransform.getTranslateInstance( left, up );
         AffineTransformOp op = new AffineTransformOp( translate, AffineTransformOp.TYPE_BILINEAR );
         WritableRaster scaledRaster = op.filter( image, null );
         return scaledRaster;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "offset:"
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_Up
-               + ":" + m_Left
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + up
+               + ":" + left
+               + ":" + prefix;
     }
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ResizeOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ResizeOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ResizeOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ResizeOperation.java Tue Feb 20 07:21:16 2007
@@ -17,54 +17,51 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
 public class ResizeOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private int     m_Height;
-    private int     m_Width;
-    private boolean m_PreserveRatio;
-    private boolean m_AdjustX;
-    
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private int     height;
+    private int     width;
+    private boolean preserveRatio;
+    private boolean adjustX;
+
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
+
     public void setup( Parameters params )
-        throws ProcessingException
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        m_Height = params.getParameterAsInteger( m_Prefix + "height", 200 );
-        if( m_Height < 0 )
-            throw new ProcessingException( "Negative Height is not allowed: " + m_Height );
-        m_Width = params.getParameterAsInteger( m_Prefix + "width", 300 );
-        if( m_Width < 0 )
-            throw new ProcessingException( "Negative Width is not allowed: " + m_Width );
-        m_PreserveRatio = params.getParameterAsBoolean( m_Prefix + "preserve-ratio", false );
-        m_AdjustX = params.getParameterAsBoolean( m_Prefix + "adjust-x", false );
+    throws ProcessingException {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        height = params.getParameterAsInteger( prefix + "height", 200 );
+        if( height < 0 ) {
+            throw new ProcessingException( "Negative Height is not allowed: " + height );
+        }
+        width = params.getParameterAsInteger( prefix + "width", 300 );
+        if( width < 0 ) {
+            throw new ProcessingException( "Negative Width is not allowed: " + width );
+        }
+        preserveRatio = params.getParameterAsBoolean( prefix + "preserve-ratio", false );
+        adjustX = params.getParameterAsBoolean( prefix + "adjust-x", false );
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+ 
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
+        }
         double height = image.getHeight();
         double width = image.getWidth();
-        double xScale = m_Width / width;
-        double yScale = m_Height / height;
-        if( m_PreserveRatio )
+        double xScale = this.width / width;
+        double yScale = this.height / height;
+        if( preserveRatio )
         {
-            if( m_AdjustX )
+            if( adjustX )
                 xScale = yScale;
             else
                 yScale = xScale;
@@ -75,12 +72,11 @@
         return scaledRaster;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "resize:"
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_Width
-               + ":" + m_Height
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + width
+               + ":" + height
+               + ":" + prefix;
     }
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/RotateOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/RotateOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/RotateOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/RotateOperation.java Tue Feb 20 07:21:16 2007
@@ -17,67 +17,62 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
-
 import org.apache.cocoon.ProcessingException;
 
 public class RotateOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private double  m_Angle;
-    
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private double  angle;
+ 
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
+
     public void setup( Parameters params )
-        throws ProcessingException
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        double angle = params.getParameterAsFloat( m_Prefix + "angle", 0.0f );
-        boolean useRadians = params.getParameterAsBoolean( m_Prefix + "use-radians", false);
-        if( ! useRadians )
-            m_Angle = ( angle / 180.0 ) * Math.PI;
-        else
-            m_Angle = angle;
+    throws ProcessingException {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        double angle = params.getParameterAsFloat( prefix + "angle", 0.0f );
+        boolean useRadians = params.getParameterAsBoolean( prefix + "use-radians", false);
+        if( ! useRadians ) {
+            this.angle = ( angle / 180.0 ) * Math.PI;
+        } else {
+            this.angle = angle;
+        }
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
+        }
         int width = image.getWidth();
         int height = image.getHeight();
         int x = width / 2;
         int y = height / 2;
-        
+
         WritableRaster newRaster1 = image.createCompatibleWritableRaster(-x, -y, width, height );
-        
+
         AffineTransform translate = AffineTransform.getTranslateInstance( -x, -y );
         AffineTransformOp op = new AffineTransformOp( translate, AffineTransformOp.TYPE_BILINEAR );
         op.filter( image, newRaster1 );
-        
-        AffineTransform rotate = AffineTransform.getRotateInstance( m_Angle );
+
+        AffineTransform rotate = AffineTransform.getRotateInstance( angle );
         op = new AffineTransformOp( rotate, AffineTransformOp.TYPE_BILINEAR );
-        
+
         WritableRaster newRaster2 = image.createCompatibleWritableRaster(-x, -y, width, height );
         op.filter( newRaster1, newRaster2 );
-        
+
         return newRaster2;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "rotate:"
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_Angle
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + angle
+               + ":" + prefix;
     }
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ScaleOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ScaleOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ScaleOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ScaleOperation.java Tue Feb 20 07:21:16 2007
@@ -17,45 +17,40 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
 
 public class ScaleOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private float   m_Scale;
-    
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private float   scale;
+
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
-    public void setup( Parameters params )
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        m_Scale = params.getParameterAsFloat( m_Prefix + "scale", 1.0f );
+
+    public void setup( Parameters params ) {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        scale = params.getParameterAsFloat( prefix + "scale", 1.0f );
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-        AffineTransform scale = AffineTransform.getScaleInstance( m_Scale, m_Scale );
+        }
+        AffineTransform scale = AffineTransform.getScaleInstance( this.scale, this.scale );
         AffineTransformOp op = new AffineTransformOp( scale, AffineTransformOp.TYPE_BILINEAR );
         WritableRaster scaledRaster = op.filter( image, null );
         return scaledRaster;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "scale:" 
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_Scale
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + scale
+               + ":" + prefix;
     }
 } 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ShearOperation.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ShearOperation.java?view=diff&rev=509603&r1=509602&r2=509603
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ShearOperation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/imageop/java/org/apache/cocoon/reading/imageop/ShearOperation.java Tue Feb 20 07:21:16 2007
@@ -17,48 +17,43 @@
 package org.apache.cocoon.reading.imageop;
 
 import java.awt.geom.AffineTransform;
-
 import java.awt.image.AffineTransformOp;
 import java.awt.image.WritableRaster;
-
 import org.apache.avalon.framework.parameters.Parameters;
 
 public class ShearOperation
-    implements ImageOperation
-{
-    private String  m_Prefix;
-    private boolean m_Enabled;
-    private float   m_ShearX;
-    private float   m_ShearY;
+    implements ImageOperation {
+
+    private String  prefix;
+    private boolean enabled;
+    private float   shearX;
+    private float   shearY;
     
-    public void setPrefix( String prefix )
-    {
-        m_Prefix = prefix;
+    public void setPrefix( String prefix ) {
+        this.prefix = prefix;
     }
-    
-    public void setup( Parameters params )
-    {
-        m_Enabled = params.getParameterAsBoolean( m_Prefix + "enabled", true);
-        m_ShearX = params.getParameterAsFloat( m_Prefix + "shear-x", 0.0f );
-        m_ShearY = params.getParameterAsFloat( m_Prefix + "shear-y", 0.0f );
+
+    public void setup( Parameters params ) {
+        enabled = params.getParameterAsBoolean( prefix + "enabled", true);
+        shearX = params.getParameterAsFloat( prefix + "shear-x", 0.0f );
+        shearY = params.getParameterAsFloat( prefix + "shear-y", 0.0f );
     }
-    
-    public WritableRaster apply( WritableRaster image )
-    {
-        if( ! m_Enabled )
+
+    public WritableRaster apply( WritableRaster image ) {
+        if( ! enabled ) {
             return image;
-        AffineTransform shear = AffineTransform.getShearInstance( m_ShearX, m_ShearY );
+        }
+        AffineTransform shear = AffineTransform.getShearInstance( shearX, shearY );
         AffineTransformOp op = new AffineTransformOp( shear, AffineTransformOp.TYPE_BILINEAR );
         WritableRaster scaledRaster = op.filter( image, null );
         return scaledRaster;
     }
 
-    public String getKey()
-    {
+    public String getKey() {
         return "shear:" 
-               + ( m_Enabled ? "enable" : "disable" )
-               + ":" + m_ShearX
-               + ":" + m_ShearY
-               + ":" + m_Prefix;
+               + ( enabled ? "enable" : "disable" )
+               + ":" + shearX
+               + ":" + shearY
+               + ":" + prefix;
     }
 } 



Mime
View raw message