Search this API

y.io
Class GIFIOHandler

java.lang.Object
  extended by y.io.IOHandler
      extended by y.io.ImageOutputHandler
          extended by y.io.GIFIOHandler

public class GIFIOHandler
extends ImageOutputHandler

Writes a Graph2D in GIF image format. The encoding process is done in two steps. First the graph will be renderer to an image. Rendering upon an image is done by calling method Graph2DView.paintVisibleContent(java.awt.Graphics2D) on the current view of the Graph2D. Configuring the view influences size, viewport, background, etc. of the rendered image. In the second step the image is taken and encoded to the output format.

Note: This class uses ImageIO.getImageWritersByFormatName(String) to retrieve an ImageWriter for encoding images in GIF format. As of Java 1.6, such an ImageWriter is available by default. For Java 1.4 and Java 1.5 a suitable ImageWriter has to be registered externally (using Java's service provider mechanism).

 
Your browser does not support SVG content.

Constructor Summary
GIFIOHandler()
          Instantiates a new GIFIOHandler.
 
Method Summary
 Graph2DView createDefaultGraph2DView(Graph2D graph)
          Takes the value returned by the base class and adds a transparent background to it.
protected  java.awt.image.BufferedImage createImage(int width, int height)
          Creates the buffered image on which the graph will be rendered.
protected  void encode(java.awt.image.BufferedImage image, java.io.OutputStream out)
          Encodes the given image to the given output stream.
 java.lang.String getFileFormatString()
          Returns the GIF file format string.
 java.lang.String getFileNameExtension()
          Returns the GIF file name extension, i.e.
 
Methods inherited from class y.io.ImageOutputHandler
canRead, createGraphicsContext, getBorder, isAntialiasingEnabled, isSelectionPaintingEnabled, read, setAntialiasingEnabled, setBorder, setSelectionPaintingEnabled, write, write
 
Methods inherited from class y.io.IOHandler
canWrite, canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GIFIOHandler

public GIFIOHandler()
Instantiates a new GIFIOHandler.

Method Detail

getFileFormatString

public java.lang.String getFileFormatString()
Returns the GIF file format string.

Specified by:
getFileFormatString in class IOHandler

getFileNameExtension

public java.lang.String getFileNameExtension()
Returns the GIF file name extension, i.e. "gif"

Specified by:
getFileNameExtension in class IOHandler

encode

protected void encode(java.awt.image.BufferedImage image,
                      java.io.OutputStream out)
               throws java.io.IOException
Description copied from class: ImageOutputHandler
Encodes the given image to the given output stream.

Specified by:
encode in class ImageOutputHandler
Throws:
java.io.IOException - if an error occurs during writing.

createImage

protected java.awt.image.BufferedImage createImage(int width,
                                                   int height)
Description copied from class: ImageOutputHandler
Creates the buffered image on which the graph will be rendered.

Specified by:
createImage in class ImageOutputHandler

createDefaultGraph2DView

public Graph2DView createDefaultGraph2DView(Graph2D graph)
Takes the value returned by the base class and adds a transparent background to it.

Overrides:
createDefaultGraph2DView in class ImageOutputHandler
See Also:
Graph2D.removeView(y.view.View)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.