コード例 #1
0
        static void SetUpSoftwareRendererOverGLSurface(
            LayoutFarm.AppHostConfig config,
            IGpuOpenGLSurfaceView myNativeWindow,
            PixelFarm.DrawingGL.GLPainterCore pcx,
            PixelFarm.DrawingGL.GLPainter glPainter,
            InnerViewportKind innerViewPortKind)
        {
            //TODO: review here
            //Temp:
            //

            var surfaceControl = myNativeWindow;

            surfaceControl.MakeCurrent();

            CpuBlitGLESUIElement _cpuBlitUIElem = (innerViewPortKind == InnerViewportKind.GdiPlusOnGLES) ?
                                                  new GdiOnGLESUIElement(surfaceControl.Width, surfaceControl.Height) :
                                                  new CpuBlitGLESUIElement(surfaceControl.Width, surfaceControl.Height);

            //optional***
            //_bridgeUI.SetUpdateCpuBlitSurfaceDelegate((p, area) =>
            //{
            //    _client.DrawToThisCanvas(_bridgeUI.GetDrawBoard(), area);
            //});

            LayoutFarm.RootGraphic rootGfx = config.RootGfx;
            _cpuBlitUIElem.CreatePrimaryRenderElement(pcx, glPainter, rootGfx);

            //*****
            LayoutFarm.RenderBoxBase renderE = (LayoutFarm.RenderBoxBase)_cpuBlitUIElem.GetPrimaryRenderElement();
            rootGfx.AddChild(renderE);
            rootGfx.SetPrimaryContainerElement(renderE);
            //***
        }
コード例 #2
0
ファイル: TestBedStartup.cs プロジェクト: brezza92/PixelFarm
        public static Form RunSpecificDemo(LayoutFarm.App demo,
                                           LayoutFarm.AppHost appHost,
                                           InnerViewportKind innerViewportKind = InnerViewportKind.GdiPlusOnGLES)
        {
            System.Drawing.Rectangle workingArea = Screen.PrimaryScreen.WorkingArea;
            Form formCanvas = LayoutFarm.UI.FormCanvasHelper.CreateNewFormCanvas(
                workingArea.Width,
                workingArea.Height,
                innerViewportKind,
                out GraphicsViewRoot viewroot);

#if DEBUG
            formCanvas.Text = innerViewportKind.ToString();
#endif


            formCanvas.FormClosed += (s, e) =>
            {
                demo.OnClosing();
                demo.OnClosed();
            };


            LayoutFarm.AppHostConfig config = new LayoutFarm.AppHostConfig();
            YourImplementation.UISurfaceViewportSetupHelper.SetUISurfaceViewportControl(config, viewroot);
            appHost.Setup(config);

            appHost.StartApp(demo);
            //
            //viewroot.TopDownRecalculateContent();
            //==================================================
            viewroot.PaintToOutputWindow();

            //formCanvas.WindowState = FormWindowState.Maximized;
            formCanvas.Show();
#if DEBUG
            if (dbugShowLayoutInspectorForm)
            {
                LayoutInspectorUtils.ShowFormLayoutInspector(viewroot);
            }
#endif

            //Application.Run(formCanvas);

            formCanvas.Show();
            return(formCanvas);
        }
コード例 #3
0
 public static void SetUISurfaceViewportControl(LayoutFarm.AppHostConfig config, LayoutFarm.UI.GraphicsViewRoot vw)
 {
     //---------------------------------------
     //this specific for WindowForm viewport
     //---------------------------------------
     System.Drawing.Rectangle primScreenWorkingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
     config.ScreenW = primScreenWorkingArea.Width;
     config.ScreenH = primScreenWorkingArea.Height;
     config.RootGfx = vw.RootGfx;
     //
     switch (vw.InnerViewportKind)
     {
     case InnerViewportKind.GdiPlusOnGLES:
     case InnerViewportKind.AggOnGLES:
         SetUpSoftwareRendererOverGLSurface(
             config,
             vw.MyNativeWindow,
             vw.GLPainterCore(),
             vw.GetGLPainter(),
             vw.InnerViewportKind);
         break;
     }
 }