Ejemplo n.º 1
0
        protected override void OnReadyForInitGLShaderProgram()
        {
            lionShape = new SpriteShape();
            lionShape.ParseLion();

            //flip this lion vertically before use with openGL
            PixelFarm.Agg.Transform.Affine aff = PixelFarm.Agg.Transform.Affine.NewMatix(
                PixelFarm.Agg.Transform.AffinePlan.Scale(1, -1),
                PixelFarm.Agg.Transform.AffinePlan.Translate(0, 600));
            lionVxs = new VertexStore();
            aff.TransformToVxs(lionShape.Vxs, lionVxs);
        }
Ejemplo n.º 2
0
        protected override void OnInitGLProgram(object sender, EventArgs args)
        {
            int max = Math.Max(this.Width, this.Height);

            canvas2d  = CreateCanvasGL2d(max, max);
            lionShape = new SpriteShape();
            lionShape.ParseLion();
            //flip this lion vertically before use with openGL
            PixelFarm.Agg.Transform.Affine aff = PixelFarm.Agg.Transform.Affine.NewMatix(
                PixelFarm.Agg.Transform.AffinePlan.Scale(1, -1),
                PixelFarm.Agg.Transform.AffinePlan.Translate(0, 600));
            lionVxs = new VertexStore();
            aff.TransformToVxs(lionShape.Path.Vxs, lionVxs);
            painter = new GLCanvasPainter(canvas2d, max, max);
        }
Ejemplo n.º 3
0
        public void Init2(CanvasGL2d canvas2d)
        {
            int max = 800;

            this.canvas2d = canvas2d;
            lionShape     = new SpriteShape();
            lionShape.ParseLion();
            //flip this lion vertically before use with openGL
            PixelFarm.Agg.Transform.Affine aff = PixelFarm.Agg.Transform.Affine.NewMatix(
                PixelFarm.Agg.Transform.AffinePlan.Scale(1, -1),
                PixelFarm.Agg.Transform.AffinePlan.Translate(0, 600));
            lionVxs = new VertexStore();
            aff.TransformToVxs(lionShape.Path.Vxs, lionVxs);
            painter = new GLCanvasPainter(canvas2d, max, max);
            SetPrinter(painter);
        }
        protected override void OnReadyForInitGLShaderProgram()
        {
            int max = Math.Max(this.Width, this.Height);

            lionShape = new SpriteShape();
            lionShape.ParseLion();
            //flip this lion vertically before use with openGL
            PixelFarm.Agg.Transform.Affine aff = PixelFarm.Agg.Transform.Affine.NewMatix(
                PixelFarm.Agg.Transform.AffinePlan.Scale(1, -1),
                PixelFarm.Agg.Transform.AffinePlan.Translate(0, 600));
            lionVxs = new VertexStore();
            aff.TransformToVxs(lionShape.Vxs, lionVxs);
            //convert lion vxs to renderVx

            ////-------------
            ////version 1:
            //int j = lionShape.NumPaths;
            //int[] pathList = lionShape.PathIndexList;
            //for (int i = 0; i < j; ++i)
            //{
            //    lionRenderVxList.Add(painter.CreateRenderVx(new VertexStoreSnap(lionVxs, pathList[i])));
            //}
            ////-------------
            //version 2:
            {
                tmpDrawVersion = 2;
                MultiPartPolygon mutiPartPolygon = new MultiPartPolygon();
                int     j        = lionShape.NumPaths;
                int[]   pathList = lionShape.PathIndexList;
                Color[] colors   = lionShape.Colors;
                for (int i = 0; i < j; ++i)
                {
                    //from lionvxs extract each part
                    //fetch data and add to multipart polygon
                    //if (i != 4) continue;
                    //if (i > 1)
                    //{
                    //    break;
                    //}
                    mutiPartPolygon.AddVertexSnap(new VertexStoreSnap(lionVxs, pathList[i]));
                }
                //then create single render vx
                this.multipartTessResult = painter.CreateMultiPartTessResult(mutiPartPolygon);
                //create render vx for the multipart test result
            }
        }
Ejemplo n.º 5
0
        protected override void OnInitGLProgram(object sender, EventArgs args)
        {
            int max = Math.Max(this.Width, this.Height);

            canvas2d  = CreateCanvasGL2d(max, max);
            lionShape = new SpriteShape();
            lionShape.ParseLion();
            //flip this lion vertically before use with openGL
            PixelFarm.Agg.Transform.Affine aff = PixelFarm.Agg.Transform.Affine.NewMatix(
                PixelFarm.Agg.Transform.AffinePlan.Scale(1, -1),
                PixelFarm.Agg.Transform.AffinePlan.Translate(0, 600));
            lionVxs = new VertexStore();
            aff.TransformToVxs(lionShape.Path.Vxs, lionVxs);
            painter = new GLCanvasPainter(canvas2d, max, max);
            //convert lion vxs to renderVx

            int j = lionShape.NumPaths;

            int[] pathList = lionShape.PathIndexList;
            for (int i = 0; i < j; ++i)
            {
                lionRenderVxList.Add(painter.CreateRenderVx(new VertexStoreSnap(lionVxs, pathList[i])));
            }
        }