Package com.sixlegs.image.png

Examples of com.sixlegs.image.png.PngImage


public class PixelGrabberExample
{
    static public void main(String[] args)
    throws IOException
    {
        PngImage png = new PngImage(args[0]);

        int x = Integer.parseInt(args[1]);
        int y = Integer.parseInt(args[2]);
        int w = png.getWidth();

        int[] pixels = new int[1];
        PixelGrabber pg =
          new PixelGrabber(png, x, y, 1, 1, pixels, 0, w);
        try {
View Full Code Here


    {
        String loc = getParameter("URL");
        try {
            if (loc != null) {
                URL url = new URL(getCodeBase(), loc);
                png = new PngImage(url);
                String bgparam = getParameter("bgcolor");
                if (bgparam != null)
                    imgbg = new Color(Integer.valueOf(bgparam, 16).intValue());
                if (imgbg == null)
                    imgbg = png.getBackgroundColor();
View Full Code Here

    {
        // Register instance of this class as "heLo" handler
        PngImage.registerChunk(new ChunkHandlerExample(), "heLo");

        // Read PNG image from file
        PngImage png = new PngImage(args[0]);

        // Ensures that entire PNG image has been read,
        // triggering handleChunk when a "heLo" chunk is found
        png.getEverything();
    }
View Full Code Here

    {
        // Update ImageObservers after each interlace pass
        PngImage.setProgressiveDisplay(true);

            // Read PNG image from file
        PngImage png = new PngImage(args[0]);
        Toolkit tk = Toolkit.getDefaultToolkit();
        Image img = tk.createImage(png);
        int w = png.getWidth();
        int h = png.getHeight();

        // Call prepareImage using an instance of this class
        // as the ImageObserver; triggers imageUpdate (below)
        tk.prepareImage(img, w, h, new ObserverExample());
    }
View Full Code Here

        try {
            // Makes errors in ancillary chunks fatal
            PngImage.setAllErrorsFatal(true);

            // Read PNG image from file
            PngImage png = new PngImage(args[0]);

            // Read entire PNG image (doesn't throw exceptions)
            png.getEverything();

            // Print all errors
            if (png.hasErrors()) {
                System.err.println("Errors in PNG processing:");
                for (Enumeration e = png.getErrors(); e.hasMoreElements();) {
                    // Objects returned by getErrors derive from IOException,
                    // but you usually only want to print them
                    System.err.println("  " + e.nextElement());
                }
            }
View Full Code Here

{
    public static void main(String[] args)
    throws IOException
    {
        // Read PNG image from file
        PngImage png = new PngImage(args[0]);

        // Ensures that entire PNG image has been read
        png.getEverything();

        // Print all available properties
        for (Enumeration e = png.getProperties(); e.hasMoreElements();) {
            String key = (String)e.nextElement();
            System.out.println(key);
            System.out.println("\t" + png.getProperty(key));
        }
    }
View Full Code Here

TOP

Related Classes of com.sixlegs.image.png.PngImage

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.