org.jboss.seam.ui.graphicImage
Class Image

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

@Name(value="org.jboss.seam.graphicImage.image")
@Install(precedence=0)
@BypassInterceptors
public class Image
extends Object
implements 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
 BufferedImage getBufferedImage()
           
 Image.Type getContentType()
          The content type of the output image, by default DEFAULT_CONTENT_TYPE
 Integer getHeight()
          The height of the image
 byte[] getImage()
          Get the image as a byte[], any conversions having been applied.
 Double getRatio()
          The aspect ratio of the image
 Integer getWidth()
          The width of the image
static Image instance()
           
 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 scaleToFit(int height, int width)
           
 Image scaleToHeight(int height)
          Scale the image to the given height
 Image scaleToWidth(int width)
          Scale the image to the given width
 void setBufferedImage(BufferedImage bufferedImage)
           
 void setContentType(Image.Type contentType)
           
 Image setInput(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(Object value)
               throws 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:
IOException

getImage

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

Throws:
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 BufferedImage getBufferedImage()

setBufferedImage

public void setBufferedImage(BufferedImage bufferedImage)

getRatio

public Double getRatio()
                throws IOException
The aspect ratio of the image

Throws:
IOException

isRatio

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

Throws:
IOException

getWidth

public Integer getWidth()
                 throws IOException
The width of the image

Throws:
IOException

getHeight

public Integer getHeight()
                  throws IOException
The height of the image

Throws:
IOException

adjustRatio

public Image adjustRatio(double desiredRatio,
                         double precision)
                  throws InterruptedException,
                         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:
InterruptedException
IOException

blur

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

Throws:
IOException

scaleToWidth

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

Throws:
IOException

scaleToFit

public Image scaleToFit(int height,
                        int width)
                 throws IOException
Throws:
IOException

scaleToHeight

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

Throws:
IOException

scale

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

Throws:
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 © 2011 Seam Framework. All Rights Reserved.