net.aerith.misao.image
Class DoubleBuffer

java.lang.Object
  |
  +--net.aerith.misao.image.Buffer
        |
        +--net.aerith.misao.image.DoubleBuffer

public class DoubleBuffer
extends Buffer

The DoubleBuffer is a class of double array for an image buffer.


Field Summary
private  double[] pixels
          The buffer to keep double values of the image.
 
Fields inherited from class net.aerith.misao.image.Buffer
signed_flag, size
 
Constructor Summary
DoubleBuffer(Size allocate_size)
          Constructs a DoubleBuffer, allocates the buffer.
 
Method Summary
 Buffer cloneBuffer()
          Creates a clone image buffer.
 double get(int x, int y)
          Gets pixel value of a specified position.
 double getValue(int x, int y)
          Gets pixel value of a specified position.
 void inverse()
          Inverses white and black.
 void read(java.io.DataInput input, Size size)
          Reads pixel values and set pixel values into the buffer.
 void reverseHorizontally()
          Reverses left to the right.
 void reverseVertically()
          Reverses upside down.
 void set(int x, int y, double value)
          Sets pixel value of a specified position.
 void setValue(int x, int y, double value)
          Sets pixel value of a specified position.
 void write(java.io.DataOutput output)
          Write pixel values into the specified stream.
 
Methods inherited from class net.aerith.misao.image.Buffer
getDataCount, getSize, getValueAt, setSigned
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

pixels

private double[] pixels
The buffer to keep double values of the image.
Constructor Detail

DoubleBuffer

public DoubleBuffer(Size allocate_size)
Constructs a DoubleBuffer, allocates the buffer.
Parameters:
allocate_size - the buffer size.
Method Detail

get

public double get(int x,
                  int y)
           throws java.lang.IndexOutOfBoundsException
Gets pixel value of a specified position.
Parameters:
x - the x position.
y - the y position.
Returns:
the pixel value of the position.
Throws:
java.lang.IndexOutOfBoundsException - if specified position is out of the image area.

set

public void set(int x,
                int y,
                double value)
         throws java.lang.IndexOutOfBoundsException
Sets pixel value of a specified position.
Parameters:
x - the x position.
y - the y position.
value - the value to set.
Throws:
java.lang.IndexOutOfBoundsException - if specified position is out of the image area.

getValue

public double getValue(int x,
                       int y)
                throws java.lang.IndexOutOfBoundsException
Gets pixel value of a specified position.
Overrides:
getValue in class Buffer
Parameters:
x - the x position.
y - the y position.
Returns:
the pixel value of the position.
Throws:
java.lang.IndexOutOfBoundsException - if specified position is out of the image area.

setValue

public void setValue(int x,
                     int y,
                     double value)
              throws java.lang.IndexOutOfBoundsException
Sets pixel value of a specified position. The value is forcedly converted into the data type of image buffer.
Overrides:
setValue in class Buffer
Parameters:
x - the x position.
y - the y position.
value - the value to set.
Throws:
java.lang.IndexOutOfBoundsException - if specified position is out of the image area.

read

public void read(java.io.DataInput input,
                 Size size)
          throws java.io.IOException
Reads pixel values and set pixel values into the buffer.
Overrides:
read in class Buffer
Parameters:
input - the input stream pointing to the start of int data.
size - the size of image.
Throws:
java.io.IOException - if I/O error occurs.

write

public void write(java.io.DataOutput output)
           throws java.io.IOException
Write pixel values into the specified stream.
Overrides:
write in class Buffer
Parameters:
output - the output stream.
Throws:
java.io.IOException - if I/O error occurs.

inverse

public void inverse()
Inverses white and black.
Overrides:
inverse in class Buffer

reverseVertically

public void reverseVertically()
Reverses upside down.
Overrides:
reverseVertically in class Buffer

reverseHorizontally

public void reverseHorizontally()
Reverses left to the right.
Overrides:
reverseHorizontally in class Buffer

cloneBuffer

public Buffer cloneBuffer()
Creates a clone image buffer.
Overrides:
cloneBuffer in class Buffer
Returns:
the new clone image buffer.