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


C# ImageBuffer.GetPixelPointerXY方法代码示例

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


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

示例1: pixel_high_res

		public void pixel_high_res(ImageBuffer sourceImage, RGBA_Bytes[] destBuffer, int destBufferOffset, int x, int y)
		{
			int r, g, b, a;
			r = g = b = a = LineAABasics.line_subpixel_scale * LineAABasics.line_subpixel_scale / 2;

			int weight;
			int x_lr = x >> LineAABasics.line_subpixel_shift;
			int y_lr = y >> LineAABasics.line_subpixel_shift;

			x &= LineAABasics.line_subpixel_mask;
			y &= LineAABasics.line_subpixel_mask;
			int sourceOffset;
			byte[] ptr = sourceImage.GetPixelPointerXY(x_lr, y_lr, out sourceOffset);

			weight = (LineAABasics.line_subpixel_scale - x) *
					 (LineAABasics.line_subpixel_scale - y);
			r += weight * ptr[sourceOffset + ImageBuffer.OrderR];
			g += weight * ptr[sourceOffset + ImageBuffer.OrderG];
			b += weight * ptr[sourceOffset + ImageBuffer.OrderB];
			a += weight * ptr[sourceOffset + ImageBuffer.OrderA];

			sourceOffset += sourceImage.GetBytesBetweenPixelsInclusive();

			weight = x * (LineAABasics.line_subpixel_scale - y);
			r += weight * ptr[sourceOffset + ImageBuffer.OrderR];
			g += weight * ptr[sourceOffset + ImageBuffer.OrderG];
			b += weight * ptr[sourceOffset + ImageBuffer.OrderB];
			a += weight * ptr[sourceOffset + ImageBuffer.OrderA];

			ptr = sourceImage.GetPixelPointerXY(x_lr, y_lr + 1, out sourceOffset);

			weight = (LineAABasics.line_subpixel_scale - x) * y;
			r += weight * ptr[sourceOffset + ImageBuffer.OrderR];
			g += weight * ptr[sourceOffset + ImageBuffer.OrderG];
			b += weight * ptr[sourceOffset + ImageBuffer.OrderB];
			a += weight * ptr[sourceOffset + ImageBuffer.OrderA];

			sourceOffset += sourceImage.GetBytesBetweenPixelsInclusive();

			weight = x * y;
			r += weight * ptr[sourceOffset + ImageBuffer.OrderR];
			g += weight * ptr[sourceOffset + ImageBuffer.OrderG];
			b += weight * ptr[sourceOffset + ImageBuffer.OrderB];
			a += weight * ptr[sourceOffset + ImageBuffer.OrderA];

			destBuffer[destBufferOffset].red = (byte)(r >> LineAABasics.line_subpixel_shift * 2);
			destBuffer[destBufferOffset].green = (byte)(g >> LineAABasics.line_subpixel_shift * 2);
			destBuffer[destBufferOffset].blue = (byte)(b >> LineAABasics.line_subpixel_shift * 2);
			destBuffer[destBufferOffset].alpha = (byte)(a >> LineAABasics.line_subpixel_shift * 2);
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:50,代码来源:agg_pattern_filters_rgba.cs

示例2: BlendInFilterPixel

		private void BlendInFilterPixel(int[] accumulatedColor, ref int sourceAlpha, int back_r, int back_g, int back_b, int back_a, ImageBuffer SourceRenderingBuffer, int maxx, int maxy, int x_lr, int y_lr, int weight)
		{
			byte[] fg_ptr;
			unchecked
			{
				if ((uint)x_lr <= (uint)maxx && (uint)y_lr <= (uint)maxy)
				{
					int bufferIndex;
					fg_ptr = SourceRenderingBuffer.GetPixelPointerXY(x_lr, y_lr, out bufferIndex);

					accumulatedColor[0] += weight * fg_ptr[bufferIndex + ImageBuffer.OrderR];
					accumulatedColor[1] += weight * fg_ptr[bufferIndex + ImageBuffer.OrderG];
					accumulatedColor[2] += weight * fg_ptr[bufferIndex + ImageBuffer.OrderB];
					sourceAlpha += weight * base_mask;
				}
				else
				{
					accumulatedColor[0] += back_r * weight;
					accumulatedColor[1] += back_g * weight;
					accumulatedColor[2] += back_b * weight;
					sourceAlpha += back_a * weight;
				}
			}
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:24,代码来源:agg_span_image_filter_rgb.cs


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