public WndSample()
      {
        InitializeComponent();
        CreateInitialImage();
        PopulatePresets();

        cbDec.SelectedIndex = 0;
        cbArg.SelectedIndex = 1;
        m_data = new byte[pbImage.Width * pbImage.Height * 3];
        rbNormal.Checked = true;

        try
        {
          m_parser = new Parser(Parser.EBaseType.tpDOUBLE);
          lbVersion.Text = String.Format("muParser V{0}", m_parser.GetVersion());
          m_parser.DefineFun("fun1", new Parser.Fun1Delegate(fun1), true);
          m_parser.DefineFun("fun3", new Parser.Fun3Delegate(fun3), true);
          m_parser.DefineFun("fun4", new Parser.Fun4Delegate(fun4), true);
          m_parser.DefineFun("fun5", new Parser.Fun5Delegate(fun5), true);
          m_parser.DefineFun("fun6", new Parser.Fun6Delegate(fun6), true);
          m_parser.DefineFun("fun7", new Parser.Fun7Delegate(fun7), true);
          m_parser.DefineFun("fun8", new Parser.Fun8Delegate(fun8), true);
          m_parser.DefineFun("fun9", new Parser.Fun9Delegate(fun9), true);
          m_parser.DefineFun("fun10", new Parser.Fun10Delegate(fun10), true);

          m_parser.DefineFun("prod", new Parser.MultFunDelegate(prod), true);
          m_parser.DefineOprt("%", new Parser.Fun2Delegate(mod), 2);
          m_parser.DefineOprt("and", new Parser.Fun2Delegate(mod), 2);

          //m_parser.DefinePostfixOprt("m", new muParser.Parser.Fun1Delegate(milli));
          m_parser.DefineInfixOprt("!", new muParser.Parser.Fun1Delegate(not), muParser.Parser.EPrec.prLOGIC);

          m_parser.DefineVar("ans", m_ans);
          m_parser.DefineVar("my_var1", m_val1);
          m_parser.DefineVar("my_var2", m_val2);

          // Initialize parsers used for the image calculation
          for (int i = 0; i < 3; ++i)
          {
            m_parserImg[i] = new Parser(Parser.EBaseType.tpDOUBLE);
            m_parserImg[i].DefineOprt("%", new Parser.Fun2Delegate(mod), 2);
          }

          PreCalculateBulkVariables();
        }
        catch (ParserException exc)
        {
          DumpException(exc);
        }

        m_history = new List<String>();
      }
示例#2
0
      public WndSample()
      {
        InitializeComponent();
        CreateInitialImage();
        PopulatePresets();

        cbDec.SelectedIndex = 0;
        cbArg.SelectedIndex = 1;
        m_data = new byte[pbImage.Width * pbImage.Height * 3];
        
        try
        {
          m_parser = new Parser();
          lbVersion.Text = String.Format("muParserSSE V{0}", m_parser.GetVersion());
          m_parser.DefineFun("fun1", new Parser.Fun1Delegate(fun1), true);
          m_parser.DefineFun("fun3", new Parser.Fun3Delegate(fun3), true);
          m_parser.DefineFun("fun4", new Parser.Fun4Delegate(fun4), true);
          m_parser.DefineFun("fun5", new Parser.Fun5Delegate(fun5), true);

          //m_parser.DefinePostfixOprt("m", new muParser.Parser.Fun1Delegate(milli));
          m_parser.DefineInfixOprt("!", new muParser.Parser.Fun1Delegate(not), muParser.Parser.EPrec.prLOGIC);

          m_parser.DefineVar("ans", m_ans);
          m_parser.DefineVar("my_var1", m_val1);
          m_parser.DefineVar("my_var2", m_val2);

          // Initialize parsers used for the image calculation
          for (int i = 0; i < 3; ++i)
          {
            m_parserImg[i] = new Parser();
          }
        }
        catch (ParserException exc)
        {
          DumpException(exc);
        }
      
        m_history = new List<String>();
      }
示例#3
0
        public WndSample()
        {
            InitializeComponent();
            CreateInitialImage();
            PopulatePresets();

            cbDec.SelectedIndex = 0;
            cbArg.SelectedIndex = 1;
            m_data = new byte[pbImage.Width * pbImage.Height * 3];

            try
            {
              m_parser = new Parser();
              lbVersion.Text = String.Format("muParserSSE V{0}", m_parser.GetVersion());
              m_parser.DefineFun("fun1", new Parser.Fun1Delegate(fun1), true);
              m_parser.DefineFun("fun3", new Parser.Fun3Delegate(fun3), true);
              m_parser.DefineFun("fun4", new Parser.Fun4Delegate(fun4), true);
              m_parser.DefineFun("fun5", new Parser.Fun5Delegate(fun5), true);

              //m_parser.DefinePostfixOprt("m", new muParser.Parser.Fun1Delegate(milli));
              m_parser.DefineInfixOprt("!", new muParser.Parser.Fun1Delegate(not), muParser.Parser.EPrec.prLOGIC);

              m_parser.DefineVar("ans", m_ans);
              m_parser.DefineVar("my_var1", m_val1);
              m_parser.DefineVar("my_var2", m_val2);

              // Initialize parsers used for the image calculation
              for (int i = 0; i < 3; ++i)
              {
            m_parserImg[i] = new Parser();
              }
            }
            catch (ParserException exc)
            {
              DumpException(exc);
            }

            m_history = new List<String>();
        }