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


C# IImageByte.blend_color_hspan方法代码示例

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


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

示例1: RenderCompound

		public void RenderCompound(rasterizer_compound_aa ras, IScanlineCache sl_aa, IScanlineCache sl_bin, IImageByte imageFormat, span_allocator alloc, IStyleHandler sh)
		{
#if false
            unsafe
            {
                if (ras.rewind_scanlines())
                {
                    int min_x = ras.min_x();
                    int len = ras.max_x() - min_x + 2;
                    sl_aa.reset(min_x, ras.max_x());
                    sl_bin.reset(min_x, ras.max_x());

                    //typedef typename BaseRenderer::color_type color_type;
                    ArrayPOD<RGBA_Bytes> color_span = alloc.allocate((int)len * 2);
                    byte[] ManagedCoversArray = sl_aa.GetCovers();
                    fixed (byte* pCovers = ManagedCoversArray)
                    {
                        fixed (RGBA_Bytes* pColorSpan = color_span.Array)
                        {
                            int mix_bufferOffset = len;
                            int num_spans;

                            int num_styles;
                            int style;
                            bool solid;
                            while ((num_styles = ras.sweep_styles()) > 0)
                            {
                                if (num_styles == 1)
                                {
                                    // Optimization for a single style. Happens often
                                    //-------------------------
                                    if (ras.sweep_scanline(sl_aa, 0))
                                    {
                                        style = ras.style(0);
                                        if (sh.is_solid(style))
                                        {
                                            // Just solid fill
                                            //-----------------------
                                            RenderSolidSingleScanLine(imageFormat, sl_aa, sh.color(style));
                                        }
                                        else
                                        {
                                            // Arbitrary span generator
                                            //-----------------------
                                            ScanlineSpan span_aa = sl_aa.Begin();
                                            num_spans = sl_aa.num_spans();
                                            for (; ; )
                                            {
                                                len = span_aa.len;
                                                sh.generate_span(pColorSpan,
                                                                 span_aa.x,
                                                                 sl_aa.y(),
                                                                 (int)len,
                                                                 style);

                                                imageFormat.blend_color_hspan(span_aa.x,
                                                                      sl_aa.y(),
                                                                      (int)span_aa.len,
                                                                      pColorSpan,
                                                                      &pCovers[span_aa.cover_index], 0);
                                                if (--num_spans == 0) break;
                                                span_aa = sl_aa.GetNextScanlineSpan();
                                            }
                                        }
                                    }
                                }
                                else // there are multiple styles
                                {
                                    if (ras.sweep_scanline(sl_bin, -1))
                                    {
                                        // Clear the spans of the mix_buffer
                                        //--------------------
                                        ScanlineSpan span_bin = sl_bin.Begin();
                                        num_spans = sl_bin.num_spans();
                                        for (; ; )
                                        {
                                            agg_basics.MemClear((byte*)&pColorSpan[mix_bufferOffset + span_bin.x - min_x],
                                                   span_bin.len * sizeof(RGBA_Bytes));

                                            if (--num_spans == 0) break;
                                            span_bin = sl_bin.GetNextScanlineSpan();
                                        }

                                        for (int i = 0; i < num_styles; i++)
                                        {
                                            style = ras.style(i);
                                            solid = sh.is_solid(style);

                                            if (ras.sweep_scanline(sl_aa, (int)i))
                                            {
                                                //IColorType* colors;
                                                //IColorType* cspan;
                                                //typename ScanlineAA::cover_type* covers;
                                                ScanlineSpan span_aa = sl_aa.Begin();
                                                num_spans = sl_aa.num_spans();
                                                if (solid)
                                                {
                                                    // Just solid fill
                                                    //-----------------------
                                                    for (; ; )
//.........这里部分代码省略.........
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:101,代码来源:ScanlineRenderer.cs

示例2: GenerateAndRenderSingleScanline

		private void GenerateAndRenderSingleScanline(IScanlineCache scanLineCache, IImageByte destImage, span_allocator alloc, ISpanGenerator span_gen)
		{
			int y = scanLineCache.y();
			int num_spans = scanLineCache.num_spans();
			ScanlineSpan scanlineSpan = scanLineCache.begin();

			byte[] ManagedCoversArray = scanLineCache.GetCovers();
			for (; ; )
			{
				int x = scanlineSpan.x;
				int len = scanlineSpan.len;
				if (len < 0) len = -len;

				if (tempSpanColors.Capacity() < len)
				{
					tempSpanColors.Capacity(len);
				}

				span_gen.generate(tempSpanColors.Array, 0, x, y, len);
				bool useFirstCoverForAll = scanlineSpan.len < 0;
				destImage.blend_color_hspan(x, y, len, tempSpanColors.Array, 0, ManagedCoversArray, scanlineSpan.cover_index, useFirstCoverForAll);

				if (--num_spans == 0) break;
				scanlineSpan = scanLineCache.GetNextScanlineSpan();
			}
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:26,代码来源:ScanlineRenderer.cs


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