Package org.apache.batik.transcoder

Examples of org.apache.batik.transcoder.TranscoderInput


    /**
     * Creates the <tt>TranscoderInput</tt>.
     */
    protected TranscoderInput createTranscoderInput() {
  return new TranscoderInput(resolveURL(inputURI).toString());
    }
View Full Code Here


    /**
     * Creates the <tt>TranscoderInput</tt>.
     */
    protected TranscoderInput createTranscoderInput() {
  return new TranscoderInput(resolveURL(inputURI).toString());
    }
View Full Code Here

            String parser = XMLResourceDescriptor.getXMLParserClassName();
            DOMImplementation impl =
                GenericDOMImplementation.getDOMImplementation();
            SAXDocumentFactory f = new SAXDocumentFactory(impl, parser);
            Document doc = f.createDocument(url.toString());
      TranscoderInput input = new TranscoderInput(doc);
      input.setURI(url.toString()); // Needed for external resources
      return input;
  } catch (IOException ex) {
            ex.printStackTrace();
            throw new IllegalArgumentException(inputURI);
  }
View Full Code Here

    /**
     * Creates the <tt>TranscoderInput</tt>.
     */
    protected TranscoderInput createTranscoderInput() {
  return new TranscoderInput(resolveURL(inputURI).toString());
    }
View Full Code Here

      Map hints = createTranscodingHints();
      if (hints != null) {
    transcoder.setTranscodingHints(hints);
      }

      TranscoderInput input = createTranscoderInput();
      transcoder.transcode(input, null);
  } catch (Exception ex) {
      report.setErrorCode(ERROR_TRANSCODING);
      report.addDescriptionEntry(ERROR_TRANSCODING, toString(ex));
            ex.printStackTrace();
View Full Code Here

  r.setAttributeNS(null, "width", "100");
  r.setAttributeNS(null, "height", "50");
  r.setAttributeNS(null, "style", "fill:red");
  root.appendChild(r);

  return new TranscoderInput(doc);
    }
View Full Code Here

    /**
     * Helper method: creates a valid reference image
     */
    public static URL createValidReferenceImage(String svgContent) throws Exception{
        TranscoderInput validSrc = new TranscoderInput(new StringReader(svgContent));
       
        File tmpFile = File.createTempFile(SVGRenderingAccuracyTest.TEMP_FILE_PREFIX,
                                           SVGRenderingAccuracyTest.TEMP_FILE_SUFFIX);
       
        TranscoderOutput validDst
View Full Code Here

   
    public TestReport encode(URL srcURL, FileOutputStream fos) {
        DefaultTestReport report = new DefaultTestReport(this);
        try{
            ImageTranscoder transcoder = getTestImageTranscoder();
            TranscoderInput src = new TranscoderInput(svgURL.toString());
            TranscoderOutput dst = new TranscoderOutput(fos);
            transcoder.transcode(src, dst);
            return null;
        }catch(TranscoderException e){
            StringWriter trace = new StringWriter();
View Full Code Here

     */
    protected void transcode(SVGConverterSource inputFile,
                             File outputFile,
                             Transcoder transcoder)
        throws SVGConverterException {
        TranscoderInput input = null;
        TranscoderOutput output = null;
        OutputStream outputStream = null;

        if (!controller.proceedWithSourceTranscoding(inputFile,
                                                     outputFile)){
            return;
        }

        try {
            if (inputFile.isSameAs(outputFile.getPath())) {
                throw new SVGConverterException(ERROR_SOURCE_SAME_AS_DESTINATION,
                                                 true /* fatal error */);
            }
           
            // Compute transcoder input.
            if (!inputFile.isReadable()) {
                throw new SVGConverterException(ERROR_CANNOT_READ_SOURCE,
                                                 new Object[]{inputFile.getName()});
            }

            try {
                InputStream in = inputFile.openStream();
                in.close();
            } catch(IOException ioe) {
                throw new SVGConverterException(ERROR_CANNOT_OPEN_SOURCE,
                                                 new Object[] {inputFile.getName(),
                                                               ioe.toString()});
                                                               }
           
            input = new TranscoderInput(inputFile.getURI());

            // Compute transcoder output.
            if (!isWriteable(outputFile)) {
                throw new SVGConverterException(ERROR_OUTPUT_NOT_WRITEABLE,
                                                 new Object[] {outputFile.getName()});
View Full Code Here

        //
        // First, request the transcoder to transcode
        // each of the input files
        //
        for(int i=0; i<args.length; i++){
            transcoder.transcode(new TranscoderInput(new File(args[i]).toURL().toString()),
                                 null);
        }

        //
        // Now, print...
View Full Code Here

TOP

Related Classes of org.apache.batik.transcoder.TranscoderInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.