org.apache.batik.transcoder_1.6.0.v201011041432

16:40:55.993 INFO  jd.cli.Main - Decompiling org.apache.batik.transcoder_1.6.0.v201011041432.jar
package org.apache.batik.transcoder;

public abstract class AbstractTranscoder
  extends TranscoderSupport
  implements Transcoder
{
  public abstract void transcode(TranscoderInput paramTranscoderInput, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException;
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.AbstractTranscoder
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.io.PrintStream;

public class DefaultErrorHandler
  implements ErrorHandler
{
  public void error(TranscoderException paramTranscoderException)
    throws TranscoderException
  {
    System.err.println("ERROR: " + paramTranscoderException.getMessage());
  }
  
  public void fatalError(TranscoderException paramTranscoderException)
    throws TranscoderException
  {
    throw paramTranscoderException;
  }
  
  public void warning(TranscoderException paramTranscoderException)
    throws TranscoderException
  {
    System.err.println("WARNING: " + paramTranscoderException.getMessage());
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.DefaultErrorHandler
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

public abstract interface ErrorHandler
{
  public abstract void error(TranscoderException paramTranscoderException)
    throws TranscoderException;
  
  public abstract void fatalError(TranscoderException paramTranscoderException)
    throws TranscoderException;
  
  public abstract void warning(TranscoderException paramTranscoderException)
    throws TranscoderException;
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.ErrorHandler
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.batik.bridge.DefaultScriptSecurity;
import org.apache.batik.bridge.NoLoadScriptSecurity;
import org.apache.batik.bridge.RelaxedScriptSecurity;
import org.apache.batik.bridge.ScriptSecurity;
import org.apache.batik.bridge.UserAgentAdapter;
import org.apache.batik.util.ParsedURL;

public class SVGAbstractTranscoder$SVGAbstractTranscoderUserAgent
  extends UserAgentAdapter
{
  protected List scripts;
  private final SVGAbstractTranscoder this$0;
  
  public SVGAbstractTranscoder$SVGAbstractTranscoderUserAgent(SVGAbstractTranscoder paramSVGAbstractTranscoder)
  {
    this$0 = paramSVGAbstractTranscoder;
    addStdFeatures();
  }
  
  public AffineTransform getTransform()
  {
    return this$0.curTxf;
  }
  
  public void setTransform(AffineTransform paramAffineTransform)
  {
    this$0.curTxf = paramAffineTransform;
  }
  
  public Dimension2D getViewportSize()
  {
    return new Dimension((int)this$0.width, (int)this$0.height);
  }
  
  public void displayError(String paramString)
  {
    try
    {
      this$0.handler.error(new TranscoderException(paramString));
    }
    catch (TranscoderException localTranscoderException)
    {
      throw new RuntimeException();
    }
  }
  
  public void displayError(Exception paramException)
  {
    try
    {
      paramException.printStackTrace();
      this$0.handler.error(new TranscoderException(paramException));
    }
    catch (TranscoderException localTranscoderException)
    {
      throw new RuntimeException();
    }
  }
  
  public void displayMessage(String paramString)
  {
    try
    {
      this$0.handler.warning(new TranscoderException(paramString));
    }
    catch (TranscoderException localTranscoderException)
    {
      throw new RuntimeException();
    }
  }
  
  public float getPixelUnitToMillimeter()
  {
    Object localObject = this$0.hints.get(SVGAbstractTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER);
    if (localObject != null) {
      return ((Float)localObject).floatValue();
    }
    return super.getPixelUnitToMillimeter();
  }
  
  public String getLanguages()
  {
    if (this$0.hints.containsKey(SVGAbstractTranscoder.KEY_LANGUAGE)) {
      return (String)this$0.hints.get(SVGAbstractTranscoder.KEY_LANGUAGE);
    }
    return super.getLanguages();
  }
  
  public String getMedia()
  {
    String str = (String)this$0.hints.get(SVGAbstractTranscoder.KEY_MEDIA);
    if (str != null) {
      return str;
    }
    return super.getMedia();
  }
  
  public String getDefaultFontFamily()
  {
    String str = (String)this$0.hints.get(SVGAbstractTranscoder.KEY_DEFAULT_FONT_FAMILY);
    if (str != null) {
      return str;
    }
    return super.getDefaultFontFamily();
  }
  
  public String getAlternateStyleSheet()
  {
    String str = (String)this$0.hints.get(SVGAbstractTranscoder.KEY_ALTERNATE_STYLESHEET);
    if (str != null) {
      return str;
    }
    return super.getAlternateStyleSheet();
  }
  
  public String getUserStyleSheetURI()
  {
    String str = (String)this$0.hints.get(SVGAbstractTranscoder.KEY_USER_STYLESHEET_URI);
    if (str != null) {
      return str;
    }
    return super.getUserStyleSheetURI();
  }
  
  public String getXMLParserClassName()
  {
    String str = (String)this$0.hints.get(XMLAbstractTranscoder.KEY_XML_PARSER_CLASSNAME);
    if (str != null) {
      return str;
    }
    return super.getXMLParserClassName();
  }
  
  public boolean isXMLParserValidating()
  {
    Boolean localBoolean = (Boolean)this$0.hints.get(XMLAbstractTranscoder.KEY_XML_PARSER_VALIDATING);
    if (localBoolean != null) {
      return localBoolean.booleanValue();
    }
    return super.isXMLParserValidating();
  }
  
  public ScriptSecurity getScriptSecurity(String paramString, ParsedURL paramParsedURL1, ParsedURL paramParsedURL2)
  {
    if (scripts == null) {
      computeAllowedScripts();
    }
    if (!scripts.contains(paramString)) {
      return new NoLoadScriptSecurity(paramString);
    }
    boolean bool = true;
    if (this$0.hints.containsKey(SVGAbstractTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN)) {
      bool = ((Boolean)this$0.hints.get(SVGAbstractTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN)).booleanValue();
    }
    if (bool) {
      return new DefaultScriptSecurity(paramString, paramParsedURL1, paramParsedURL2);
    }
    return new RelaxedScriptSecurity(paramString, paramParsedURL1, paramParsedURL2);
  }
  
  protected void computeAllowedScripts()
  {
    scripts = new LinkedList();
    if (!this$0.hints.containsKey(SVGAbstractTranscoder.KEY_ALLOWED_SCRIPT_TYPES)) {
      return;
    }
    String str = (String)this$0.hints.get(SVGAbstractTranscoder.KEY_ALLOWED_SCRIPT_TYPES);
    StringTokenizer localStringTokenizer = new StringTokenizer(str, ",");
    while (localStringTokenizer.hasMoreTokens()) {
      scripts.add(localStringTokenizer.nextToken());
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.SVGAbstractTranscoder.SVGAbstractTranscoderUserAgent
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.Rectangle2D.Float;
import java.awt.geom.RectangularShape;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import org.apache.batik.bridge.BaseScriptingEnvironment;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.BridgeException;
import org.apache.batik.bridge.DefaultScriptSecurity;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.NoLoadScriptSecurity;
import org.apache.batik.bridge.RelaxedScriptSecurity;
import org.apache.batik.bridge.ScriptSecurity;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.bridge.UserAgentAdapter;
import org.apache.batik.bridge.ViewBox;
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.dom.util.DOMUtilities;
import org.apache.batik.dom.util.DocumentFactory;
import org.apache.batik.gvt.CanvasGraphicsNode;
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.transcoder.keys.BooleanKey;
import org.apache.batik.transcoder.keys.FloatKey;
import org.apache.batik.transcoder.keys.LengthKey;
import org.apache.batik.transcoder.keys.Rectangle2DKey;
import org.apache.batik.transcoder.keys.StringKey;
import org.apache.batik.util.ParsedURL;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGSVGElement;

public abstract class SVGAbstractTranscoder
  extends XMLAbstractTranscoder
{
  public static final String DEFAULT_DEFAULT_FONT_FAMILY = "Arial, Helvetica, sans-serif";
  protected Rectangle2D curAOI;
  protected AffineTransform curTxf;
  protected GraphicsNode root;
  protected BridgeContext ctx;
  protected GVTBuilder builder;
  protected float width = 400.0F;
  protected float height = 400.0F;
  protected UserAgent userAgent = createUserAgent();
  public static final TranscodingHints.Key KEY_WIDTH = new LengthKey();
  public static final TranscodingHints.Key KEY_HEIGHT = new LengthKey();
  public static final TranscodingHints.Key KEY_MAX_WIDTH = new LengthKey();
  public static final TranscodingHints.Key KEY_MAX_HEIGHT = new LengthKey();
  public static final TranscodingHints.Key KEY_AOI = new Rectangle2DKey();
  public static final TranscodingHints.Key KEY_LANGUAGE = new StringKey();
  public static final TranscodingHints.Key KEY_MEDIA = new StringKey();
  public static final TranscodingHints.Key KEY_DEFAULT_FONT_FAMILY = new StringKey();
  public static final TranscodingHints.Key KEY_ALTERNATE_STYLESHEET = new StringKey();
  public static final TranscodingHints.Key KEY_USER_STYLESHEET_URI = new StringKey();
  public static final TranscodingHints.Key KEY_PIXEL_UNIT_TO_MILLIMETER = new FloatKey();
  /**
   * @deprecated
   */
  public static final TranscodingHints.Key KEY_PIXEL_TO_MM = KEY_PIXEL_UNIT_TO_MILLIMETER;
  public static final TranscodingHints.Key KEY_EXECUTE_ONLOAD = new BooleanKey();
  public static final TranscodingHints.Key KEY_ALLOWED_SCRIPT_TYPES = new StringKey();
  public static final String DEFAULT_ALLOWED_SCRIPT_TYPES = "text/ecmascript, application/java-archive";
  public static final TranscodingHints.Key KEY_CONSTRAIN_SCRIPT_ORIGIN = new BooleanKey();
  
  protected SVGAbstractTranscoder()
  {
    hints.put(XMLAbstractTranscoder.KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, "http://www.w3.org/2000/svg");
    hints.put(XMLAbstractTranscoder.KEY_DOCUMENT_ELEMENT, "svg");
    hints.put(XMLAbstractTranscoder.KEY_DOM_IMPLEMENTATION, SVGDOMImplementation.getDOMImplementation());
    hints.put(KEY_MEDIA, "screen");
    hints.put(KEY_DEFAULT_FONT_FAMILY, "Arial, Helvetica, sans-serif");
    hints.put(KEY_EXECUTE_ONLOAD, Boolean.FALSE);
    hints.put(KEY_ALLOWED_SCRIPT_TYPES, "text/ecmascript, application/java-archive");
  }
  
  protected UserAgent createUserAgent()
  {
    return new SVGAbstractTranscoderUserAgent();
  }
  
  protected DocumentFactory createDocumentFactory(DOMImplementation paramDOMImplementation, String paramString)
  {
    return new SAXSVGDocumentFactory(paramString);
  }
  
  public void transcode(TranscoderInput paramTranscoderInput, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException
  {
    super.transcode(paramTranscoderInput, paramTranscoderOutput);
    if (ctx != null) {
      ctx.dispose();
    }
  }
  
  protected void transcode(Document paramDocument, String paramString, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException
  {
    if ((paramDocument != null) && (!(paramDocument.getImplementation() instanceof SVGDOMImplementation)))
    {
      localObject1 = (DOMImplementation)hints.get(XMLAbstractTranscoder.KEY_DOM_IMPLEMENTATION);
      paramDocument = DOMUtilities.deepCloneDocument(paramDocument, (DOMImplementation)localObject1);
      if (paramString != null) {
        try
        {
          URL localURL = new URL(paramString);
          ((SVGOMDocument)paramDocument).setURLObject(localURL);
        }
        catch (MalformedURLException localMalformedURLException) {}
      }
    }
    ctx = createBridgeContext();
    Object localObject1 = (SVGOMDocument)paramDocument;
    SVGSVGElement localSVGSVGElement = ((SVGOMDocument)localObject1).getRootElement();
    builder = new GVTBuilder();
    int i = (hints.containsKey(KEY_EXECUTE_ONLOAD)) && (((Boolean)hints.get(KEY_EXECUTE_ONLOAD)).booleanValue()) && (ctx.isDynamicDocument((Document)localObject1)) ? 1 : 0;
    GraphicsNode localGraphicsNode;
    try
    {
      if (i != 0) {
        ctx.setDynamicState(2);
      }
      localGraphicsNode = builder.build(ctx, (Document)localObject1);
      if (ctx.isDynamic())
      {
        BaseScriptingEnvironment localBaseScriptingEnvironment = new BaseScriptingEnvironment(ctx);
        localBaseScriptingEnvironment.loadScripts();
        localBaseScriptingEnvironment.dispatchSVGLoadEvent();
      }
    }
    catch (BridgeException localBridgeException1)
    {
      throw new TranscoderException(localBridgeException1);
    }
    float f1 = (float)ctx.getDocumentSize().getWidth();
    float f2 = (float)ctx.getDocumentSize().getHeight();
    setImageSize(f1, f2);
    AffineTransform localAffineTransform;
    if (hints.containsKey(KEY_AOI))
    {
      localObject2 = (Rectangle2D)hints.get(KEY_AOI);
      localAffineTransform = new AffineTransform();
      double d1 = width / ((RectangularShape)localObject2).getWidth();
      double d2 = height / ((RectangularShape)localObject2).getHeight();
      double d3 = Math.min(d1, d2);
      localAffineTransform.scale(d3, d3);
      double d4 = -((RectangularShape)localObject2).getX() + (width / d3 - ((RectangularShape)localObject2).getWidth()) / 2.0D;
      double d5 = -((RectangularShape)localObject2).getY() + (height / d3 - ((RectangularShape)localObject2).getHeight()) / 2.0D;
      localAffineTransform.translate(d4, d5);
      curAOI = ((Rectangle2D)localObject2);
    }
    else
    {
      localObject2 = new ParsedURL(paramString).getRef();
      try
      {
        localAffineTransform = ViewBox.getViewTransform((String)localObject2, localSVGSVGElement, width, height);
      }
      catch (BridgeException localBridgeException2)
      {
        throw new TranscoderException(localBridgeException2);
      }
      if ((localAffineTransform.isIdentity()) && ((width != f1) || (height != f2)))
      {
        float f3 = width / f1;
        float f4 = height / f2;
        float f5 = Math.min(f3, f4);
        localAffineTransform = AffineTransform.getScaleInstance(f5, f5);
      }
      curAOI = new Rectangle2D.Float(0.0F, 0.0F, width, height);
    }
    Object localObject2 = getCanvasGraphicsNode(localGraphicsNode);
    if (localObject2 != null)
    {
      ((CanvasGraphicsNode)localObject2).setViewingTransform(localAffineTransform);
      curTxf = new AffineTransform();
    }
    else
    {
      curTxf = localAffineTransform;
    }
    root = localGraphicsNode;
  }
  
  protected CanvasGraphicsNode getCanvasGraphicsNode(GraphicsNode paramGraphicsNode)
  {
    if (!(paramGraphicsNode instanceof CompositeGraphicsNode)) {
      return null;
    }
    CompositeGraphicsNode localCompositeGraphicsNode = (CompositeGraphicsNode)paramGraphicsNode;
    List localList = localCompositeGraphicsNode.getChildren();
    if (localList.size() == 0) {
      return null;
    }
    paramGraphicsNode = (GraphicsNode)localList.get(0);
    if (!(paramGraphicsNode instanceof CanvasGraphicsNode)) {
      return null;
    }
    return (CanvasGraphicsNode)paramGraphicsNode;
  }
  
  protected BridgeContext createBridgeContext()
  {
    return new BridgeContext(userAgent);
  }
  
  protected void setImageSize(float paramFloat1, float paramFloat2)
  {
    float f1 = -1.0F;
    if (hints.containsKey(KEY_WIDTH)) {
      f1 = ((Float)hints.get(KEY_WIDTH)).floatValue();
    }
    float f2 = -1.0F;
    if (hints.containsKey(KEY_HEIGHT)) {
      f2 = ((Float)hints.get(KEY_HEIGHT)).floatValue();
    }
    if ((f1 > 0.0F) && (f2 > 0.0F))
    {
      width = f1;
      height = f2;
    }
    else if (f2 > 0.0F)
    {
      width = (paramFloat1 * f2 / paramFloat2);
      height = f2;
    }
    else if (f1 > 0.0F)
    {
      width = f1;
      height = (paramFloat2 * f1 / paramFloat1);
    }
    else
    {
      width = paramFloat1;
      height = paramFloat2;
    }
    float f3 = -1.0F;
    if (hints.containsKey(KEY_MAX_WIDTH)) {
      f3 = ((Float)hints.get(KEY_MAX_WIDTH)).floatValue();
    }
    float f4 = -1.0F;
    if (hints.containsKey(KEY_MAX_HEIGHT)) {
      f4 = ((Float)hints.get(KEY_MAX_HEIGHT)).floatValue();
    }
    if ((f4 > 0.0F) && (height > f4))
    {
      width = (paramFloat1 * f4 / paramFloat2);
      height = f4;
    }
    if ((f3 > 0.0F) && (width > f3))
    {
      width = f3;
      height = (paramFloat2 * f3 / paramFloat1);
    }
  }
  
  protected class SVGAbstractTranscoderUserAgent
    extends UserAgentAdapter
  {
    protected List scripts;
    
    public SVGAbstractTranscoderUserAgent()
    {
      addStdFeatures();
    }
    
    public AffineTransform getTransform()
    {
      return curTxf;
    }
    
    public void setTransform(AffineTransform paramAffineTransform)
    {
      curTxf = paramAffineTransform;
    }
    
    public Dimension2D getViewportSize()
    {
      return new Dimension((int)width, (int)height);
    }
    
    public void displayError(String paramString)
    {
      try
      {
        handler.error(new TranscoderException(paramString));
      }
      catch (TranscoderException localTranscoderException)
      {
        throw new RuntimeException();
      }
    }
    
    public void displayError(Exception paramException)
    {
      try
      {
        paramException.printStackTrace();
        handler.error(new TranscoderException(paramException));
      }
      catch (TranscoderException localTranscoderException)
      {
        throw new RuntimeException();
      }
    }
    
    public void displayMessage(String paramString)
    {
      try
      {
        handler.warning(new TranscoderException(paramString));
      }
      catch (TranscoderException localTranscoderException)
      {
        throw new RuntimeException();
      }
    }
    
    public float getPixelUnitToMillimeter()
    {
      Object localObject = hints.get(SVGAbstractTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER);
      if (localObject != null) {
        return ((Float)localObject).floatValue();
      }
      return super.getPixelUnitToMillimeter();
    }
    
    public String getLanguages()
    {
      if (hints.containsKey(SVGAbstractTranscoder.KEY_LANGUAGE)) {
        return (String)hints.get(SVGAbstractTranscoder.KEY_LANGUAGE);
      }
      return super.getLanguages();
    }
    
    public String getMedia()
    {
      String str = (String)hints.get(SVGAbstractTranscoder.KEY_MEDIA);
      if (str != null) {
        return str;
      }
      return super.getMedia();
    }
    
    public String getDefaultFontFamily()
    {
      String str = (String)hints.get(SVGAbstractTranscoder.KEY_DEFAULT_FONT_FAMILY);
      if (str != null) {
        return str;
      }
      return super.getDefaultFontFamily();
    }
    
    public String getAlternateStyleSheet()
    {
      String str = (String)hints.get(SVGAbstractTranscoder.KEY_ALTERNATE_STYLESHEET);
      if (str != null) {
        return str;
      }
      return super.getAlternateStyleSheet();
    }
    
    public String getUserStyleSheetURI()
    {
      String str = (String)hints.get(SVGAbstractTranscoder.KEY_USER_STYLESHEET_URI);
      if (str != null) {
        return str;
      }
      return super.getUserStyleSheetURI();
    }
    
    public String getXMLParserClassName()
    {
      String str = (String)hints.get(XMLAbstractTranscoder.KEY_XML_PARSER_CLASSNAME);
      if (str != null) {
        return str;
      }
      return super.getXMLParserClassName();
    }
    
    public boolean isXMLParserValidating()
    {
      Boolean localBoolean = (Boolean)hints.get(XMLAbstractTranscoder.KEY_XML_PARSER_VALIDATING);
      if (localBoolean != null) {
        return localBoolean.booleanValue();
      }
      return super.isXMLParserValidating();
    }
    
    public ScriptSecurity getScriptSecurity(String paramString, ParsedURL paramParsedURL1, ParsedURL paramParsedURL2)
    {
      if (scripts == null) {
        computeAllowedScripts();
      }
      if (!scripts.contains(paramString)) {
        return new NoLoadScriptSecurity(paramString);
      }
      boolean bool = true;
      if (hints.containsKey(SVGAbstractTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN)) {
        bool = ((Boolean)hints.get(SVGAbstractTranscoder.KEY_CONSTRAIN_SCRIPT_ORIGIN)).booleanValue();
      }
      if (bool) {
        return new DefaultScriptSecurity(paramString, paramParsedURL1, paramParsedURL2);
      }
      return new RelaxedScriptSecurity(paramString, paramParsedURL1, paramParsedURL2);
    }
    
    protected void computeAllowedScripts()
    {
      scripts = new LinkedList();
      if (!hints.containsKey(SVGAbstractTranscoder.KEY_ALLOWED_SCRIPT_TYPES)) {
        return;
      }
      String str = (String)hints.get(SVGAbstractTranscoder.KEY_ALLOWED_SCRIPT_TYPES);
      StringTokenizer localStringTokenizer = new StringTokenizer(str, ",");
      while (localStringTokenizer.hasMoreTokens()) {
        scripts.add(localStringTokenizer.nextToken());
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.SVGAbstractTranscoder
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.util.Map;

public abstract interface Transcoder
{
  public abstract void transcode(TranscoderInput paramTranscoderInput, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException;
  
  public abstract TranscodingHints getTranscodingHints();
  
  public abstract void addTranscodingHint(TranscodingHints.Key paramKey, Object paramObject);
  
  public abstract void removeTranscodingHint(TranscodingHints.Key paramKey);
  
  public abstract void setTranscodingHints(Map paramMap);
  
  public abstract void setTranscodingHints(TranscodingHints paramTranscodingHints);
  
  public abstract void setErrorHandler(ErrorHandler paramErrorHandler);
  
  public abstract ErrorHandler getErrorHandler();
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.Transcoder
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

public class TranscoderException
  extends Exception
{
  protected Exception ex;
  
  public TranscoderException(String paramString)
  {
    this(paramString, null);
  }
  
  public TranscoderException(Exception paramException)
  {
    this(null, paramException);
  }
  
  public TranscoderException(String paramString, Exception paramException)
  {
    super(paramString);
    ex = paramException;
  }
  
  public String getMessage()
  {
    String str = super.getMessage();
    if (ex != null)
    {
      str = str + "\nEnclosed Exception:\n";
      str = str + ex.getMessage();
    }
    return str;
  }
  
  public Exception getException()
  {
    return ex;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.TranscoderException
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.io.InputStream;
import java.io.Reader;
import org.w3c.dom.Document;
import org.xml.sax.XMLReader;

public class TranscoderInput
{
  protected XMLReader xmlReader;
  protected InputStream istream;
  protected Reader reader;
  protected Document document;
  protected String uri;
  
  public TranscoderInput() {}
  
  public TranscoderInput(XMLReader paramXMLReader)
  {
    xmlReader = paramXMLReader;
  }
  
  public TranscoderInput(InputStream paramInputStream)
  {
    istream = paramInputStream;
  }
  
  public TranscoderInput(Reader paramReader)
  {
    reader = paramReader;
  }
  
  public TranscoderInput(Document paramDocument)
  {
    document = paramDocument;
  }
  
  public TranscoderInput(String paramString)
  {
    uri = paramString;
  }
  
  public void setXMLReader(XMLReader paramXMLReader)
  {
    xmlReader = paramXMLReader;
  }
  
  public XMLReader getXMLReader()
  {
    return xmlReader;
  }
  
  public void setInputStream(InputStream paramInputStream)
  {
    istream = paramInputStream;
  }
  
  public InputStream getInputStream()
  {
    return istream;
  }
  
  public void setReader(Reader paramReader)
  {
    reader = paramReader;
  }
  
  public Reader getReader()
  {
    return reader;
  }
  
  public void setDocument(Document paramDocument)
  {
    document = paramDocument;
  }
  
  public Document getDocument()
  {
    return document;
  }
  
  public void setURI(String paramString)
  {
    uri = paramString;
  }
  
  public String getURI()
  {
    return uri;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.TranscoderInput
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.io.OutputStream;
import java.io.Writer;
import org.w3c.dom.Document;
import org.xml.sax.XMLFilter;

public class TranscoderOutput
{
  protected XMLFilter xmlFilter;
  protected OutputStream ostream;
  protected Writer writer;
  protected Document document;
  protected String uri;
  
  public TranscoderOutput() {}
  
  public TranscoderOutput(XMLFilter paramXMLFilter)
  {
    xmlFilter = paramXMLFilter;
  }
  
  public TranscoderOutput(OutputStream paramOutputStream)
  {
    ostream = paramOutputStream;
  }
  
  public TranscoderOutput(Writer paramWriter)
  {
    writer = paramWriter;
  }
  
  public TranscoderOutput(Document paramDocument)
  {
    document = paramDocument;
  }
  
  public TranscoderOutput(String paramString)
  {
    uri = paramString;
  }
  
  public void setXMLFilter(XMLFilter paramXMLFilter)
  {
    xmlFilter = paramXMLFilter;
  }
  
  public XMLFilter getXMLFilter()
  {
    return xmlFilter;
  }
  
  public void setOutputStream(OutputStream paramOutputStream)
  {
    ostream = paramOutputStream;
  }
  
  public OutputStream getOutputStream()
  {
    return ostream;
  }
  
  public void setWriter(Writer paramWriter)
  {
    writer = paramWriter;
  }
  
  public Writer getWriter()
  {
    return writer;
  }
  
  public void setDocument(Document paramDocument)
  {
    document = paramDocument;
  }
  
  public Document getDocument()
  {
    return document;
  }
  
  public void setURI(String paramString)
  {
    uri = paramString;
  }
  
  public String getURI()
  {
    return uri;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.TranscoderOutput
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.util.Map;

public class TranscoderSupport
{
  static final ErrorHandler defaultErrorHandler = new DefaultErrorHandler();
  protected TranscodingHints hints = new TranscodingHints();
  protected ErrorHandler handler = defaultErrorHandler;
  
  public TranscodingHints getTranscodingHints()
  {
    return new TranscodingHints(hints);
  }
  
  public void addTranscodingHint(TranscodingHints.Key paramKey, Object paramObject)
  {
    hints.put(paramKey, paramObject);
  }
  
  public void removeTranscodingHint(TranscodingHints.Key paramKey)
  {
    hints.remove(paramKey);
  }
  
  public void setTranscodingHints(Map paramMap)
  {
    hints.putAll(paramMap);
  }
  
  public void setTranscodingHints(TranscodingHints paramTranscodingHints)
  {
    hints = paramTranscodingHints;
  }
  
  public void setErrorHandler(ErrorHandler paramErrorHandler)
  {
    handler = paramErrorHandler;
  }
  
  public ErrorHandler getErrorHandler()
  {
    return handler;
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.TranscoderSupport
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

public abstract class TranscodingHints$Key
{
  public abstract boolean isCompatibleValue(Object paramObject);
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.TranscodingHints.Key
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class TranscodingHints
  extends HashMap
{
  public TranscodingHints()
  {
    this(null);
  }
  
  public TranscodingHints(Map paramMap)
  {
    super(7);
    if (paramMap != null) {
      putAll(paramMap);
    }
  }
  
  public boolean containsKey(Object paramObject)
  {
    return super.containsKey(paramObject);
  }
  
  public Object get(Object paramObject)
  {
    return super.get(paramObject);
  }
  
  public Object put(Object paramObject1, Object paramObject2)
  {
    if (!((Key)paramObject1).isCompatibleValue(paramObject2)) {
      throw new IllegalArgumentException(paramObject2 + " incompatible with " + paramObject1);
    }
    return super.put(paramObject1, paramObject2);
  }
  
  public Object remove(Object paramObject)
  {
    return super.remove(paramObject);
  }
  
  public void putAll(TranscodingHints paramTranscodingHints)
  {
    super.putAll(paramTranscodingHints);
  }
  
  public void putAll(Map paramMap)
  {
    if ((paramMap instanceof TranscodingHints))
    {
      putAll((TranscodingHints)paramMap);
    }
    else
    {
      Iterator localIterator = paramMap.entrySet().iterator();
      while (localIterator.hasNext())
      {
        Map.Entry localEntry = (Map.Entry)localIterator.next();
        put(localEntry.getKey(), localEntry.getValue());
      }
    }
  }
  
  public static abstract class Key
  {
    public abstract boolean isCompatibleValue(Object paramObject);
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.TranscodingHints
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder;

import java.io.IOException;
import org.apache.batik.dom.util.DocumentFactory;
import org.apache.batik.dom.util.SAXDocumentFactory;
import org.apache.batik.transcoder.keys.BooleanKey;
import org.apache.batik.transcoder.keys.DOMImplementationKey;
import org.apache.batik.transcoder.keys.StringKey;
import org.apache.batik.util.XMLResourceDescriptor;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;

public abstract class XMLAbstractTranscoder
  extends AbstractTranscoder
{
  public static final TranscodingHints.Key KEY_XML_PARSER_CLASSNAME = new StringKey();
  public static final TranscodingHints.Key KEY_XML_PARSER_VALIDATING = new BooleanKey();
  public static final TranscodingHints.Key KEY_DOCUMENT_ELEMENT = new StringKey();
  public static final TranscodingHints.Key KEY_DOCUMENT_ELEMENT_NAMESPACE_URI = new StringKey();
  public static final TranscodingHints.Key KEY_DOM_IMPLEMENTATION = new DOMImplementationKey();
  
  protected XMLAbstractTranscoder()
  {
    hints.put(KEY_XML_PARSER_VALIDATING, Boolean.FALSE);
  }
  
  public void transcode(TranscoderInput paramTranscoderInput, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException
  {
    Document localDocument = null;
    String str1 = paramTranscoderInput.getURI();
    if (paramTranscoderInput.getDocument() != null)
    {
      localDocument = paramTranscoderInput.getDocument();
    }
    else
    {
      String str2 = (String)hints.get(KEY_XML_PARSER_CLASSNAME);
      String str3 = (String)hints.get(KEY_DOCUMENT_ELEMENT_NAMESPACE_URI);
      String str4 = (String)hints.get(KEY_DOCUMENT_ELEMENT);
      DOMImplementation localDOMImplementation = (DOMImplementation)hints.get(KEY_DOM_IMPLEMENTATION);
      if (str2 == null) {
        str2 = XMLResourceDescriptor.getXMLParserClassName();
      }
      if (localDOMImplementation == null)
      {
        handler.fatalError(new TranscoderException("Unspecified transcoding hints: KEY_DOM_IMPLEMENTATION"));
        return;
      }
      if (str3 == null)
      {
        handler.fatalError(new TranscoderException("Unspecified transcoding hints: KEY_DOCUMENT_ELEMENT_NAMESPACE_URI"));
        return;
      }
      if (str4 == null)
      {
        handler.fatalError(new TranscoderException("Unspecified transcoding hints: KEY_DOCUMENT_ELEMENT"));
        return;
      }
      DocumentFactory localDocumentFactory = createDocumentFactory(localDOMImplementation, str2);
      boolean bool = ((Boolean)hints.get(KEY_XML_PARSER_VALIDATING)).booleanValue();
      localDocumentFactory.setValidating(bool);
      try
      {
        if (paramTranscoderInput.getInputStream() != null) {
          localDocument = localDocumentFactory.createDocument(str3, str4, paramTranscoderInput.getURI(), paramTranscoderInput.getInputStream());
        } else if (paramTranscoderInput.getReader() != null) {
          localDocument = localDocumentFactory.createDocument(str3, str4, paramTranscoderInput.getURI(), paramTranscoderInput.getReader());
        } else if (paramTranscoderInput.getXMLReader() != null) {
          localDocument = localDocumentFactory.createDocument(str3, str4, paramTranscoderInput.getURI(), paramTranscoderInput.getXMLReader());
        } else if (str1 != null) {
          localDocument = localDocumentFactory.createDocument(str3, str4, str1);
        }
      }
      catch (DOMException localDOMException)
      {
        handler.fatalError(new TranscoderException(localDOMException));
      }
      catch (IOException localIOException)
      {
        localIOException.printStackTrace();
        handler.fatalError(new TranscoderException(localIOException));
      }
    }
    if (localDocument != null) {
      try
      {
        transcode(localDocument, str1, paramTranscoderOutput);
      }
      catch (TranscoderException localTranscoderException)
      {
        handler.fatalError(localTranscoderException);
        return;
      }
    }
  }
  
  protected DocumentFactory createDocumentFactory(DOMImplementation paramDOMImplementation, String paramString)
  {
    return new SAXDocumentFactory(paramDOMImplementation, paramString);
  }
  
  protected abstract void transcode(Document paramDocument, String paramString, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException;
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.XMLAbstractTranscoder
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder.image;

import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D.Float;
import java.awt.image.BufferedImage;
import org.apache.batik.ext.awt.image.GraphicsUtil;
import org.apache.batik.gvt.renderer.ConcreteImageRendererFactory;
import org.apache.batik.gvt.renderer.ImageRenderer;
import org.apache.batik.gvt.renderer.ImageRendererFactory;
import org.apache.batik.gvt.renderer.Renderer;
import org.apache.batik.transcoder.SVGAbstractTranscoder;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.TranscoderSupport;
import org.apache.batik.transcoder.TranscodingHints;
import org.apache.batik.transcoder.TranscodingHints.Key;
import org.apache.batik.transcoder.keys.BooleanKey;
import org.apache.batik.transcoder.keys.PaintKey;
import org.w3c.dom.Document;

public abstract class ImageTranscoder
  extends SVGAbstractTranscoder
{
  public static final TranscodingHints.Key KEY_BACKGROUND_COLOR = new PaintKey();
  public static final TranscodingHints.Key KEY_FORCE_TRANSPARENT_WHITE = new BooleanKey();
  
  protected void transcode(Document paramDocument, String paramString, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException
  {
    super.transcode(paramDocument, paramString, paramTranscoderOutput);
    int i = (int)(width + 0.5D);
    int j = (int)(height + 0.5D);
    ConcreteImageRendererFactory localConcreteImageRendererFactory = new ConcreteImageRendererFactory();
    ImageRenderer localImageRenderer = localConcreteImageRendererFactory.createStaticImageRenderer();
    localImageRenderer.updateOffScreen(i, j);
    localImageRenderer.setTransform(curTxf);
    localImageRenderer.setTree(root);
    root = null;
    try
    {
      Rectangle2D.Float localFloat = new Rectangle2D.Float(0.0F, 0.0F, width, height);
      localImageRenderer.repaint(curTxf.createInverse().createTransformedShape(localFloat));
      BufferedImage localBufferedImage1 = localImageRenderer.getOffScreen();
      localImageRenderer = null;
      BufferedImage localBufferedImage2 = createImage(i, j);
      Graphics2D localGraphics2D = GraphicsUtil.createGraphics(localBufferedImage2);
      if (hints.containsKey(KEY_BACKGROUND_COLOR))
      {
        Paint localPaint = (Paint)hints.get(KEY_BACKGROUND_COLOR);
        localGraphics2D.setComposite(AlphaComposite.SrcOver);
        localGraphics2D.setPaint(localPaint);
        localGraphics2D.fillRect(0, 0, i, j);
      }
      if (localBufferedImage1 != null) {
        localGraphics2D.drawRenderedImage(localBufferedImage1, new AffineTransform());
      }
      localGraphics2D.dispose();
      localBufferedImage1 = null;
      writeImage(localBufferedImage2, paramTranscoderOutput);
    }
    catch (Exception localException)
    {
      throw new TranscoderException(localException);
    }
  }
  
  public abstract BufferedImage createImage(int paramInt1, int paramInt2);
  
  public abstract void writeImage(BufferedImage paramBufferedImage, TranscoderOutput paramTranscoderOutput)
    throws TranscoderException;
}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.image.ImageTranscoder
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder.image;

class JPEGTranscoder$1 {}

/* Location:
 * Qualified Name:     org.apache.batik.transcoder.image.JPEGTranscoder.1
 * Java Class Version: 1.1 (45.3)
 * JD-Core Version:    0.7.1
 */
package org.apache.batik.transcoder.image;

import java.io.IOException;
import java.io.OutputStream;

class JPEGTranscoder$OutputStreamWrapper
  extends OutputStream
{
  OutputStream os;
  
  JPEGTranscoder$OutputStreamWrapper(OutputStream paramOutputStream)
  {
    os = paramOutputStream;
  }
  
  public void close()
    throws IOException
  {
    if (os == null) {
      return;
    }
    try
    {
      os.close();
    }
    catch (IOException localIOException)
    {
      os = null;
    }
  }
  
  public void flush()
    throws IOException
  {
    if (os == null) {
      return;
    }
    try
    {
      os.flush();
    }
    catch (IOException localIOException)
    {
      os = null;
    }
  }
  
  public void write(byte[] paramArrayOfByte)
    throws IOException
  {
    if (os == null) {
      return;
    }
    try
    {
      os.write(paramArrayOfByte);
    }
    catch (IOException localIOException)
    {
      os = null;
    }
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    if (os == null) {
      return;
    }
    try
    {
      os.write(paramArrayOfByte, paramInt1, paramInt2);
    }
    catch (IOException localIOException)
    {
      os = null;
    }
  }
  
  public void write(int paramInt)
    throws IOException
  {
    if (os == null) {
      return;
    }
    try
    {
      os.write(paramInt);
    }
    catch (IOException localIOException)
    {
      os = null;
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.batik.
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd