Пример #1
0
  public void update(URL svg) {
    g.setColor(new Color(0, 0, 0, 255));
    g.setColor(new Color(20, 20, 20, 200));
    g.setBackground(new Color(0, 0, 0, 0));
    g.clearRect(0, 0, OSDParams.W, OSDParams.H);
    Transcoder t =
        new ImageTranscoder() {

          @Override
          public BufferedImage createImage(int arg0, int arg1) {
            return bi;
          }

          @Override
          public void writeImage(BufferedImage arg0, TranscoderOutput arg1)
              throws TranscoderException {
            // TODO Auto-generated method stub

          }
        };

    try {
      TranscoderInput ti = new TranscoderInput(new FileReader(svg.getFile()));
      ti.setURI(svg.toURI().toString());
      TranscoderOutput to = new TranscoderOutput();
      t.transcode(ti, to);
    } catch (Exception e) {
      System.out.println("Failed to transcode");
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }
Пример #2
0
 /** Creates the <tt>TranscoderInput</tt>. */
 protected TranscoderInput createTranscoderInput() {
   try {
     URL url = resolveURL(inputURI);
     InputStream istream = url.openStream();
     TranscoderInput input = new TranscoderInput(istream);
     input.setURI(url.toString()); // Needed for external resources
     return input;
   } catch (IOException ex) {
     throw new IllegalArgumentException(inputURI);
   }
 }