org.mmbase.util.images
Class JAIImageConverter

java.lang.Object
  extended by org.mmbase.util.images.AbstractImageConverter
      extended by org.mmbase.util.images.JAIImageConverter
All Implemented Interfaces:
ImageConverter

public class JAIImageConverter
extends AbstractImageConverter
implements ImageConverter

Converts Images using image Java Advanced Imaging

Version:
$Id: JAIImageConverter.java 36462 2009-06-29 11:49:30Z michiel $
Author:
Daniel Ockeloen, Martijn Houtman (JAI fix)

Constructor Summary
JAIImageConverter()
           
 
Method Summary
protected static javax.media.jai.PlanarImage border(javax.media.jai.PlanarImage inImg, int xpadding, int ypadding)
          Performs the 'border' operation: Adds a border to an image using the specified horizontal and vertical padding.
 byte[] convertImage(byte[] input, String sourceFormat, List<String> commands)
          This functions converts an image by the given parameters
protected static javax.media.jai.PlanarImage crop(javax.media.jai.PlanarImage inImg, int x1, int y1, int x2, int y2)
           
protected static javax.media.jai.PlanarImage flip(javax.media.jai.PlanarImage inImg)
          Performs the 'flip' or 'flipy' operation: Flip an image across an imaginary vertical line that runs through the center of the image.
protected static javax.media.jai.PlanarImage flop(javax.media.jai.PlanarImage inImg)
          Performs the 'flop' or 'flipx' operation: Flip an image across an imaginary horizontal line that runs through the center of the image.
 void init(Map<String,String> params)
           
protected static javax.media.jai.PlanarImage loadImage(String filename)
           
protected static javax.media.jai.PlanarImage negate(javax.media.jai.PlanarImage inImg)
          Performs the 'dia' or 'negate' operation.
protected static javax.media.jai.PlanarImage rotate(javax.media.jai.PlanarImage inImg, int x, int y, int a)
          Performs the 'rotate' operation: rotates an image.
protected static javax.media.jai.PlanarImage size(javax.media.jai.PlanarImage inImg, int width, int height, boolean maintainAspectRation)
          Performs the 's' or 'geometry' operation: Resize an image using specified width and height.
 
Methods inherited from class org.mmbase.util.images.AbstractImageConverter
convertImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mmbase.util.images.ImageConverter
convertImage
 

Constructor Detail

JAIImageConverter

public JAIImageConverter()
Method Detail

init

public void init(Map<String,String> params)
Specified by:
init in interface ImageConverter
Overrides:
init in class AbstractImageConverter
See Also:
ImageConverter.init(java.util.Map)
Javadoc:

convertImage

public byte[] convertImage(byte[] input,
                           String sourceFormat,
                           List<String> commands)
Description copied from interface: ImageConverter
This functions converts an image by the given parameters

Specified by:
convertImage in interface ImageConverter
Overrides:
convertImage in class AbstractImageConverter
Parameters:
input - an array of byte which represents the original image
sourceFormat - original image format
commands - a List of Strings containing commands which are operations on the image which will be returned.
Returns:
an array of bytes containing the new converted image.
See Also:
ImageConverter.convertImage(byte[], java.lang.String, java.util.List)
Javadoc:

crop

protected static javax.media.jai.PlanarImage crop(javax.media.jai.PlanarImage inImg,
                                                  int x1,
                                                  int y1,
                                                  int x2,
                                                  int y2)
Javadoc:

size

protected static javax.media.jai.PlanarImage size(javax.media.jai.PlanarImage inImg,
                                                  int width,
                                                  int height,
                                                  boolean maintainAspectRation)
Performs the 's' or 'geometry' operation: Resize an image using specified width and height.

Parameters:
inImg - the image to transform
width - new width of the image
height - new height of the image
maintainAspectRation - if true, width and height are maximums: aspect ratio is maintained
Returns:
the transformed image

negate

protected static javax.media.jai.PlanarImage negate(javax.media.jai.PlanarImage inImg)
Performs the 'dia' or 'negate' operation. Replace every pixel with its complementary color (white becomes black, yellow becomes blue, etc.)

Parameters:
inImg - the image to transform
Returns:
the transformed image

rotate

protected static javax.media.jai.PlanarImage rotate(javax.media.jai.PlanarImage inImg,
                                                    int x,
                                                    int y,
                                                    int a)
Performs the 'rotate' operation: rotates an image.

Parameters:
inImg - the image to transform
x - xposition of the rotation
y - yposition of the rotation
a - angle of the rotation
Returns:
the transformed image

border

protected static javax.media.jai.PlanarImage border(javax.media.jai.PlanarImage inImg,
                                                    int xpadding,
                                                    int ypadding)
Performs the 'border' operation: Adds a border to an image using the specified horizontal and vertical padding.

Parameters:
inImg - the image to transform
xpadding - the horizontal padding
ypadding - the vertical padding
Returns:
the transformed image

flop

protected static javax.media.jai.PlanarImage flop(javax.media.jai.PlanarImage inImg)
Performs the 'flop' or 'flipx' operation: Flip an image across an imaginary horizontal line that runs through the center of the image.

Parameters:
inImg - the image to transform
Returns:
the transformed image

flip

protected static javax.media.jai.PlanarImage flip(javax.media.jai.PlanarImage inImg)
Performs the 'flip' or 'flipy' operation: Flip an image across an imaginary vertical line that runs through the center of the image.

Parameters:
inImg - the image to transform
Returns:
the transformed image

loadImage

protected static javax.media.jai.PlanarImage loadImage(String filename)
Javadoc:


MMBase 2.0-SNAPSHOT - null