Exemple #1
0
        public void TestRender3DSceneToBitmap(string sceneName)
        {
            var scene = SceneFactory.CreateRecord3D(sceneName);

            scene.DrawCube(Matrix4x4.Identity, COLOR.Red, COLOR.Green, COLOR.Blue);

            AttachmentInfo
            .From($"{sceneName}.png")
            .WriteObject(f => Canvas2DFactory.SaveToBitmap(f, 1024, 1024, null, scene));
        }
        public _ActualCanvas2DContext(Canvas2DFactory owner, float pixelWidth, float pixelHeight, System.Windows.Media.DrawingContext context, _WPFResourcesCache resources)
        {
            _Owner       = owner;
            PixelsWidth  = (int)pixelWidth;
            PixelsHeight = (int)pixelHeight;

            DotsPerInchX = DotsPerInchY = 96;

            _Context   = context;
            _Resources = resources;

            _Geometries = new _GeometryPool();
        }
Exemple #3
0
        public static void AttachToCurrentTest(this Record2D batch, string filePath)
        {
            var ainfo = NUnit.Framework.AttachmentInfo.From(filePath);

            if (filePath.ToLower().EndsWith(".svg"))
            {
                ainfo.WriteObject(f => SVGSceneDrawing2D.SaveToSVG(f, batch));
                return;
            }

            if (filePath.ToLower().EndsWith(".png") || filePath.ToLower().EndsWith(".jpg") || filePath.ToLower().EndsWith(".gif"))
            {
                ainfo.WriteObject(f => Canvas2DFactory.SaveToBitmap(f, 1024, 1024, null, batch));
                return;
            }
        }