public override void CreatePDFLayout(XGraphics page, Ellipse ellipse, XRect bounds, double scaleFactor)
 {
     if (ellipse.BackgroundColor != default)
     {
         page.DrawRectangle(ellipse.BackgroundColor.ToXBrush(), bounds);
     }
     if (ellipse.Stroke != null)
     {
         page.DrawEllipse(ellipse.Stroke.ToXPen(ellipse.StrokeThickness * scaleFactor), bounds);
     }
     if (ellipse.Fill != null)
     {
         page.DrawEllipse(ellipse.Fill.ToXBrush(), bounds);
     }
 }
Exemplo n.º 2
0
        public void DrawEllipse(Rect bounds, DrawingStyle style)
        {
            OnRendering(bounds);

            bounds.Offset(0, -_offset);

            if (style.HasFill)
            {
                _g.DrawEllipse(style.Fill.ToXBrush(bounds.Width, bounds.Height), bounds.ToXRect());
            }

            if (style.HasStroke)
            {
                _g.DrawEllipse(new XPen(style.Stroke.ToXColor(), style.StrokeThickness.Left), bounds.ToXRect());
            }
        }
Exemplo n.º 3
0
 internal static void SvgCircle2Pdf(SvgCircle element, XGraphics graphics)
 {
     if (element.Display == "none")
     {
         return;
     }
     if (element.Fill == SvgPaintServer.None)
     {
         var pen = ConvertHelper.Stroke2XPen(element.Stroke, element.StrokeWidth);
         graphics.DrawEllipse(pen, ConvertHelper.Circle2XRect(element.CenterX, element.CenterY, element.Radius));
     }
     else
     {
         var brush = ConvertHelper.Fill2XBrush(element.Fill);
         graphics.DrawEllipse(brush, ConvertHelper.Circle2XRect(element.CenterX, element.CenterY, element.Radius));
     }
 }
Exemplo n.º 4
0
        public override void Visit(ExportCircle exportCircle)
        {
            var pen = PdfHelper.CreateDashedPen(exportCircle);

            xGraphics.DrawEllipse(pen,
                                  PdfHelper.CreateBrush(exportCircle.BackColor),
                                  new XRect(containerLocation.ToXPoints(),
                                            exportCircle.Size.ToXSize()));
        }
Exemplo n.º 5
0
 static void DrawFace(XGraphics gfx, XPen pen, XBrush brush)
 {
     for (int i = 0; i < 60; i++)
     {
         int size = i % 5 == 0 ? 100 : 30;
         gfx.DrawEllipse(pen, brush, 0 - size / 2, -900 - size / 2, size, size);
         gfx.RotateTransform(6);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Draws the number in the middle of the page.
        /// </summary>
        static void DrawNumber(XGraphics gfx, XFont font, int number)
        {
            const double width = 130;

            gfx.DrawEllipse(new XPen(XColors.DarkBlue, 7), XBrushes.DarkOrange,
                            new XRect((gfx.PageSize.Width - width) / 2, (gfx.PageSize.Height - width) / 2, width, width));
            gfx.DrawString(number.ToString(), font, XBrushes.Firebrick,
                           new XRect(new XPoint(), gfx.PageSize), XStringFormats.Center);
        }
Exemplo n.º 7
0
        void DrawSecondHand(XGraphics gfx, XPen pen)
        {
            XGraphicsState gs = gfx.Save();

            gfx.RotateTransform(360 * Time.Second / 60 + 6 * Time.Millisecond / 1000);

            gfx.DrawEllipse(new XSolidBrush(pen.Color), -15, -15, 30, 30);
            gfx.DrawLine(pen, 0, 40, 0, -800);
            gfx.Restore(gs);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Demonstrates the use of XGraphics.SetClip.
        /// </summary>
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

            gfx.Save();
            gfx.TranslateTransform(50, 50);
            gfx.IntersectClip(new Rectangle(0, 0, 400, 250));
            gfx.TranslateTransform(50, 50);
            //gfx.Clear(XColor.GhostWhite);
            gfx.DrawEllipse(XPens.Green, XBrushes.Yellow, 40, 40, 500, 500);
            gfx.Restore();

            gfx.Save();
            //gfx.Transform = new XMatrix();  //XMatrix.Identity;
            gfx.TranslateTransform(200, 200);
            gfx.IntersectClip(new Rectangle(0, 0, 400, 250));
            gfx.DrawEllipse(XPens.Green, XBrushes.Yellow, 40, 40, 500, 500);
            gfx.Restore();
        }
Exemplo n.º 9
0
        public override void Visit(ExportCircle exportCircle)
        {
            var columnLocation = containerLocation;

            columnLocation.Offset(exportCircle.Location);
            var pen = PdfHelper.PdfPen(exportCircle);

            pen.DashStyle = PdfHelper.DashStyle(exportCircle);
            gfx.DrawEllipse(pen, new XRect(columnLocation.ToXPoints(),
                                           exportCircle.Size.ToXSize()));
        }
        private void DrawForAndroid(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor)
        {
            var thumbColor = toggleSwitch.ThumbColor != default ? toggleSwitch.ThumbColor : Color.WhiteSmoke;

            if (toggleSwitch.IsToggled)
            {
                var onColor = toggleSwitch.OnColor != default ? toggleSwitch.OnColor : Color.DodgerBlue;
                page.DrawRoundedRectangle(onColor.ToXBrush(), bounds.X, bounds.Y + bounds.Height * 0.25,
                                          2 * bounds.Height, bounds.Height * 0.5, bounds.Height / 2, bounds.Height / 2);
                page.DrawEllipse(thumbColor.ToXBrush(), bounds.X + bounds.Height * 1.1, bounds.Y + bounds.Height * 0.1,
                                 bounds.Height * 0.8, bounds.Height * 0.8);
            }
            else
            {
                page.DrawRoundedRectangle(Color.DarkGray.ToXBrush(), bounds.X, bounds.Y + bounds.Height * 0.25,
                                          2 * bounds.Height, bounds.Height * 0.5, bounds.Height / 2, bounds.Height / 2);
                page.DrawEllipse(Color.LightGray.ToXBrush(), bounds.X + bounds.Height * 0.1,
                                 bounds.Y + bounds.Height * 0.1, bounds.Height * 0.8, bounds.Height * 0.8);
            }
        }
Exemplo n.º 11
0
        public override void Visit(ExportCircle exportCircle)
        {
            var savedLocation = containerLocation;
            var pen           = PdfHelper.CreatePen(exportCircle);

            xGraphics.DrawEllipse(pen,
                                  PdfHelper.CreateBrush(exportCircle.BackColor),
                                  new XRect(containerLocation.ToXPoints(),
                                            exportCircle.Size.ToXSize()));
            RenderContainerInternal(exportCircle, savedLocation);
        }
Exemplo n.º 12
0
        public static void DrawHandle(UI.Controls.Canvas canvas, XGraphics graphics, Palette palette, Rect bounds, DrawingContext context, bool alwaysAlpha, bool round)
        {
            if (bounds.Width <= 0 || bounds.Height <= 0)
            {
                return;
            }

            using (var quality = new Smoothing(graphics, XSmoothingMode.Default))
            {
                XBrush brush;
                Pen    pen;
                var    alpha = 180;

                if (context.Selected)
                {
                    if (!alwaysAlpha)
                    {
                        alpha = 255;
                    }
                    brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LemonChiffon), Color.FromArgb(alpha, Color.DarkOrange));
                    pen   = palette.Pen(Color.FromArgb(alpha, Color.Chocolate), 0);
                }
                else
                {
                    brush = palette.Gradient(bounds, Color.FromArgb(alpha, Color.LightCyan), Color.FromArgb(alpha, Color.SteelBlue));
                    pen   = palette.Pen(Color.FromArgb(alpha, Color.Navy), 0);
                }

                if (round)
                {
                    graphics.DrawEllipse(brush, bounds.ToRectangleF());
//          graphics.DrawRectangle(new XPen(Color.Red), bounds.ToRectangleF() );
                    graphics.DrawEllipse(pen, bounds.ToRectangleF());
                }
                else
                {
                    graphics.DrawRectangle(brush, bounds.ToRectangleF());
                    graphics.DrawRectangle(pen, bounds.ToRectangleF());
                }
            }
        }
Exemplo n.º 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="gfx"></param>
 /// <param name="brush"></param>
 /// <param name="pen"></param>
 /// <param name="isStroked"></param>
 /// <param name="isFilled"></param>
 /// <param name="rect"></param>
 private static void DrawEllipseInternal(
     XGraphics gfx,
     XSolidBrush brush,
     XPen pen,
     bool isStroked,
     bool isFilled,
     ref XRect rect)
 {
     if (isStroked && isFilled)
     {
         gfx.DrawEllipse(pen, brush, rect);
     }
     else if (isStroked && !isFilled)
     {
         gfx.DrawEllipse(pen, rect);
     }
     else if (!isStroked && isFilled)
     {
         gfx.DrawEllipse(brush, rect);
     }
 }
        private void DrawForUWP(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor)
        {
            var thumbColor = toggleSwitch.ThumbColor != default ? toggleSwitch.ThumbColor : Color.WhiteSmoke;

            if (toggleSwitch.IsToggled)
            {
                var onColor = toggleSwitch.OnColor != default ? toggleSwitch.OnColor : Color.DodgerBlue;
                page.DrawRoundedRectangle(onColor.ToXBrush(), bounds.X, bounds.Y, 2 * bounds.Height, bounds.Height,
                                          bounds.Height, bounds.Height);
                page.DrawEllipse(thumbColor.ToXBrush(), bounds.X + bounds.Height * 1.2, bounds.Y + bounds.Height * 0.2,
                                 bounds.Height * 0.6, bounds.Height * 0.6);
            }
            else
            {
                page.DrawRoundedRectangle(new XPen(XColors.LightGray, scaleFactor), bounds.X, bounds.Y,
                                          2 * bounds.Height, bounds.Height, bounds.Height, bounds.Height);

                page.DrawEllipse(Color.Black.ToXBrush(), bounds.X + bounds.Height * 0.2, bounds.Y + bounds.Height * 0.2,
                                 bounds.Height * 0.6, bounds.Height * 0.6);
            }
        }
        private void DrawForiOS(XGraphics page, Switch toggleSwitch, XRect bounds, double scaleFactor)
        {
            var thumbColor = toggleSwitch.ThumbColor != default ? toggleSwitch.ThumbColor : Color.WhiteSmoke;

            if (toggleSwitch.IsToggled)
            {
                var onColor = toggleSwitch.OnColor != default ? toggleSwitch.OnColor : Color.Green;
                page.DrawRoundedRectangle(onColor.ToXBrush(), bounds.X, bounds.Y, 2 * bounds.Height, bounds.Height,
                                          bounds.Height, bounds.Height);
                page.DrawEllipse(thumbColor.ToXBrush(), bounds.X + bounds.Height * 1.1, bounds.Y + bounds.Height * 0.1,
                                 bounds.Height * 0.8, bounds.Height * 0.8);
            }
            else
            {
                page.DrawRoundedRectangle(new XPen(XColors.LightGray, scaleFactor), bounds.X, bounds.Y,
                                          2 * bounds.Height, bounds.Height, bounds.Height, bounds.Height);

                page.DrawEllipse(new XPen(Color.LightGray.ToXColor(), scaleFactor), bounds.X + bounds.Height * 0.1,
                                 bounds.Y + bounds.Height * 0.1, bounds.Height * 0.8, bounds.Height * 0.8);
            }
        }
Exemplo n.º 16
0
        private static void DrawVertex(XGraphics g, Vertex v, LayoutProvider layout, NetworkColorizer colorizer)
        {
            Vector3 p = layout.GetPositionOfNode(v);

            double size = ComputeNodeSize(v);

            if (!double.IsNaN(p.X) &&
                !double.IsNaN(p.Y) &&
                !double.IsNaN(p.Z))
            {
                g.DrawEllipse(new SolidBrush(colorizer[v]), p.X - size / 2d, p.Y - size / 2d, size, size);
            }
        }
Exemplo n.º 17
0
        private static void DrawVertex(XGraphics g, string v, LayoutProvider layout, NetworkColorizer colorizer)
        {
            OpenTK.Vector3 p = layout.GetPositionOfNode(v);

            double size = Renderer.ComputeNodeSize(v);

            if (!double.IsNaN(p.X) &&
                !double.IsNaN(p.Y) &&
                !double.IsNaN(p.Z))
            {
                g.DrawEllipse(new SolidBrush(colorizer[v]), p.X - size / 2d - x_offset, p.Y - size / 2d - y_offset, size, size);
            }
        }
Exemplo n.º 18
0
 private void DrawEllipse(XGraphics gfx, EllipseItem ellipse)
 {
     if (ellipse.IsFilled)
     {
         var pen = new XPen(XColor.FromArgb(ellipse.Stroke.Alpha, ellipse.Stroke.Red, ellipse.Stroke.Green, ellipse.Stroke.Blue),
                            X(ellipse.StrokeThickness == 0.0 ? XUnit.FromMillimeter(defaultStrokeThickness).Value : ellipse.StrokeThickness))
         {
             LineCap = XLineCap.Round
         };
         var brush = new XSolidBrush(XColor.FromArgb(ellipse.Fill.Alpha, ellipse.Fill.Red, ellipse.Fill.Green, ellipse.Fill.Blue));
         gfx.DrawEllipse(pen, brush, X(ellipse.X), Y(ellipse.Y), X(ellipse.Width), Y(ellipse.Height));
     }
     else
     {
         var pen = new XPen(XColor.FromArgb(ellipse.Stroke.Alpha, ellipse.Stroke.Red, ellipse.Stroke.Green, ellipse.Stroke.Blue),
                            X(ellipse.StrokeThickness == 0.0 ? XUnit.FromMillimeter(defaultStrokeThickness).Value : ellipse.StrokeThickness))
         {
             LineCap = XLineCap.Round
         };
         gfx.DrawEllipse(pen, X(ellipse.X), Y(ellipse.Y), X(ellipse.Width), Y(ellipse.Height));
     }
 }
        private static void CrateBack(XUnit pageWdith, XUnit pageHeight, PdfDocument document, string currentCardType)
        {
            PdfPage page = document.AddPage();

            page.Width  = new XUnit(pageWdith.Millimeter, XGraphicsUnit.Millimeter);
            page.Height = new XUnit(pageHeight.Millimeter, XGraphicsUnit.Millimeter);


            XGraphics gfx = XGraphics.FromPdfPage(page);

            // HACK²
            gfx.MUH = PdfFontEncoding.Unicode;
            //gfx.MFEH = PdfFontEmbedding.Default;

            gfx.ScaleAtTransform(-1, 1, page.Width / 2, page.Height / 2);

            XFont font = new XFont("Verdana", 13, XFontStyle.Regular);



            var costSize = new XSize(new XUnit(23, XGraphicsUnit.Millimeter), font.Height);

            var costMarginRight = new XUnit(5, XGraphicsUnit.Millimeter);



            var actionRect     = new XRect(costMarginRight, new XUnit(5, XGraphicsUnit.Millimeter), pageHeight * 2, costSize.Height * 2);
            var actionTextRect = actionRect;

            actionTextRect.Height = costSize.Height;
            actionTextRect.Offset(new XUnit(3, XGraphicsUnit.Millimeter), 0);

            gfx.TranslateTransform(new XUnit(3, XGraphicsUnit.Millimeter), 0);
            gfx.RotateAtTransform(90, actionRect.TopLeft);

            gfx.DrawRoundedRectangle(XPens.MidnightBlue, XBrushes.DarkSlateBlue, actionRect, new XSize(10, 10));

            gfx.ScaleAtTransform(1, -1, actionTextRect.Center);

            gfx.DrawString(currentCardType, font, XBrushes.White,
                           actionTextRect, XStringFormats.TopLeft);
            gfx.ScaleAtTransform(1, -1, actionTextRect.Center);


            gfx.RotateAtTransform(-90, actionRect.TopLeft);
            gfx.TranslateTransform(new XUnit(-3, XGraphicsUnit.Millimeter), 0);

            var circle = new XRect(new XUnit(-3, XGraphicsUnit.Millimeter), pageHeight - new XUnit(10, XGraphicsUnit.Millimeter), new XUnit(13, XGraphicsUnit.Millimeter), new XUnit(13, XGraphicsUnit.Millimeter));

            gfx.DrawEllipse(XPens.MidnightBlue, XBrushes.White, circle);
        }
Exemplo n.º 20
0
        public void Paint(XGraphics graphics, RectangleF rect, MapOptions options, Color dotColor, XBrush labelBrush, XFont labelFont)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            Point pt = Astrometrics.LocationToCoordinates(Location);

            using (RenderUtil.SaveState(graphics))
            {
                graphics.SmoothingMode = XSmoothingMode.HighSpeed;
                graphics.TranslateTransform(pt.X, pt.Y);
                graphics.ScaleTransform(1.0f / Astrometrics.ParsecScaleX, 1.0f / Astrometrics.ParsecScaleY);

                const float radius = 3;

                XBrush brush = new XSolidBrush(dotColor);
                XPen   pen   = new XPen(dotColor);
                graphics.DrawEllipse(brush, -radius / 2, -radius / 2, radius, radius);

                graphics.SmoothingMode = XSmoothingMode.HighQuality;
                graphics.DrawEllipse(pen, -radius / 2, -radius / 2, radius, radius);

                XStringFormat format = (LabelBiasX == -1) ? RenderUtil.StringFormatTopRight :
                                       (LabelBiasX == 1) ? RenderUtil.StringFormatTopLeft : RenderUtil.StringFormatTopCenter;

                XSize  size = graphics.MeasureString(Name, labelFont);
                XPoint pos  = new XPoint(0, 0);

                //pos.X += ( LabelBiasX * radius / 2 ) + ( -size.Width  * ( 1 - LabelBiasX ) / 2.0f );
                pos.Y += (LabelBiasY * radius / 2) + (-size.Height * (1 - LabelBiasY) / 2.0f);
                pos.X += (LabelBiasX * radius / 2);
                //pos.Y += ( LabelBiasY * radius / 2 );

                graphics.DrawString(Name, labelFont, labelBrush, pos.X, pos.Y, format);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Demonstrates the use of XGraphics.DrawBezier.
        /// </summary>
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

            gfx.DrawEllipse(XBrushes.Red, MakeRect(50, 100));
            gfx.DrawEllipse(XBrushes.Red, MakeRect(450, 100));
            gfx.DrawEllipse(XBrushes.Red, MakeRect(550, 190));
            gfx.DrawEllipse(XBrushes.Red, MakeRect(150, 300));

            gfx.DrawLine(XPens.Red, 50, 100, 450, 100);
            gfx.DrawLine(XPens.Red, 550, 190, 150, 300);

            gfx.DrawBezier(properties.Pen2.Pen, 50, 100, 450, 100, 550, 190, 150, 300);

            //XPoint[] points = new XPoint[1 + 3 * 3];
            //Random rnd = new Random();
            //for (int idx = 0; idx < points.Length; idx++)
            //{
            //  points[idx].X = 100 + rnd.Next(400);
            //  points[idx].Y = 200 + rnd.Next(700);
            //}
            //gfx.DrawBeziers(properties.Pen1.Pen, points);
        }
Exemplo n.º 22
0
 private static void DrawElement(XGraphics gfx, PcbShape gs, XPen pen)
 {
     if (gs is PcbLine)
     {
         gfx.DrawLine(pen, new XPoint(gs.Left, gs.Top), new XPoint(gs.Left + gs.Width, gs.Top + gs.Height));
     }
     if (gs is PcbRect)
     {
         gfx.DrawRectangle(pen, new XSolidBrush(pen.Color), gs.Left, gs.Top, gs.Width, gs.Height);
     }
     if (gs is PcbEllipse)
     {
         gfx.DrawEllipse(pen, new XSolidBrush(pen.Color), gs.Left, gs.Top, gs.Width, gs.Height);
     }
 }
Exemplo n.º 23
0
        private static void drawMeanGroup(XGraphics it, decimal currentTargetSize, decimal zoomFactor, List <Shot> shotsList, decimal rBar, decimal xBar, decimal yBar, int xLoc, int yLoc)
        {
            if (shotsList.Count >= 2)
            {
                float circle = getDimension(currentTargetSize, rBar * 2, zoomFactor);

                XPoint x = transform((float)xBar, (float)yBar, (float)currentTargetSize, zoomFactor, xLoc, yLoc);
                XPen   p = new XPen(XColor.FromKnownColor(XKnownColor.Red), 0.5);

                it.DrawEllipse(p, x.X - (circle / 2), x.Y - (circle / 2), circle, circle);

                float cross = 4; // center of group cross is always the same size - 5 pixels

                it.DrawLine(p, x.X - cross, x.Y, x.X + cross, x.Y);
                it.DrawLine(p, x.X, x.Y - cross, x.X, x.Y + cross);
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Source and more infos: http://www.math.dartmouth.edu/~dlittle/java/SpiroGraph/
        /// </summary>
        public override void RenderPage(XGraphics gfx)
        {
            base.RenderPage(gfx);

            //int R =  60, r =  60, p =   60, N = 270; // Cardioid
            //int R =  60, r = -45, p = -101, N = 270; // Rounded Square
            //int R =  75, r = -25, p =   85, N = 270; // Gold fish
            //int R =  75, r = -30, p =   60, N = 270; // Star fish
            //int R = 100, r =  49, p =   66, N =   7; // String of Pearls
            //int R =  90, r =   1, p =  105, N = 105; // Rotating Triangle

            //int R =  90, r =   1, p =  105, N = 105;
            int R = 60, r = 2, p = 122, N = 490;

            int revs = Math.Abs(r) / Gcd(R, Math.Abs(r));

            XPoint[] points = new XPoint[revs * N + 1];
            for (int i = 0; i <= revs * N; i++)
            {
                double t = 4 * i * Math.PI / N;
                points[i].X = ((R + r) * Math.Cos(t) - p * Math.Cos((R + r) * t / r));
                points[i].Y = ((R + r) * Math.Sin(t) - p * Math.Sin((R + r) * t / r));
            }

#if true
            // Draw as lines
            gfx.TranslateTransform(300, 250);
            gfx.DrawLines(properties.Pen2.Pen, points);

            //gfx.DrawPolygon(properties.Pen2.Pen, properties.Brush2.Brush, points, properties.General.FillMode);

            // Draw as closed curve
            gfx.TranslateTransform(0, 400);
            gfx.DrawClosedCurve(properties.Pen2.Pen, properties.Brush2.Brush, points, properties.General.FillMode,
                                properties.General.Tension);
#else
            gfx.TranslateTransform(300, 400);
            XSolidBrush dotBrush = new XSolidBrush(properties.Pen2.Pen.Color);
            float       width    = properties.Pen2.Width;
            for (int i = 0; i < revs * N; i++)
            {
                gfx.DrawEllipse(dotBrush, points[i].X, points[i].Y, width, width);
            }
#endif
        }
Exemplo n.º 25
0
        private void AddOmrRow(int i, ExamTaker examTaker, XGraphics gfx)
        {
            int   y    = 70 + 50 * i;
            var   text = $"{i + 1}. {examTaker.User.Name} {examTaker.User.Surname}";
            XFont font = new XFont("Arial", 12, XFontStyle.Regular);

            gfx.DrawString(text, font, XBrushes.Gray, new XPoint(15, y));

            XFont smallFont = new XFont("Arial", 5, XFontStyle.BoldItalic);

            for (int points = 0; points < 10; points++)
            {
                string pointsPlusOne = (points + 1).ToString();
                var    pointX        = 15 + points * 20;
                var    pointY        = y + 15;
                gfx.DrawEllipse(new XPen(XColor.FromKnownColor(XKnownColor.Black), 2), pointX, pointY, 10, 10);
                gfx.DrawString(pointsPlusOne, smallFont, XBrushes.LightGray, new XRect(pointX, pointY, 10, 10), XStringFormats.Center);
            }
        }
        public override void CreatePDFLayout(XGraphics page, Slider slider, XRect bounds, double scaleFactor)
        {
            double valueXPosition    = slider.Value / (slider.Maximum - slider.Minimum) * bounds.Width;
            var    minimumTrackColor = slider.MinimumTrackColor != default
                                ? slider.MinimumTrackColor.ToXBrush()
                                : XBrushes.LightBlue;
            var maximumTrackColor = slider.MaximumTrackColor != default
                                ? slider.MaximumTrackColor.ToXBrush()
                                : XBrushes.LightGray;
            var thumbColor = slider.ThumbColor != default ? slider.ThumbColor.ToXBrush() : XBrushes.LightSlateGray;

            if (slider.BackgroundColor != default)
            {
                page.DrawRectangle(slider.BackgroundColor.ToXBrush(), bounds);
            }

            page.DrawRectangle(minimumTrackColor, bounds.X, bounds.Y, valueXPosition, 8 * scaleFactor);
            page.DrawRectangle(maximumTrackColor, valueXPosition + bounds.X, bounds.Y, bounds.Width - valueXPosition,
                               8 * scaleFactor);
            page.DrawEllipse(thumbColor, bounds.X + valueXPosition - 10 * scaleFactor,
                             bounds.Y + bounds.Height % 2 - 6 * scaleFactor, 20 * scaleFactor, 20 * scaleFactor);
        }
Exemplo n.º 27
0
 void IDrawingCanvas.DrawEllipse(PenEx pen, RectangleF rect)
 {
     _graphics.DrawEllipse((Pen)pen, PdfConverter.Convert(rect));
 }
Exemplo n.º 28
0
 public void DrawEllipse(Pen pen, int x, int y, int width, int height)
 {
     _graphics.DrawEllipse(PenToXPen(pen), x, y, width, height);
 }
Exemplo n.º 29
0
 public override void Process(iPDF owner, ref PdfDocument Document, ref PdfPage Page, ref XGraphics Graphics)
 {
     Graphics.DrawEllipse(new XPen(owner.TextColor), new XSolidBrush(owner.FillColor), X, Y, R, R);
 }
Exemplo n.º 30
0
        private static void paintTarget(int dimension, int xLoc, int yLoc, int blackRingCutoff, decimal[] rings, decimal zoomFactor, bool solidInner, List <Shot> shotsList, PdfPage page)
        {
            XPen   penBlack   = new XPen(XColor.FromKnownColor(XKnownColor.Black), 0.5);
            XPen   penWhite   = new XPen(XColor.FromKnownColor(XKnownColor.Linen), 0.5);
            XBrush brushBlack = new XSolidBrush(XColor.FromKnownColor(XKnownColor.Black));
            XBrush brushWhite = new XSolidBrush(XColor.FromKnownColor(XKnownColor.Linen));

            XGraphics gfx = XGraphics.FromPdfPage(page);

            gfx.IntersectClip(new XRect(xLoc, yLoc, dimension, dimension));

            gfx.SmoothingMode = XSmoothingMode.AntiAlias;

            gfx.DrawRectangle(brushWhite, xLoc, yLoc, dimension, dimension);

            int r = 1;

            for (int i = 0; i < rings.Length; i++)
            {
                XPen   p;
                XBrush b;
                XBrush bText;
                if (r < blackRingCutoff)
                {
                    p     = penBlack;
                    b     = brushWhite;
                    bText = brushBlack;
                }
                else
                {
                    p     = penWhite;
                    b     = brushBlack;
                    bText = brushWhite;
                }

                float circle  = getDimension(dimension, rings[i], zoomFactor);
                float centerX = (dimension / 2) + xLoc;
                float centerY = (dimension / 2) + yLoc;
                float x       = centerX - (circle / 2);
                float y       = centerY - (circle / 2);
                float xInvers = centerX + (circle / 2);
                float yInvers = centerY + (circle / 2);


                if (solidInner && i == rings.Length - 1) //rifle target - last ring (10) is a solid dot
                {
                    gfx.DrawEllipse(brushWhite, x, y, circle, circle);
                }
                else
                {
                    gfx.DrawEllipse(b, x, y, circle, circle);
                    gfx.DrawEllipse(p, x, y, circle, circle);
                }

                if (r < 9) //for ring 9 and after no text is displayed
                {
                    float nextCircle = getDimension(dimension, rings[i + 1], zoomFactor);
                    float diff       = circle - nextCircle;
                    float fontSize   = diff / 6f;
                    Font  f          = new Font("Arial", fontSize, GraphicsUnit.World);

                    XStringFormat format = new XStringFormat();
                    format.LineAlignment = (XLineAlignment)XStringAlignment.Center;
                    format.Alignment     = XStringAlignment.Center;

                    gfx.DrawString(r.ToString(), f, bText, centerX, y + (diff / 4), format);
                    gfx.DrawString(r.ToString(), f, bText, centerX, yInvers - (diff / 4), format);
                    gfx.DrawString(r.ToString(), f, bText, x + (diff / 4), centerY, format);
                    gfx.DrawString(r.ToString(), f, bText, xInvers - (diff / 4), centerY, format);
                }
                r++;
            }

            gfx.DrawRectangle(penBlack, xLoc, yLoc, dimension, dimension);

            foreach (Shot shot in shotsList)
            {
                drawShot(shot, gfx, xLoc, yLoc, dimension, zoomFactor);
            }

            decimal localRbar;
            decimal localXbar;
            decimal localYbar;

            computeMeans(out localRbar, out localXbar, out localYbar, shotsList);

            drawMeanGroup(gfx, dimension, zoomFactor, shotsList, localRbar, localXbar, localYbar, xLoc, yLoc);

            gfx.Dispose();
        }