psdi.webclient.applet.wfcanvas.diagram

Class GifImageGenerator

  • java.lang.Object
    • psdi.webclient.applet.wfcanvas.diagram.GifImageGenerator


  • public class GifImageGenerator
    extends java.lang.Object
    This class is used to translate an image into a GIF format byte array.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected int firstFree 
      protected int freeCode 
      protected int need 
      protected int[][] StrTab 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected int addCodeToBuffer(int code, int n, byte[] buf, int pos)
      Adds the code to buffer adjusting for the bit offset.
      protected void initTable()
      Initializes the string table with first,next as unassigned
      protected int lookupCode(int code, int c)
      Looks up a code Take the current code and see if there is a longer string that contains the new character.
      byte[] makeGifImage(java.awt.Image image)
      Makes a gif image from the passed image.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • need

        protected int need
      • firstFree

        protected int firstFree
      • freeCode

        protected int freeCode
      • StrTab

        protected int[][] StrTab
    • Constructor Detail

      • GifImageGenerator

        public GifImageGenerator()
    • Method Detail

      • makeGifImage

        public byte[] makeGifImage(java.awt.Image image)
        Makes a gif image from the passed image.
        Parameters:
        image - The image to convert
        Returns:
        The array representing the gif image
      • lookupCode

        protected int lookupCode(int code,
                                 int c)
        Looks up a code Take the current code and see if there is a longer string that contains the new character. If there is return it otherwise add a new code and return -1 to indicate that the code was not matched. The lookup is cummulative in the main code loop.
        Parameters:
        code - The code to lookup
        c - The next character
        Returns:
        Matching code or -1 if not found
      • addCodeToBuffer

        protected int addCodeToBuffer(int code,
                                      int n,
                                      byte[] buf,
                                      int pos)
        Adds the code to buffer adjusting for the bit offset. The remaining bits in the current byte are in 'need' which is a static variable for this class Note that n < 0 is used to force alignment to the next byte
        Parameters:
        code - The code to add
        n - The number of bits in the code
        buf - The buffer
        pos - The current byte position
        Returns:
        The new byte position
      • initTable

        protected void initTable()
        Initializes the string table with first,next as unassigned