protected RenderedImage doFilter ( BufferedImage pImage , ServletRequest pRequest , ImageServletResponse pResponse ) { // Get quality setting // SMOOTH | FAST | REPLICATE | DEFAULT | AREA_AVERAGING // See Image (mHints) int quality = getQuality ( pRequest . getParameter ( PARAM_SCALE_QUALITY ) ) ; // Get units, default is pixels // PIXELS | PERCENT | METRIC | INCHES int units = getUnits ( pRequest . getParameter ( PARAM_SCALE_UNITS ) ) ; if ( units == UNITS_UNKNOWN ) { log ( "Unknown units for scale, returning original." ) ; return pImage ; } // Use uniform scaling? Default is true boolean uniformScale = ServletUtil . getBooleanParameter ( pRequest , PARAM_SCALE_UNIFORM , true ) ; // Get dimensions int width = ServletUtil . getIntParameter ( pRequest , PARAM_SCALE_X , - 1 ) ; int height = ServletUtil . getIntParameter ( pRequest , PARAM_SCALE_Y , - 1 ) ; // Get dimensions for scaled image Dimension dim = getDimensions ( pImage , width , height , units , uniformScale ) ; width = ( int ) dim . getWidth ( ) ; height = ( int ) dim . getHeight ( ) ; // Return scaled instance directly return ImageUtil . createScaled ( pImage , width , height , quality ) ; }
Reads the image from the requested URL scales it and returns it in the Servlet stream . See above for details on parameters .