org.jboss.seam.ui.graphicImage
Class Image

java.lang.Object
  extended by org.jboss.seam.ui.graphicImage.Image
All Implemented Interfaces:
java.io.Serializable

@Name(value="org.jboss.seam.graphicImage.image")
@Install(precedence=0)
@BypassInterceptors
public class Image
extends java.lang.Object
implements java.io.Serializable

Image manipulation and interrogation

Author:
pmuir
See Also:
Serialized Form

Nested Class Summary
static class Image.Type
           
 
Field Summary
static int DEFAULT_IMAGE_TYPE
           
static int PNG_IMAGE_TYPE
           
 
Constructor Summary
Image()
           
 
Method Summary
 Image adjustRatio(double desiredRatio, double precision)
          Alter the ratio of the output image without altering the ratio of the input by adding transparent strips.
 Image blur(int radius)
          Blur the output image using a convolution
 java.awt.image.BufferedImage getBufferedImage()
           
 Image.Type getContentType()
          The content type of the output image, by default DEFAULT_CONTENT_TYPE
 java.lang.Integer getHeight()
          The height of the image
 byte[] getImage()
          Get the image as a byte[], any conversions having been applied.
 java.lang.Double getRatio()
          The aspect ratio of the image
 java.lang.Integer getWidth()
          The width of the image
static Image instance()
           
 java.lang.Boolean isRatio(double ratio, double precision)
          Check whether the image is of a given ratio to within a given precision
 Image resize(int width, int height)
          Resize the image to the given width and height, changing the ratio if necessary
 Image scale(double factor)
          Scale the image by the given factor
 Image scaleToHeight(int height)
          Scale the image to the given height
 Image scaleToWidth(int width)
          Scale the image to the given width
 void setBufferedImage(java.awt.image.BufferedImage bufferedImage)
           
 void setContentType(Image.Type contentType)
           
 Image setInput(java.lang.Object value)
          Set the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PNG_IMAGE_TYPE

public static final int PNG_IMAGE_TYPE
See Also:
Constant Field Values

DEFAULT_IMAGE_TYPE

public static final int DEFAULT_IMAGE_TYPE
See Also:
Constant Field Values
Constructor Detail

Image

public Image()
Method Detail

setInput

public Image setInput(java.lang.Object value)
               throws java.io.IOException
Set the image. This can be one of String (loaded from the classpath), a URL, a File, an InputStream or a byte[]

Parameters:
value -
Throws:
java.io.IOException

getImage

public byte[] getImage()
                throws java.io.IOException
Get the image as a byte[], any conversions having been applied. Returns null if the image could not be read

Throws:
java.io.IOException

getContentType

public Image.Type getContentType()
The content type of the output image, by default DEFAULT_CONTENT_TYPE


setContentType

public void setContentType(Image.Type contentType)

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()

setBufferedImage

public void setBufferedImage(java.awt.image.BufferedImage bufferedImage)

getRatio

public java.lang.Double getRatio()
                          throws java.io.IOException
The aspect ratio of the image

Throws:
java.io.IOException

isRatio

public java.lang.Boolean isRatio(double ratio,
                                 double precision)
                          throws java.io.IOException
Check whether the image is of a given ratio to within a given precision

Throws:
java.io.IOException

getWidth

public java.lang.Integer getWidth()
                           throws java.io.IOException
The width of the image

Throws:
java.io.IOException

getHeight

public java.lang.Integer getHeight()
                            throws java.io.IOException
The height of the image

Throws:
java.io.IOException

adjustRatio

public Image adjustRatio(double desiredRatio,
                         double precision)
                  throws java.lang.InterruptedException,
                         java.io.IOException
Alter the ratio of the output image without altering the ratio of the input by adding transparent strips. If the image is already of the correct ratio (to within the given precision) nothing happens

Throws:
java.lang.InterruptedException
java.io.IOException

blur

public Image blur(int radius)
           throws java.io.IOException
Blur the output image using a convolution

Throws:
java.io.IOException

scaleToWidth

public Image scaleToWidth(int width)
                   throws java.io.IOException
Scale the image to the given width

Throws:
java.io.IOException

scaleToHeight

public Image scaleToHeight(int height)
                    throws java.io.IOException
Scale the image to the given height

Throws:
java.io.IOException

scale

public Image scale(double factor)
            throws java.io.IOException
Scale the image by the given factor

Throws:
java.io.IOException

resize

public Image resize(int width,
                    int height)
Resize the image to the given width and height, changing the ratio if necessary


instance

public static Image instance()


Copyright © 2008 JBoss. All Rights Reserved.