public static void setTranscoderStringHint( Transcoder transcoder, String property, TranscodingHints.Key key) { String str = System.getProperty(property); if (str != null) { transcoder.addTranscodingHint(key, str); } }
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); } } }
public static void setTranscoderBooleanHint( Transcoder transcoder, String property, TranscodingHints.Key key) { String str = System.getProperty(property); if (str != null) { Boolean value = new Boolean("true".equalsIgnoreCase(str)); transcoder.addTranscodingHint(key, value); } }
public void convert(InputStream in, OutputStream out, Integer size) throws TranscoderException { Transcoder t = createTranscoder(); if (size != null) { final float sizeBound = Math.max(Math.min(size, 2000.0f), 32.0f); t.addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, sizeBound); } t.transcode(new TranscoderInput(in), new TranscoderOutput(out)); }
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); } } }
protected Transcoder createTranscoder() { Transcoder t = new JPEGTranscoder(); t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, 0.95f); return t; }