Monday, 30 July 2007

Image Display

JAI uses the Java 2D BufferedImage model for displaying images. The BufferedImage manages an image in memory and provides ways to store pixel data, interpret pixel data, and to render the pixel data to a Graphics2D context.

The display of images in JAI may be accomplished in several ways. First, the drawRenderedImage() call on Graphics2D may be used to produce an immediate rendering. Another method is to instantiate a display widget that responds to user requests such as scrolling and panning, as well as expose events, and requests image data from a RenderedImage source. This technique allows image data to be computed on demand.

* int getWidth()
returns the width of the rendered image.

* int getHeight()
returns the height of the rendered image.

* ScrollingImagePanel(RenderedImage im, int width, int height)
constructs a ScrollingImagePanel of a given size for a given RenderedImage.

* void setOrigin(int x, int y)
sets the image origin to a given (x, y) position. The scrollbars are updated appropriately.

* void setCenter(int x, int y)
sets the image center to a given (x, y) position. The scrollbars are updated appropriately.

* ImageCanvas(RenderedImage im, boolean drawBorder)
constructs an ImageCanvas to display a RenderedImage.

* ImageCanvas(java.awt.image.RenderedImage im)
constructs an ImageCanvas to display a RenderedImage.

* void set(RenderedImage im)
changes the source image to a new RenderedImage.

* void paint(java.awt.Graphics g)
paint the image onto a Graphics object.

* void setOrigin(int x, int y)
sets the origin of the image at x,y.

* int getXOrigin()
returns the x coordinate of the image origin.

* int getYOrigin()
returns the y coordinate of the image origin.

No comments: