当前位置: 首页>>代码示例>>Java>>正文


Java Transcoder类代码示例

本文整理汇总了Java中org.apache.batik.transcoder.Transcoder的典型用法代码示例。如果您正苦于以下问题:Java Transcoder类的具体用法?Java Transcoder怎么用?Java Transcoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Transcoder类属于org.apache.batik.transcoder包,在下文中一共展示了Transcoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTranscoder

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
/**
 * Returns a transcoder object of the result image type.
 *
 * @return Transcoder object or <tt>null</tt> if there isn't a proper transcoder.
 */
protected Transcoder getTranscoder() {

  switch (code) {
    case PNG_CODE:
      return new PNGTranscoder();
    case JPEG_CODE:
      return new JPEGTranscoder();
    case TIFF_CODE:
      return new TIFFTranscoder();
    case PDF_CODE:
      try {
        Class pdfClass = Class.forName("org.apache.fop.svg.PDFTranscoder");
        return (Transcoder) pdfClass.newInstance();
      }
      catch (Exception e) {
        return null;
      }
    default:
      return null;
  }

}
 
开发者ID:etomica,项目名称:etomica,代码行数:28,代码来源:DestinationType.java

示例2: streamOut

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public void streamOut(OutputStream out) {

    // Stream out SVG to the standard output using UTF-8 encoding.
    try {
      TranscoderInput input = new TranscoderInput(svg);
      TranscoderOutput output = new TranscoderOutput(new BufferedWriter(new OutputStreamWriter(out, "UTF-8")));
      Transcoder t = new SVGTranscoder();
      t.transcode(input, output);
    }
    catch (TranscoderException e) {
      e.printStackTrace();
    }
    catch (UnsupportedEncodingException uee) {
      uee.printStackTrace();
    }
  }
 
开发者ID:etomica,项目名称:etomica,代码行数:17,代码来源:GraphMap.java

示例3: setTranscoderRectangleHint

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public static void setTranscoderRectangleHint(Transcoder transcoder,
                                              String property,
                                              TranscodingHints.Key key){
    String str = System.getProperty(property);
    if(str != null){
        StringTokenizer st = new StringTokenizer(str, " ,");
        if(st.countTokens() != 4){
            handleValueError(property, str);
        }

        try{
            String x = st.nextToken();
            String y = st.nextToken();
            String width = st.nextToken();
            String height = st.nextToken();
            Rectangle2D r = new Rectangle2D.Float(Float.parseFloat(x),
                                                  Float.parseFloat(y),
                                                  Float.parseFloat(width),
                                                  Float.parseFloat(height));
            transcoder.addTranscodingHint(key, r);
        }catch(NumberFormatException e){
            handleValueError(property, str);
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:26,代码来源:PrintTranscoder.java

示例4: getTranscoder

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
/**
 * Returns a transcoder object of the result image type.
 *
 * @return Transcoder object or <code>null</code> if there isn't a proper transcoder.
 */
protected Transcoder getTranscoder(){
    switch(code) {
        case PNG_CODE:
            return new PNGTranscoder();
        case JPEG_CODE:
            return new JPEGTranscoder();
        case TIFF_CODE:
            return new TIFFTranscoder();
        case PDF_CODE:
            try {
                Class pdfClass = Class.forName("org.apache.fop.svg.PDFTranscoder");
                return (Transcoder)pdfClass.newInstance();
            } catch(Exception e) {
                return null;
            }
        default:
            return null;
    }

}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:26,代码来源:DestinationType.java

示例5: convert

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
private void convert(String svgFileName, String pngFileName)
{
	Transcoder transcoder = new PNGTranscoder();
       Map<TranscodingHints.Key, Float> hints = 
       	new HashMap<TranscodingHints.Key, Float>();
       hints.put(ImageTranscoder.KEY_MAX_HEIGHT, new Float(750));
       hints.put(ImageTranscoder.KEY_MAX_WIDTH, new Float(750));
       transcoder.setTranscodingHints(hints);
	
       try {
        TranscoderInput input = 
        	new TranscoderInput(new File(svgFileName).toURI().toString());
		TranscoderOutput output =
			new TranscoderOutput(new FileOutputStream(pngFileName));
	
		transcoder.transcode(input, output);
	} catch (Exception e) {
		throw new RuntimeException("Transcoding failed.", e);
	}
}
 
开发者ID:donkirkby,项目名称:donkirkby,代码行数:21,代码来源:PaintWriter.java

示例6: convert

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
private void convert(String svgFileName, String pngFileName)
{
	Transcoder transcoder = new PNGTranscoder();
       Map<TranscodingHints.Key, Float> hints = 
       	new HashMap<TranscodingHints.Key, Float>();
       hints.put(ImageTranscoder.KEY_MAX_HEIGHT, new Float(200));
       hints.put(ImageTranscoder.KEY_MAX_WIDTH, new Float(750));
       transcoder.setTranscodingHints(hints);
	
       try {
        TranscoderInput input = 
        	new TranscoderInput(new File(svgFileName).toURI().toString());
		TranscoderOutput output =
			new TranscoderOutput(new FileOutputStream(pngFileName));
	
		transcoder.transcode(input, output);
	} catch (Exception e) {
		throw new RuntimeException("Transcoding failed.", e);
	}
}
 
开发者ID:donkirkby,项目名称:donkirkby,代码行数:21,代码来源:PaintWriter.java

示例7: proceedWithComputedTask

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public boolean proceedWithComputedTask(Transcoder transcoder,
                                       Map hints,
                                       List sources,
                                       List dest){
    System.out.println(Messages.formatMessage(MESSAGE_ABOUT_TO_TRANSCODE,
                                              new Object[]{"" + sources.size()}));
    return true;
}
 
开发者ID:etomica,项目名称:etomica,代码行数:9,代码来源:Main.java

示例8: export

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
@Override
public void export(Model model, OutputStream out) throws IOException, SerialisationException {
    InputStream svg = SvgExportUtils.stream(model);
    Transcoder transcoder = new EPSTranscoder();
    TranscoderInput transcoderInput = new TranscoderInput(svg);
    TranscoderOutput transcoderOutput = new TranscoderOutput(out);
    try {
        transcoder.transcode(transcoderInput, transcoderOutput);
    } catch (TranscoderException e) {
        throw new SerialisationException(e);
    }
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:13,代码来源:EpsExporter.java

示例9: export

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
@Override
public void export(Model model, OutputStream out) throws IOException, SerialisationException {
    InputStream svg = SvgExportUtils.stream(model);
    Transcoder transcoder = new PSTranscoder();
    TranscoderInput transcoderInput = new TranscoderInput(svg);
    TranscoderOutput transcoderOutput = new TranscoderOutput(out);
    try {
        transcoder.transcode(transcoderInput, transcoderOutput);
    } catch (TranscoderException e) {
        throw new SerialisationException(e);
    }
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:13,代码来源:PsExporter.java

示例10: export

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
@Override
public void export(Model model, OutputStream out) throws IOException, SerialisationException {
    InputStream svg = SvgExportUtils.stream(model);
    Transcoder transcoder = new PDFTranscoder();
    TranscoderInput transcoderInput = new TranscoderInput(svg);
    TranscoderOutput transcoderOutput = new TranscoderOutput(out);
    try {
        transcoder.transcode(transcoderInput, transcoderOutput);
    } catch (TranscoderException e) {
        throw new SerialisationException(e);
    }
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:13,代码来源:PdfExporter.java

示例11: export

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
@Override
public void export(Model model, OutputStream out) throws IOException, SerialisationException {
    InputStream svg = SvgExportUtils.stream(model);
    Transcoder transcoder = new PNGTranscoder();
    TranscoderInput transcoderInput = new TranscoderInput(svg);
    TranscoderOutput transcoderOutput = new TranscoderOutput(out);
    try {
        transcoder.transcode(transcoderInput, transcoderOutput);
    } catch (TranscoderException e) {
        throw new SerialisationException(e);
    }
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:13,代码来源:PngExporter.java

示例12: setTranscoderFloatHint

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public static void setTranscoderFloatHint(Transcoder transcoder,
                                          String property,
                                          TranscodingHints.Key key){
    String str = System.getProperty(property);
    if(str != null){
        try{
            Float value = new Float(Float.parseFloat(str));
            transcoder.addTranscodingHint(key, value);
        }catch(NumberFormatException e){
            handleValueError(property, str);
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:14,代码来源:PrintTranscoder.java

示例13: setTranscoderBooleanHint

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public static void setTranscoderBooleanHint(Transcoder transcoder,
                                            String property,
                                            TranscodingHints.Key key){
    String str = System.getProperty(property);
    if(str != null){
        Boolean value = "true".equalsIgnoreCase(str) ? Boolean.TRUE : Boolean.FALSE;
        transcoder.addTranscodingHint(key, value);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:10,代码来源:PrintTranscoder.java

示例14: setTranscoderStringHint

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public static void setTranscoderStringHint(Transcoder transcoder,
                                          String property,
                                          TranscodingHints.Key key){
    String str = System.getProperty(property);
    if(str != null){
        transcoder.addTranscodingHint(key, str);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:9,代码来源:PrintTranscoder.java

示例15: proceedWithComputedTask

import org.apache.batik.transcoder.Transcoder; //导入依赖的package包/类
public boolean proceedWithComputedTask(Transcoder transcoder,
                                       Map hints,
                                       List sources,
                                       List dest){
    computedConfig = new Config();
    computedConfig.transcoderClass = transcoder.getClass();
    computedConfig.sources = new ArrayList( sources );
    computedConfig.dest = new ArrayList( dest );
    computedConfig.hints = new HashMap(hints);
    return false; // Do not proceed with the convertion process,
    // we are only checking the config in this test.
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:13,代码来源:SVGConverterTest.java


注:本文中的org.apache.batik.transcoder.Transcoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。