示例#1
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)
     {
     }
 }
        GLBitmap ConvertFromBGRA_To_RGBA(GLBitmap bgraBmp)
        {
            GLBitmap rgba_result = new GLBitmap(bgraBmp.Width, bgraBmp.Height);//create another from blank with the same size

            using (GLRenderSurface surface1 = new GLRenderSurface(bgraBmp.Width, bgraBmp.Height))
                using (GLRenderSurface surface2 = new GLRenderSurface(rgba_result, false))
                {
                    _pcx.AttachToRenderSurface(surface1);
                    _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                    //------------------------------------------------------------------------------------
                    //after make the frameBuffer current
                    //then all drawing command will apply to frameBuffer
                    //do draw to frame buffer here
                    _pcx.Clear(PixelFarm.Drawing.Color.Black);
                    _pcx.DrawImage(bgraBmp, 0, 0);
                    //------------------------------------------------------------------------------------
                    _pcx.AttachToRenderSurface(null);
                    //after release current, we move back to default frame buffer again***

                    _pcx.AttachToRenderSurface(surface2);
                    _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                    _pcx.Clear(PixelFarm.Drawing.Color.Black);
                    _pcx.DrawImage(surface1.GetGLBitmap(), 0, 0);
                    _pcx.AttachToRenderSurface(null);
                }
            return(rgba_result);
        }
        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();
            //-------------------------------
            _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
            if (!_isInit)
            {
                _glbmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\logo-dark.png");
                _isInit = true;
            }
            if (_surface1.IsValid)
            {
                if (_frameBufferNeedUpdate)
                {
                    //------------------------------------------------------------------------------------
                    //framebuffer
                    _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                    _pcx.AttachToRenderSurface(_surface1);
                    //after make the frameBuffer current
                    //then all drawing command will apply to frameBuffer
                    //do draw to frame buffer here
                    _pcx.Clear(PixelFarm.Drawing.Color.Red);
                    _pcx.DrawImageWithBlurX(_glbmp, 0, 0);
                    _pcx.AttachToRenderSurface(null);//switch to primary render surface
                    //------------------------------------------------------------------------------------
                    //framebuffer2

                    _pcx.AttachToRenderSurface(_surface2);
                    _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;

                    //GLBitmap bmp2 = new GLBitmap(_frameBuffer.TextureId, _frameBuffer.Width, _frameBuffer.Height);
                    //bmp2.IsYFlipped = true;
                    //bmp2.IsBigEndianPixel = true;

                    _pcx.DrawImageWithBlurY(_surface1.GetGLBitmap(), 0, 0);
                    _pcx.AttachToRenderSurface(null);
                    //------------------------------------------------------------------------------------
                    //after release current, we move back to default frame buffer again***
                    _frameBufferNeedUpdate = false;
                }
                _pcx.DrawImage(_surface2.GetGLBitmap(), 0, 0);

                //_pcx.DrawFrameBuffer(_frameBuffer2, 0, 0, true);
            }
            else
            {
                _pcx.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            SwapBuffers();
        }
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.Clear(PixelFarm.Drawing.Color.White); //set clear color and clear all buffer
            _pcx.ClearColorBuffer();                   //test , clear only color buffer
            //-------------------------------
            if (!_isInit)
            {
                _glbmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\logo-dark.jpg");
                _isInit = true;
            }

            PixelFarm.Drawing.RenderSurfaceOrientation prevOrgKind = _pcx.OriginKind; //save
            _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;

            if (_surface1.IsValid)
            {
                if (_frameBufferNeedUpdate)
                {
                    _pcx.AttachToRenderSurface(_surface1);

                    _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                    //------------------------------------------------------------------------------------
                    //after make the frameBuffer current
                    //then all drawing command will apply to frameBuffer
                    //do draw to frame buffer here
                    _pcx.Clear(PixelFarm.Drawing.Color.Black);
                    _pcx.DrawImage(_glbmp, 5, 5);
                    //------------------------------------------------------------------------------------
                    _pcx.AttachToRenderSurface(null);
                    //after release current, we move back to default frame buffer again***
                    _frameBufferNeedUpdate = false;
                }
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                //_pcx.DrawFrameBuffer(_frameBuffer, 0, 0, true);

                for (int i = 0; i < 1; ++i)
                {
                    _pcx.DrawImage(_surface1.GetGLBitmap(), 100 + (i * 30), 200 + (i * 30));
                }
            }
            else
            {
                _pcx.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            _pcx.OriginKind = prevOrgKind;//restore
        }
示例#5
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.ClearColorBuffer();
            if (!_resInit)
            {
                _msdf_bmp = DemoHelper.LoadTexture(RootDemoPath.Path + @"\msdf_75.png");
                _resInit  = true;
            }
            _pcx.Clear(PixelFarm.Drawing.Color.White);

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

            _pcx.DrawImageWithSubPixelRenderingMsdf(_msdf_bmp, 200, 500, 15f);
            //canvas2d.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 300, 500, 0.5f);
            //canvas2d.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 300, 520, 0.4f);
            //canvas2d.DrawImageWithSubPixelRenderingMsdf(msdf_bmp, 300, 550, 0.3f);

            ////
            //canvas2d.DrawImageWithMsdf(sdf_bmp, 400, 400, 6);
            //canvas2d.DrawImageWithMsdf(sdf_bmp, 400, 500, 0.5f);
            //canvas2d.DrawImageWithMsdf(sdf_bmp, 400, 520, 0.4f);
            //canvas2d.DrawImageWithMsdf(sdf_bmp, 400, 550, 0.3f);
            _pcx.DrawImage(_msdf_bmp, 100, 300);

            SwapBuffers();
        }
示例#6
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.Clear();
            //-------------------------------
            if (!_isInit)
            {
                _isInit = true;
            }
            if (_surface1.IsValid)
            {
                GLRenderSurface.InnerGLData innerData = _surface1.GetInnerGLData();
                //------------------------------------------------------------------------------------
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, innerData.FramebufferId);
                //--------
                //do draw to frame buffer here
                GL.ClearColor(OpenTK.Graphics.Color4.Red); //clear with red color
                GL.Clear(ClearBufferMask.ColorBufferBit);


                //------------------------------------------------------------------------------------
                GL.BindTexture(TextureTarget.Texture2D, innerData.TextureId);
                GL.GenerateMipmap(TextureTarget.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, 0);
                GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);//switch to default framewbuffer
                //------------------------------------------------------------------------------------

                //create gl bmp from framebuffer
                GLBitmap bmp = new GLBitmap(innerData.TextureId, _surface1.Width, _surface1.Height);
                bmp.IsBigEndianPixel = true;//since this is created from FrameBuffer so set BigEndianPixel = true


                _pcx.DrawImage(bmp, 15, 0);

                //
                GL.ClearColor(OpenTK.Graphics.Color4.White); //clear with red color
            }
            else
            {
                _pcx.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            SwapBuffers();
        }
        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)
            {
                _glbmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\leaves.jpg");
                _isInit = true;
            }
            if (_surface1.IsValid)
            {
                if (_frameBufferNeedUpdate)
                {
                    //------------------------------------------------------------------------------------
                    //framebuffer
                    _pcx.AttachToRenderSurface(_surface1);
                    //after make the frameBuffer current
                    //then all drawing command will apply to frameBuffer
                    //do draw to frame buffer here
                    _pcx.Clear(PixelFarm.Drawing.Color.Red);
                    _pcx.DrawImageWithConv3x3(_glbmp, Mat3x3ConvGen.emboss, 0, 0);
                    _pcx.AttachToRenderSurface(null);

                    //after release current, we move back to default frame buffer again***
                    _frameBufferNeedUpdate = false;
                }
                //_pcx.DrawFrameBuffer(_frameBuffer, 0, 0, true);
                _pcx.DrawImage(_surface1.GetGLBitmap(), 0, 0);
            }
            else
            {
                _pcx.Clear(PixelFarm.Drawing.Color.Blue);
            }
            //-------------------------------
            SwapBuffers();
        }
示例#8
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();
        }
示例#9
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode  = SmoothMode.Smooth;
            _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _pcx.ClearColorBuffer();
            _pcx.Clear(PixelFarm.Drawing.Color.White);


#if DEBUG
            //test only
            GLBitmapGlyphTextPrinter.s_dbugDrawTechnique    = DrawTextTechnique;
            GLBitmapGlyphTextPrinter.s_dbugUseVBO           = UseVbo;
            GLBitmapGlyphTextPrinter.s_dbugShowGlyphTexture = ShowGlyphTexture;
            GLBitmapGlyphTextPrinter.s_dbugShowMarkers      = ShowMarkers;
#endif

            //-------------------------------

            PixelFarm.Drawing.Color fillColor = PixelFarm.Drawing.Color.Black;
            switch (DrawTextColor)
            {
            case T110_DrawTextColor.Blue:
                fillColor = PixelFarm.Drawing.Color.Blue;
                break;

            case T110_DrawTextColor.Green:
                fillColor = PixelFarm.Drawing.Color.Green;
                break;

            case T110_DrawTextColor.Magenta:
                fillColor = PixelFarm.Drawing.Color.Magenta;
                break;

            case T110_DrawTextColor.Red:
                fillColor = PixelFarm.Drawing.Color.Red;
                break;

            case T110_DrawTextColor.Yellow:
                fillColor = PixelFarm.Drawing.Color.Yellow;
                break;
            }


            int line_top = 500;
            _painter.FontFillColor = fillColor;


            _painter.DrawString("aftjypqkx", 0, line_top);

            //
            line_top = 550;
            _painter.DrawString("1234567890 ABCD", 0, line_top);
            //-------------------------------
            line_top = 570;
            if (!string.IsNullOrEmpty(UserText))
            {
                _painter.DrawString(UserText, 0, line_top);
            }

            SwapBuffers();
        }
示例#10
0
        protected override void OnGLRender(object sender, EventArgs args)
        {
            _pcx.SmoothMode      = SmoothMode.Smooth;
            _painter.StrokeColor = _pcx.StrokeColor = PixelFarm.Drawing.Color.Blue;

            _pcx.Clear(PixelFarm.Drawing.Color.White); //set clear color and clear all buffer
            _pcx.ClearColorBuffer();                   //test , clear only color buffer
                                                       //-------------------------------

            float prevStrokeW = _pcx.StrokeWidth;

            switch (T102_1_StrokeWidth)
            {
            default: throw new NotSupportedException();

            case T102_1_StrokeWidth.HalfPx:
                _pcx.StrokeWidth = 0.5f;
                break;

            case T102_1_StrokeWidth.OnePx:
                _pcx.StrokeWidth = 1;
                break;

            case T102_1_StrokeWidth.TwoPx:
                _pcx.StrokeWidth = 2;
                break;

            case T102_1_StrokeWidth.ThreePx:
                _pcx.StrokeWidth = 3;
                break;

            case T102_1_StrokeWidth.FourPx:
                _pcx.StrokeWidth = 4;
                break;

            case T102_1_StrokeWidth.FivePx:
                _pcx.StrokeWidth = 5;
                break;
            }
            PixelFarm.Drawing.RenderSurfaceOrientation prevOrgKind = _pcx.OriginKind; //save
            switch (DrawSet)
            {
            default:
            case T102_1_Set.Lines:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawLine(i + 10, i + 10, i + 30, i + 50);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawLine(i + 10, i + 10, i + 30, i + 50);
                    i += 50;
                }
            }
            break;

            case T102_1_Set.FillRect:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    _pcx.FillRect(PixelFarm.Drawing.Color.Red, i, i, 50, 50);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.FillRect(PixelFarm.Drawing.Color.Red, i, i, 50, 50);
                    i += 50;
                }
            }
            break;

            case T102_1_Set.DrawRect:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    _painter.DrawRect(i, i, 50, 50);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _painter.DrawRect(i, i, 50, 50);
                    i += 50;
                }
            }
            break;
            }
            _pcx.OriginKind = prevOrgKind;//restore


            _pcx.StrokeWidth = prevStrokeW;
        }
示例#11
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); //set clear color and clear all buffer
            _pcx.ClearColorBuffer();                   //test , clear only color buffer
            //-------------------------------
            if (!_isInit)
            {
                _glbmp  = DemoHelper.LoadTexture(RootDemoPath.Path + @"\logo-dark.jpg");
                _isInit = true;
            }

            PixelFarm.Drawing.RenderSurfaceOrientation prevOrgKind = _pcx.OriginKind; //save
            switch (DrawSet)
            {
            default:
            case T107_1_DrawImageSet.Full:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImage(_glbmp, i, i);         //left,top (NOT x,y)
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImage(_glbmp, i, i);         //left,top (NOT x,y)
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.Half:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    _pcx.DrawImage(_glbmp, i, i, _glbmp.Width / 2, _glbmp.Height / 2);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImage(_glbmp, i, i, _glbmp.Width / 2, _glbmp.Height / 2);         //left,top (NOT x,y)
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.ToRect:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    //PixelFarm.Drawing.RectangleF srcRect = new PixelFarm.Drawing.RectangleF(i, i, _glbmp.Width, _glbmp.Height);
                    _pcx.DrawImage(_glbmp, i, i, _glbmp.Width / 2, _glbmp.Height / 2);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    //PixelFarm.Drawing.RectangleF srcRect = new PixelFarm.Drawing.RectangleF(i, i, _glbmp.Width, _glbmp.Height);
                    _pcx.DrawImage(_glbmp, i, i, _glbmp.Width / 2, _glbmp.Height / 2);
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.ToQuad1:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    _pcx.DrawImageToQuad(_glbmp,
                                         new PixelFarm.Drawing.PointF(i, i),
                                         new PixelFarm.Drawing.PointF(i + _glbmp.Width / 2, i),
                                         new PixelFarm.Drawing.PointF(i + _glbmp.Width / 2, i + _glbmp.Height / 2),
                                         new PixelFarm.Drawing.PointF(i, i + _glbmp.Height / 2));

                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImageToQuad(_glbmp,
                                         new PixelFarm.Drawing.PointF(i, i),
                                         new PixelFarm.Drawing.PointF(i + _glbmp.Width / 2, i),
                                         new PixelFarm.Drawing.PointF(i + _glbmp.Width / 2, i + _glbmp.Height / 2),
                                         new PixelFarm.Drawing.PointF(i, i + _glbmp.Height / 2));

                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.ToQuad2:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;

                float rotateDegree = 20;

                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    float[] quad = new float[]
                    {
                        0, 0,                        //left-top
                        _glbmp.Width, 0,             //right-top
                        _glbmp.Width, _glbmp.Height, //right-bottom
                        0, _glbmp.Height             //left bottom
                    };

                    PixelFarm.CpuBlit.VertexProcessing.Affine aff =
                        PixelFarm.CpuBlit.VertexProcessing.Affine.NewMatix2(
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(-_glbmp.Width / 2, -_glbmp.Height / 2),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.RotateDeg(rotateDegree),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(i + _glbmp.Width / 2, i + _glbmp.Height / 2));


                    aff.Transform(ref quad[0], ref quad[1]);
                    aff.Transform(ref quad[2], ref quad[3]);
                    aff.Transform(ref quad[4], ref quad[5]);
                    aff.Transform(ref quad[6], ref quad[7]);


                    _pcx.DrawImageToQuad(_glbmp,
                                         new PixelFarm.Drawing.PointF(quad[0], quad[1]),
                                         new PixelFarm.Drawing.PointF(quad[2], quad[3]),
                                         new PixelFarm.Drawing.PointF(quad[4], quad[5]),
                                         new PixelFarm.Drawing.PointF(quad[6], quad[7]));

                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    float[] quad = new float[]
                    {
                        0, 0,                         //left-top
                        _glbmp.Width, 0,              //right-top
                        _glbmp.Width, -_glbmp.Height, //right-bottom
                        0, -_glbmp.Height             //left bottom
                    };

                    PixelFarm.CpuBlit.VertexProcessing.Affine aff =
                        PixelFarm.CpuBlit.VertexProcessing.Affine.NewMatix2(
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(-_glbmp.Width / 2, -_glbmp.Height / 2),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.RotateDeg(rotateDegree),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(i + _glbmp.Width / 2, i + _glbmp.Height / 2));


                    aff.Transform(ref quad[0], ref quad[1]);
                    aff.Transform(ref quad[2], ref quad[3]);
                    aff.Transform(ref quad[4], ref quad[5]);
                    aff.Transform(ref quad[6], ref quad[7]);


                    _pcx.DrawImageToQuad(_glbmp,
                                         new PixelFarm.Drawing.PointF(quad[0], quad[1]),
                                         new PixelFarm.Drawing.PointF(quad[2], quad[3]),
                                         new PixelFarm.Drawing.PointF(quad[4], quad[5]),
                                         new PixelFarm.Drawing.PointF(quad[6], quad[7]));


                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.ToQuad3:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;

                float rotateDegree = 60;

                for (int i = 0; i < 400;)
                {
                    PixelFarm.CpuBlit.VertexProcessing.Affine aff =
                        PixelFarm.CpuBlit.VertexProcessing.Affine.NewMatix2(
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(-_glbmp.Width / 2, -_glbmp.Height / 2),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.RotateDeg(rotateDegree),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(i + _glbmp.Width / 2, i + _glbmp.Height / 2));

                    _pcx.DrawImageToQuad(_glbmp, aff);


                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    PixelFarm.CpuBlit.VertexProcessing.Affine aff =
                        PixelFarm.CpuBlit.VertexProcessing.Affine.NewMatix2(
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(-_glbmp.Width / 2, -_glbmp.Height / 2),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.RotateDeg(rotateDegree),
                            PixelFarm.CpuBlit.VertexProcessing.AffinePlan.Translate(i + _glbmp.Width / 2, i + _glbmp.Height / 2));

                    _pcx.DrawImageToQuad(_glbmp, aff);


                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.SubImages0:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(0, 0, _glbmp.Width, _glbmp.Height);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(0, 0, _glbmp.Width, _glbmp.Height);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i);
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.SubImages1:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(0, 0, _glbmp.Width / 2, _glbmp.Height / 2);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(0, 0, _glbmp.Width / 2, _glbmp.Height / 2);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i);
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.SubImages2:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(20, 20, 50, 50);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(20, 20, 50, 50);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i);
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.SubImagesWithScale:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(20, 20, 50, 50);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i, 2f);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    PixelFarm.Drawing.Rectangle srcRect = new PixelFarm.Drawing.Rectangle(20, 20, 50, 50);
                    _pcx.DrawSubImage(_glbmp, ref srcRect, i, i, 2f);
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.SubImageWithBlurX:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    _pcx.DrawImageWithBlurX(_glbmp, i, i);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImageWithBlurX(_glbmp, i, i);
                    i += 50;
                }
            }
            break;

            case T107_1_DrawImageSet.SubImageWithBlurY:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    _pcx.DrawImageWithBlurY(_glbmp, i, i);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImageWithBlurY(_glbmp, i, i);
                    i += 50;
                }

                //
            }
            break;

            case T107_1_DrawImageSet.DrawWithConv3x3:
            {
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftTop;
                for (int i = 0; i < 400;)
                {
                    //left,top (NOT x,y)
                    _pcx.DrawImageWithConv3x3(_glbmp, Mat3x3ConvGen.sobelHorizontal, i, i);
                    i += 50;
                }
                //
                _pcx.OriginKind = PixelFarm.Drawing.RenderSurfaceOrientation.LeftBottom;
                for (int i = 0; i < 400;)
                {
                    _pcx.DrawImageWithConv3x3(_glbmp, Mat3x3ConvGen.emboss, i, i);
                    i += 50;
                }
            }
            break;
            }
            _pcx.OriginKind = prevOrgKind;//restore
        }