Пример #1
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.ClearColorBuffer();
            _painter.FillColor = PixelFarm.Drawing.Color.Black;
            _painter.FillRect(0, 0, 150, 150);

            //-------------------------------------------------------------------------
            _painter.FillRenderVx(_textureBrush, _polygon1);
            //_painter.FillRenderVx(_linearGradient, _polygon1);
            ////-------------------------------------------------------------------------


            //fill polygon with gradient brush
            _painter.FillColor = Color.Yellow;
            _painter.FillRect(200, 0, 150, 150);
            //_painter.FillRenderVx(_textureBrush2, _polygon2);
            _painter.FillRenderVx(_linearGradient, _polygon2);


            ////-------------------------------------------------------------------------
            _painter.FillColor = Color.Black;
            _painter.FillRect(400, 0, 150, 150);
            //another  ...
            _painter.FillRenderVx(_textureBrush2, _polygon3);
            ////-------------------------------------------------------------------------


            SwapBuffers();
        }
Пример #2
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.ClearColorBuffer();
            _painter.FillColor = PixelFarm.Drawing.Color.Black;
            _painter.FillRect(0, 0, 150, 150);
            GLBitmap glBmp        = DemoHelper.LoadTexture(RootDemoPath.Path + @"\logo-dark.jpg");
            var      textureBrush = new TextureBrush(glBmp);

            _painter.FillRenderVx(textureBrush, _polygon1);
            //-------------------------------------------------------------------------
            var linearGrBrush2 = new LinearGradientBrush(
                new PointF(0, 50), new PointF(0, 100),
                Color.Red, Color.White);

            //fill polygon with gradient brush
            _painter.FillColor = Color.Yellow;
            _painter.FillRect(200, 0, 150, 150);
            _painter.FillRenderVx(linearGrBrush2, _polygon2);
            _painter.FillColor = Color.Black;
            _painter.FillRect(400, 0, 150, 150);
            //-------------------------------------------------------------------------
            //another  ...
            _painter.FillRenderVx(linearGrBrush2, _polygon3);
            //-------------------------------------------------------------------------


            SwapBuffers();
        }
Пример #3
0
 protected override void OnGLRender(object sender, EventArgs args)
 {
     _pcx.SmoothMode  = SmoothMode.Smooth;
     _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
     _pcx.Clear(PixelFarm.Drawing.Color.White);
     _pcx.ClearColorBuffer();
     //-------------------------------
     if (!_isInit)
     {
         _isInit = true;
     }
     _pcx.Clear(PixelFarm.Drawing.Color.Blue);
     _painter.StrokeColor = PixelFarm.Drawing.Color.Black;
     _painter.StrokeWidth = 2;
     //-------------------------------
     //painter.FillColor = PixelFarm.Drawing.Color.Yellow;
     //painter.FillRenderVx(polygon1);
     //-------------------------------
     //painter.FillColor = PixelFarm.Drawing.Color.Red;
     //painter.FillRenderVx(polygon2);
     //////-------------------------------
     _painter.FillColor = PixelFarm.Drawing.Color.Magenta;
     try
     {
         _painter.FillRenderVx(_polygon3);
         SwapBuffers();
     }
     catch (Exception ex)
     {
     }
 }
Пример #4
0
        void Test2()
        {
            _pcx.ClearColorBuffer();
            _pcx.SmoothMode      = SmoothMode.Smooth;
            _pcx.StrokeColor     = PixelFarm.Drawing.Color.Blue;
            _pcx.StrokeWidth     = 1;
            _painter.StrokeWidth = 1;
            ////line
            _painter.FillColor = PixelFarm.Drawing.Color.Green;
            _painter.FillRect(100, 100, 50, 50);
            _pcx.DrawLine(50, 50, 200, 200);

            _painter.FillRenderVx(_polygon2);
            _painter.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _painter.DrawRenderVx(_polygon2);
            //-------------------------------------------
            ////polygon
            _painter.DrawRenderVx(_polygon1);
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Green;
            ////--------------------------------------------
            _painter.DrawCircle(100, 100, 25);
            _painter.DrawEllipse(200, 200, 225, 250);
            ////
            _painter.FillColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.FillCircle(100, 400, 25);
            _pcx.StrokeColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.DrawCircle(100, 400, 25);
            ////
            _painter.FillColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.FillEllipse(200, 400, 225, 450);
            _pcx.StrokeColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.DrawEllipse(200, 400, 225, 450);
            //-------------------------------------------
            SwapBuffers();
        }
Пример #5
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            //-----------------------------
            //see:  lazyfoo.net/tutorials/OpenGL/26_the_stencil_buffer/index.php
            //-----------------------------

            _pcx.Clear(PixelFarm.Drawing.Color.White);
            //-------------------
            //disable rendering to color buffer
            GL.ColorMask(false, false, false, false);
            //start using stencil
            GL.Enable(EnableCap.StencilTest);
            //place a 1 where rendered
            GL.StencilFunc(StencilFunction.Always, 1, 1);
            //replace where rendered
            GL.StencilOp(StencilOp.Replace, StencilOp.Replace, StencilOp.Replace);
            //render  to stencill buffer

            _painter.FillColor = PixelFarm.Drawing.Color.Black;
            _painter.FillRenderVx(_stencilPolygon);
            _painter.StrokeColor = PixelFarm.Drawing.Color.Black;
            //render color
            GL.ColorMask(true, true, true, true);
            //where a 1 was not rendered
            GL.StencilFunc(StencilFunction.Equal, 1, 1);
            //keep the pixel
            GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Keep);
            //draw
            _painter.FillColor = PixelFarm.Drawing.Color.Red;
            _painter.FillRenderVx(_rectPolygon);
            GL.Disable(EnableCap.StencilTest);
            //-----------------------------------------------------------
            SwapBuffers();
        }
Пример #6
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.ClearColorBuffer();
            _painter.FillColor = PixelFarm.Drawing.Color.Black;
            //painter.FillRectLBWH(0, 0, 150, 150);
            //GLBitmap glBmp = LoadTexture("..\\logo-dark.jpg");
            //var textureBrush = new TextureBrush(new GLImage(glBmp));
            //painter.FillRenderVx(textureBrush, polygon1);
            ////-------------------------------------------------------------------------

            //fill
            _painter.FillColor = PixelFarm.Drawing.Color.Black;
            _painter.FillRenderVx(_linearGrBrush2, _glyph_vx);
            //painter.FillRenderVx(glyph_vx);
            //-------------------------------------------------------------------------


            SwapBuffers();
        }