示例#1
0
        public virtual global::format.gif.Block readApplicationExtension()
        {
            unchecked {
                if ((this.i.readByte() != 11))
                {
                    throw global::haxe.lang.HaxeException.wrap("Incorrect size of Application Extension introducer block.");
                }

                string name    = this.i.readString(8);
                string version = this.i.readString(3);
                global::haxe.io.BytesOutput buffer = new global::haxe.io.BytesOutput();
                global::haxe.io.Bytes       bytes  = global::haxe.io.Bytes.alloc(255);
                int len = this.i.readByte();
                while ((len != 0))
                {
                    this.i.readBytes(bytes, 0, len);
                    buffer.writeBytes(bytes, 0, len);
                    len = this.i.readByte();
                }

                buffer.flush();
                bytes = buffer.getBytes();
                buffer.close();
                global::haxe.io.Bytes data = bytes;
                if ((((name == "NETSCAPE") && (version == "2.0")) && (((int)(data.b[0])) == 1)))
                {
                    return(global::format.gif.Block.BExtension(global::format.gif.Extension.EApplicationExtension(global::format.gif.ApplicationExtension.AENetscapeLooping((((int)(data.b[1])) | (((int)(data.b[2])) << 8))))));
                }

                return(global::format.gif.Block.BExtension(global::format.gif.Extension.EApplicationExtension(global::format.gif.ApplicationExtension.AEUnknown(name, version, data))));
            }
        }
示例#2
0
        public global::haxe.io.Bytes readBlocks()
        {
            unchecked {
                global::haxe.io.BytesOutput buffer = new global::haxe.io.BytesOutput();
                global::haxe.io.Bytes       bytes  = global::haxe.io.Bytes.alloc(255);
                int len = this.i.readByte();
                while ((len != 0))
                {
                    this.i.readBytes(bytes, 0, len);
                    buffer.writeBytes(bytes, 0, len);
                    len = this.i.readByte();
                }

                buffer.flush();
                bytes = buffer.getBytes();
                buffer.close();
                return(bytes);
            }
        }
示例#3
0
        public virtual global::format.gif.Block readExtension()
        {
            unchecked {
                int subId = this.i.readByte();
                switch (subId)
                {
                case 1:
                {
                    if ((this.i.readByte() != 12))
                    {
                        throw global::haxe.lang.HaxeException.wrap("Incorrect size of Plain Text Extension introducer block.");
                    }

                    int tmp  = this.i.readUInt16();
                    int tmp1 = this.i.readUInt16();
                    int tmp2 = this.i.readUInt16();
                    int tmp3 = this.i.readUInt16();
                    int tmp4 = this.i.readByte();
                    int tmp5 = this.i.readByte();
                    int tmp6 = this.i.readByte();
                    int tmp7 = this.i.readByte();
                    global::haxe.io.BytesOutput buffer = new global::haxe.io.BytesOutput();
                    global::haxe.io.Bytes       bytes  = global::haxe.io.Bytes.alloc(255);
                    int len = this.i.readByte();
                    while ((len != 0))
                    {
                        this.i.readBytes(bytes, 0, len);
                        buffer.writeBytes(bytes, 0, len);
                        len = this.i.readByte();
                    }

                    buffer.flush();
                    bytes = buffer.getBytes();
                    buffer.close();
                    object __temp_stmt5 = null;
                    {
                        string __temp_odecl1 = bytes.toString();
                        __temp_stmt5 = new global::haxe.lang.DynamicObject(new int[] { 1291439277 }, new object[] { __temp_odecl1 }, new int[] { 31706958, 89406858, 555415130, 853386981, 853386982, 1539378591, 1740766879, 1991808755 }, new double[] { ((double)(tmp4)), ((double)(tmp7)), ((double)(tmp3)), ((double)(tmp)), ((double)(tmp1)), ((double)(tmp5)), ((double)(tmp6)), ((double)(tmp2)) });
                    }

                    global::format.gif.Extension __temp_stmt4 = global::format.gif.Extension.EText(__temp_stmt5);
                    return(global::format.gif.Block.BExtension(__temp_stmt4));
                }


                case 249:
                {
                    if ((this.i.readByte() != 4))
                    {
                        throw global::haxe.lang.HaxeException.wrap("Incorrect Graphic Control Extension block size!");
                    }

                    int packed = this.i.readByte();
                    global::format.gif.DisposalMethod disposalMethod = null;
                    int _g = (((packed & 28)) >> 2);
                    switch (_g)
                    {
                    case 0:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.UNSPECIFIED;
                        break;
                    }


                    case 1:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.NO_ACTION;
                        break;
                    }


                    case 2:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.FILL_BACKGROUND;
                        break;
                    }


                    case 3:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.RENDER_PREVIOUS;
                        break;
                    }


                    default:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.UNDEFINED((((packed & 28)) >> 2));
                        break;
                    }
                    }

                    object __temp_stmt7 = null;
                    {
                        int __temp_odecl2 = this.i.readUInt16();
                        int __temp_odecl3 = this.i.readByte();
                        __temp_stmt7 = new global::haxe.lang.DynamicObject(new int[] { 701242674, 755457067, 1743811007 }, new object[] { disposalMethod, (((packed & 1)) == 1), (((packed & 2)) == 2) }, new int[] { 772773472, 1462163331 }, new double[] { ((double)(__temp_odecl3)), ((double)(__temp_odecl2)) });
                    }

                    global::format.gif.Extension __temp_stmt6 = global::format.gif.Extension.EGraphicControl(__temp_stmt7);
                    global::format.gif.Block     b            = global::format.gif.Block.BExtension(__temp_stmt6);
                    this.i.readByte();
                    return(b);
                }


                case 254:
                {
                    global::haxe.io.BytesOutput buffer1 = new global::haxe.io.BytesOutput();
                    global::haxe.io.Bytes       bytes1  = global::haxe.io.Bytes.alloc(255);
                    int len1 = this.i.readByte();
                    while ((len1 != 0))
                    {
                        this.i.readBytes(bytes1, 0, len1);
                        buffer1.writeBytes(bytes1, 0, len1);
                        len1 = this.i.readByte();
                    }

                    buffer1.flush();
                    bytes1 = buffer1.getBytes();
                    buffer1.close();
                    return(global::format.gif.Block.BExtension(global::format.gif.Extension.EComment(bytes1.toString())));
                }


                case 255:
                {
                    return(this.readApplicationExtension());
                }


                default:
                {
                    global::haxe.io.BytesOutput buffer2 = new global::haxe.io.BytesOutput();
                    global::haxe.io.Bytes       bytes2  = global::haxe.io.Bytes.alloc(255);
                    int len2 = this.i.readByte();
                    while ((len2 != 0))
                    {
                        this.i.readBytes(bytes2, 0, len2);
                        buffer2.writeBytes(bytes2, 0, len2);
                        len2 = this.i.readByte();
                    }

                    buffer2.flush();
                    bytes2 = buffer2.getBytes();
                    buffer2.close();
                    return(global::format.gif.Block.BExtension(global::format.gif.Extension.EUnknown(subId, bytes2)));
                }
                }
            }
        }