00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 package de.picana.converter;
00014
00015 import de.picana.control.*;
00016 import de.picana.logging.*;
00017
00018 import org.apache.batik.transcoder.image.PNGTranscoder;
00019 import org.apache.batik.transcoder.TranscoderInput;
00020 import org.apache.batik.transcoder.TranscoderOutput;
00021
00022 import java.io.*;
00023
00024
00031 public class SVG2PNG extends Task {
00032
00033 private String srcfile;
00034 private String destfile;
00035
00036
00038 public SVG2PNG() {
00039 }
00040
00041 public void init(ParameterSet params, Logger logger) {
00042
00043 super.init(params, logger);
00044
00045 srcfile = (String)params.getParameter("src");
00046 destfile = (String)params.getParameter("dest");
00047 }
00048
00049 public void start() throws TaskException {
00050
00051 try {
00052 PNGTranscoder t = new PNGTranscoder();
00053
00054 TranscoderInput input = new TranscoderInput(
00055 new FileReader(new File(srcfile)));
00056
00057 FileOutputStream outputStream = new FileOutputStream(new File(destfile));
00058 TranscoderOutput output = new TranscoderOutput(outputStream);
00059
00060 t.transcode(input, output);
00061 outputStream.close();
00062
00063 } catch (Exception ex) {
00064 throw new TaskException(ex.toString());
00065 }
00066 }
00067
00068 public void stop() {
00069
00070 }
00071
00072 public void pause() {
00073
00074 }
00075
00076 public void resume() {
00077
00078 }
00079 }