Example #1
0
        public override void UpdateViewContent(FormRenderUpdateEventArgs formRenderUpdateEventArgs)
        {
            //1. create platform bitmap
            // create the surface
            int w = 800;
            int h = 600;

            if (myImg == null)
            {
                myImg = new TestGlfw.MyNativeRGBA32BitsImage(w, h);
                //test1
                // create the surface
                var info = new SKImageInfo(w, h, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
                using (var surface = SKSurface.Create(info, myImg.Scan0, myImg.Stride))
                {
                    // start drawing
                    SKCanvas canvas = surface.Canvas;
                    DrawWithSkia(canvas);
                    surface.Canvas.Flush();
                }
            }

            var glBmp = new PixelFarm.DrawingGL.GLBitmap(w, h, myImg.Scan0);

            _glsx.DrawImage(glBmp, 0, 600);
            glBmp.Dispose();
        }
Example #2
0
        static void UpdateViewContent(FormRenderUpdateEventArgs formRenderUpdateEventArgs)
        {
            needUpdateContent = false;
            //1. create platform bitmap
            // create the surface
            int w = 800;
            int h = 600;

            if (myImg == null)
            {
                myImg = new TestGlfw.MyNativeRGBA32BitsImage(w, h);
            }


            int testNo = 2;

            if (testNo == 0)
            {
                //test1
                // create the surface
                var info = new SKImageInfo(w, h, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
                using (var surface = SKSurface.Create(info, myImg.Scan0, myImg.Stride))
                {
                    // start drawing
                    SKCanvas canvas = surface.Canvas;
                    DrawWithSkia(canvas);
                    surface.Canvas.Flush();
                }
                glBmp = new PixelFarm.DrawingGL.GLBitmap(w, h, myImg.Scan0);
            }
            else
            {
                ////---------------------------------------------------------------------------------------
                //test2
                var lionShape = new PixelFarm.Agg.SpriteShape();
                lionShape.ParseLion();
                var lionBounds = lionShape.Bounds;
                //-------------
                var aggImage   = new PixelFarm.Agg.ActualImage((int)lionBounds.Width, (int)lionBounds.Height, PixelFarm.Agg.PixelFormat.ARGB32);
                var imgGfx2d   = new PixelFarm.Agg.ImageGraphics2D(aggImage);
                var aggPainter = new PixelFarm.Agg.AggCanvasPainter(imgGfx2d);
                DrawLion(aggPainter, lionShape, lionShape.Path.Vxs);
                //-------------



                //convert affImage to texture
                glBmp = LoadTexture(aggImage);
            }
        }