Class PngWriter


  • public class PngWriter
    extends java.lang.Object
    Writes a PNG image.
    Since:
    5.0.3
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int[] crc_table  
      private static byte[] iCCP  
      private static byte[] IDAT  
      private static byte[] IEND  
      private static byte[] IHDR  
      private java.io.OutputStream outp  
      private static byte[] PLTE  
      private static byte[] PNG_SIGNTURE  
    • Constructor Summary

      Constructors 
      Constructor Description
      PngWriter​(java.io.OutputStream outp)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static int crc​(byte[] buf)  
      private static int crc​(byte[] buf, int offset, int len)  
      private static void make_crc_table()  
      void outputInt​(int n)  
      static void outputInt​(int n, java.io.OutputStream s)  
      private static int update_crc​(int crc, byte[] buf, int offset, int len)  
      void writeChunk​(byte[] chunkType, byte[] data)  
      void writeData​(byte[] data, int stride)  
      void writeEnd()  
      void writeHeader​(int width, int height, int bitDepth, int colorType)  
      void writeIccProfile​(byte[] data)  
      void writePalette​(byte[] data)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PNG_SIGNTURE

        private static final byte[] PNG_SIGNTURE
      • IHDR

        private static final byte[] IHDR
      • PLTE

        private static final byte[] PLTE
      • IDAT

        private static final byte[] IDAT
      • IEND

        private static final byte[] IEND
      • iCCP

        private static final byte[] iCCP
      • crc_table

        private static int[] crc_table
      • outp

        private java.io.OutputStream outp
    • Constructor Detail

      • PngWriter

        public PngWriter​(java.io.OutputStream outp)
                  throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • writeHeader

        public void writeHeader​(int width,
                                int height,
                                int bitDepth,
                                int colorType)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeEnd

        public void writeEnd()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeData

        public void writeData​(byte[] data,
                              int stride)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writePalette

        public void writePalette​(byte[] data)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeIccProfile

        public void writeIccProfile​(byte[] data)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • make_crc_table

        private static void make_crc_table()
      • update_crc

        private static int update_crc​(int crc,
                                      byte[] buf,
                                      int offset,
                                      int len)
      • crc

        private static int crc​(byte[] buf,
                               int offset,
                               int len)
      • crc

        private static int crc​(byte[] buf)
      • outputInt

        public void outputInt​(int n)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • outputInt

        public static void outputInt​(int n,
                                     java.io.OutputStream s)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeChunk

        public void writeChunk​(byte[] chunkType,
                               byte[] data)
                        throws java.io.IOException
        Throws:
        java.io.IOException