jjil.algorithm
Class GrayShrink

java.lang.Object
  extended by jjil.core.PipelineStage
      extended by jjil.algorithm.GrayShrink

public class GrayShrink
extends PipelineStage

Shrinks an input Gray8Image to a given new size. The shrinking is done with proper averaging so each output pixel is the average of the corresponding rectangular region in the input.

Author:
webb

Constructor Summary
GrayShrink(int cWidth, int cHeight)
          Creates a new instance of GrayRectStretch.
 
Method Summary
 int getHeight()
          Gets current target height
 int getWidth()
          Gets current target width
 void push(Image image)
          Process an input Gray8Image, producing a new shrunk output image.
 void setHeight(int cHeight)
          Changes target height
 void setWidth(int cWidth)
          Changes target width
 java.lang.String toString()
          Return a string describing the shrinking operation.
 
Methods inherited from class jjil.core.PipelineStage
getFront, isEmpty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GrayShrink

public GrayShrink(int cWidth,
                  int cHeight)
           throws Error
Creates a new instance of GrayRectStretch.

Parameters:
cWidth - new image width
cHeight - new image height
Throws:
Error - if either is less than or equal to zero.
Method Detail

getHeight

public int getHeight()
Gets current target height

Returns:
current height

getWidth

public int getWidth()
Gets current target width

Returns:
current width

push

public void push(Image image)
          throws Error
Process an input Gray8Image, producing a new shrunk output image.

Specified by:
push in class PipelineStage
Parameters:
image - The input Gray8Image.
Throws:
Error - if input is not a Gray8Image, or the input image size is smaller (either horizontally or vertically) than the desired size.

setHeight

public void setHeight(int cHeight)
               throws Error
Changes target height

Parameters:
cHeight - the new target height.
Throws:
Error - if height is not positive

setWidth

public void setWidth(int cWidth)
              throws Error
Changes target width

Parameters:
cWidth - the new target width.
Throws:
Error - if height is not positive

toString

public java.lang.String toString()
Return a string describing the shrinking operation.

Overrides:
toString in class java.lang.Object
Returns:
the string describing the shrinking operation.