예제 #1
0
 //special option
 public LionOutlineSprite()
 {
     lionShape = new SpriteShape();
     lionShape.ParseLion();
     this.Width  = 500;
     this.Height = 500;
 }
예제 #2
0
        public alpha_mask2_application()
        {
            lionShape = new SpriteShape();
            lionShape.ParseLion();

            this.Width  = 800;
            this.Height = 600;

            //AnchorAll();
            //alphaMaskImageBuffer = new ReferenceImage();

#if USE_CLIPPING_ALPHA_MASK
            //alphaMask = new AlphaMaskByteClipped(alphaMaskImageBuffer, 1, 0);
#else
            //alphaMask = new AlphaMaskByteUnclipped(alphaMaskImageBuffer, 1, 0);
#endif

            //numMasksSlider = new UI.Slider(5, 5, 150, 12);
            //sliderValue = 0.0;
            //AddChild(numMasksSlider);
            //numMasksSlider.SetRange(5, 100);
            //numMasksSlider.Value = 10;
            //numMasksSlider.Text = "N={0:F3}";
            //numMasksSlider.OriginRelativeParent = Vector2.Zero;
        }
예제 #3
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);
        }
예제 #4
0
 public perspective_application()
 {
     lionShape = new SpriteShape();
     lionShape.ParseLion();
     quadPolygonControl = new PixelFarm.Agg.UI.PolygonEditWidget(4, 5.0);
     quadPolygonControl.SetXN(0, lionShape.Bounds.Left);
     quadPolygonControl.SetYN(0, lionShape.Bounds.Top);
     quadPolygonControl.SetXN(1, lionShape.Bounds.Right);
     quadPolygonControl.SetYN(1, lionShape.Bounds.Top);
     quadPolygonControl.SetXN(2, lionShape.Bounds.Right);
     quadPolygonControl.SetYN(2, lionShape.Bounds.Bottom);
     quadPolygonControl.SetXN(3, lionShape.Bounds.Left);
     quadPolygonControl.SetYN(3, lionShape.Bounds.Bottom);
 }
예제 #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);
        }
        protected override void OnReadyForInitGLShaderProgram()
        {
            lionShape = new SpriteShape();
            lionShape.ParseLion();
            RectD lionBounds = lionShape.Bounds;

            //-------------
            aggImage   = new ActualImage((int)lionBounds.Width, (int)lionBounds.Height, PixelFarm.Agg.PixelFormat.ARGB32);
            _aggsx     = new AggRenderSurface(aggImage);
            aggPainter = new AggPainter(_aggsx);


            DrawLion(aggPainter, lionShape, lionShape.Vxs);
            //convert affImage to texture
            glBmp = DemoHelper.LoadTexture(aggImage);
        }
예제 #7
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
            }
        }
        protected override void OnInitGLProgram(object sender, EventArgs args)
        {
            lionShape = new SpriteShape();
            lionShape.ParseLion();
            RectD lionBounds = lionShape.Bounds;

            //-------------
            aggImage   = new ActualImage((int)lionBounds.Width, (int)lionBounds.Height, PixelFarm.Agg.PixelFormat.ARGB32);
            imgGfx2d   = new ImageGraphics2D(aggImage);
            aggPainter = new AggCanvasPainter(imgGfx2d);

            DrawLion(aggPainter, lionShape, lionShape.Path.Vxs);
            //convert affImage to texture
            glBmp = LoadTexture(aggImage);

            int max = Math.Max(this.Width, this.Height);

            canvas2d = PixelFarm.Drawing.GLES2.GLES2Platform.CreateCanvasGL2d(max, max);
            //-------------------------
            painter = new GLCanvasPainter(canvas2d, max, max);
        }
예제 #10
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])));
            }
        }