/Users/lyon/j4p/src/ip/gif/gifAnimation/IndexGif89Frame.java

1    //****************************************************************************** 
2    // IndexGif89Frame.java 
3    //****************************************************************************** 
4    package ip.gif.gifAnimation; 
5     
6    //============================================================================== 
7     
8    /** Instances of this Gif89Frame subclass are constructed from bitmaps in the 
9     *  form of color-index pixels, which accords with a GIF's native palettized 
10    *  color model.  The class is useful when complete control over a GIF's color 
11    *  palette is desired.  It is also much more efficient when one is using an 
12    *  algorithmic frame generator that isn't interested in RGB values (such 
13    *  as a cellular automaton). 
14    *  <p> 
15    *  Objects of this class are normally added to a Gif89Encoder object that has 
16    *  been provided with an explicit color table at construction.  While you may 
17    *  also add them to "auto-map" encoders without an exception being thrown, 
18    *  there obviously must be at least one DirectGif89Frame object in the sequence 
19    *  so that a color table may be detected. 
20    * 
21    * @version 0.90 beta (15-Jul-2000) 
22    * @author J. M. G. Elliott (tep@jmge.net) 
23    * @see Gif89Encoder 
24    * @see Gif89Frame 
25    * @see DirectGif89Frame 
26    */ 
27   public class IndexGif89Frame extends Gif89Frame { 
28    
29       //---------------------------------------------------------------------------- 
30       /** Construct a IndexGif89Frame from color-index pixel data. 
31        * 
32        * @param width 
33        *   Width of the bitmap. 
34        * @param height 
35        *   Height of the bitmap. 
36        * @param ci_pixels 
37        *   Array containing at least width*height color-index pixels. 
38        */ 
39       public IndexGif89Frame(int width, int height, byte ci_pixels[]) { 
40           theWidth = width; 
41           theHeight = height; 
42           ciPixels = new byte[theWidth * theHeight]; 
43           System.arraycopy(ci_pixels, 0, ciPixels, 0, ciPixels.length); 
44       } 
45    
46       //---------------------------------------------------------------------------- 
47       Object getPixelSource() { 
48           return ciPixels; 
49       } 
50   }