Пример #1
0
        void Test2()
        {
            _pcx.ClearColorBuffer();
            _pcx.SmoothMode      = SmoothMode.Smooth;
            _pcx.StrokeColor     = PixelFarm.Drawing.Color.Blue;
            _pcx.StrokeWidth     = 1;
            _painter.StrokeWidth = 1;
            ////line
            _painter.FillColor = PixelFarm.Drawing.Color.Green;
            _painter.FillRect(100, 100, 50, 50);
            _pcx.DrawLine(50, 50, 200, 200);

            _painter.FillRenderVx(_polygon2);
            _painter.StrokeColor = PixelFarm.Drawing.Color.Blue;
            _painter.DrawRenderVx(_polygon2);
            //-------------------------------------------
            ////polygon
            _painter.DrawRenderVx(_polygon1);
            _pcx.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);
            _pcx.StrokeColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.DrawCircle(100, 400, 25);
            ////
            _painter.FillColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.FillEllipse(200, 400, 225, 450);
            _pcx.StrokeColor = PixelFarm.Drawing.Color.OrangeRed;
            _painter.DrawEllipse(200, 400, 225, 450);
            //-------------------------------------------
            SwapBuffers();
        }
Пример #2
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;
        }