RGBIndex
public class OrderedDither extends ImageToImageOperation implements RGBIndex
ErrorDiffusionDithering
or similar other methods.
OrderedDither od = new OrderedDither(); od.setRgbBits(3, 3, 2); od.setInputImage(image); od.process(); Paletted8Image ditheredImage = (Paletted8Image)od.getOutputImage();
Modifier and Type | Field | Description |
---|---|---|
private int |
blueBits |
|
private int |
grayBits |
|
private int |
greenBits |
|
private int |
redBits |
|
private int |
valueHeight |
|
private int[] |
values |
|
private int |
valueWidth |
INDEX_BLUE, INDEX_GREEN, INDEX_RED
Constructor | Description |
---|---|
OrderedDither() |
Modifier and Type | Method | Description |
---|---|---|
void |
process() |
This method does the actual work of the operation.
|
private void |
process(Gray8Image in,
BilevelImage out) |
|
private void |
process(Gray8Image in,
Gray8Image out) |
|
private void |
process(RGB24Image in,
Paletted8Image out) |
|
private void |
process(RGB24Image in,
RGB24Image out) |
|
void |
setOutputBits(int bits) |
|
void |
setRgbBits(int red,
int green,
int blue) |
Sets the number of bits to be used for each RGB component in the output image.
|
void |
setStandardThresholdValues() |
Calls
setThresholdValues(int[], int, int) with a 16 x 16 matrix. |
void |
setThresholdValues(int[] values,
int valueWidth,
int valueHeight) |
Defines a matrix of threshold values that will be used for grayscale
dithering.
|
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress
private int[] values
private int valueWidth
private int valueHeight
private int grayBits
private int redBits
private int greenBits
private int blueBits
private void process(Gray8Image in, Gray8Image out)
private void process(Gray8Image in, BilevelImage out)
private void process(RGB24Image in, Paletted8Image out)
private void process(RGB24Image in, RGB24Image 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 setOutputBits(int bits)
public void setRgbBits(int red, int green, int blue)
process(net.sourceforge.jiu.data.Gray8Image, net.sourceforge.jiu.data.Gray8Image)
, these values are checked against
the actual number of bits per component in the input image.
If any of the arguments of this method is equal to or larger
than those actual bits per channel values, a WrongParameterException
will then be thrown.
Right now, there is no way how this can be checked, because
the input image may not have been defined yet.red
- number of bits for the red channel in the output imagegreen
- number of bits for the green channel in the output imageblue
- number of bits for the blue channel in the output imageIllegalArgumentException
- if at least one argument is smaller than 1
public void setStandardThresholdValues()
setThresholdValues(int[], int, int)
with a 16 x 16 matrix.public void setThresholdValues(int[] values, int valueWidth, int valueHeight)
values
- the int values to use for comparingvalueWidth
- valueHeight
-