Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.avi
Class DIBCodec

    java.lang.Object
      org.monte.media.AbstractCodec
          org.monte.media.AbstractVideoCodec
              org.monte.media.avi.DIBCodec

All Implemented Interfaces:
  Codec

    public class DIBCodec

extends AbstractVideoCodec

`DIBCodec` encodes a BufferedImage as a Microsoft Device Independent Bitmap (DIB) into a byte array.

The DIB codec only works with the AVI file format. Other file formats, such as QuickTime, use a different encoding for uncompressed video.

This codec currently only supports encoding from a `BufferedImage` into the file format. Decoding support may be added in the future.

This codec does not encode the color palette of an image. This must be done separately.

The pixels of a frame are written row by row from bottom to top and from the left to the right. 24-bit pixels are encoded as BGR.

Supported input formats:

`Format` with `BufferedImage.class`, any width, any height, depth=4.

Supported output formats:

`Format` with `byte[].class`, same width and height as input format, depth=4.

Version:
  $Id: DIBCodec.java 186 2012-03-28 11:18:42Z werner $
Author:
  Werner Randelshofer

Field Summary

Fields inherited from class org.monte.media.AbstractCodec
`inputFormat, inputFormats, name, outputFormat, outputFormats`

Fields inherited from interface org.monte.media.Codec
`CODEC_FAILED, CODEC_INPUT_NOT_CONSUMED, CODEC_OK, CODEC_OUTPUT_NOT_FILLED`

Constructor Summary
`DIBCodec()`

Method Summary
`int` | `process(Buffer in, Buffer out)` Performs the media processing defined by this codec.
`void` | `writeKey24(java.io.OutputStream out, int[] pixels, int width, int height, int offset, int scanlineStride)` Encodes a 24-bit key frame.
`void` | `writeKey4(java.io.OutputStream out, byte[] pixels, int width, int height, int offset, int scanlineStride)` Encodes a 4-bit key frame.
`void` | `writeKey8(java.io.OutputStream out, byte[] pixels, int width, int height, int offset, int scanlineStride)` Encodes an 8-bit key frame.

Methods inherited from class org.monte.media.AbstractVideoCodec
`copyImage, getARGB32, getBufferedImage, getIndexed8, getRGB15, getRGB16, getRGB24, writeInt24, writeInt24LE, writeInts24, writeInts24LE`

Methods inherited from class org.monte.media.AbstractCodec
`getInputFormat, getInputFormats, getName, getOutputFormat, getOutputFormats, reset, setInputFormat, setOutputFormat, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DIBCodec

    public DIBCodec()

Method Detail

### process

    public int process(Buffer in,
                       Buffer out)

  Description copied from interface: `Codec`
  Performs the media processing defined by this codec.

  Copies the data from the input buffer into the output buffer.

  Returns:
    A combination of processing flags.

### writeKey4

    public void writeKey4(java.io.OutputStream out,
                          byte[] pixels,
                          int width,
                          int height,
                          int offset,
                          int scanlineStride)
                   throws java.io.IOException

  Encodes a 4-bit key frame.

  Parameters:
    `out` - The output stream.
    `pixels` - The image data.
    `offset` - The offset to the first pixel in the data array.
    `width` - The width of the image in data elements.
    `scanlineStride` - The number to append to offset to get to the next scanline.
  Throws:
    `java.io.IOException`

### writeKey8

    public void writeKey8(java.io.OutputStream out,
                          byte[] pixels,
                          int width,
                          int height,
                          int offset,
                          int scanlineStride)
                   throws java.io.IOException

  Encodes an 8-bit key frame.

  Parameters:
    `out` - The output stream.
    `pixels` - The image data.
    `offset` - The offset to the first pixel in the data array.
    `width` - The width of the image in data elements.
    `scanlineStride` - The number to append to offset to get to the next scanline.
  Throws:
    `java.io.IOException`

### writeKey24

    public void writeKey24(java.io.OutputStream out,
                           int[] pixels,
                           int width,
                           int height,
                           int offset,
                           int scanlineStride)
                    throws java.io.IOException

  Encodes a 24-bit key frame.

  Parameters:
    `out` - The output stream.
    `pixels` - The image data.
    `offset` - The offset to the first pixel in the data array.
    `width` - The width of the image in data elements.
    `scanlineStride` - The number to append to offset to get to the next scanline.
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD