Exemple #1
0
        public void Set(string stream)
        {
            SubBlocks = new List <string>();
            Debug.Log("IMAGE DATA: " + stream);

            int    index, total, subBlockLength;
            string temp;

            LZWCompressionSize = GifHelper.HexToDecimal(stream.Substring(0, 2));
            Debug.Log("LZW minimum code size: " + LZWCompressionSize);


            index = 2;
            total = 2;
            for (int i = 0; i < stream.Length; i++)
            {
                subBlockLength = GifHelper.HexToDecimal(stream.Substring(index, 2)) * 2;
                index         += 2;
                if (subBlockLength == 0)
                {
                    Debug.LogWarning("byte index in image data: " + index + " /" + stream.Length.ToString());
                    //Debug.Log("number of sub blocks:" + SubBlocks.Count);
                    break;
                }
                Debug.Log("sub block length: " + subBlockLength);
                total += subBlockLength + 2;

                temp   = stream.Substring(index, subBlockLength);
                index += subBlockLength;
                SubBlocks.Add(temp);
                //Debug.LogWarning("byte index in image data: " + index + " /" + stream.Length.ToString());
            }

            DecryptImageData(stream);
        }
        public void Set(string stream)
        {
            string label = stream.Substring(0, 2);
            Debug.Log("IMAGE DESCRIPTOR: " + stream);
            if(ImageSeperator != label)
            {
                Debug.LogError("NOT AN IMAGE SEPERATOR");
            }

            string redrawLeftHex = stream.Substring(4, 2) + stream.Substring(2, 2);
            Left = GifHelper.HexToDecimal(redrawLeftHex);
            

            string redrawTopHex = stream.Substring(8, 2) + stream.Substring(6, 2);
            Top = GifHelper.HexToDecimal(redrawTopHex);
            

            string redrawWidthHex = stream.Substring(12, 2) + stream.Substring(10, 2);
            Width = GifHelper.HexToDecimal(redrawWidthHex);
            

            string redrawHeightHex = stream.Substring(16, 2) + stream.Substring(14, 2);
            Height = GifHelper.HexToDecimal(redrawHeightHex);
            

            string PacketField = stream.Substring(18, 2);
            //Debug.LogWarning("Resize Left: " + Left);
            //Debug.LogWarning("Resize Top: " + Top);
            //Debug.LogWarning("Resize Width: " + Width);
            //Debug.LogWarning("Resize Height: " + Height);

            //Debug.LogWarning("PacketField: " + PacketField);

            packetFieldDecrypt(PacketField);
        }
 private void packetFieldDecrypt(string input)
 {
     string packetField = GifHelper.HexToBinary(input);
     LocalColorTableFlag = packetField.Substring(0, 1) == "1";
     InterlaceFlag = packetField.Substring(1, 1) == "1";
     SortFlag = packetField.Substring(2, 1) =="1";
     ResevedForFutureUse = packetField.Substring(3, 2);
     LocalColorTableSize = GifHelper.HexToDecimal(packetField.Substring(5, 3));
 }
        private void PacketField(string packetField)
        {
            packetField = GifHelper.HexToBinary(packetField);
            //Debug.LogWarning("GCE PACKET FIELD BINARY: " + packetField);

            FutureUse      = GifHelper.HexToDecimal(packetField.Substring(0, 3));
            DisposalMethod = GifHelper.HexToDecimal(packetField.Substring(3, 3));

            UserInput       = packetField.Substring(6, 1) == "1";
            HasTransparency = packetField.Substring(7, 1) == "1";
        }
Exemple #5
0
        public void Set(string stream)
        {
            Debug.Log("APPLICATION EXTENSION: " + stream);
            string extension = stream.Substring(0, 2);
            string label     = stream.Substring(2, 2);

            if (label != ExtensionLabel)
            {
                Debug.LogError("NOT AN APPLICATION EXTENSION");
            }
            BlockSize             = GifHelper.HexToDecimal(stream.Substring(4, 2));
            ApplicationIdentifier = GifHelper.HexToASCII(stream.Substring(6, 16));
            AuthenticationCode    = GifHelper.HexToASCII(stream.Substring(22, 6));
        }
Exemple #6
0
    //The likely hood of this next coding working is minimal at best but I will do my best anyways
    private void LZW_Decompress(string hex)
    {
        List <int> data = new List <int>();

        //convert the strig data to a list of integers
        for (int i = 0; i < hex.Length; i += 2)
        {
            string temp = hex.Substring(i, 2);
            data.Add(GifHelper.HexToDecimal(temp));
        }

        //create our dictionary or code table
        //our dictionary is the doce table
        for (int i = 0; i < 256; i++)
        {
            codeTable.Add(i, ((char)i).ToString());
        }
    }
        public void Set(string stream)
        {
            Debug.Log("LOGICAL DESCRIPTOR: " + stream);
            string widthHex  = stream.Substring(2, 2) + stream.Substring(0, 2);
            string heightHex = stream.Substring(6, 2) + stream.Substring(4, 2);

            Width  = GifHelper.HexToDecimal(widthHex);
            Height = GifHelper.HexToDecimal(heightHex);

            string BgColor = stream.Substring(10, 2);

            BackgroundColorIndex = GifHelper.HexToDecimal(BgColor);

            string AspectRatio = stream.Substring(12, 2);

            PixelAspectRatio = GifHelper.HexToDecimal(AspectRatio);

            DecodePacketField(stream.Substring(8, 2));
        }
        public void Set(string stream)
        {
            Debug.Log("GRAPHICS CONTROL EXTENSION: " + stream);
            ErrorCheck(stream);

            string size = stream.Substring(4, 2);

            size      = GifHelper.HexToBinary(size);
            BlockSize = (int)Convert.ToInt64(size, 2);

            string packetField = stream.Substring(6, 2);

            PacketField(packetField);

            string delay = stream.Substring(8, 4);

            Delay = GifHelper.HexToDecimal(delay);

            string transparentIndex = stream.Substring(12, 2);

            TransparencyIndex = GifHelper.HexToDecimal(transparentIndex);
            //Debug.LogWarning("GCE TRANSPARENCY INDEX: " + TransparencyIndex);
        }
 public void Set(string data)
 {
     R = GifHelper.HexToDecimal(data.Substring(0, 2));
     G = GifHelper.HexToDecimal(data.Substring(2, 2));
     B = GifHelper.HexToDecimal(data.Substring(4, 2));
 }