org.faceless.graph.output
Class GIFOutput

java.lang.Object
  extended by org.faceless.graph.output.Output
      extended by org.faceless.graph.output.ImageOutput
          extended by org.faceless.graph.output.GIFOutput

public class GIFOutput
extends ImageOutput

The GIFOutput class is concrete subclass of GraphicsOutput which creates a GIF image when it's rendered.

The GIF creation is done using the Acme.JPM.Encoders.GifEncoder class, which needs to be installed separately. It is available from http://www.acme.com/java. Unisys have a patent on LZW compression, which may or may not apply to the Acme library in your country. This class does not contain any code implementing the LZW algorithm.

Since version 1.0.8 of the package, GIF images may have transparent backgrounds. See PNGOutput for more information.


Constructor Summary
GIFOutput(int width, int height, Color color, OutputStream out)
          Create a new GIFOutput of the specified width and height and background color.
GIFOutput(int width, int height, OutputStream out)
          Create a new GIFOutput of the specified width and height.
 
Method Summary
 void render(Graph gr)
          Render the Graph to this Output object.
 void setNumColors(int numcolors)
           The number of distinct colors to use in the image.
 
Methods inherited from class org.faceless.graph.output.ImageOutput
canPattern, canRotate, getCanvas, getGraph, getImage, getReducedColorImage, getTextBox, line, poly, setColor, setFontMap, setLineDash, setLineThickness, setMargin, setRenderingHint, text
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GIFOutput

public GIFOutput(int width,
                 int height,
                 OutputStream out)
Create a new GIFOutput of the specified width and height. This constructor creates a GIF of up to 256 colours with a white background.

Parameters:
width - the width of the output GIF in pixels
height - the height of the output GIF in pixels
out - the OutputStream to render the GIF image to (the stream is left open)

GIFOutput

public GIFOutput(int width,
                 int height,
                 Color color,
                 OutputStream out)
Create a new GIFOutput of the specified width and height and background color. This constructor creates a GIF with up to 256 colours.

Parameters:
width - the width of the output GIF in pixels
height - the height of the output GIF in pixels
color - the background colour of the GIF
out - the OutputStream to render the GIF image to (the stream is left open)
Method Detail

setNumColors

public void setNumColors(int numcolors)

The number of distinct colors to use in the image. By default, all GIF images are limited to 256 colors, which the maximum allowed by the GIF specification. Smaller files can be obtained by setting this value to value between 2 and 255, at the expense of lower quality and slightly longer rendering time.

Parameters:
num - the maximum number of colors to use in the image, from 2 to 256

render

public void render(Graph gr)
            throws IOException
Description copied from class: Output
Render the Graph to this Output object.

Overrides:
render in class ImageOutput
Throws:
IOException


Copyright © 2001-2012 Big Faceless Organization