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


C# IImageByte.copy_color_hspan方法代码示例

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


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

示例1: blur_x

		public void blur_x(IImageByte img, double radius)
		{
			if (radius < 0.62) return;
			if (img.Width < 3) return;

			double s = (double)(radius * 0.5);
			double q = (double)((s < 2.5) ?
									3.97156 - 4.14554 * Math.Sqrt(1 - 0.26891 * s) :
									0.98711 * s - 0.96330);

			double q2 = (double)(q * q);
			double q3 = (double)(q2 * q);

			double b0 = (double)(1.0 / (1.578250 +
											2.444130 * q +
											1.428100 * q2 +
											0.422205 * q3));

			double b1 = (double)(2.44413 * q +
									  2.85619 * q2 +
									  1.26661 * q3);

			double b2 = (double)(-1.42810 * q2 +
									 -1.26661 * q3);

			double b3 = (double)(0.422205 * q3);

			double b = (double)(1 - (b1 + b2 + b3) * b0);

			b1 *= b0;
			b2 *= b0;
			b3 *= b0;

			int w = img.Width;
			int h = img.Height;
			int wm = (int)w - 1;
			int x, y;

			int StartCreatingAt = (int)m_sum1.Count;
			for (int i = StartCreatingAt; i < w; i++)
			{
				m_sum1.Add(null);
				m_sum2.Add(null);
			}
			m_buf.Allocate(w);

			List<RecursizeBlurCalculator> Sum1Array = m_sum1;
			List<RecursizeBlurCalculator> Sum2Array = m_sum2;
			RGBA_Bytes[] BufferArray = m_buf.Array;

			for (int i = StartCreatingAt; i < w; i++)
			{
				Sum1Array[i] = m_RecursizeBlurCalculatorFactory.CreateNew();
				Sum2Array[i] = m_RecursizeBlurCalculatorFactory.CreateNew();
			}

			for (y = 0; y < h; y++)
			{
				RecursizeBlurCalculator c = m_RecursizeBlurCalculatorFactory;
				c.from_pix(img.GetPixel(0, y));
				Sum1Array[0].calc(b, b1, b2, b3, c, c, c, c);
				c.from_pix(img.GetPixel(1, y));
				Sum1Array[1].calc(b, b1, b2, b3, c, Sum1Array[0], Sum1Array[0], Sum1Array[0]);
				c.from_pix(img.GetPixel(2, y));
				Sum1Array[2].calc(b, b1, b2, b3, c, Sum1Array[1], Sum1Array[0], Sum1Array[0]);

				for (x = 3; x < w; ++x)
				{
					c.from_pix(img.GetPixel(x, y));
					Sum1Array[x].calc(b, b1, b2, b3, c, Sum1Array[x - 1], Sum1Array[x - 2], Sum1Array[x - 3]);
				}

				Sum2Array[wm].calc(b, b1, b2, b3, Sum1Array[wm], Sum1Array[wm], Sum1Array[wm], Sum1Array[wm]);
				Sum2Array[wm - 1].calc(b, b1, b2, b3, Sum1Array[wm - 1], Sum2Array[wm], Sum2Array[wm], Sum2Array[wm]);
				Sum2Array[wm - 2].calc(b, b1, b2, b3, Sum1Array[wm - 2], Sum2Array[wm - 1], Sum2Array[wm], Sum2Array[wm]);
				Sum2Array[wm].to_pix(ref BufferArray[wm]);
				Sum2Array[wm - 1].to_pix(ref BufferArray[wm - 1]);
				Sum2Array[wm - 2].to_pix(ref BufferArray[wm - 2]);

				for (x = wm - 3; x >= 0; --x)
				{
					Sum2Array[x].calc(b, b1, b2, b3, Sum1Array[x], Sum2Array[x + 1], Sum2Array[x + 2], Sum2Array[x + 3]);
					Sum2Array[x].to_pix(ref BufferArray[x]);
				}

				img.copy_color_hspan(0, y, w, BufferArray, 0);
			}
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:88,代码来源:RecursiveBlur.cs


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