public class Shear extends ImageToImageOperation
IntegerImage
.
Shear shear = new Shear(); shear.setInputImage(image); // some IntegerImage shear.setAngle(5.0); shear.process(); PixelImage shearedImage = shear.getOutputImage();
This is an adjusted version of Jef Poskanzer's shearing code from his ACME package; see the API documentation page of ACME's Shear class.
Modifier and Type | Field and Description |
---|---|
private double |
angle |
Constructor and Description |
---|
Shear() |
Modifier and Type | Method and Description |
---|---|
static int |
computeNewImageWidth(int oldImageWidth,
int height,
double angle)
For a given image width and shearing angle this method
computes the width of the resulting image.
|
double |
getAngle()
Returns the angle associated with this shearing operation object.
|
void |
process()
This method does the actual work of the operation.
|
private void |
process(IntegerImage in,
IntegerImage out) |
void |
setAngle(double newAngle)
Sets the angle to be used in the shearing operation to the argument value.
|
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress
public static int computeNewImageWidth(int oldImageWidth, int height, double angle)
oldImageWidth
- horizontal resolution of the image to be shearedheight
- height of the image to be shearedangle
- the angle to be used in the shearing operationpublic double getAngle()
setAngle(double)
private void process(IntegerImage in, IntegerImage out)
public void process() throws MissingParameterException, WrongParameterException
Operation
process
in class Operation
MissingParameterException
- if any mandatory parameter was not given to the operationWrongParameterException
- if at least one of the input parameters was
not initialized appropriately (values out of the valid interval, etc.)public void setAngle(double newAngle)
newAngle
- the angle to be used in this operationjava.lang.IllegalArgumentException
- if the argument is not in the above mentioned intervalgetAngle()