SourceForge.net Logo
aXSL API 0.2

org.axsl.graphic
Interface Graphic

All Known Subinterfaces:
EpsGraphic, SvgGraphic

public interface Graphic

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


Nested Class Summary
static class Graphic.Compression
          Enumeration of compression schemes used in Graphic files.
static class Graphic.Type
          Enumeration of graphic formats.
 
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()
          Tells the server that the client application is done with this graphic, which gives the server an opportunity to release any resources devoted to this graphic.
 int getBitsPerComponent()
          Return the number of uncompressed bits per component for this graphic.
 java.awt.color.ColorSpace getColorSpace()
          Return the image color space: DeviceGray, DeviceRGB, or DeviceCMYK.
 Graphic.Compression getCompressionType()
          Indicates the type of compression used in this graphic.
 byte[] getContent()
          Return the uncompressed content of the graphic.
 int getContentSize()
          Return the graphic content size, in bytes (uncompressed).
 Graphic.Type getGraphicType()
          Indicates the type of this graphic.
 GraphicLink[] getLinks()
          Returns any links embedded in the graphic.
 java.lang.String getMimeType()
          Return corresponding mime type.
 java.lang.String getName()
          Return the name of the Graphic.
 byte[] getRawSamples()
          Return the raw content of the sample portion of the graphic.
 java.awt.Color getTransparentColor()
          Return the transparent color, if any.
 java.net.URL getUrl()
          Return the image URL.
 boolean isInverted()
          Indicates whether a graphic has its colors inverted.
 boolean isTransparent()
          Indicates whether this image is transparent.
 int pixelHeight()
          Return the image height, in pixels, if available.
 int pixelWidth()
          Return the image width, in pixels, if available.
 

Method Detail

isInverted

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

java.net.URL getUrl()
Return the image URL.

Returns:
The image URL.

pixelWidth

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 - For errors during parsing of the graphic content.

pixelHeight

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 - For errors during parsing of the graphic content.

absoluteWidth

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 - For errors during parsing of the graphic content.

absoluteHeight

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 - For errors during parsing of the graphic content.

getColorSpace

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

Returns:
the image color space
Throws:
GraphicException - For errors during parsing of the graphic content.

getBitsPerComponent

int getBitsPerComponent()
                        throws GraphicException
Return the number of uncompressed bits per component for this graphic. For example, a typical opaque RGB image has 3 components, each component using 8 bits to describe its integral value from 0 to 255, and this method would return 8.

Returns:
The number of bits per component.
Throws:
GraphicException - For errors during parsing of the graphic content.

isTransparent

boolean isTransparent()
                      throws GraphicException
Indicates whether this image is transparent.

Returns:
True iff the image is transparent.
Throws:
GraphicException - For errors during parsing of the graphic content.

getTransparentColor

java.awt.Color getTransparentColor()
                                   throws GraphicException
Return the transparent color, if any.

Returns:
The transparent color, or null if the image is not transparent.
Throws:
GraphicException - For errors during parsing of the graphic content.

getRawSamples

byte[] getRawSamples()
                     throws GraphicException
Return the raw content of the sample portion of the graphic. This content may be either compressed or uncompressed. This method is provided to avoid unnecessary filtering when that is possible. For example, JPEG images are compressed using a DCT filter, so applications that wish to embed the JPEG data using a DCT filter can avoid the overhead of having the graphic convert itself to a standard format (see getContent(), and then needing to recompress it after getting the uncompressed image.

Returns:
The raw content of the sample portion of the graphic content. Graphics that contain only vector data (no image samples) return null.
Throws:
GraphicException - For errors during parsing of the graphic content.

getContent

byte[] getContent()
                  throws GraphicException
Return the uncompressed content of the graphic. This content is provided in a standard image coordinate system and scanning order format that is used by PostScript and PDF. This format is described in Section 4.8.3 of the "PDF Reference, 5th Edition." Briefly, the pixels or samples are ordered from left-to-right, and from top-to-bottom, with the first row read entirely, then the second row, etc. The getColorSpace() and the getBitsPerComponent() indicate the number of channels, order of the channels, and number of bits that are used to describe each image sample.

Returns:
The graphic content. Graphics that contain only vector data (no image samples) return null.
Throws:
GraphicException - For errors during parsing of the graphic content.

getContentSize

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

Returns:
The graphic content size, in bytes.
Throws:
GraphicException - For errors during parsing of the graphic content.

close

void close()
Tells the server that the client application is done with this graphic, which gives the server an opportunity to release any resources devoted to this graphic. Implementations are expected to release such resources unless they have been instructed to cache the graphic for future use.


getGraphicType

Graphic.Type getGraphicType()
Indicates the type of this graphic.

Returns:
The type of this graphic, or null if it is not known.

getCompressionType

Graphic.Compression getCompressionType()
                                       throws GraphicException
Indicates the type of compression used in this graphic.

Returns:
The type of compression used in this graphic, or null if it is not known.
Throws:
GraphicException - If an error occurs attempting to find the compression scheme.

getMimeType

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

Returns:
image mime type

getName

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.

getLinks

GraphicLink[] getLinks()
Returns any links embedded in the graphic.

Returns:
The links embedded in the graphic. If there are none, returns an empty array.

SourceForge.net Logo
aXSL API 0.2

This documentation was created August 8 2007 by The aXSL Group and may be freely copied. See license for details.