示例#1
0
        static void BT(IntPtr reserved, IntPtr info)
        {
            // sadly the parameters are always identical and we can't know the operator name
            // IOW we can NOT dispatch (internally) to a nice C# looking method

            // We do NOT want people to use the "obvious" new CGPDFScanner(reserved) because that will
            // call retain (and this gets called a lot of time)
            // So _a_ solution is to provide an helper method to give them what they want
            var scanner = CGPDFOperatorTable.GetScannerFromInfo(info);

            (scanner.UserInfo as PDFScannerTest).bt_count++;
        }
示例#2
0
        static void Do(IntPtr reserved, IntPtr info)
        {
            // sadly the parameters are always identical and we can't know the operator name
            // IOW we can NOT dispatch (internally) to a nice C# looking method

            // We do NOT want people to use the "obvious" new CGPDFScanner(reserved) because that will
            // call retain (and this gets called a lot of time)
            // So _a_ solution is to provide an helper method to give them what they want
            var    scanner = CGPDFOperatorTable.GetScannerFromInfo(info);
            string name;

            if (!scanner.TryPopName(out name))
            {
                return;
            }

            var test = (scanner.UserInfo as PDFScannerTest);

            test.do_checks--;

            var cs = scanner.GetContentStream();

            if (cs == null)
            {
                return;
            }
            test.do_checks--;

            var ro = cs.GetResource("XObject", name);

            if (ro.Type != CGPDFObjectType.Stream)
            {
                return;
            }
            test.do_checks--;

            CGPDFStream s;

            if (!ro.TryGetValue(out s))
            {
                return;
            }
            test.do_checks--;

            var dict = s.Dictionary;

            if (dict == null)
            {
                return;
            }
            test.do_checks--;

            string dictname;

            if (!dict.GetName("Subtype", out dictname))
            {
                return;
            }
            test.do_checks--;

            if (dictname != "Image")
            {
                return;
            }
            test.do_checks--;
        }