Esempio n. 1
0
 public ImageObject(Renderer.Image image, RectangleF rect)
 {
     Brush      = PBrush.CreateSolid(Color.White);
     this.image = image;
     AddPoint(rect.Left, rect.Top, 1);
     AddPoint(rect.Right, rect.Top, 1);
     AddPoint(rect.Right, rect.Bottom, 1);
     AddPoint(rect.Left, rect.Bottom, 1);
 }
Esempio n. 2
0
        public override void Draw(GPURenderer renderer, int width, int height)
        {
            int _x = x;
            int _y = y;

            control.GetTransform().Transform(ref _x, ref _y);
            renderer.Transform(Transformation);
            PBrush     brushI = PBrush.CreateSolid(Color.White);
            PBrush     brushO = PBrush.CreateSolid(Color.Black);
            RectangleF rect   = new RectangleF(_x - innerRad, _y - innerRad, innerRad * 2, innerRad * 2);

            renderer.FillEllipse(brushI, rect);
            renderer.DrawEllipse(brushO, 4, rect);
            renderer.DrawImage(img, rect);
        }
Esempio n. 3
0
        public override void Draw(BaseRenderer r, PageFormat format, float border, Color mainColor, Color secondaryColor)
        {
            PBrush brush = PBrush.CreateSolid(mainColor);

            r.BeginCircles(brush);
            for (float x = border; x < format.Width - border; x += 5)
            {
                float xpx = Util.MmToPoint(x);
                for (float y = border; y < format.Height - border; y += 5)
                {
                    float ypx = Util.MmToPoint(y);
                    r.Circle(xpx, ypx, 1);
                }
            }
            r.EndCircle();
        }
Esempio n. 4
0
        public override void Draw(GPURenderer renderer, int width, int height)
        {
            renderer.Transform(Transformation);
            RectangleF rect = new RectangleF(0, 0, width, size);

            renderer.FillRectangle(Color.FromArgb(100, 200, 200, 200), rect);
            renderer.DrawRect(Color.Black, 1, rect);

            float scale = parent.GetTransform().GetScale();
            int   linMM = (int)(Util.PointToMm(width) / scale);
            float len1  = Util.MmToPoint(3);
            float len2  = Util.MmToPoint(5);
            float len3  = Util.MmToPoint(10);

            renderer.BeginLines(Color.Black, 1);
            for (int i = 0; i <= linMM; i++)
            {
                float x  = Util.MmToPoint(i) * scale;
                float y1 = len1;
                if (i % 5 == 0)
                {
                    y1 = len2;
                }
                if (i % 10 == 0)
                {
                    y1 = len3;
                }
                renderer.BatchedLine(new PointF(x, 0), new PointF(x, y1));
                renderer.BatchedLine(new PointF(x, size), new PointF(x, size - y1));
                //renderer.DrawLine(Color.Black, 1, new PointF(x, 0), new PointF(x, y1));
                //renderer.DrawLine(Color.Black, 1, new PointF(x, size), new PointF(x, size - y1));
            }
            renderer.EndLines();

            float  tx  = width / 2;
            double deg = Math.Abs(
                Math.Round(
                    (Transformation.GetRotation() - parent.GetTransform().GetRotation())
                    * 18000.0 / Math.PI) / 100.0);

            if (deg > 90)
            {
                deg = 180 - deg;
            }
            renderer.DrawText("" + deg + "°", PBrush.CreateSolid(Color.Tomato),
                              new RectangleF(Util.PointToMm(tx), 10, 50, 50), 20);
        }
Esempio n. 5
0
        public override void Draw(GPURenderer renderer, int width, int height)
        {
            renderer.Transform(Transformation);
            int _x = x;
            int _y = y;

            control.GetTransform().Transform(ref _x, ref _y);

            Rectangle rect = new Rectangle(_x - rad, _y - rad, 2 * rad, 2 * rad);

            renderer.DrawEllipse(PBrush.CreateSolid(Color.White), this.width, rect);
            rect.Extend(-this.width / 2);
            renderer.DrawEllipse(PBrush.CreateSolid(Color.Black), 4, rect);
            rect.Extend(this.width);
            renderer.DrawEllipse(PBrush.CreateSolid(Color.Black), 4, rect);
            Matrix3x3 mat = new Matrix3x3();

            mat.TransformRotateAt(ringRot, _x, _y);
            renderer.Transform(mat);
            renderer.DrawImage(img, new RectangleF(imRect.X + _x, imRect.Y + _y, imRect.Width, imRect.Height));
        }
Esempio n. 6
0
        public void RenderTransformed(BaseRenderer r)
        {
            if (r is GPURenderer)
            {
                GPURenderer gr  = (GPURenderer)r;
                Matrix3x3   mat = gr.GetCurrentTransform();
                gr.ResetTransform();
                gr.Transform(this.Transformation * mat);
                this.Render(r);
                gr.ResetTransform();
                gr.Transform(mat);
            }
            else
            {
            }

            r.BeginCircles(PBrush.CreateSolid(System.Drawing.Color.Lime));
            foreach (var point in Points)
            {
                r.Circle(point.X, point.Y, 4);
            }
            r.EndCircle();
        }
Esempio n. 7
0
        public override void Draw(GPURenderer renderer, int width, int height)
        {
            Matrix3x3 rotate = Matrix3x3.Rotate(angle);

            renderer.Transform(rotate);
            renderer.Transform(Transformation);
            PBrush     bgrColor = PBrush.CreateSolid(Color.FromArgb(100, 200, 200, 200));
            PBrush     fgrColor = PBrush.CreateSolid(Color.Black);
            PBrush     fntColor = PBrush.CreateSolid(Color.Tomato);
            RectangleF rect1    = new RectangleF(-ballRad, -ballRad, ballRad * 2, ballRad * 2);
            RectangleF rect2    = rect1;

            rect2.X += rad;
            renderer.FillEllipse(bgrColor, rect1);
            renderer.FillEllipse(bgrColor, rect2);
            renderer.DrawEllipse(fgrColor, 2, rect1);
            renderer.DrawEllipse(fgrColor, 2, rect2);
            renderer.DrawLine(Color.Black, 2, new PointF(ballRad, 0),
                              new PointF(rad - ballRad, 0));
            renderer.DrawLine(Color.Tomato, 1, new PointF(-ballRad, 0), new PointF(ballRad, 0));
            renderer.DrawLine(Color.Tomato, 1, new PointF(0, -ballRad), new PointF(0, ballRad));
            renderer.DrawLine(Color.Tomato, 1, new PointF(-ballRad + rad, 0), new PointF(ballRad + rad, 0));
            renderer.DrawLine(Color.Tomato, 1, new PointF(rad, -ballRad), new PointF(rad, ballRad));

            float  pageScale = parent.GetTransform().GetScale();
            float  pageRot   = parent.GetTransform().GetRotation();
            string strRad    = "" + Math.Round(Util.PointToMm(rad / pageScale) * 100.0) / 100.0;
            string strDeg    = "" + Math.Round((pageRot - angle) * 18000.0 / Math.PI) / 100.0;

            renderer.DrawText($"{strRad}mm\n{strDeg}°",
                              fntColor,
                              new RectangleF(Util.PointToMm(ballRad), Util.PointToMm(-ballRad), 500, 50),
                              10);

            renderer.ResetTransform();
        }
Esempio n. 8
0
 public ImageObject()
 {
     Brush = PBrush.CreateSolid(Color.White);
 }