railo.runtime.img
Class PSDReader

java.lang.Object
  extended by railo.runtime.img.PSDReader

public class PSDReader
extends Object


Field Summary
static int ImageType
           
static int STATUS_FORMAT_ERROR
          File read status: Error decoding file (may be partially decoded)
static int STATUS_OK
          File read status: No errors.
static int STATUS_OPEN_ERROR
          File read status: Unable to open source.
static int STATUS_UNSUPPORTED
          File read status: Unsupported format
 
Constructor Summary
PSDReader()
           
 
Method Summary
 int getDelay(int forFrame)
          Gets display duration for specified frame.
 BufferedImage getFrame(int n)
          Gets the image contents of frame n.
 int getFrameCount()
          Gets the number of layers read from file.
 Dimension getFrameSize()
          Gets maximum image size.
 BufferedImage getImage()
          Gets the first (or only) image read.
 BufferedImage getLayer(int n)
          Gets the image contents of layer n.
 Point getLayerOffset(int n)
          Gets the subimage offset of layer n if it is smaller than the full frame size.
 int read(InputStream stream)
          Reads PhotoShop layers from stream.
 int read(String name)
          Reads PhotoShop file from specified source (file or URL string)
 void reset()
          Closes input stream and discards contents of all frames.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_OK

public static final int STATUS_OK
File read status: No errors.

See Also:
Constant Field Values

STATUS_FORMAT_ERROR

public static final int STATUS_FORMAT_ERROR
File read status: Error decoding file (may be partially decoded)

See Also:
Constant Field Values

STATUS_OPEN_ERROR

public static final int STATUS_OPEN_ERROR
File read status: Unable to open source.

See Also:
Constant Field Values

STATUS_UNSUPPORTED

public static final int STATUS_UNSUPPORTED
File read status: Unsupported format

See Also:
Constant Field Values

ImageType

public static int ImageType
Constructor Detail

PSDReader

public PSDReader()
Method Detail

getFrameCount

public int getFrameCount()
Gets the number of layers read from file.

Returns:
frame count

getDelay

public int getDelay(int forFrame)
Gets display duration for specified frame. Always returns 0.


getFrame

public BufferedImage getFrame(int n)
Gets the image contents of frame n. Note that this expands the image to the full frame size (if the layer was smaller) and any subsequent use of getLayer() will return the full image.

Returns:
BufferedImage representation of frame, or null if n is invalid.

getFrameSize

public Dimension getFrameSize()
Gets maximum image size. Individual layers may be smaller.

Returns:
maximum image dimensions

getImage

public BufferedImage getImage()
Gets the first (or only) image read.

Returns:
BufferedImage containing first frame, or null if none.

getLayer

public BufferedImage getLayer(int n)
Gets the image contents of layer n. May be smaller than full frame size - use getFrameOffset() to obtain position of subimage within main image area.

Returns:
BufferedImage representation of layer, or null if n is invalid.

getLayerOffset

public Point getLayerOffset(int n)
Gets the subimage offset of layer n if it is smaller than the full frame size.

Returns:
Point indicating offset from upper left corner of frame.

read

public int read(InputStream stream)
Reads PhotoShop layers from stream.

Parameters:
InputStream - in PhotoShop format.
Returns:
read status code (0 = no errors)

read

public int read(String name)
Reads PhotoShop file from specified source (file or URL string)

Parameters:
name - String containing source
Returns:
read status code (0 = no errors)

reset

public void reset()
Closes input stream and discards contents of all frames.



Copyright © 2012 Railo