edu.stanford.hci.r3.render
Class SheetRenderer

java.lang.Object
  extended by edu.stanford.hci.r3.render.SheetRenderer
Direct Known Subclasses:
PDFSheetRenderer

public class SheetRenderer
extends java.lang.Object

This class will render a Sheet into a JPEG, PDF, or Java2D graphics context.

For individual regions, it will use specific region renderers (e.g., ImageRenderer, PolygonRenderer, and TextRenderer).

This software is distributed under the BSD License.


Field Summary
protected  boolean renderActiveRegionsWithPattern
          By default, any active regions will be overlaid with pattern (unique to at least this sheet, unless otherwise specified).
protected  Sheet sheet
          The sheet we are to render.
 
Constructor Summary
SheetRenderer(Sheet s)
          Create a new TiledPatternGenerator for this Sheet.
SheetRenderer(Sheet s, TiledPatternGenerator patternGenerator)
          Feel free to share TiledPatternGenerator between Sheets.
 
Method Summary
 PatternLocationToSheetLocationMapping getPatternInformation()
           
 void renderToG2D(java.awt.Graphics2D g2d)
          We assume the g2d is big enough for us to draw this Sheet to.
 void renderToJPEG(java.io.File file)
          Use the default pixels per inch.
 void renderToJPEG(java.io.File destJPEGFile, Pixels destUnits)
           
 void renderToPDF(java.io.File destPDFFile)
          Uses the iText package to render a PDF file from scratch.
protected  void renderToPDFContentLayers(java.io.File destPDFFile, PdfContentByte topLayer, PdfContentByte bottomLayer)
           
 void savePatternInformation()
          This saves an xml file with the same name/path, but different extension as the most-recently rendered PDF file.
 void savePatternInformation(java.io.File patternInfoFile)
          After Rendering Pattern, we now know the particulars of the pattern coordinates for each region.
 void setPatternColor(java.awt.Color pColor)
           
 void setPatternGenerator(TiledPatternGenerator tiledPatternGenerator)
          Useful for when rendering many sheets at a time.
 void setRenderActiveRegionsWithPattern(boolean activeWithPattern)
           
 void useLargerPatternDots()
           
 void useSmallerPatternDots()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

renderActiveRegionsWithPattern

protected boolean renderActiveRegionsWithPattern
By default, any active regions will be overlaid with pattern (unique to at least this sheet, unless otherwise specified).


sheet

protected Sheet sheet
The sheet we are to render.

Constructor Detail

SheetRenderer

public SheetRenderer(Sheet s)
Create a new TiledPatternGenerator for this Sheet.

Parameters:
s -

SheetRenderer

public SheetRenderer(Sheet s,
                     TiledPatternGenerator patternGenerator)
Feel free to share TiledPatternGenerator between Sheets. That way, you can get unique pattern across multiple Sheets.

Parameters:
s -
patternGenerator -
Method Detail

getPatternInformation

public PatternLocationToSheetLocationMapping getPatternInformation()
Returns:

renderToG2D

public void renderToG2D(java.awt.Graphics2D g2d)
We assume the g2d is big enough for us to draw this Sheet to. By default, the transforms works at 72 dots per inch. Scale the transform beforehand if you would like better or worse rendering.

Parameters:
g2d -

renderToJPEG

public void renderToJPEG(java.io.File file)
Use the default pixels per inch. Specified in our configuration file.

Parameters:
file -

renderToJPEG

public void renderToJPEG(java.io.File destJPEGFile,
                         Pixels destUnits)
Parameters:
destJPEGFile -
destUnits - Converts the graphics2D object into a new coordinate space based on the destination units' pixels per inch. This is for the purposes of rendering the document to screen, where Graphics2D's default 72ppi isn't always the right way to do it.

renderToPDF

public void renderToPDF(java.io.File destPDFFile)
Uses the iText package to render a PDF file from scratch. iText is nice because we can write to a Graphics2D context. Alternatively, we can use PDF-like commands.

Parameters:
destPDFFile -

renderToPDFContentLayers

protected void renderToPDFContentLayers(java.io.File destPDFFile,
                                        PdfContentByte topLayer,
                                        PdfContentByte bottomLayer)
Parameters:
destPDFFile -
topLayer -
bottomLayer -

savePatternInformation

public void savePatternInformation()
This saves an xml file with the same name/path, but different extension as the most-recently rendered PDF file.


savePatternInformation

public void savePatternInformation(java.io.File patternInfoFile)
After Rendering Pattern, we now know the particulars of the pattern coordinates for each region. Save that information to disk.

Parameters:
patternInfoFile -

setPatternColor

public void setPatternColor(java.awt.Color pColor)
Parameters:
pColor -

setPatternGenerator

public void setPatternGenerator(TiledPatternGenerator tiledPatternGenerator)
Useful for when rendering many sheets at a time. This can guarantee that the pattern is unique across sheets. If you want to reset the pattern, or pick a particular sheet, you may, by interacting with the generator object.

Parameters:
tiledPatternGenerator -

setRenderActiveRegionsWithPattern

public void setRenderActiveRegionsWithPattern(boolean activeWithPattern)
Parameters:
activeWithPattern -

useLargerPatternDots

public void useLargerPatternDots()

useSmallerPatternDots

public void useSmallerPatternDots()

Copyright 2006 Stanford University