Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

non_com.media.jai.codec
Class BMPImageEncoder  view BMPImageEncoder download BMPImageEncoder.java

java.lang.Object
  extended bynon_com.media.jai.codec.ImageEncoderImpl
      extended bynon_com.media.jai.codec.BMPImageEncoder
All Implemented Interfaces:
ImageEncoder

public class BMPImageEncoder
extends ImageEncoderImpl

An ImageEncoder for the various versions of the BMP image file format. Unless specified otherwise by the BMPDecodeParam object passed to the constructor, Version 3 will be the default version used.

If the image to be encoded has an IndexColorModel and can be encoded using upto 8 bits per pixel, the image will be written out as a Palette color image with an appropriate number of bits per pixel. For example an image having a 256 color IndexColorModel will be written out as a Palette image with 8 bits per pixel while one with a 16 color palette will be written out as a Palette image with 4 bits per pixel. For all other images, the 24 bit image format will be used.


Field Summary
private  int compImageSize
           
private  int h
           
private  boolean isCompressed
           
private  boolean isTopDown
           
private  java.io.OutputStream output
           
private  int version
           
private  int w
           
 
Fields inherited from class non_com.media.jai.codec.ImageEncoderImpl
param
 
Constructor Summary
BMPImageEncoder(java.io.OutputStream output, ImageEncodeParam param)
          An ImageEncoder for the BMP file format.
 
Method Summary
 void encode(java.awt.image.RenderedImage im)
          Encodes a RenderedImage and writes the output to the OutputStream associated with this ImageEncoder.
private  void encodeRLE4(byte[] bipixels, int scanlineBytes)
           
private  void encodeRLE8(byte[] bpixels, int scanlineBytes)
           
private  void incCompImageSize(int value)
           
private  boolean isEven(int number)
           
 void writeDWord(int dword)
          Description of the Method
private  void writeFileHeader(int fileSize, int offset)
           
private  void writeInfoHeader(int headerSize, int bitsPerPixel)
           
private  void writePixels(int l, int scanlineBytes, int bitsPerPixel, int[] pixels, byte[] bpixels, int padding, int numBands, java.awt.image.IndexColorModel icm)
           
private  void writeSize(int dword, int offset)
           
 void writeWord(int word)
          Description of the Method
 
Methods inherited from class non_com.media.jai.codec.ImageEncoderImpl
encode, getOutputStream, getParam, setParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

output

private java.io.OutputStream output

version

private int version

isCompressed

private boolean isCompressed

isTopDown

private boolean isTopDown

w

private int w

h

private int h

compImageSize

private int compImageSize
Constructor Detail

BMPImageEncoder

public BMPImageEncoder(java.io.OutputStream output,
                       ImageEncodeParam param)
An ImageEncoder for the BMP file format.

Method Detail

encode

public void encode(java.awt.image.RenderedImage im)
            throws java.io.IOException
Encodes a RenderedImage and writes the output to the OutputStream associated with this ImageEncoder.

Specified by:
encode in interface ImageEncoder
Specified by:
encode in class ImageEncoderImpl

writeWord

public void writeWord(int word)
               throws java.io.IOException
Description of the Method


writeDWord

public void writeDWord(int dword)
                throws java.io.IOException
Description of the Method


isEven

private boolean isEven(int number)

writePixels

private void writePixels(int l,
                         int scanlineBytes,
                         int bitsPerPixel,
                         int[] pixels,
                         byte[] bpixels,
                         int padding,
                         int numBands,
                         java.awt.image.IndexColorModel icm)
                  throws java.io.IOException

encodeRLE8

private void encodeRLE8(byte[] bpixels,
                        int scanlineBytes)
                 throws java.io.IOException

encodeRLE4

private void encodeRLE4(byte[] bipixels,
                        int scanlineBytes)
                 throws java.io.IOException

incCompImageSize

private void incCompImageSize(int value)

writeFileHeader

private void writeFileHeader(int fileSize,
                             int offset)
                      throws java.io.IOException

writeInfoHeader

private void writeInfoHeader(int headerSize,
                             int bitsPerPixel)
                      throws java.io.IOException

writeSize

private void writeSize(int dword,
                       int offset)
                throws java.io.IOException