Class EXRBitmapWriter

  • All Implemented Interfaces:
    BitmapWriter

    public class EXRBitmapWriter
    extends java.lang.Object
    implements BitmapWriter
    • Field Detail

      • filename

        private java.lang.String filename
      • file

        private java.io.RandomAccessFile file
      • tileOffsets

        private long[][] tileOffsets
      • tileOffsetsPosition

        private long tileOffsetsPosition
      • tilesX

        private int tilesX
      • tilesY

        private int tilesY
      • tileSize

        private int tileSize
      • compression

        private int compression
      • channelType

        private byte channelType
      • channelSize

        private int channelSize
      • tmpbuf

        private byte[] tmpbuf
      • comprbuf

        private byte[] comprbuf
    • Constructor Detail

      • EXRBitmapWriter

        public EXRBitmapWriter()
    • Method Detail

      • configure

        public void configure​(java.lang.String option,
                              java.lang.String value)
        Description copied from interface: BitmapWriter
        This method will be called before writing begins. It is used to set common attributes to file writers. Currently supported keywords include:
        • "compression"
        • "channeltype": "byte", "short", "half", "float"
        Note that this method should not fail if its input is not supported or invalid. It should gracefully ignore the error and keep its default state.
        Specified by:
        configure in interface BitmapWriter
      • openFile

        public void openFile​(java.lang.String filename)
                      throws java.io.IOException
        Description copied from interface: BitmapWriter
        Open a handle to the specified file for writing. If the writer buffers the image and writes it on close, then the filename should be stored.
        Specified by:
        openFile in interface BitmapWriter
        Parameters:
        filename - filename to write the bitmap to
        Throws:
        java.io.IOException - thrown if an I/O error occurs
      • writeHeader

        public void writeHeader​(int width,
                                int height,
                                int tileSize)
                         throws java.io.IOException,
                                java.lang.UnsupportedOperationException
        Description copied from interface: BitmapWriter
        Write the bitmap header. This may be defered if the image is buffered for writing all at once on close. Note that if tile size is positive, data sent to this class is guarenteed to arrive in tiles of that size (except at borders). Otherwise, it should be assumed that the data is random, and that it may overlap. The writer should then either throw an error or start buffering data manually.
        Specified by:
        writeHeader in interface BitmapWriter
        Parameters:
        width - image width
        height - image height
        tileSize - tile size or 0 if the image will not be sent in tiled form
        Throws:
        java.io.IOException - thrown if an I/O error occurs
        java.lang.UnsupportedOperationException - thrown if this writer does not support writing the image with the supplied tile size
      • writeTile

        public void writeTile​(int x,
                              int y,
                              int w,
                              int h,
                              Color[] color,
                              float[] alpha)
                       throws java.io.IOException
        Description copied from interface: BitmapWriter
        Write a tile of data. Note that this method may be called by more than one thread, so it should be made thread-safe if possible.
        Specified by:
        writeTile in interface BitmapWriter
        Parameters:
        x - tile x coordinate
        y - tile y coordinate
        w - tile width
        h - tile height
        color - color data
        alpha - alpha data
        Throws:
        java.io.IOException - thrown if an I/O error occurs
      • closeFile

        public void closeFile()
                       throws java.io.IOException
        Description copied from interface: BitmapWriter
        Close the file, this completes the bitmap writing process.
        Specified by:
        closeFile in interface BitmapWriter
        Throws:
        java.io.IOException - thrown if an I/O error occurs
      • writeRGBAHeader

        private void writeRGBAHeader​(int w,
                                     int h,
                                     int tileSize)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTileOffsets

        private void writeTileOffsets()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeEXRTile

        private void writeEXRTile​(int tileX,
                                  int tileY,
                                  int w,
                                  int h,
                                  Color[] tile,
                                  float[] alpha)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • compress

        private static final int compress​(int tp,
                                          byte[] in,
                                          int inSize,
                                          byte[] out)
      • rleCompress

        private static final int rleCompress​(byte[] in,
                                             int inLen,
                                             byte[] out)