示例#1
0
文件: Tools.cs 项目: Yanrishatum/UGif
        public static global::haxe.ds.List <object> build32BGRA(int width, int height, global::haxe.io.Bytes data, global::haxe.lang.Null <int> level)
        {
            unchecked {
                global::haxe.lang.Null <int> level1 = ((!(level.hasValue)) ? (new global::haxe.lang.Null <int>(9, true)) : (level));
                global::haxe.io.Bytes        rgba   = global::haxe.io.Bytes.alloc((((width * height) * 4) + height));
                int w = 0;
                int r = 0;
                {
                    int _g1 = 0;
                    int _g  = height;
                    while ((_g1 < _g))
                    {
                        int y = _g1++;
                        rgba.b[w++] = ((byte)(0));
                        {
                            int _g3 = 0;
                            int _g2 = width;
                            while ((_g3 < _g2))
                            {
                                int x = _g3++;
                                rgba.b[w++] = ((byte)(((int)(data.b[(r + 2)]))));
                                rgba.b[w++] = ((byte)(((int)(data.b[(r + 1)]))));
                                rgba.b[w++] = ((byte)(((int)(data.b[r]))));
                                rgba.b[w++] = ((byte)(((int)(data.b[(r + 3)]))));
                                r          += 4;
                            }
                        }
                    }
                }

                global::haxe.ds.List <object> l = new global::haxe.ds.List <object>();
                object __temp_stmt2             = null;
                {
                    global::format.png.Color __temp_odecl1 = global::format.png.Color.ColTrue(true);
                    __temp_stmt2 = new global::haxe.lang.DynamicObject(new int[] { 1247572323, 1501088657 }, new object[] { __temp_odecl1, false }, new int[] { 38537191, 1247983110, 1724357446 }, new double[] { ((double)(height)), ((double)(width)), ((double)(8)) });
                }

                l.@add(global::format.png.Chunk.CHeader(__temp_stmt2));
                l.@add(global::format.png.Chunk.CData(global::format.tools.Deflate.run(rgba, level1)));
                l.@add(global::format.png.Chunk.CEnd);
                return(l);
            }
        }
示例#2
0
        public virtual global::haxe.ds.List map(global::haxe.lang.Function f)
        {
                        #line 234 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
            global::haxe.ds.List           b = new global::haxe.ds.List();
            global::haxe.ds._List.ListNode l = this.h;
                        #line 236 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
            while ((l != null))
            {
                                #line 237 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
                object v = l.item;
                l = l.next;
                                #line 239 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
                b.@add(((object)(f.__hx_invoke1_o(default(double), v))));
            }

                        #line 241 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
            return(b);
        }
示例#3
0
    public static global::haxe.ds.List <A> list <A>(object it)
    {
                #line 58 "/opt/haxe/std/Lambda.hx"
        global::haxe.ds.List <A> l = new global::haxe.ds.List <A>();
        {
                        #line 59 "/opt/haxe/std/Lambda.hx"
            object i = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null)));
                        #line 59 "/opt/haxe/std/Lambda.hx"
            while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(i, "hasNext", 407283053, null)))
            {
                                #line 59 "/opt/haxe/std/Lambda.hx"
                A i1 = global::haxe.lang.Runtime.genericCast <A>(global::haxe.lang.Runtime.callField(i, "next", 1224901875, null));
                l.@add(i1);
            }
        }

                #line 61 "/opt/haxe/std/Lambda.hx"
        return(l);
    }
示例#4
0
        public static global::haxe.ds.List list(object it)
        {
                        #line 58 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx"
            global::haxe.ds.List l = new global::haxe.ds.List();
            {
                                #line 59 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx"
                object i = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null)));
                                #line 59 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx"
                while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(i, "hasNext", 407283053, null)))
                {
                                        #line 59 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx"
                    object i1 = ((object)(global::haxe.lang.Runtime.callField(i, "next", 1224901875, null)));
                    l.@add(i1);
                }
            }

                        #line 61 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx"
            return(l);
        }
示例#5
0
        public virtual global::haxe.ds.List filter(global::haxe.lang.Function f)
        {
                        #line 218 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
            global::haxe.ds.List           l2 = new global::haxe.ds.List();
            global::haxe.ds._List.ListNode l  = this.h;
                        #line 220 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
            while ((l != null))
            {
                                #line 221 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
                object v = l.item;
                l = l.next;
                                #line 223 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
                if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), v)))
                {
                                        #line 224 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
                    l2.@add(v);
                }
            }

                        #line 226 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx"
            return(l2);
        }
示例#6
0
        public virtual object read()
        {
            unchecked {
                {
                    int _g = 0;
                    global::haxe.root.Array <int> _g1 = new global::haxe.root.Array <int>(new int[] { 71, 73, 70 });
                    while ((_g < _g1.length))
                    {
                        int b = _g1[_g];
                        ++_g;
                        if ((this.i.readByte() != b))
                        {
                            throw global::haxe.lang.HaxeException.wrap("Invalid header");
                        }
                    }
                }

                string gifVer = this.i.readString(3);
                global::format.gif.Version version = global::format.gif.Version.GIF89a;
                switch (gifVer)
                {
                case "87a":
                {
                    version = global::format.gif.Version.GIF87a;
                    break;
                }


                case "89a":
                {
                    version = global::format.gif.Version.GIF89a;
                    break;
                }


                default:
                {
                    version = global::format.gif.Version.Unknown(gifVer);
                    break;
                }
                }

                int    width            = this.i.readUInt16();
                int    height           = this.i.readUInt16();
                int    packedField      = this.i.readByte();
                int    bgIndex          = this.i.readByte();
                double pixelAspectRatio = ((double)(this.i.readByte()));
                if ((pixelAspectRatio != 0))
                {
                    pixelAspectRatio = (((pixelAspectRatio + 15)) / 64);
                }
                else
                {
                    pixelAspectRatio = ((double)(1));
                }

                object lsd = new global::haxe.lang.DynamicObject(new int[] { 808948541, 2070785640 }, new object[] { (((packedField & 8)) == 8), (((packedField & 128)) == 128) }, new int[] { 38537191, 234855119, 623891245, 736935997, 1018258543, 1247983110 }, new double[] { ((double)(height)), ((double)((2 << ((packedField & 7))))), pixelAspectRatio, ((double)(bgIndex)), ((double)(((int)((((uint)(((packedField & 112)))) >> 4))))), ((double)(width)) });
                global::haxe.io.Bytes gct = null;
                if (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.getField(lsd, "hasGlobalColorTable", 2070785640, true)))
                {
                    gct = this.readColorTable(((int)(global::haxe.lang.Runtime.getField_f(lsd, "globalColorTableSize", 234855119, true))));
                }

                global::haxe.ds.List <object> blocks = new global::haxe.ds.List <object>();
                while (true)
                {
                    global::format.gif.Block b1 = this.readBlock();
                    blocks.@add(b1);
                    if ((b1 == global::format.gif.Block.BEOF))
                    {
                        break;
                    }
                }

                return(new global::haxe.lang.DynamicObject(new int[] { 146652910, 669658758, 2032764644, 2096228120 }, new object[] { gct, blocks, lsd, version }, new int[] {}, new double[] {}));
            }
        }