org.faceless.graph2
Class FlashOutput

java.lang.Object
  extended by org.faceless.graph2.Output
      extended by org.faceless.graph2.FlashOutput

public class FlashOutput
extends Output

The FlashOutput class allows you to create simple Macromedia Flash movies which display the graph. In the current release these movies have no interaction - they're just a still frame - but we anticipate future releases will allow interaction with the graph. Here's a simple example:

 Graph graph = makeMyGraph();
 FlashOutput out = new FlashOutput(100, 100);
 graph.draw(out);
 out.writeFlash(new FileOutputStream("Graph.swf"));
 

See Also:
Graph.draw(org.faceless.graph2.Output), Graph.setMetaData(java.lang.String, java.lang.String)

Constructor Summary
FlashOutput(int width, int height)
          Creates a new Flash movie with the default white background
FlashOutput(int width, int height, Color background)
          Creates a new Flash movie with the specified background color
 
Method Summary
 void setDetailLevel(int detailLevel)
          Set the level of detail to draw.
 void setFont(String name, Font font)
           Define a font for use in the movie.
 void writeFlash(OutputStream out)
          Write the completed SWF file to the specified OutputStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlashOutput

public FlashOutput(int width,
                   int height)
Creates a new Flash movie with the default white background

Parameters:
width - the width of the image in user units
height - the height of the image in user units

FlashOutput

public FlashOutput(int width,
                   int height,
                   Color background)
Creates a new Flash movie with the specified background color

Parameters:
width - the width of the image
height - the height of the image
background - the background color of the movie
Method Detail

setFont

public void setFont(String name,
                    Font font)

Define a font for use in the movie. This method can be used to define non-standard fonts for use in Graphs. Without calling this method the "Default" font is available and set to a sans-serif font. Additionally since 2.0.4 any fonts available to the Java process may be referenced by name without having to call this method.

For example, to use a font called "myfont" in a style:

 output.setFont("myfont", Font.createFont("myfont.ttf"));
 

Parameters:
name - the name of the font, as passed to TextStyle.setFont(java.lang.String, double). A name of "Default" will override the default font. The name is case-insensitive.
font - the Font to use

writeFlash

public void writeFlash(OutputStream out)
                throws IOException
Write the completed SWF file to the specified OutputStream. The stream is left open when finished.

Parameters:
out - the OutputStream to write the movie to
Throws:
IOException

setDetailLevel

public void setDetailLevel(int detailLevel)
Set the level of detail to draw. Flash viewers seem to have trouble displaying very small shapes - on Windows at least, the Flash viewer uses far more system resources than required. Consequently we omit smaller shapes (like the detail on small flags, for instance). This method can be used to control how much detail is omitted if required - although generally it's enough to leave it at the default level.

Parameters:
detailLevel - the level of detail to display. The default value is 30, and lower values give more detail, with 0 meaning "display everything"


Copyright © 2001-2011 Big Faceless Organization