public void write(OutputStream output) throws IOException { output.write(separator_); BitUtils.writeWord(output, this.leftPosition); BitUtils.writeWord(output, this.topPosition); BitUtils.writeWord(output, this.imageWidth); BitUtils.writeWord(output, this.imageHeight); output.write(this.currentByte); } // ends write(OutputStream)
/** * Writes the image out to a stream in the <CODE>GIF</CODE> file format. * This will be a single GIF87a image, non-interlaced, with no background * color. <B>This may take some time.</B> * * @param output * The stream to which to output. This should probably be a * buffered stream. * @exception IOException * Thrown if a write operation fails. */ public void write(OutputStream output) throws IOException { BitUtils.writeString(output, "GIF87a"); ScreenDescriptor sd = new ScreenDescriptor(this.imageWidth, this.imageHeight, this.numberOfColors); sd.write(output); output.write(this.allColors, 0, this.allColors.length); ImageDescriptor id = new ImageDescriptor(this.imageWidth, this.imageHeight, ','); id.write(output); byte codesize = BitUtils.BitsNeeded(this.numberOfColors); if (codesize == 1) codesize++; output.write(codesize); LZWCompressor.LZWCompress(output, codesize, this.allPixels); output.write(0); id = new ImageDescriptor((byte) 0, (byte) 0, ';'); id.write(output); output.flush(); } // ends write(OutputStream)
this.numberOfColors = 1 << BitUtils.BitsNeeded(colornum); byte copy[] = new byte[this.numberOfColors * 3]; System.arraycopy(this.allColors, 0, copy, 0, this.numberOfColors * 3);
/** * tool for dumping current screen image?? * * @param width * @param height * @param numColors */ public ScreenDescriptor(short width, short height, int numColors) { this.localScreenWidth = width; this.localScreenHeight = height; SetGlobalColorTableSize((byte) (BitUtils.BitsNeeded(numColors) - 1)); SetGlobalColorTableFlag((byte) 1); SetSortFlag((byte) 0); SetColorResolution((byte) 7); this.backgroundColorIndex = 0; this.pixelAspectRatio = 0; } // ends constructor ScreenDescriptor(short, short, int)
public void write(OutputStream output) throws IOException { BitUtils.writeWord(output, this.localScreenWidth); BitUtils.writeWord(output, this.localScreenHeight); output.write(this.currentByte); output.write(this.backgroundColorIndex); output.write(this.pixelAspectRatio); } // ends write(OutputStream)