Package org.newdawn.slick.opengl

Examples of org.newdawn.slick.opengl.PNGDecoder


        }
        if (pngStream == null) {
            throw new IOException("Missing png to go with texture json");
        }
        try {
            PNGDecoder decoder = new PNGDecoder(pngStream);

            ByteBuffer buf = ByteBuffer.allocateDirect(4 * decoder.getWidth() * decoder.getHeight());
            decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.RGBA);
            buf.flip();

            ByteBuffer data = buf;
            int height = decoder.getHeight();
            int width = decoder.getWidth();

            Texture.FilterMode filterMode = Texture.FilterMode.NEAREST;
            Texture.WrapMode wrapMode = Texture.WrapMode.CLAMP;
            Texture.Type type = Texture.Type.TEXTURE2D;

View Full Code Here


                }
            }

            try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
                ImageIO.write(image, "png", bos);
                PNGDecoder decoder = new PNGDecoder(new ByteArrayInputStream(bos.toByteArray()));
                ByteBuffer buf = ByteBuffer.allocateDirect(4 * decoder.getWidth() * decoder.getHeight());
                decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.RGBA);
                buf.flip();
                data[i] = buf;
            } catch (IOException e) {
                logger.error("Failed to create atlas texture");
            }
View Full Code Here

TOP

Related Classes of org.newdawn.slick.opengl.PNGDecoder

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.