Methods Summary |
---|
public javax.media.jai.PlanarImage | executeDrawOperation(){@inheritDoc}.
for (int i = 0; i < instructions.size(); i++) {
ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
if (instr instanceof DrawOperation) {
PlanarImage image = null;
// If this TransformOperation has DrawOperation children
// then Rotate the first child and return.
performScale(image);
return image;
}
}
return null;
|
public javax.media.jai.PlanarImage | executeTransformOperation(javax.media.jai.PlanarImage image){@inheritDoc}.
BufferedImage bi = null;
for (int i = 0; i < instructions.size(); i++) {
ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
if (instr instanceof DrawOperation) {
return performScale(image);
} else if (instr instanceof TransformOperation) {
bi = image.getAsBufferedImage();
image = ((TransformOperation) instr)
.executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
bi = image.getAsBufferedImage();
}
}
return performScale(image);
|
public float | getHeight()Get the height.
int percIndex = heightStr.indexOf('%");
if (percIndex > 0) {
float height = Float.parseFloat(heightStr.substring(0, percIndex));
yPercent = true;
return height / HUNDRED;
} else {
yPercent = false;
return Float.parseFloat(heightStr);
}
|
public float | getWidth()Get the width.
float width = 0.0F;
int percIndex = widthStr.indexOf('%");
if (percIndex > 0) {
width = Float.parseFloat(widthStr.substring(0, percIndex));
xPercent = true;
return width / HUNDRED;
} else {
xPercent = false;
return Float.parseFloat(widthStr);
}
|
public javax.media.jai.PlanarImage | performScale(javax.media.jai.PlanarImage image)Scale an image.
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
float xFl = getWidth();
float yFl = getHeight();
if (!xPercent) {
xFl = (xFl / image.getWidth());
}
if (!yPercent) {
yFl = (yFl / image.getHeight());
}
if ("width".equals(proportions)) {
yFl = xFl;
} else if ("height".equals(proportions)) {
xFl = yFl;
} else if ("fit".equals(proportions)) {
yFl = Math.min(xFl, yFl);
xFl = yFl;
} else if ("cover".equals(proportions)) {
yFl = Math.max(xFl, yFl);
xFl = yFl;
}
pb.add(new Float(xFl));
pb.add(new Float(yFl));
log("\tScaling to " + (xFl * HUNDRED) + "% x "
+ (yFl * HUNDRED) + "%");
return JAI.create("scale", pb);
|
public void | setHeight(java.lang.String height)Sets the height of the image, either as an integer or a %. Defaults to 100%.
heightStr = height;
|
public void | setProportions(org.apache.tools.ant.types.optional.image.Scale$ProportionsAttribute pa)Sets the behaviour regarding the image proportions.
proportions = pa.getValue();
|
public void | setWidth(java.lang.String width)Sets the width of the image, either as an integer or a %.
Defaults to 100%.
widthStr = width;
|