SourceForge.net Logo
aXSL API 0.1

org.axsl.graphicR
Interface Graphic

All Known Subinterfaces:
EPSGraphic, SVGGraphic

public interface Graphic

Interface for "graphics". Graphics, as used here, may include:


Field Summary
static byte COMPRESSION_CCITT_FAX
          Constant indicating a CCITT Fax compression scheme.
static byte COMPRESSION_DCT
          Constant indicating a DCT compression scheme.
static byte COMPRESSION_UNKNOWN
          Constant indicating an unknown compression scheme.
static byte TYPE_BMP
          Constant indicating a BMP image.
static byte TYPE_EPS
          Constant indicating an EPS graphic.
static byte TYPE_GIF
          Constant indicating a GIG image.
static byte TYPE_JPEG
          Constant indicating a JPEG image.
static byte TYPE_PDF
          Constant indicating a PDF graphic.
static byte TYPE_SVG
          Constant indicating an SVG graphic.
static byte TYPE_TIFF
          Constant indicating a TIFF image.
static byte TYPE_UNKNOWN
          Constant indicating an unknown graphic type.
 
Method Summary
 int absoluteHeight(int pixelsPerInch)
          For image formats that store such information, return the image height, in millipoints.
 int absoluteWidth(int pixelsPerInch)
          For image formats that store such information, return the image width, in millipoints.
 void close()
          Free all resources.
 int getBitsPerPixel()
          Return the number of bits per pixel.
 java.awt.color.ColorSpace getColorSpace()
          Return the image color space: DeviceGray, DeviceRGB, or DeviceCMYK.
 int getCompressionType()
          Indicates the type of compression used in this graphic.
 byte[] getContent()
          Return the graphic content (uncompressed).
 int getContentSize()
          Return the graphic content size, in bytes (uncompressed).
 int getGraphicType()
          Indicates the type of this graphic.
 java.lang.String getMimeType()
          Return corresponding mime type.
 java.lang.String getName()
          Return the name of the Graphic.
 java.awt.Color getTransparentColor()
          Return the transparent color.
 java.net.URL getURL()
          Return the image URL.
 boolean isInverted()
          Indicates whether a graphic has its colors inverted.
 boolean isTransparent()
          Return the image transparency.
 int pixelHeight()
          Return the image height, in pixels, if available.
 int pixelWidth()
          Return the image width, in pixels, if available.
 

Field Detail

TYPE_UNKNOWN

public static final byte TYPE_UNKNOWN
Constant indicating an unknown graphic type.

See Also:
Constant Field Values

TYPE_TIFF

public static final byte TYPE_TIFF
Constant indicating a TIFF image.

See Also:
Constant Field Values

TYPE_SVG

public static final byte TYPE_SVG
Constant indicating an SVG graphic.

See Also:
Constant Field Values

TYPE_JPEG

public static final byte TYPE_JPEG
Constant indicating a JPEG image.

See Also:
Constant Field Values

TYPE_GIF

public static final byte TYPE_GIF
Constant indicating a GIG image.

See Also:
Constant Field Values

TYPE_EPS

public static final byte TYPE_EPS
Constant indicating an EPS graphic.

See Also:
Constant Field Values

TYPE_BMP

public static final byte TYPE_BMP
Constant indicating a BMP image.

See Also:
Constant Field Values

TYPE_PDF

public static final byte TYPE_PDF
Constant indicating a PDF graphic.

See Also:
Constant Field Values

COMPRESSION_UNKNOWN

public static final byte COMPRESSION_UNKNOWN
Constant indicating an unknown compression scheme.

See Also:
Constant Field Values

COMPRESSION_DCT

public static final byte COMPRESSION_DCT
Constant indicating a DCT compression scheme.

See Also:
Constant Field Values

COMPRESSION_CCITT_FAX

public static final byte COMPRESSION_CCITT_FAX
Constant indicating a CCITT Fax compression scheme.

See Also:
Constant Field Values
Method Detail

isInverted

public boolean isInverted()
Indicates whether a graphic has its colors inverted. Some applications, most notably Adobe Photoshop, invert the image colors, and client applications need to know this in order to be able to render the graphic properly.

Returns:
True iff the data for this graphic have the colors inverted.

getURL

public java.net.URL getURL()
Return the image URL.

Returns:
The image URL.

pixelWidth

public int pixelWidth()
               throws GraphicException
Return the image width, in pixels, if available.

Returns:
The image width, in pixels, or -1 if that value is not known.
Throws:
GraphicException - Error occurred in parsing of Graphic file.

pixelHeight

public int pixelHeight()
                throws GraphicException
Return the image height, in pixels, if available.

Returns:
The image height, in pixels, or -1 if that value is not known.
Throws:
GraphicException - Error occurred in parsing of Graphic file.

absoluteWidth

public int absoluteWidth(int pixelsPerInch)
                  throws GraphicException
For image formats that store such information, return the image width, in millipoints. A millipoint, as used here, is 1/72,000 of an inch.

Parameters:
pixelsPerInch - The density factor that should be used if the graphic does not know its absolute width, but does know its pixel width. Set this value to less than one to ensure that the fallback computation based on density will return -1 if the absolute width is not known.
Returns:
The image width, in millipoints, or -1 if that value is not known.
Throws:
GraphicException - Error occurred in parsing of Graphic file.

absoluteHeight

public int absoluteHeight(int pixelsPerInch)
                   throws GraphicException
For image formats that store such information, return the image height, in millipoints. A millipoint, as used here, is 1/72,000 of an inch.

Parameters:
pixelsPerInch - The density factor that should be used if the graphic does not know its absolute height, but does know its pixel height. Set this value to less than one to ensure that the fallback computation based on density will return -1 if the absolute width is not known.
Returns:
The image height, in millipoints, or -1 if that value is not known.
Throws:
GraphicException - Error occurred in parsing of Graphic file.

getColorSpace

public java.awt.color.ColorSpace getColorSpace()
                                        throws GraphicException
Return the image color space: DeviceGray, DeviceRGB, or DeviceCMYK.

Returns:
the image color space
Throws:
GraphicException - Error occurred in parsing of Graphic file.

getBitsPerPixel

public int getBitsPerPixel()
                    throws GraphicException
Return the number of bits per pixel.

Returns:
number of bits per pixel
Throws:
GraphicException - Error occurred in parsing of Graphic file.

isTransparent

public boolean isTransparent()
                      throws GraphicException
Return the image transparency.

Returns:
true if the image is transparent
Throws:
GraphicException - Error occurred in parsing of Graphic file.

getTransparentColor

public java.awt.Color getTransparentColor()
                                   throws GraphicException
Return the transparent color.

Returns:
the transparent color
Throws:
GraphicException - Error occurred in parsing of Graphic file.

getContent

public byte[] getContent()
                  throws GraphicException
Return the graphic content (uncompressed).

Returns:
The graphic content.
Throws:
GraphicException - Error occurred in parsing of Graphic file.

getContentSize

public int getContentSize()
                   throws GraphicException
Return the graphic content size, in bytes (uncompressed).

Returns:
The graphic content size, in bytes.
Throws:
GraphicException - Error occurred in parsing of Graphic file.

close

public void close()
Free all resources.


getGraphicType

public int getGraphicType()
Indicates the type of this graphic.

Returns:
One of the following Graphic constants: TYPE_UNKNOWN, TYPE_TIFF, TYPE_SVG, TYPE_JPEG, TYPE_GIF, TYPE_EPS, TYPE_BMP.

getCompressionType

public int getCompressionType()
                       throws GraphicException
Indicates the type of compression used in this graphic.

Returns:
One of the following Graphic constants: COMPRESSION_UNKNOWN, COMPRESSION_DCT, COMPRESSION_CCITT_FAX.
Throws:
GraphicException - If an error occurs attempting to find the compression scheme.

getMimeType

public java.lang.String getMimeType()
Return corresponding mime type.

Returns:
image mime type

getName

public java.lang.String getName()
Return the name of the Graphic. Some graphic formats include a name as part of their meta information.

Returns:
The name of this graphic, or null if no name is available in the graphic.

SourceForge.net Logo
aXSL API 0.1

This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.