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


C# Renderer.Render方法代码示例

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


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

示例1: Render

        public virtual void Render(Renderer renderer, IViewProject viewProject)
        {
            Frustum.Update(this);

            renderer.Render(viewProject, new Sphere(World.Translation, 1, Color));
            renderer.Render(viewProject, Frustum);

            if (Highlight)
                renderer.Render(viewProject, new Circle2D(World.Translation, 60, 20, Color));
        }
开发者ID:JaapSuter,项目名称:Pentacorn,代码行数:10,代码来源:Camera.cs

示例2: VisualBrushImpl

        public VisualBrushImpl(
            VisualBrush brush,
            RenderTarget target,
            Size targetSize)
        {
            var visual = brush.Visual;
            var layoutable = visual as ILayoutable;

            if (layoutable?.IsArrangeValid == false)
            {
                layoutable.Measure(Size.Infinity);
                layoutable.Arrange(new Rect(layoutable.DesiredSize));
            }

            var sourceRect = brush.SourceRect.ToPixels(layoutable.Bounds.Size);
            var destinationRect = brush.DestinationRect.ToPixels(targetSize);
            var bitmapSize = brush.TileMode == TileMode.None ? targetSize : destinationRect.Size;
            var scale = brush.Stretch.CalculateScaling(destinationRect.Size, sourceRect.Size);
            var translate = CalculateTranslate(brush, sourceRect, destinationRect, scale);
            var options = CompatibleRenderTargetOptions.None;

            using (var brt = new BitmapRenderTarget(target, options, bitmapSize.ToSharpDX()))
            {
                var renderer = new Renderer(brt);
                var transform = Matrix.CreateTranslation(-sourceRect.Position) *
                                Matrix.CreateScale(scale) *
                                Matrix.CreateTranslation(translate);

                Rect drawRect;

                if (brush.TileMode == TileMode.None)
                {
                    drawRect = destinationRect;
                    transform *= Matrix.CreateTranslation(destinationRect.Position);
                }
                else
                {
                    drawRect = new Rect(0, 0, destinationRect.Width, destinationRect.Height);
                }

                renderer.Render(visual, null, transform, drawRect);

                var result = new BitmapBrush(brt, brt.Bitmap);
                result.ExtendModeX = (brush.TileMode & TileMode.FlipX) != 0 ? ExtendMode.Mirror : ExtendMode.Wrap;
                result.ExtendModeY = (brush.TileMode & TileMode.FlipY) != 0 ? ExtendMode.Mirror : ExtendMode.Wrap;

                if (brush.TileMode != TileMode.None)
                {
                    result.Transform = SharpDX.Matrix3x2.Translation(
                        (float)destinationRect.X,
                        (float)destinationRect.Y);
                }

                PlatformBrush = result;
            }
        }
开发者ID:healtech,项目名称:Perspex,代码行数:56,代码来源:VisualBrushImpl.cs

示例3: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            IRenderer renderer = new Renderer(Canvas);
            Chest chest = new Chest(200, 100, 100);
            var image = new Image();
            image.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/Images/chest.png"));

            renderer.Render(chest);
        }
开发者ID:hristodobrev,项目名称:Software-University,代码行数:10,代码来源:MainWindow.xaml.cs

示例4: DoLayoutPass

        public void DoLayoutPass()
        {
            Size clientSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
            this.Child.Measure(clientSize);
            this.Child.Arrange(new Rect(this.Child.DesiredSize));

            using (DrawingContext drawingContext = this.PresentationSource.CreateDrawingContext())
            {
                Renderer renderer = new Renderer();
                renderer.Render(drawingContext, this.Child);
            }
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:12,代码来源:PopupRoot.cs

示例5: Render

        public void Render(Visual visual)
        {
            IPlatformRenderTargetBitmap impl = (IPlatformRenderTargetBitmap)this.PlatformImpl;
            FrameworkElement fe = visual as FrameworkElement;

            if (fe != null && !fe.IsInitialized)
            {
                fe.IsInitialized = true;
                fe.ApplyTemplate();
            }

            using (DrawingContext context = impl.CreateDrawingContext())
            {
                Renderer renderer = new Renderer();
                renderer.Render(context, visual);
            }
        }
开发者ID:modulexcite,项目名称:Avalonia,代码行数:17,代码来源:RenderTargetBitmap.cs

示例6: MainWindow

        public MainWindow()
        {
            this.InitializeComponent();
            var canvas = this.FindName("canvas") as Canvas;
            int width = (int) canvas.Width;
            int height = (int) canvas.Height;

            var assetLoader = AssetLoader.Instance;
            var renderer = new Renderer(canvas, assetLoader);

            var randomGenerator = new Random();
            for (int i = 0; i < 10000; i++)
            {
                int x = randomGenerator.Next(0, width);
                int y = randomGenerator.Next(0, height);

                renderer.Render(new Reaper(x, y));
            }
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:19,代码来源:MainWindow.xaml.cs

示例7: Render

 protected override void Render()
 {
     var renderer = new Renderer(Variables);
       renderer.Render();
 }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:5,代码来源:UpdateCheck.cs

示例8: Render

 protected override void Render(Drawable drawable)
 {
     var renderer = new Renderer(Variables);
       renderer.Render(drawable);
 }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:5,代码来源:Pointillize.cs

示例9: Render

 public void Render(IVisual visual)
 {
     Renderer renderer = new Renderer(this.Surface);
     renderer.Render(visual, new PlatformHandle(IntPtr.Zero, "RTB"));
 }
开发者ID:Robertofon,项目名称:Perspex,代码行数:5,代码来源:RenderTargetBitmapImpl.cs

示例10: Render

 protected override void Render(Image image, Drawable drawable)
 {
     var renderer = new Renderer(Variables);
       renderer.Render(image, drawable);
 }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:5,代码来源:QR.cs

示例11: CreateVisualBrush

        public static SurfacePattern CreateVisualBrush(VisualBrush brush, Size targetSize)
        {
            var visual = brush.Visual;

            if (visual == null)
            {
                return null;
            }

            var layoutable = visual as ILayoutable;

            if (layoutable?.IsArrangeValid == false)
            {
                layoutable.Measure(Size.Infinity);
                layoutable.Arrange(new Rect(layoutable.DesiredSize));
            }

            // TODO: This is directly ported from Direct2D and could probably be made more
            // efficient on cairo by taking advantage of the fact that cairo has Extend.None.
            var tileMode = brush.TileMode;
            var sourceRect = brush.SourceRect.ToPixels(layoutable.Bounds.Size);
            var destinationRect = brush.DestinationRect.ToPixels(targetSize);
            var scale = brush.Stretch.CalculateScaling(destinationRect.Size, sourceRect.Size);
            var translate = CalculateTranslate(brush, sourceRect, destinationRect, scale);
            var intermediateSize = CalculateIntermediateSize(tileMode, targetSize, destinationRect.Size);
            
			using (var intermediate = new ImageSurface(Format.ARGB32, (int)intermediateSize.Width, (int)intermediateSize.Height))
            using (var context = new Context(intermediate))
            {
                Rect drawRect;
                var transform = CalculateIntermediateTransform(
                    tileMode,
                    sourceRect,
                    destinationRect,
                    scale,
                    translate,
                    out drawRect);
                var renderer = new Renderer(intermediate);

                context.Rectangle(drawRect.ToCairo());
                context.Clip();
                context.Transform(transform.ToCairo());
                renderer.Render(visual, new PlatformHandle(IntPtr.Zero, "RTB"), transform, drawRect);

                var result = new SurfacePattern(intermediate);

                if ((brush.TileMode & TileMode.FlipXY) != 0)
                {
                    // TODO: Currently always FlipXY as that's all cairo supports natively. 
                    // Support separate FlipX and FlipY by drawing flipped images to intermediate
                    // surface.
                    result.Extend = Extend.Reflect;
                }
                else
                {
                    result.Extend = Extend.Repeat;
                }

                if (brush.TileMode != TileMode.None)
                {
                    var matrix = result.Matrix;
                    matrix.InitTranslate(-destinationRect.X, -destinationRect.Y);
                    result.Matrix = matrix;
                }

                return result;
            }
        }
开发者ID:shahid-pk,项目名称:Perspex,代码行数:68,代码来源:TileBrushes.cs

示例12: Render

 public void Render(Renderer renderer, IViewProject viewProject)
 {
     renderer.Render(viewProject, Text);
 }
开发者ID:JaapSuter,项目名称:Pentacorn,代码行数:4,代码来源:WorkFlowTask.cs

示例13: Render

 protected override void Render()
 {
     var renderer = new Renderer(Variables);
       renderer.Render(_layout.Value, _loader.Value);
 }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:5,代码来源:PicturePackage.cs

示例14: Render

 public void Render(IVisual visual)
 {
     Renderer renderer = new Renderer(_target);
     renderer.Render(visual, null);
 }
开发者ID:healtech,项目名称:Perspex,代码行数:5,代码来源:RenderTargetBitmapImpl.cs

示例15: ThreadMain

        public void ThreadMain()
        {
            while(true)
              {
            mutexDraw.WaitOne();
            if (threadFilename != null)
            {
              int w = 0;
              Dispatcher.Invoke((Action)(() => { try { w = Convert.ToInt32(xRez.Text); } catch (FormatException) { w = 256; } }));

              Renderer filerender = new Renderer();
              filerender.noDispatch = true;
              filerender.mShadow = render.mShadow;
              filerender.mNormal = render.mNormal;
              filerender.Apply(Parameters);
              filerender.InitData(w, w);
              BitmapSource bitmap = filerender.Render(mNoise, mGradient);
              BitmapPalette myPalette = BitmapPalettes.Halftone256;
              FileStream stream = new FileStream(threadFilename, FileMode.Create);
              PngBitmapEncoder encoder = new PngBitmapEncoder();
              encoder.Interlace = PngInterlaceOption.On;
              encoder.Frames.Add(BitmapFrame.Create(bitmap));
              encoder.Save(stream);
              stream.Close();
              Dispatcher.Invoke((Action)(() =>
              {
            xSaving.Visibility = Visibility.Collapsed;
              }));
            }
            else
            {
              BitmapSource bitmap = !threadRedraw ? render.Render(mNoise, mGradient) : render.Redraw(mNoise, mGradient);
              Dispatcher.Invoke((Action)(() =>
              {
            xCanvas.Source = bitmap;
            //            xCanvas.Visibility = Visibility.Visible;
            xDrawing.Visibility = Visibility.Collapsed;
            Range = "Output Range: " + Math.Round(render.min, 2) + " to " + Math.Round(render.max, 2);
            OnRendered();
              }));
            }
            threadFilename = null;
            threadRedraw = false;
              }
        }
开发者ID:MadoxLabs,项目名称:NoiseTool,代码行数:45,代码来源:NoiseObject.xaml.cs


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