Esempio n. 1
0
        void RunSampleE(PixelFarm.Drawing.Painter p)
        {
            //version 4:
            p.Clear(PixelFarm.Drawing.Color.White);
            p.UseLcdEffectSubPixelRendering = this.EnableSubPix;
            //--------------------------
            p.StrokeColor = PixelFarm.Drawing.Color.Black;
            p.StrokeWidth = 2.0f;
            p.DrawLine(2, 0, 10, 15);

            int lineLen = 10;
            int x       = 30;
            int y       = 30;

            p.FillColor = PixelFarm.Drawing.Color.Black;
            p.FillRect(0, 0, 1, 1);

            for (int i = 0; i < 360; i += 30)
            {
                p.DrawLine(x, y, x + lineLen * Math.Cos(DegToRad(i)), y + lineLen * Math.Sin(DegToRad(i)));
            }
            y += 10;
            for (int i = 0; i < 360; i += 360)
            {
                p.DrawLine(x, y, x + lineLen * Math.Cos(DegToRad(i)), y + lineLen * Math.Sin(DegToRad(i)));
            }
        }
Esempio n. 2
0
        void DrawBoneJoint(PixelFarm.Drawing.Painter painter, GlyphBoneJoint joint)
        {
            //--------------
            EdgeLine p_contactEdge = joint.dbugGetEdge_P();
            //mid point
            Vector2 jointPos = joint.OriginalJointPos * _pxscale;//scaled joint pos

            painter.FillRect(jointPos.X, jointPos.Y, 4, 4, PixelFarm.Drawing.Color.Yellow);
            if (joint.TipEdgeP != null)
            {
                EdgeLine tipEdge = joint.TipEdgeP;
                double   p_x, p_y, q_x, q_y;
                tipEdge.dbugGetScaledXY(out p_x, out p_y, out q_x, out q_y, _pxscale);
                //
                painter.Line(
                    jointPos.X, jointPos.Y,
                    p_x, p_y,
                    PixelFarm.Drawing.Color.White);
                painter.FillRect(p_x, p_y, 3, 3, PixelFarm.Drawing.Color.Green); //marker

                //
                painter.Line(
                    jointPos.X, jointPos.Y,
                    q_x, q_y,
                    PixelFarm.Drawing.Color.White);
                painter.FillRect(q_x, q_y, 3, 3, PixelFarm.Drawing.Color.Green); //marker
            }
            if (joint.TipEdgeQ != null)
            {
                EdgeLine tipEdge = joint.TipEdgeQ;
                double   p_x, p_y, q_x, q_y;
                tipEdge.dbugGetScaledXY(out p_x, out p_y, out q_x, out q_y, _pxscale);
                //
                painter.Line(
                    jointPos.X, jointPos.Y,
                    p_x, p_y,
                    PixelFarm.Drawing.Color.White);
                painter.FillRect(p_x, p_y, 3, 3, PixelFarm.Drawing.Color.Green); //marker

                //
                painter.Line(
                    jointPos.X, jointPos.Y,
                    q_x, q_y,
                    PixelFarm.Drawing.Color.White);
                painter.FillRect(q_x, q_y, 3, 3, PixelFarm.Drawing.Color.Green); //marker
            }
        }
        public override void Draw(PixelFarm.Drawing.Painter p)
        {
            p.Clear(Drawing.Color.White);
            //p.SmoothingMode = Drawing.SmoothingMode.AntiAlias;
            //// draw a circle
            p.FillColor = Drawing.Color.Blue;
            p.FillCircle(50, 50, 30);
            p.StrokeColor = Drawing.Color.FromArgb(20, 200, 200);
            p.DrawLine(10, 100, 520, 50);
            //// draw a filled box
            p.FillRect(60, 260, 200, 280, Drawing.Color.Yellow);

            // and an outline around it
            p.DrawRectangle(60, 260, 200, 280, Drawing.Color.Magenta);
            p.DrawString("A Simple Example", 20, 400);
            p.DrawString("A Simple Example2", 300, 350);
            p.DrawString("A Simple Example3", 300, 300);
            p.DrawString("A Simple Example4", 300, 250);
        }
Esempio n. 4
0
 public override void Draw(PixelFarm.Drawing.Painter p)
 {
     if (p is AggPainter)
     {
         var p2 = (AggPainter)p;
         p.FillColor = Drawing.Color.Red;
         p.FillRect(0, 70, 150, 120);
         //-------------------------------------------
         var innerGradient = new Gradients.GvcRadial();
         SpanInterpolatorLinear       linerInterpolator   = new SpanInterpolatorLinear(Affine.IdentityMatrix);
         LinearGradientColorsProvider linearColorProvider = new LinearGradientColorsProvider(Drawing.Color.Red, Drawing.Color.Yellow);
         SpanGenGradient spanGenGradient = new SpanGenGradient(linerInterpolator,
                                                               innerGradient,
                                                               linearColorProvider,
                                                               0, 150);
         SimpleRect srect = new SimpleRect(0, 0, 150, 50);
         var        v1    = GetFreeVxs();
         p2.Fill(srect.MakeVxs(v1), spanGenGradient);
         ReleaseVxs(ref v1);
     }
 }
Esempio n. 5
0
        void DrawPointKind(PixelFarm.Drawing.Painter painter, GlyphPoint point)
        {
            if (!DrawGlyphPoint)
            {
                return;
            }

            switch (point.PointKind)
            {
            case PointKind.C3Start:
            case PointKind.C3End:
            case PointKind.C4Start:
            case PointKind.C4End:
            case PointKind.LineStart:
            case PointKind.LineStop:

                painter.FillRect(point.OX * _pxscale, point.OY * _pxscale, 5, 5, PixelFarm.Drawing.Color.Red);

                break;
            }
        }
Esempio n. 6
0
 public void DrawMarker(float x, float y, PixelFarm.Drawing.Color color, float sizeInPx = 8)
 {
     painter.FillRect(x, y, sizeInPx, sizeInPx, color);
 }
 static void FillPoint(Vector2 v, PixelFarm.Drawing.Painter p)
 {
     p.FillRect(
         v.x, v.y,
         v.x + 3, v.y + 3);
 }