Examples of PNGTranscoder


Examples of org.apache.batik.transcoder.image.PNGTranscoder

     * @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:
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

                        (resources.getString("Message.exportAsPNG"));

                    // create a BufferedImage of the appropriate type
                    int w = buffer.getWidth();
                    int h = buffer.getHeight();
                    final ImageTranscoder trans = new PNGTranscoder();
                    trans.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME,
                                             application.getXMLParserClassName());
                    trans.addTranscodingHint(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE,
                                             new Boolean(true));
                    final BufferedImage img = trans.createImage(w, h);

                    // paint the buffer to the image
                    Graphics2D g2d = img.createGraphics();
                    g2d.drawImage(buffer, null, 0, 0);
                    new Thread() {
                        public void run() {
                            try {
                                currentExportPath = f;
                                OutputStream ostream =
                                    new BufferedOutputStream(new FileOutputStream(f));
                                trans.writeImage(img,
                                                 new TranscoderOutput(ostream));
                                ostream.flush();
                            } catch (Exception ex) {}
                            statusBar.setMessage
                                (resources.getString("Message.done"));
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

       
        TranscoderOutput validDst
            = new TranscoderOutput(new FileOutputStream(tmpFile));
       
        ImageTranscoder transcoder
            = new PNGTranscoder();
       
        transcoder.transcode(validSrc, validDst);
       
        tmpFile.deleteOnExit();
       
        return tmpFile.toURL();
    }
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

       
        TranscoderOutput validDst
            = new TranscoderOutput(new FileOutputStream(tmpFile));
       
        ImageTranscoder transcoder
            = new PNGTranscoder();
       
        transcoder.transcode(validSrc, validDst);
       
        tmpFile.deleteOnExit();
       
        return tmpFile.toURL();
    }
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

     * @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:
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

                        (resources.getString("Message.exportAsPNG"));

                    // create a BufferedImage of the appropriate type
                    int w = buffer.getWidth();
                    int h = buffer.getHeight();
                    final ImageTranscoder trans = new PNGTranscoder();
                    if (application.getXMLParserClassName() != null) {
                        trans.addTranscodingHint
                            (JPEGTranscoder.KEY_XML_PARSER_CLASSNAME,
                                application.getXMLParserClassName());
                    }
                    trans.addTranscodingHint(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE,
                                             Boolean.TRUE );

            // Start: By Jun Inamori
            if(isIndexed){
                trans.addTranscodingHint(PNGTranscoder.KEY_INDEXED,new Integer(256));
            }
            // End: By Jun Inamori

                    final BufferedImage img = trans.createImage(w, h);

                    // paint the buffer to the image
                    Graphics2D g2d = img.createGraphics();
                    g2d.drawImage(buffer, null, 0, 0);
                    new Thread() {
                        public void run() {
                            try {
                                currentSavePath = f;
                                OutputStream ostream =
                                    new BufferedOutputStream(new FileOutputStream(f));
                                trans.writeImage(img,
                                                 new TranscoderOutput(ostream));
                                ostream.close();
                            } catch (Exception ex) {}
                            statusBar.setMessage
                                (resources.getString("Message.done"));
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

public class SOTranscoder
{
    public static void main(String [] args) throws Exception
  {
        PNGTranscoder  aTranscoder = new PNGTranscoder();
        OutputStream  aOStm = new FileOutputStream( args[ 1 ] );

        aTranscoder.transcode( new TranscoderInput( new File( args[ 0 ] ).toURL().toString() ), new TranscoderOutput( aOStm ) );

        aOStm.flush();
        aOStm.close();
    }
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

public class SOTranscoder
{
    public static void main(String [] args) throws Exception
  {
        PNGTranscoder  aTranscoder = new PNGTranscoder();
        OutputStream  aOStm = new FileOutputStream( args[ 1 ] );

        aTranscoder.transcode( new TranscoderInput( new File( args[ 0 ] ).toURL().toString() ), new TranscoderOutput( aOStm ) );

        aOStm.flush();
        aOStm.close();
    }
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

            mimeType.equals("image/jpe")) {
            t = new JPEGTranscoder();
            t.addTranscodingHint(JPEGTranscoder.KEY_XML_PARSER_CLASSNAME,
                                 "org.apache.crimson.parser.XMLReaderImpl");
        } else if (mimeType.equals("image/png")) {
            t = new PNGTranscoder();
            t.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME,
                                 "org.apache.crimson.parser.XMLReaderImpl");
        }
        if (t == null) {
            error("No transcoder found for mime type : "+mimeType);
View Full Code Here

Examples of org.apache.batik.transcoder.image.PNGTranscoder

                        (resources.getString("Message.exportAsPNG"));

                    // create a BufferedImage of the appropriate type
                    int w = buffer.getWidth();
                    int h = buffer.getHeight();
                    final ImageTranscoder trans = new PNGTranscoder();
                    trans.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME,
                                             application.getXMLParserClassName());
                    final BufferedImage img = trans.createImage(w, h);

                    // paint the buffer to the image
                    Graphics2D g2d = img.createGraphics();
                    g2d.drawImage(buffer, null, 0, 0);
                    new Thread() {
                        public void run() {
                            try {
                                currentExportPath = f.getCanonicalPath();
                                OutputStream ostream =
                                    new BufferedOutputStream(new FileOutputStream(f));
                                trans.writeImage(img,
                                                 new TranscoderOutput(ostream));
                                ostream.flush();
                            } catch (Exception ex) {}
                            statusBar.setMessage
                                (resources.getString("Message.done"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.