当前位置: 首页>>代码示例>>C#>>正文


C# IFilter.Filter方法代码示例

本文整理汇总了C#中IFilter.Filter方法的典型用法代码示例。如果您正苦于以下问题:C# IFilter.Filter方法的具体用法?C# IFilter.Filter怎么用?C# IFilter.Filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFilter的用法示例。


在下文中一共展示了IFilter.Filter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: binarizationFilter_Click

        private void binarizationFilter_Click(object sender, EventArgs e)
        {
            iFilter = new OtsuBinarizationFilter();

            try
            {
                if (!(mainPicture.Image.GetType() == typeof(Bitmap))) // мб эта проверка и не нужна?  а ещё нужна проверка на то, есть ли фотка вообще
                {
                    throw new InvalidCastException("Ошибка преобразования типа файла к Bitmap-у");
                }
                // бинаризируем изображение по методу Отсу, используя изображение, переведённые в серые тона.
                mainPicture.Image = iFilter.Filter((Bitmap)mainPicture.Image);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ОШИБКА: " + ex + "\n\n");
            }
        }
开发者ID:Aleksey993,项目名称:Misoi,代码行数:18,代码来源:MainForm.cs

示例2: AddFilter

        /// <summary>
        /// Adds a filter to one of the read or write filter chains.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="where">The position in the chain.</param>
        public void AddFilter(IFilter filter, FilterChainOptions where)
        {
            Debug.Assert((where & FilterChainOptions.ReadWrite) != FilterChainOptions.ReadWrite);
            List<IFilter> list = null;

            // Which chain.
            if ((where & FilterChainOptions.Read) > 0)
            {
                if (readFilters == null) readFilters = new List<IFilter>();
                list = readFilters;
            }
            else
            {
                if (writeFilters == null) writeFilters = new List<IFilter>();
                list = writeFilters;
            }

            // Position in the chain.
            if ((where & FilterChainOptions.Tail) > 0)
            {
                list.Add(filter);
                if ((list == readFilters) && (ReadBufferLength > 0))
                {
                    // Process all the data in the read buffers.
                    var q = new Queue<TextElement>();
                    foreach (var o in readBuffers)
                    {
                        q.Enqueue(filter.Filter(_ctx, o, false));
                    }

                    readBuffers = q;
                }
            }
            else
            {
                list.Insert(0, filter);
            }
        }
开发者ID:iolevel,项目名称:peachpie,代码行数:43,代码来源:PhpStream.cs

示例3: AddFilter

		/// <summary>
		/// Adds a filter to one of the read or write filter chains.
		/// </summary>
		/// <param name="filter">The filter.</param>
		/// <param name="where">The position in the chain.</param>
		public void AddFilter(IFilter filter, FilterChainOptions where)
		{
			Debug.Assert((where & FilterChainOptions.ReadWrite) != FilterChainOptions.ReadWrite);
			ArrayList list = null;

			// Which chain.
			if ((where & FilterChainOptions.Read) > 0)
			{
				if (readFilters == null) readFilters = new ArrayList();
				list = readFilters;
			}
			else
			{
				if (writeFilters == null) writeFilters = new ArrayList();
				list = writeFilters;
			}

			// Position in the chain.
			if ((where & FilterChainOptions.Tail) > 0)
			{
				list.Add(filter);
				if ((list == readFilters) && (ReadBufferLength > 0))
				{
					// Process all the data in the read buffers.
					Queue q = new Queue();
					foreach (object o in readBuffers)
						q.Enqueue(filter.Filter(o, false));
					readBuffers = q;
				}
			}
			else
			{
				list.Insert(0, filter);
			}
		}
开发者ID:kripper,项目名称:Phalanger,代码行数:40,代码来源:PhpStream.cs

示例4: FilteringCatalog

 /// <summary>
 /// Initializes a new instance of the <see cref="FilteringCatalog"/> class.
 /// </summary>
 /// <param name="inner">A <see cref="ComposablePartCatalog"/> whose parts
 /// are to be filtered based on a given criteria.</param>
 /// <param name="filter">An instance of the <see cref="IFilter"/> interface
 /// to be used as a filter query.</param>
 public FilteringCatalog(ComposablePartCatalog inner, IFilter filter)
     : this(inner, p => filter.Filter(p))
 {
 }
开发者ID:damonrpayne,项目名称:MefContrib,代码行数:11,代码来源:FilteringCatalog.cs

示例5: CreateLUT

        /// <summary>
        /// 
        /// </summary>
        /// <param name="filename"></param>
        /// @todo clean this up (coded at 3 AM after hours of coding) [maybe access the lut class directly in gui]
        public void CreateLUT(string filename, IFilter filter=null)
        {
            LookupTable table = new LookupTable(System.IO.Path.GetFileName(filename),Dimension, 255);

            for (int b = 0; b < Dimension; b++)
                for (int g = 0; g < Dimension; g++)
                    for (int r = 0; r < Dimension; r++)
                    {
                        Color color = GetSample(r, g, b);
                        if (filter != null)
                            color = filter.Filter(color);
                        table.AddSample(r, g, b, color.R, color.G, color.B);    ///@todo array indexing operator
                    }

            table.Save(filename);
        }
开发者ID:davidpet,项目名称:photography,代码行数:21,代码来源:ReferenceImage.cs

示例6: unsharpFilterButton_Click

 private void unsharpFilterButton_Click(object sender, EventArgs e)
 {
     iFilter = new UnsharpFilter();
     Bitmap mainBitmap = (Bitmap)mainPicture.Image;
     Graphics g = mainPicture.CreateGraphics();
     g.Clear(SystemColors.ControlDarkDark);
     mainPicture.Image = iFilter.Filter(mainBitmap);
 }
开发者ID:Aleksey993,项目名称:Misoi,代码行数:8,代码来源:MainForm.cs


注:本文中的IFilter.Filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。