Serializable, javax.servlet.Filter, javax.servlet.FilterConfigCropFilterpublic class ScaleFilter extends ImageFilter
Parameters:
scaleXscaleYscaleUniformtrue.
scaleUnitsPIXELS, PERCENT.
PIXELS is default.
scaleQualitySCALE_SMOOTH, SCALE_FAST,
SCALE_REPLICATE, SCALE_AREA_AVERAGING.
SCALE_DEFAULT is default (see
Image.getScaledInstance(int,int,int), Image
for more details).
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
defaultScaleQuality |
|
protected static String |
PARAM_IMAGE |
image |
protected static String |
PARAM_SCALE_QUALITY |
scaleQuality |
protected static String |
PARAM_SCALE_UNIFORM |
scaleUniform |
protected static String |
PARAM_SCALE_UNITS |
scaleUnits |
protected static String |
PARAM_SCALE_X |
scaleX |
protected static String |
PARAM_SCALE_Y |
scaleY |
static int |
UNITS_PERCENT |
Width and height are percentage of original width and height.
|
static int |
UNITS_PIXELS |
Width and height are absolute pixels.
|
static int |
UNITS_UNKNOWN |
Unknown units.
|
oncePerRequesttriggerParams| Constructor | Description |
|---|---|
ScaleFilter() |
| Modifier and Type | Method | Description |
|---|---|---|
protected RenderedImage |
doFilter(BufferedImage pImage,
javax.servlet.ServletRequest pRequest,
ImageServletResponse pResponse) |
Reads the image from the requested URL, scales it, and returns it in the
Servlet stream.
|
protected Dimension |
getDimensions(Image pImage,
int pWidth,
int pHeight,
int pUnits,
boolean pUniformScale) |
Gets the dimensions (height and width) of the scaled image.
|
protected int |
getQuality(String pQualityStr) |
Gets the quality constant for the scaling, from the string argument.
|
protected int |
getUnits(String pUnitStr) |
Gets the units constant for the width and height arguments, from the
given string argument.
|
void |
setDefaultScaleQuality(String pDefaultScaleQuality) |
destroy, doFilter, getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, init, log, log, setFilterConfig, setOncePerRequestdoFilterImpl, setTriggerParams, triggerpublic static final int UNITS_PIXELS
public static final int UNITS_PERCENT
public static final int UNITS_UNKNOWN
protected static final String PARAM_SCALE_QUALITY
scaleQualityprotected static final String PARAM_SCALE_UNITS
scaleUnitsprotected static final String PARAM_SCALE_UNIFORM
scaleUniformprotected static final String PARAM_SCALE_X
scaleXprotected static final String PARAM_SCALE_Y
scaleYprotected static final String PARAM_IMAGE
imageprotected int defaultScaleQuality
protected RenderedImage doFilter(BufferedImage pImage, javax.servlet.ServletRequest pRequest, ImageServletResponse pResponse)
doFilter in class ImageFilterpImage - the image to filterpRequest - the servlet requestpResponse - the servlet responseprotected int getQuality(String pQualityStr)
pQualityStr - The string representation of the scale quality
constant.Image,
Image.getScaledInstance(int,int,int)public void setDefaultScaleQuality(String pDefaultScaleQuality)
protected int getUnits(String pUnitStr)
pUnitStr - The string representation of the units constant,
can be one of "PIXELS" or "PERCENT".protected Dimension getDimensions(Image pImage, int pWidth, int pHeight, int pUnits, boolean pUniformScale)
pImage - the image to be scaledpWidth - the new width of the image, or -1 if unknownpHeight - the new height of the image, or -1 if unknownpUnits - the constant specifying units for width and height
parameter (UNITS_PIXELS or UNITS_PERCENT)pUniformScale - boolean specifying uniform scale or notCopyright © 2018. All rights reserved.