Beispiel #1
0
 protected override void OnGLRender(object sender, EventArgs args)
 {
     _glsx.SmoothMode  = SmoothMode.Smooth;
     _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
     _glsx.Clear(PixelFarm.Drawing.Color.White);
     _glsx.ClearColorBuffer();
     //-------------------------------
     if (!isInit)
     {
         isInit = true;
     }
     _glsx.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)
     {
     }
 }
Beispiel #2
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.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), Color.Red,
                new PointF(400, 100), 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();
        }
 protected override void OnGLRender(object sender, EventArgs args)
 {
     _glsx.SmoothMode  = SmoothMode.Smooth;
     _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
     _glsx.ClearColorBuffer();
     //-------------------------------
     if (tmpDrawVersion == 2)
     {
         Color[] colors = lionShape.Colors;
         if (multipartTessResult != null)
         {
             int j = multipartTessResult.PartCount;
             for (int i = 0; i < j; ++i)
             {
                 _glsx.FillRenderVx(colors[i], multipartTessResult, i);
             }
         }
     }
     else
     {
         int     j      = lionRenderVxList.Count;
         Color[] colors = lionShape.Colors;
         for (int i = 0; i < j; ++i)
         {
             _glsx.FillRenderVx(colors[i], lionRenderVxList[i]);
         }
     }
     //-------------------------------
     SwapBuffers();
 }
Beispiel #4
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.ClearColorBuffer();
            //-------------------------------
            if (tmpDrawVersion == 2)
            {
                if (multipartTessResult != null)
                {
                    SvgRenderVx renderVx  = (SvgRenderVx)lionShape.GetRenderVx();
                    int         partCount = renderVx.SvgVxCount;

                    int partIndex = 0;
                    for (int i = 0; i < partCount; ++i)
                    {
                        SvgPart vx = renderVx.GetInnerVx(i);
                        if (vx.Kind != SvgRenderVxKind.Path)
                        {
                            continue;
                        }
                        _glsx.FillRenderVx(vx.FillColor, multipartTessResult, partIndex);
                        partIndex++;
                    }

                    //Color[] colors = lionShape.Colors;
                    //int j = multipartTessResult.PartCount;
                    //for (int i = 0; i < j; ++i)
                    //{

                    //}
                }
            }
            else
            {
                int         j         = lionRenderVxList.Count;
                SvgRenderVx renderVx  = (SvgRenderVx)lionShape.GetRenderVx();
                int         partCount = renderVx.SvgVxCount;
                int         partIndex = 0;
                for (int i = 0; i < partCount; ++i)
                {
                    SvgPart vx = renderVx.GetInnerVx(i);
                    if (vx.Kind != SvgRenderVxKind.Path)
                    {
                        continue;
                    }
                    _glsx.FillRenderVx(vx.FillColor, lionRenderVxList[partIndex]);
                    partIndex++;
                }


                //Color[] colors = lionShape.Colors;
                //for (int i = 0; i < j; ++i)
                //{
                //    _glsx.FillRenderVx(colors[i], lionRenderVxList[i]);
                //}
            }
            //-------------------------------
            SwapBuffers();
        }
Beispiel #5
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.ClearColorBuffer();
            if (!resInit)
            {
                msdf_bmp = DemoHelper.LoadTexture(RootDemoPath.Path + @"\msdf_75.png");
                sdf_bmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\sdf_75.png");
                resInit  = true;
            }
            _glsx.Clear(PixelFarm.Drawing.Color.White);

            _glsx.DrawImageWithMsdf(msdf_bmp, 0, 400, 6);
            _glsx.DrawImageWithMsdf(msdf_bmp, 100, 500, 0.5f);
            _glsx.DrawImageWithMsdf(msdf_bmp, 100, 520, 0.4f);
            _glsx.DrawImageWithMsdf(msdf_bmp, 100, 550, 0.3f);
            _glsx.DrawImage(msdf_bmp, 150, 400);

            _glsx.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 200, 400, 6);
            _glsx.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 300, 500, 0.5f);
            _glsx.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 300, 520, 0.4f);
            _glsx.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 300, 550, 0.3f);

            //
            _glsx.DrawImageWithMsdf(sdf_bmp, 400, 400, 6);
            _glsx.DrawImageWithMsdf(sdf_bmp, 400, 500, 0.5f);
            _glsx.DrawImageWithMsdf(sdf_bmp, 400, 520, 0.4f);
            _glsx.DrawImageWithMsdf(sdf_bmp, 400, 550, 0.3f);
            _glsx.DrawImage(sdf_bmp, 400, 300);

            SwapBuffers();
        }
 void Test2()
 {
     _glsx.ClearColorBuffer();
     _glsx.SmoothMode    = SmoothMode.Smooth;
     _glsx.StrokeColor   = PixelFarm.Drawing.Color.Blue;
     _glsx.StrokeWidth   = 1;
     painter.StrokeWidth = 1;
     ////line
     painter.FillColor = PixelFarm.Drawing.Color.Green;
     painter.FillRect(100, 100, 50, 50);
     _glsx.DrawLine(50, 50, 200, 200);
     _glsx.DrawRect(10, 10, 50, 50);
     painter.FillRenderVx(polygon2);
     painter.StrokeColor = PixelFarm.Drawing.Color.Blue;
     painter.DrawRenderVx(polygon2);
     //-------------------------------------------
     ////polygon
     painter.DrawRenderVx(polygon1);
     _glsx.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);
     _glsx.StrokeColor = PixelFarm.Drawing.Color.OrangeRed;
     painter.DrawCircle(100, 400, 25);
     ////
     painter.FillColor = PixelFarm.Drawing.Color.OrangeRed;
     painter.FillEllipse(200, 400, 225, 450);
     _glsx.StrokeColor = PixelFarm.Drawing.Color.OrangeRed;
     painter.DrawEllipse(200, 400, 225, 450);
     //-------------------------------------------
     SwapBuffers();
 }
 protected override void OnGLRender(object sender, EventArgs args)
 {
     _glsx.SmoothMode  = SmoothMode.Smooth;
     _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
     _glsx.ClearColorBuffer();
     //-------------------------------
     _glsx.DrawImage(glBmp, 0, 600);
     SwapBuffers();
 }
Beispiel #8
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.ClearColorBuffer();
            _glsx.Clear(PixelFarm.Drawing.Color.Red);

            //-------------------------------
            painter.FillColor = PixelFarm.Drawing.Color.Black;
            painter.DrawString("OK", 0, 100);
            painter.DrawString("1234567890", 0, 200);
            //-------------------------------
            SwapBuffers();
        }
 void HandleGLPaint(object sender, System.EventArgs e)
 {
     _glsx.SmoothMode  = SmoothMode.Smooth;
     _glsx.StrokeColor = PixelFarm.Drawing.Color.Black;
     _glsx.ClearColorBuffer();
     //example
     canvasPainter.FillColor = PixelFarm.Drawing.Color.Black;
     canvasPainter.FillRect(20, 20, 150, 150);
     //load bmp image
     //-------------------------------------------------------------------------
     if (demobase != null)
     {
         demobase.Draw(canvasPainter);
     }
     glControl.SwapBuffers();
 }
 void HandleGLPaint(object sender, System.EventArgs e)
 {
     _glsx.SmoothMode  = SmoothMode.Smooth;
     _glsx.StrokeColor = PixelFarm.Drawing.Color.Black;
     _glsx.ClearColorBuffer();
     //example
     //canvasPainter.FillColor = PixelFarm.Drawing.Color.Black;
     //canvasPainter.FillRectLBWH(20, 20, 150, 150);
     ////load bmp image
     ////-------------------------------------------------------------------------
     //if (exampleBase != null)
     //{
     //    exampleBase.Draw(canvasPainter);
     //}
     //miniGLControl.SwapBuffers();
 }
 protected override void OnGLRender(object sender, EventArgs args)
 {
     _glsx.SmoothMode  = SmoothMode.Smooth;
     _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
     _glsx.Clear(PixelFarm.Drawing.Color.White);
     _glsx.ClearColorBuffer();
     //-------------------------------
     if (!isInit)
     {
         glbmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\logo-dark.png");
         isInit = true;
     }
     if (frameBuffer.FrameBufferId > 0)
     {
         if (frameBufferNeedUpdate)
         {
             //------------------------------------------------------------------------------------
             //framebuffer
             _glsx.AttachFrameBuffer(frameBuffer);
             //after make the frameBuffer current
             //then all drawing command will apply to frameBuffer
             //do draw to frame buffer here
             _glsx.Clear(PixelFarm.Drawing.Color.Red);
             _glsx.DrawImageWithBlurX(glbmp, 0, 300);
             _glsx.DetachFrameBuffer();
             //------------------------------------------------------------------------------------
             //framebuffer2
             _glsx.AttachFrameBuffer(frameBuffer2);
             GLBitmap bmp2 = new GLBitmap(frameBuffer.TextureId, frameBuffer.Width, frameBuffer.Height);
             bmp2.IsBigEndianPixel = true;
             _glsx.DrawImageWithBlurY(bmp2, 0, 300);
             _glsx.DetachFrameBuffer();
             //------------------------------------------------------------------------------------
             //after release current, we move back to default frame buffer again***
             frameBufferNeedUpdate = false;
         }
         _glsx.DrawFrameBuffer(frameBuffer2, 15, 300);
     }
     else
     {
         _glsx.Clear(PixelFarm.Drawing.Color.Blue);
     }
     //-------------------------------
     SwapBuffers();
 }
Beispiel #12
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.ClearColorBuffer();
            if (!resInit)
            {
                //glbmp = LoadTexture(@"..\logo-dark.jpg");
                glbmp = DemoHelper.LoadTexture(RootDemoPath.Path + @"\logo-dark.jpg");

                resInit = true;
            }

            _glsx.DrawSubImage(glbmp, 10, 10, 100, 100, 200, 400);
            _glsx.DrawImage(glbmp, 0, 300);
            _glsx.DrawImageWithBlurX(glbmp, 0, 600);
            SwapBuffers();
        }
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.Clear(PixelFarm.Drawing.Color.White);
            _glsx.ClearColorBuffer();
            //-------------------------------
            if (!isInit)
            {
                isInit = true;
            }
            if (frameBuffer.FrameBufferId > 0)
            {
                //------------------------------------------------------------------------------------
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, frameBuffer.FrameBufferId);
                //--------
                //do draw to frame buffer here
                GL.ClearColor(OpenTK.Graphics.Color4.Red);
                GL.Clear(ClearBufferMask.ColorBufferBit);
                //------------------------------------------------------------------------------------



                //------------------------------------------------------------------------------------
                GL.BindTexture(TextureTarget.Texture2D, frameBuffer.TextureId);
                GL.GenerateMipmap(TextureTarget.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, 0);
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
                //------------------------------------------------------------------------------------

                GLBitmap bmp = new GLBitmap(frameBuffer.TextureId, frameBuffer.Width, frameBuffer.Height);
                bmp.IsBigEndianPixel = true;
                _glsx.DrawImage(bmp, 15, 300);
            }
            else
            {
                _glsx.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            SwapBuffers();
        }
Beispiel #14
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.ClearColorBuffer();
            //-------------------------------

            int j = lionShape.NumPaths;

            int[]       pathList = lionShape.PathIndexList;
            Color[]     colors   = lionShape.Colors;
            VertexStore myvxs    = lionVxs;

            for (int i = 0; i < j; ++i)
            {
                painter.FillColor = colors[i];
                painter.Fill(new VertexStoreSnap(myvxs, pathList[i]));
            }
            //-------------------------------
            SwapBuffers();
        }
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.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();
        }
Beispiel #16
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.Clear(PixelFarm.Drawing.Color.White);
            _glsx.ClearColorBuffer();
            //-------------------------------
            if (!isInit)
            {
                glbmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\leaves.jpg");
                isInit = true;
            }
            if (frameBuffer.FrameBufferId > 0)
            {
                if (frameBufferNeedUpdate)
                {
                    //------------------------------------------------------------------------------------
                    //framebuffer
                    _glsx.AttachFrameBuffer(frameBuffer);
                    //after make the frameBuffer current
                    //then all drawing command will apply to frameBuffer
                    //do draw to frame buffer here
                    _glsx.Clear(PixelFarm.Drawing.Color.Red);
                    _glsx.DrawImageWithConv3x3(glbmp, Mat3x3ConvGen.emboss, 0, 300);
                    _glsx.DetachFrameBuffer();

                    //after release current, we move back to default frame buffer again***
                    frameBufferNeedUpdate = false;
                }
                _glsx.DrawFrameBuffer(frameBuffer, 15, 300);
            }
            else
            {
                _glsx.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            SwapBuffers();
        }
Beispiel #17
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _glsx.SmoothMode  = SmoothMode.Smooth;
            _glsx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _glsx.ClearColorBuffer();
            if (!resInit)
            {
                // msdf_bmp = LoadTexture(@"..\msdf_75.png");
                //msdf_bmp = LoadTexture(@"d:\\WImageTest\\a001_x1_66.png");
                msdf_bmp = DemoHelper.LoadTexture(totalImg);
                //msdf_bmp = LoadTexture(@"d:\\WImageTest\\a001_x1.png");
                //msdf_bmp = LoadTexture(@"d:\\WImageTest\\msdf_65.png");

                resInit = true;
            }

            painter.Clear(PixelFarm.Drawing.Color.White);
            //var f = painter.CurrentFont;

            //painter.DrawString("hello!", 0, 20);
            //canvas2d.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 200, 500, 15f);

            Typography.Rendering.TextureFontGlyphData glyphData;

            byte[] codepoint = System.Text.Encoding.UTF8.GetBytes("AB");
            fontAtlas.TryGetGlyphDataByCodePoint(codepoint[0], out glyphData);
            PixelFarm.Drawing.Rectangle r = ConvToRect(glyphData.Rect);
            //canvas2d.DrawSubImageWithMsdf(msdf_bmp, ref r, 100, 500);
            _glsx.DrawSubImageWithMsdf(msdf_bmp, ref r, 100, 500);

            fontAtlas.TryGetGlyphDataByCodePoint(codepoint[1], out glyphData);
            PixelFarm.Drawing.Rectangle r2 = ConvToRect(glyphData.Rect);
            _glsx.DrawSubImageWithMsdf(msdf_bmp, ref r2, 100 + r.Width - 10, 500);

            //full image
            _glsx.DrawImage(msdf_bmp, 100, 300);
            SwapBuffers();
        }