int rowOffset = row * width;
    void encodeDone() throws IOException	{	int transparentIndex = -1;	int transparentRgb = -1;        // Put all the pixels into a hash table.        colorHash = new Acme.IntHashtable();	int index = 0;        for ( int row = 0; row < height; ++row )            {            int rowOffset = row * width;            for ( int col = 0; col < width; ++col )                {                int rgb = rgbPixels[row][col];		boolean isTransparent = ( ( rgb >>> 24 ) < 0x80 );		if ( isTransparent )		    {		    if ( transparentIndex < 0 )			{			// First transparent color; remember it.			transparentIndex = index;			transparentRgb = rgb;			}		    else if ( rgb != transparentRgb )			{			// A second transparent color; replace it with			// the first one.			rgbPixels[row][col] = rgb = transparentRgb;			}		    }                GifEncoderHashitem item =		    (GifEncoderHashitem) colorHash.get( rgb );                if ( item == null )		    {		    if ( index >= 256 )			throw new IOException( "too many colors for a GIF" );                    item = new GifEncoderHashitem(			rgb, 1, index, isTransparent );		    ++index;		    colorHash.put( rgb, item );		    }                else                    ++item.count;                }            }	// Figure out how many bits to use.	int logColors;	if ( index <= 2 )	    logColors = 1;	else if ( index <= 4 )	    logColors = 2;	else if ( index <= 16 )	    logColors = 4;	else	    logColors = 8;	// Turn colors into colormap entries.	int mapSize = 1 << logColors;	byte[] reds = new byte[mapSize];	byte[] grns = new byte[mapSize];	byte[] blus = new byte[mapSize];	for ( Enumeration e = colorHash.elements(); e.hasMoreElements(); )	    {	    GifEncoderHashitem item = (GifEncoderHashitem) e.nextElement();	    reds[item.index] = (byte) ( ( item.rgb >> 16 ) & 0xff );	    grns[item.index] = (byte) ( ( item.rgb >>  8 ) & 0xff );	    blus[item.index] = (byte) (   item.rgb         & 0xff );	    }	GIFEncode(	    out, width, height, interlace, (byte) 0, transparentIndex,	    logColors, reds, grns, blus );	}