Package org.apache.flex.forks.batik.ext.awt.image.codec

Examples of org.apache.flex.forks.batik.ext.awt.image.codec.PNGImageEncoder


     */
    public void encodeImage(BufferedImage buf, File imageFile)
        throws SVGGraphics2DIOException {
        try {
            OutputStream os = new FileOutputStream(imageFile);
            ImageEncoder encoder = new PNGImageEncoder(os, null);
            encoder.encode(buf);
            os.close();
        } catch (IOException e) {
            throw new SVGGraphics2DIOException(ERR_WRITE+imageFile.getName());
        }
    }
View Full Code Here


    /**
     * Uses PNG encoding.
     */
    public void encodeImage(BufferedImage buf, OutputStream os)
            throws IOException {
        ImageEncoder encoder = new PNGImageEncoder(os, null);
        encoder.encode(buf);
    }
View Full Code Here

    }

    public void encodeImage(RenderedImage buf, OutputStream os)
        throws SVGGraphics2DIOException {
        try{
            ImageEncoder encoder = new PNGImageEncoder(os, null);
            encoder.encode(buf);
        } catch(IOException e) {
            // We are doing in-memory processing. This should not happen.
            throw new SVGGraphics2DIOException(ERR_UNEXPECTED);
        }
    }
View Full Code Here

        // num Pixs in 1 Meter
        int numPix      = (int)((1000/PixSzMM)+0.5);
        params.setPhysicalDimension(numPix, numPix, 1); // 1 means 'pix/meter'

        try {
            PNGImageEncoder pngEncoder = new PNGImageEncoder(ostream, params);
            pngEncoder.encode(img);
            ostream.flush();
        } catch (IOException ex) {
            throw new TranscoderException(ex);
        }
    }
View Full Code Here

     * Uses PNG encoding.
     */
    public void encodeImage(BufferedImage buf, OutputStream os)
            throws IOException {
        Base64EncoderStream b64Encoder = new Base64EncoderStream(os);
        ImageEncoder encoder = new PNGImageEncoder(b64Encoder, null);
        encoder.encode(buf);
        b64Encoder.close();
    }
View Full Code Here

        throws IOException {

        File imageFile =  makeRandomFileName(imageType);
        imageFile.deleteOnExit();

        PNGImageEncoder encoder
            = new PNGImageEncoder(new FileOutputStream(imageFile),
                                  PNGEncodeParam.getDefaultEncodeParam(img));
       
        encoder.encode(img);
       
        return imageFile;
       
    }
View Full Code Here

    /**
     * Saves an image in a given File
     */
    protected void saveImage(BufferedImage img, OutputStream os)
        throws IOException {
        PNGImageEncoder encoder = new PNGImageEncoder
            (os, PNGEncodeParam.getDefaultEncodeParam(img));
       
        encoder.encode(img);
    }
View Full Code Here

            imageFile = makeRandomFileName(imageType);
        }
       
        imageFile.deleteOnExit();

        PNGImageEncoder encoder = new PNGImageEncoder
            (new FileOutputStream(imageFile),
             PNGEncodeParam.getDefaultEncodeParam(img));
       
        encoder.encode(img);
       
        return imageFile;
    }
View Full Code Here

                BufferedImage diff =
                    SVGRenderingAccuracyTest.buildDiffImage(ref, img);
                String s = new File(filename).getName();
                s = ("test-references/org/apache/batik/transcoder/image/"+
                     "candidate-variation/"+s);
                PNGImageEncoder encoder
                    = new PNGImageEncoder
                    (new FileOutputStream(s),
                     PNGEncodeParam.getDefaultEncodeParam(diff));
                encoder.encode(diff);
                report.addDescriptionEntry(DIFFERENCE_IMAGE,new File(s));
            } catch (Exception e) { }
        }
View Full Code Here

TOP

Related Classes of org.apache.flex.forks.batik.ext.awt.image.codec.PNGImageEncoder

Copyright © 2018 www.massapicom. 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.