org.apache.batik.apps.regsvggen
Class Main

java.lang.Object
  |
  +--org.apache.batik.apps.regsvggen.Main

public class Main
extends java.lang.Object

A regression checking tool for SVG generator test cases.


Field Summary
static java.lang.String CSS_PARSER_CLASS_NAME
          The CSS parser class name key.
 
Constructor Summary
Main()
           
 
Method Summary
static void cleanUp()
           
static java.lang.String compileTestClass(java.lang.String testFileName)
          This method will do the following: 1.
static java.lang.String computeTimeStamp()
           
static void createBufImage(java.lang.String className, java.lang.String testImageName)
          This method will generate PNG file directly from the BufferedImage, the image files will be stored in the "new" directory
static void createSvgFile(java.lang.String className, java.lang.String testImageName)
          This method will generate SVG files using the SVGGraphics2D, SVG files will be in "svg" directory
static void diffBufferedImage(java.awt.image.Raster ref, java.awt.image.Raster cmp, java.awt.image.Raster diff)
          This is the core method to calculate the difference of the two input images and save the comparison into the output image
static void diffImage()
           
static boolean diffImage(java.lang.String refInputURI, java.lang.String newInputURI)
          Returns true if the specified images are the same, false otherwise.
static void display(java.lang.String msg)
          Display the specified message.
static void error(java.lang.String msg)
          Display the specified error message.
static void exit(int code)
          Exits the application with the specified code.
static void generateGraphics()
           
static void generateRefImages()
          This method will generate PNG files from corresponding SVG files under "svg" directory, the image files will be in "ref" directory
static void generateReport()
           
static void generateReport(java.io.File[] refImages, int[] badIndex, int bi)
           
static java.lang.String getClassesDirectory()
          Returns the directory where temporary classes are stored.
static java.lang.String getDiffDirectory()
          Returns the directory where the difference images are stored.
static java.lang.String getNewDirectory()
          Returns the directory where the new images are stored.
static java.lang.String getRefDirectory()
          Returns the directory where the reference images are stored.
static java.lang.String getSvgDirectory()
          Returns the directory where the svg files are stored.
static Transcoder getTranscoder()
          Returns the transcoder to use.
static java.lang.String getXmlDirectory()
          Returns the directory where the XML test cases are stored.
static void init()
          INITILIZATION Creates the regsvggen directory and its sub directories.
static void main(java.lang.String[] args)
          MAIN
static void reset()
           
static void setUp()
          GO The main processing unit, devided into four parts: 1.
static void usage(java.io.PrintStream out)
          Shows the usage message.
static void writeImage(Transcoder transcoder, java.lang.String inputURI, java.lang.String output)
          Writes an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSS_PARSER_CLASS_NAME

public static final java.lang.String CSS_PARSER_CLASS_NAME
The CSS parser class name key.
Constructor Detail

Main

public Main()
Method Detail

main

public static void main(java.lang.String[] args)
MAIN

init

public static void init()
INITILIZATION Creates the regsvggen directory and its sub directories.

setUp

public static void setUp()
GO The main processing unit, devided into four parts: 1. setUp() -- generate temp directories: ref and new 2. generateGraphics() -- load XML file, create Classes, generate PNG image in "new" and SVG file in "svg" 3. generateRefImages() -- generate PNG image from SVG files into "ref" 4. diffImage() -- compare the images between "ref" and "new", generate reports 5. cleanUp() -- delete temp files and directories

generateGraphics

public static void generateGraphics()

compileTestClass

public static java.lang.String compileTestClass(java.lang.String testFileName)
                                         throws java.lang.Exception
This method will do the following: 1. Load the test case XML file specified by testFileName 2. Extract the Java code in the XML file and merge a Java source file 3. Compile the temparory Java source file and get the Class name

createBufImage

public static void createBufImage(java.lang.String className,
                                  java.lang.String testImageName)
                           throws java.lang.Exception
This method will generate PNG file directly from the BufferedImage, the image files will be stored in the "new" directory

createSvgFile

public static void createSvgFile(java.lang.String className,
                                 java.lang.String testImageName)
                          throws java.lang.Exception
This method will generate SVG files using the SVGGraphics2D, SVG files will be in "svg" directory

generateRefImages

public static void generateRefImages()
This method will generate PNG files from corresponding SVG files under "svg" directory, the image files will be in "ref" directory

diffImage

public static void diffImage()

generateReport

public static void generateReport()

generateReport

public static void generateReport(java.io.File[] refImages,
                                  int[] badIndex,
                                  int bi)

reset

public static void reset()

cleanUp

public static void cleanUp()

writeImage

public static void writeImage(Transcoder transcoder,
                              java.lang.String inputURI,
                              java.lang.String output)
Writes an image.
Parameters:
transcoder - the transcoder to use to generate the image
inputURI - the URI of the SVG file
outputURI - the URI of the image to generate

diffImage

public static boolean diffImage(java.lang.String refInputURI,
                                java.lang.String newInputURI)
Returns true if the specified images are the same, false otherwise.
Parameters:
refInputURI - the reference image
newInputURI - the new produced image

diffBufferedImage

public static void diffBufferedImage(java.awt.image.Raster ref,
                                     java.awt.image.Raster cmp,
                                     java.awt.image.Raster diff)
This is the core method to calculate the difference of the two input images and save the comparison into the output image
Parameters:
ref - the reference image in BufferedImage
new - the new image in BufferedImage
diff - the difference image in BufferedImage

computeTimeStamp

public static java.lang.String computeTimeStamp()

getTranscoder

public static Transcoder getTranscoder()
Returns the transcoder to use.

error

public static void error(java.lang.String msg)
Display the specified error message.
Parameters:
msg - the error message to display

display

public static void display(java.lang.String msg)
Display the specified message.
Parameters:
msg - the message to display

usage

public static void usage(java.io.PrintStream out)
Shows the usage message.
Parameters:
out - the stream where to write the usage message

exit

public static void exit(int code)
Exits the application with the specified code.
Parameters:
code - the exit code

getXmlDirectory

public static java.lang.String getXmlDirectory()
Returns the directory where the XML test cases are stored.

getRefDirectory

public static java.lang.String getRefDirectory()
Returns the directory where the reference images are stored.

getNewDirectory

public static java.lang.String getNewDirectory()
Returns the directory where the new images are stored.

getClassesDirectory

public static java.lang.String getClassesDirectory()
Returns the directory where temporary classes are stored.

getDiffDirectory

public static java.lang.String getDiffDirectory()
Returns the directory where the difference images are stored.

getSvgDirectory

public static java.lang.String getSvgDirectory()
Returns the directory where the svg files are stored.


Copyright © 2000 Apache Software Foundation. All Rights Reserved.