JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class EPSImage

java.lang.Object
  |
  +--java.awt.Image
        |
        +--com.klg.jclass.page.EPSImage

public class EPSImage
extends Image

EPSImage encapsulates the input of an EPS image, plus display attributes.


Field Summary
protected  BufferedReader inputSource
          The file or buffer stream which contains the data of the image
protected  JCUnit.Dimension size
          The dimensions at which the EPS is to be displayed
 
Fields inherited from class java.awt.Image
SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
Constructor Summary
EPSImage(BufferedReader input)
          Create an EPS image object given the input source
 
Method Summary
 void flush()
          Flushes all resources used by this Image object.
 Graphics getGraphics()
          Creates a graphics context for drawing to an off-screen image.
 int getHeight(ImageObserver observer)
          Determines the height of the image.
 BufferedReader getInputSource()
          Return the input source for this image
 Object getProperty(String name, ImageObserver observer)
          Gets a property of this image by name.
 Image getScaledInstance(int width, int height, int hints)
          Creates a scaled version of this image.
 JCUnit.Dimension getSize()
          Get the display size of the EPS image
 ImageProducer getSource()
          Gets the object that produces the pixels for the image.
 int getWidth(ImageObserver observer)
          Determines the width of the image.
 void setSize(JCUnit.Dimension size)
          Specify the dimensions of the image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected JCUnit.Dimension size
The dimensions at which the EPS is to be displayed


inputSource

protected BufferedReader inputSource
The file or buffer stream which contains the data of the image

Constructor Detail

EPSImage

public EPSImage(BufferedReader input)
Create an EPS image object given the input source

Method Detail

getWidth

public int getWidth(ImageObserver observer)
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

Specified by:
getWidth in class Image
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the width of this image, or -1 if the width is not yet known.
See Also:
Image.getHeight(java.awt.image.ImageObserver), ImageObserver

getHeight

public int getHeight(ImageObserver observer)
Determines the height of the image. If the height is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

Specified by:
getHeight in class Image
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the height of this image, or -1 if the height is not yet known.
See Also:
Image.getWidth(java.awt.image.ImageObserver), ImageObserver

getSource

public ImageProducer getSource()
Gets the object that produces the pixels for the image. This method is called by the image filtering classes and by methods that perform image conversion and scaling.

Specified by:
getSource in class Image
Returns:
the image producer that produces the pixels for this image.
See Also:
ImageProducer

getGraphics

public Graphics getGraphics()
Creates a graphics context for drawing to an off-screen image. This method can only be called for off-screen images.

Specified by:
getGraphics in class Image
Returns:
a graphics context to draw to the off-screen image.
See Also:
Graphics, Component.createImage(int, int)

getProperty

public Object getProperty(String name,
                          ImageObserver observer)
Gets a property of this image by name.

Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object.

If the properties for this image are not yet known, this method returns null, and the ImageObserver object is notified later.

The property name "comment" should be used to store an optional comment which can be presented to the application as a description of the image, its source, or its author.

Specified by:
getProperty in class Image
Parameters:
name - a property name.
observer - an object waiting for this image to be loaded.
Returns:
the value of the named property.
See Also:
ImageObserver, Image.UndefinedProperty

getScaledInstance

public Image getScaledInstance(int width,
                               int height,
                               int hints)
Creates a scaled version of this image. A new Image object is returned which by default renders the image at the specified width and height. The new Image object may be loaded asynchronously even if the original source image has already been loaded completely. If either the width or height is a negative number then a value is substituted to maintain the aspect ratio of the image's original dimensions.

Overrides:
getScaledInstance in class Image
Parameters:
width - the width to which to scale the image.
height - the height to which to scale the image.
hints - flags to indicate the type of algorithm to use for image resampling.
Returns:
a scaled version of the image.
Since:
JDK1.1
See Also:
Image.SCALE_DEFAULT, Image.SCALE_FAST, Image.SCALE_SMOOTH, Image.SCALE_REPLICATE, Image.SCALE_AREA_AVERAGING

flush

public void flush()
Flushes all resources used by this Image object. This includes any pixel data that is cached for rendering to the screen as well as any system resources that are used to store data or pixels for the image. The image is reset to a state similar to when it was first created so that if it is again rendered, the image data will have to be recreated or fetched again from its source.

Specified by:
flush in class Image

getSize

public JCUnit.Dimension getSize()
Get the display size of the EPS image

Returns:
The output size of the image

setSize

public void setSize(JCUnit.Dimension size)
Specify the dimensions of the image

Parameters:
size - The output size of the image

getInputSource

public BufferedReader getInputSource()
Return the input source for this image


Copyright © 2004 Quest Software Inc..
All rights reserved.