本文整理汇总了C#中IRenderer.SetupCanvas方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.SetupCanvas方法的具体用法?C# IRenderer.SetupCanvas怎么用?C# IRenderer.SetupCanvas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderer
的用法示例。
在下文中一共展示了IRenderer.SetupCanvas方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public Bitmap Run(IList<ImageLayout> extractResult, NationColorOffset nationColorOffset, int imageNumber, RawParser rawParser, IRenderer renderer, Color[] imagePaletteArray, Color[] generalPaletteColors)
{
var imageGenerator = new ImageGenerator();
var partialLayouts = extractResult[imageNumber].PartialLayouts;
var largestWidth = partialLayouts
.Select(it => it.Width + it.offsetX)
.OrderByDescending(it => it)
.First();
var largestHeight = partialLayouts
.Select(it => it.Height + it.offsetY)
.OrderByDescending(it => it)
.First();
var bitMap = new Bitmap(largestWidth, largestHeight);
renderer.SetupCanvas(bitMap);
foreach (var layout in partialLayouts)
{
ImageLayoutInfo layout1 = layout;
var imageView = new ImageView(layout1.Width + layout1.offsetX, layout1.Height + layout1.offsetY);
var firstPartBlocks = Helper.WithMeasurement(() =>
{
var rawFirstPartBlocks = rawParser.ParseRawBlockGroups(layout1.Bytes, layout1.NumberOfRows);
return rawFirstPartBlocks.ConvertToAbsoluteCoordinatesBlocks();
}, "firstPartBlocks");
var secondPartBlocks = Helper.WithMeasurement(() => rawParser.GetRawColorBlocks(layout1.Bytes, layout1.ColorBlocksSectionOffset, (int)layout1.GlobalByteOffsetStart + layout1.ColorBlocksSectionOffset + layout1.HeaderBytes.Length, layout1.IsNationColorImage), "secondPartBlocks");
Helper.WithMeasurement(() =>
{
imageGenerator.RenderShapeBlocks(imageView, firstPartBlocks, layout1);
imageGenerator.RenderCounterBlocksOnBitmap(imageView, nationColorOffset, firstPartBlocks, secondPartBlocks, layout1, imagePaletteArray, generalPaletteColors);
}, "RenderCounterBlocksOnBitmap");
Helper.WithMeasurement(() => renderer.RenderImage(bitMap, imageView), "Render on bitmap");
}
return bitMap;
}