org.mmbase.module.builders
Class ConvertJAI

java.lang.Object
  extended byorg.mmbase.module.builders.ConvertJAI
All Implemented Interfaces:
ImageConvertInterface

public class ConvertJAI
extends java.lang.Object
implements ImageConvertInterface

Converts Images using image Java Advanced Imaging

Version:
$Id: ConvertJAI.java,v 1.10 2004/03/05 12:16:34 pierre Exp $
Author:
Daniel Ockeloen, Martijn Houtman (JAI fix)

Field Summary
protected  java.lang.String defaultImageFormat
          The default image format.
 
Constructor Summary
ConvertJAI()
           
 
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, java.util.List commands)
           
 byte[] ConvertImage(byte[] input, java.util.List commands)
           
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.
protected  java.lang.String getAlias(java.lang.String a)
          MMBase has some abreviations to convert commands, like 's' for 'geometry'.
protected static float getDeg2Rad(float deg)
           
protected  int getOneInt(java.lang.String cmd)
           
 void init(java.util.Map params)
           
protected static javax.media.jai.PlanarImage loadImage(java.lang.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultImageFormat

protected java.lang.String defaultImageFormat
The default image format.

Constructor Detail

ConvertJAI

public ConvertJAI()
Method Detail

init

public void init(java.util.Map params)
Specified by:
init in interface ImageConvertInterface
Warning: No Java Documentation Available.

ConvertImage

public byte[] ConvertImage(byte[] input,
                           java.util.List commands)
Specified by:
ConvertImage in interface ImageConvertInterface
Warning: No Java Documentation Available.

convertImage

public byte[] convertImage(byte[] input,
                           java.util.List commands)
Specified by:
convertImage in interface ImageConvertInterface
Warning: No Java Documentation Available.

getAlias

protected java.lang.String getAlias(java.lang.String a)
MMBase has some abreviations to convert commands, like 's' for 'geometry'. These are treated here.

Parameters:
a - alias
Returns:
actual convert parameter name for alias.

crop

protected static javax.media.jai.PlanarImage crop(javax.media.jai.PlanarImage inImg,
                                                  int x1,
                                                  int y1,
                                                  int x2,
                                                  int y2)
Warning: No Java Documentation Available.

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:
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.)

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

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.

Returns:
the transformed image

loadImage

protected static javax.media.jai.PlanarImage loadImage(java.lang.String filename)
Warning: No Java Documentation Available.

getDeg2Rad

protected static float getDeg2Rad(float deg)
Warning: No Java Documentation Available.

getOneInt

protected int getOneInt(java.lang.String cmd)
Warning: No Java Documentation Available.


MMBase build 1.7.1.20041002