jjil.algorithm
Class RgbShrink

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

public class RgbShrink
extends PipelineStage

Shrinks a color (RgbImage) to a given size. Each band is shrunk independently. The pixels that each pixel maps to are averaged. There is no between-target-pixel smoothing. The output image must be smaller than or equal to the size of the input.

Author:
webb

Constructor Summary
RgbShrink(int cWidth, int cHeight)
          Creates a new instance of RgbShrink.
 
Method Summary
 int getHeight()
          Gets current target height
 int getWidth()
          Gets current target width
 void push(Image image)
          Process an image.
 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

RgbShrink

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

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 image.

Specified by:
push in class PipelineStage
Parameters:
image - the input RgbImage.
Throws:
Error - if the input is not an RgbImage, or is smaller than the target image either horizontally or vertically.

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.