示例#1
0
        public static BytePtr PDJPG_DecodeScanForComponentLayer(BytePtr buf, int sz, string name)
        {
            BytePtr cs, cs2, cse;
            int i;

            Console.WriteLine("PDJPG_DecodeScanForComponentLayer: Sz={0} Name={1}", sz, name);

            cs = buf; cse = buf + sz;
            while (cs < cse)
            {
            //                if (cs[0] == 0xFF)
            //                    Console.WriteLine("FF,{0}", cs[1]);

                if ((cs[0] == 0xFF) && (cs[1] == JPG.JPG_APP11))
                {
                    i = (cs[2] << 8) | cs[3];
                    cs2 = cs + i + 2;

                    cs += 4;

                    Console.Write("APP11 {0}\n", cs.getString());

                    if (!cs.strcmp("TagLayer"))
                    {
                        //This does not cross tag-layer boundaries
                        break;
                    }

                    if (!cs.strcmp("CompLayer"))
                    {
                        cs += cs.strlen() + 1;

                        Console.Write("APP11 CompLayer={0}\n", cs.getString());

                        if (!cs.strcmp(name))
                        {
                            Console.Write("Found {0}\n", name);
                            cs += cs.strlen() + 1;
                            return (cs2);
                        }

                        cs += cs.strlen() + 1;
                        continue;
                    }
                    cs += i - 2;
                    continue;
                }
                if ((cs[0] == 0xFF) && (cs[1] >= JPG.JPG_APP0) && (cs[1] <= JPG.JPG_APP15))
                {
                    i = (cs[2] << 8) | cs[3];
                    cs += i + 2;
                    continue;
                }

                cs=cs+1;
            }

            Console.Write("Not Found {0}\n", name);
            return new BytePtr(null);
        }
示例#2
0
        public static BytePtr PDJPG_DecodeScanNextTagLayer(BytePtr buf, int sz, out string name)
        {
            BytePtr cs, cs2, cse;
            int i;

            //            Console.WriteLine("PDJPG_DecodeScanNextTagLayer: Sz={0} Name={1}", sz, name);

            cs = buf; cse = buf + sz;
            while (cs < cse)
            {
                //                if (cs[0] == 0xFF)
                //                    Console.WriteLine("FF,{0}", cs[1]);

                if ((cs[0] == 0xFF) && (cs[1] == JPG.JPG_APP11))
                {
                    i = (cs[2] << 8) | cs[3];
                    cs2 = cs + i + 2;

                    cs += 4;

                    Console.Write("APP11 {0}\n", cs.getString());

                    if (!cs.strcmp("TagLayer"))
                    {
                        cs += cs.strlen() + 1;

                        name = cs.getString();
                        Console.Write("APP11 TagLayer={0}\n", name);

                        cs += cs.strlen() + 1;
                        return (cs2);
                    }
                    cs += i - 2;
                    continue;
                }
                if ((cs[0] == 0xFF) && (cs[1] >= JPG.JPG_APP0) && (cs[1] <= JPG.JPG_APP15))
                {
                    i = (cs[2] << 8) | cs[3];
                    cs += i + 2;
                    continue;
                }

                cs = cs + 1;
            }

            //            Console.Write("Not Found {0}\n", name);
            name = null;
            return new BytePtr(null);
        }
示例#3
0
        public static int PDJPG_MarkerAPP11(PDJPG_Context ctx, BytePtr buf)
        {
            //	int cr, cg, cb, ca;

            buf += 2;

            if (!buf.strcmp("AlphaColor"))
            {
                buf += buf.strlen() + 1;
                //		sscanf_s(buf, "%d %d %d %d", out cr, cg, &cb, &ca);
                //		PDJPG_SetContextAlphaColor(ctx, cr, cg, cb, ca);
                return (1);
            }

            return (0);
        }