コード例 #1
0
        public void Apply(int[][] indexesOfAOIs, Bitmap bitmap)
        {
            if (bitmap == null)
            {
                return;
            }
            BitmapData pdata = null;

            try
            {
                pdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.WriteOnly, bitmap.PixelFormat);
                //foreach (IRgbProcessor p in _processStack)
                //    p.Process(indexesOfAOIs, pdata);
                int             count = Count;
                IRgbProcessor[] ps    = _processStack.ToArray();
                for (int i = count - 1; i >= 0; i--)//由于是按照先进后出的Stat形式保存的,故应反序以此处理
                {
                    IRgbProcessor p = ps[i];
                    p.Process(indexesOfAOIs, pdata);
                }
            }
            finally
            {
                if (pdata != null)
                {
                    bitmap.UnlockBits(pdata);
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: configare/hispeed
 void btn_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         IRgbProcessor p = (sender as Button).Tag as IRgbProcessor;
         foreach (IRgbProcessorArgEditor editor in _importedArgEditors)
         {
             if (editor.IsSupport(p.GetType()))
             {
                 if (p.Arguments == null)
                 {
                     p.CreateDefaultArguments();
                 }
                 editor.OnPreviewing   += new OnArgEditorPreviewing(RerenderBitmap);
                 editor.OnApplyClicked += new OnArgEditorApplyClick(RerenderBitmap);
                 RgbProcessorArg oldArg = p.Arguments.Clone();
                 (editor as Form).Text = p.Name + "参数设置...";
                 editor.Init(this as IRgbArgEditorEnvironmentSupport, p);
                 editor.Show(p.Arguments);
                 //if (editor.ShowDialog(p.Arguments) == System.Windows.Forms.DialogResult.OK)
                 //{
                 //    Invalidate();
                 //}
                 //else
                 //{
                 //    p.Arguments = oldArg;
                 //    Invalidate();
                 //}
             }
         }
     }
 }
コード例 #3
0
 private void DisplayArgEditor(IRgbProcessor processor, IRasterDrawing drawing, ICanvasViewer viewer)
 {
     if (_registeredEditors == null)
     {
         _registeredEditors = GetRegisteredEditors();
     }
     if (_registeredEditors == null)
     {
         return;
     }
     foreach (IRgbProcessorArgEditor editor in _registeredEditors)
     {
         if (editor.IsSupport(processor.GetType()))
         {
             IRgbProcessorArgEditor argeditor = Activator.CreateInstance(editor.GetType()) as IRgbProcessorArgEditor;
             if (processor.Arguments == null)
             {
                 processor.CreateDefaultArguments();
             }
             if (drawing.SelectedBandNos.Length == 1 || drawing.BandCount == 1)
             {
                 processor.BytesPerPixel = 1;
                 if (argeditor is frmReversalColorEditor)
                 {
                     return;
                 }
             }
             else
             {
                 processor.BytesPerPixel = 3;
             }
             argeditor.OnPreviewing += new OnArgEditorPreviewing((senser, arg) =>
             {
                 viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
             }
                                                                 );
             argeditor.OnApplyClicked += new OnArgEditorApplyClick((senser, arg) =>
             {
                 viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
             }
                                                                   );
             argeditor.OnCancelClicked += new OnArgEditorCancelClick((senser, arg) =>
             {
                 drawing.RgbProcessorStack.RemoveLast();
                 viewer.Canvas.Refresh(Core.DrawEngine.enumRefreshType.RasterLayer);
             });
             if (argeditor is Form)
             {
                 (argeditor as Form).Owner         = _smartSession.SmartWindowManager.MainForm as Form;
                 (argeditor as Form).StartPosition = FormStartPosition.Manual;
                 (argeditor as Form).Location      = _smartSession.SmartWindowManager.ViewLeftUpperCorner;
                 (argeditor as Form).Text          = processor.Name + "参数设置...";
             }
             argeditor.Init(viewer.RgbProcessorArgEditorEnvironment as IRgbArgEditorEnvironmentSupport, processor);
             argeditor.Show(processor.Arguments);
             return;
         }
     }
 }
コード例 #4
0
        public void UnProcess()
        {
            if (_processStack.Count == 0)
            {
                return;
            }
            IRgbProcessor p = _processStack.Pop();

            if (p != null)
            {
                _unProcessStack.Push(p);
                CheckStackIsEmpty();
            }
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: configare/hispeed
        private void CreateButton(IRgbProcessor p, int x, ref int y)
        {
            Button btn = new Button();

            btn.Text       = p.Name;
            btn.Left       = x;
            btn.Top        = y;
            btn.Width      = btnOpenImage.Width;
            btn.Anchor     = AnchorStyles.Right | AnchorStyles.Top;
            btn.Tag        = p;
            btn.Click     += new EventHandler(btn_Click);
            btn.MouseDown += new MouseEventHandler(btn_MouseDown);
            this.Controls.Add(btn);
        }
コード例 #6
0
ファイル: LdfToTiffWriter.cs プロジェクト: windygu/hispeed
        private void RgbProcess(ref byte r, ref byte g, ref byte b)
        {
            if (_grbProcessors == null || _grbProcessors.Length == 0)
            {
                return;
            }
            int           count = _grbProcessors.Length;
            IRgbProcessor p     = null;

            for (int i = count - 1; i >= 0; i--)//由于是按照先进后出的Stat形式保存的,故应反序以此处理
            {
                p = _grbProcessors[i];
                if (p is RgbProcessorByPixel)
                {
                    (p as RgbProcessorByPixel).ProcessRGB(ref b, ref g, ref r);
                }
            }
        }
コード例 #7
0
ファイル: MosaicProcess.cs プロジェクト: windygu/hispeed
        public void RgbProcess(IRgbProcessor[] ps, ref byte r, ref byte g, ref byte b)
        {
            if (ps == null || ps.Length == 0)
            {
                return;
            }
            int           count = ps.Length;
            IRgbProcessor p     = null;

            for (int i = count - 1; i >= 0; i--)//由于是按照先进后出的Stat形式保存的,故应反序以此处理
            {
                p = ps[i];
                if (p is RgbProcessorByPixel)
                {
                    (p as RgbProcessorByPixel).ProcessRGB(ref b, ref g, ref r);
                }
            }
        }
コード例 #8
0
        public override void Execute()
        {
            ICanvasViewer viewer = _smartSession.SmartWindowManager.ActiveCanvasViewer as ICanvasViewer;

            if (viewer == null)
            {
                return;
            }
            IRasterDrawing drawing = viewer.ActiveObject as IRasterDrawing;

            if (drawing == null)
            {
                return;
            }
            IRgbProcessor pro = GetRgbProcessor();

            drawing.RgbProcessorStack.Process(pro);
            DisplayArgEditor(pro, drawing, viewer);
        }
コード例 #9
0
        public void ReadXmlElement(string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            string sidentity;

            xmldoc.Load(filename);
            XmlNode    xmlElem = xmldoc.ChildNodes[0].ChildNodes[0];
            XmlElement subElem;

            Assembly assem = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "GeoDo.RSS.CA.dll");

            for (int i = (xmlElem.ChildNodes.Count - 1); i >= 0; i--)
            {
                subElem = (XmlElement)xmlElem.ChildNodes[i].ChildNodes[0];
                if (subElem.ChildNodes.Count == 0)
                {
                    return;
                }
                sidentity = xmlElem.ChildNodes[i].Attributes[1].Value.ToString();
                MethodInfo method = null;
                {
                    Type type = assem.GetType(sidentity);
                    if (type != null)
                    {
                        method = type.GetMethod("FromXML");
                        BindingFlags  flag       = BindingFlags.Public | BindingFlags.Static;
                        object[]      parameters = new object[] { subElem };
                        IRgbProcessor process    = (IRgbProcessor)method.Invoke(null, flag, Type.DefaultBinder, parameters, null);
                        _processStack.Push(process);
                    }
                }
            }
        }
コード例 #10
0
ファイル: frmRgbArgsEditor.cs プロジェクト: configare/hispeed
 public void Init(IRgbArgEditorEnvironmentSupport env, IRgbProcessor processor)
 {
     _env       = env;
     _processor = processor;
 }
コード例 #11
0
 public void Process(IRgbProcessor processor)
 {
     _processStack.Push(processor);
     _unProcessStack.Clear();
     CheckStackIsEmpty();
 }