Example #1
0
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="x">The X coord of the left side</param>
 /// <param name="y">The Y coord of the upper side</param>
 /// <param name="w">Width</param>
 /// <param name="h">Height</param>
 /// <param name="color">The color to draw the rectangle in</param>
 /// <param name="angle">The angle of the rectangle in radians</param>
 public static Action <SpriteBatch> FillRectangle(this float x, float y, float w, float h, Color color, float angle)
 {
     return((sp) =>
     {
         FillRectangle(new Vector2(x, y), new Vector2(w, h), color, angle)(sp);
     });
 }
Example #2
0
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="location">Where to draw</param>
 /// <param name="size">The size of the rectangle</param>
 /// <param name="color">The color to draw the rectangle in</param>
 public static Action <SpriteBatch> FillRectangle(this Vector2 location, Vector2 size, Color color)
 {
     return((sp) =>
     {
         FillRectangle(location, size, color, 0.0f)(sp);
     });
 }
        private void ShowTooltip(Point pt)
        {
            var        tooltip = string.Empty;
            RectangleF rect    = new RectangleF();

            if (StrokeRectangle.Contains(pt))
            {
                tooltip = Resources.StrokeColorToolTip;
                rect    = StrokeRectangle;
            }
            else if (FillRectangle.Contains(pt))
            {
                tooltip = Resources.FillColorToolTip;
                rect    = FillRectangle;
            }
            else if (SwapImageRectangle.Contains(pt))
            {
                tooltip = Resources.SwapColorsToolTip;
                rect    = SwapImageRectangle;
            }
            //Если курсор переместился в другой прямоугольник
            if (!Equals(rect, _prevRect))
            {
                toolTip1.SetToolTip(this, tooltip);
            }
            _prevRect = rect;
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;

            var rect = FillRectangle.RInflate(-1, -1);

            e.Graphics.FillRectangle(Brushes.White, rect);
            rect.Draw(e.Graphics, Pens.Black);
            e.Graphics.FillRectangle(Fill.Brush(), rect.RInflate(-2, -2));

            rect = StrokeRectangle.RInflate(-1, -1);
            e.Graphics.FillRectangle(Brushes.White, rect);
            rect.Draw(e.Graphics, Pens.Black);
            e.Graphics.FillRectangle(Stroke.Brush(), rect.RInflate(-2, -2));

            e.Graphics.DrawImage(SwapImage, SwapImageRectangle);
        }
        protected override void OnMouseClick(MouseEventArgs e)
        {
            var index = -1;

            //В каком прямоугольнике кликнули
            if (StrokeRectangle.Contains(e.Location))//цвет контура
            {
                index = 1;
            }
            else if (FillRectangle.Contains(e.Location))//цвет фона
            {
                index = 0;
            }
            else if (SwapImageRectangle.Contains(e.Location))//поменять цвета
            {
                SwapColors();
                return;
            }
            if (index == -1)
            {
                return;
            }
            using (var dialog = new ColorDialog())
            {
                dialog.Color          = index == 0 ? Fill : Stroke;
                dialog.SolidColorOnly = false;
                if (dialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                switch (index)
                {
                case 0:
                    Fill = dialog.Color;
                    break;

                case 1:
                    Stroke = dialog.Color;
                    break;
                }
            }
        }
            private IEnumerator <bool> FillRect(int x, int y, int width, int height)
            {
                Vector2I startPos = new Vector2I(x, y);
                Vector2I endPos   = startPos + new Vector2I(width, height);

                var rectangle = new FillRectangle(startPos, endPos, color);

                var task = new Task(rectangle.Generate());

                while (task.MoveNext())
                {
                    yield return(true);
                }

                task = new Task(canvas.MergeCanvas(rectangle.Draw(), rectangle.Position, 100));

                while (task.MoveNext())
                {
                    yield return(true);
                }
            }
        /// <summary>
        /// Insert Image into Slide
        /// </summary>
        /// <param name="filePath">PowerPoint Path</param>
        /// <param name="imagePath">Image Path</param>
        /// <param name="imageExt">Image Extension</param>
        public void InsertImageInLastSlide(Slide slide, string imagePath, string imageExt)
        {
            // Creates a Picture instance and adds its children.
            P.Picture picture = new P.Picture();
            string    embedId = string.Empty;

            embedId = "rId" + (slide.Elements <P.Picture>().Count() + 915).ToString();
            P.NonVisualPictureProperties nonVisualPictureProperties = new P.NonVisualPictureProperties(
                new P.NonVisualDrawingProperties()
            {
                Id = (UInt32Value)4U, Name = "Picture 5"
            },
                new P.NonVisualPictureDrawingProperties(new D.PictureLocks()
            {
                NoChangeAspect = true
            }),
                new ApplicationNonVisualDrawingProperties());

            P.BlipFill blipFill = new P.BlipFill();
            Blip       blip     = new Blip()
            {
                Embed = embedId
            };

            // Creates a BlipExtensionList instance and adds its children
            BlipExtensionList blipExtensionList = new BlipExtensionList();
            BlipExtension     blipExtension     = new BlipExtension()
            {
                Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}"
            };

            UseLocalDpi useLocalDpi = new UseLocalDpi()
            {
                Val = false
            };

            useLocalDpi.AddNamespaceDeclaration("a14",
                                                "http://schemas.microsoft.com/office/drawing/2010/main");

            blipExtension.Append(useLocalDpi);
            blipExtensionList.Append(blipExtension);
            blip.Append(blipExtensionList);

            Stretch       stretch       = new Stretch();
            FillRectangle fillRectangle = new FillRectangle();

            stretch.Append(fillRectangle);

            blipFill.Append(blip);
            blipFill.Append(stretch);

            // Creates a ShapeProperties instance and adds its children.
            P.ShapeProperties shapeProperties = new P.ShapeProperties();

            D.Transform2D transform2D = new D.Transform2D();
            D.Offset      offset      = new D.Offset()
            {
                X = 457200L, Y = 1524000L
            };
            D.Extents extents = new D.Extents()
            {
                Cx = 8229600L, Cy = 5029200L
            };

            transform2D.Append(offset);
            transform2D.Append(extents);

            D.PresetGeometry presetGeometry = new D.PresetGeometry()
            {
                Preset = D.ShapeTypeValues.Rectangle
            };
            D.AdjustValueList adjustValueList = new D.AdjustValueList();

            presetGeometry.Append(adjustValueList);

            shapeProperties.Append(transform2D);
            shapeProperties.Append(presetGeometry);

            picture.Append(nonVisualPictureProperties);
            picture.Append(blipFill);
            picture.Append(shapeProperties);

            slide.CommonSlideData.ShapeTree.AppendChild(picture);

            // Generates content of imagePart.
            ImagePart  imagePart  = slide.SlidePart.AddNewPart <ImagePart>(@"image/" + imageExt, embedId);
            FileStream fileStream = new FileStream(imagePath, FileMode.Open);

            imagePart.FeedData(fileStream);
            fileStream.Close();
        }
        /// <summary>
        /// Creates an image paragraph.
        /// </summary>
        /// <param name="relationshipId">The relationship id.</param>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <returns>The <see cref="Paragraph" /> containing the image.</returns>
        private DocumentFormat.OpenXml.Wordprocessing.Paragraph CreateImageParagraph(
            string relationshipId, string name, string description, double width, double height)
        {
            // http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.extents.aspx
            // http://polymathprogrammer.com/2009/10/22/english-metric-units-and-open-xml/

            // cx (Extent Length)
            // Specifies the length of the extents rectangle in EMUs. This rectangle shall dictate the size of the object as displayed (the result of any scaling to the original object).
            // Example: Consider a DrawingML object specified as follows:
            // <… cx="1828800" cy="200000"/>
            // The cx attributes specifies that this object has a height of 1828800 EMUs (English Metric Units). end example]
            // The possible values for this attribute are defined by the ST_PositiveCoordinate simple type (§20.1.10.42).

            // cy (Extent Width)
            // Specifies the width of the extents rectangle in EMUs. This rectangle shall dictate the size of the object as displayed (the result of any scaling to the original object).
            // Example: Consider a DrawingML object specified as follows:
            // < … cx="1828800" cy="200000"/>
            // The cy attribute specifies that this object has a width of 200000 EMUs (English Metric Units). end example]
            // The possible values for this attribute are defined by the ST_PositiveCoordinate simple type (§20.1.10.42).
            var paragraph1 = new DocumentFormat.OpenXml.Wordprocessing.Paragraph
            {
                RsidParagraphAddition  = "00D91137",
                RsidRunAdditionDefault = "00AC08EB"
            };

            var run1 = new Run();

            var runProperties1 = new RunProperties();
            var noProof1       = new NoProof();

            runProperties1.AppendChild(noProof1);

            var drawing1 = new Drawing();

            var inline1 = new Inline
            {
                DistanceFromTop    = 0U,
                DistanceFromBottom = 0U,
                DistanceFromLeft   = 0U,
                DistanceFromRight  = 0U
            };
            var extent1 = new Extent {
                Cx = 5753100L, Cy = 3600450L
            };

            extent1.Cx = (long)(width * 914400);
            extent1.Cy = (long)(height * 914400);

            var effectExtent1 = new EffectExtent {
                LeftEdge = 0L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L
            };
            var docProperties1 = new DocProperties {
                Id = 1U, Name = name, Description = description
            };

            var nonVisualGraphicFrameDrawingProperties1 = new NonVisualGraphicFrameDrawingProperties();

            var graphicFrameLocks1 = new GraphicFrameLocks {
                NoChangeAspect = true
            };

            graphicFrameLocks1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");

            nonVisualGraphicFrameDrawingProperties1.AppendChild(graphicFrameLocks1);

            var graphic1 = new Graphic();

            graphic1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");

            var graphicData1 = new GraphicData {
                Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture"
            };

            var picture1 = new Picture();

            picture1.AddNamespaceDeclaration("pic", "http://schemas.openxmlformats.org/drawingml/2006/picture");

            var nonVisualPictureProperties1 = new NonVisualPictureProperties();
            var nonVisualDrawingProperties1 = new NonVisualDrawingProperties
            {
                Id          = 0U,
                Name        = name,
                Description = description
            };

            var nonVisualPictureDrawingProperties1 = new NonVisualPictureDrawingProperties();
            var pictureLocks1 = new PictureLocks {
                NoChangeAspect = true, NoChangeArrowheads = true
            };

            nonVisualPictureDrawingProperties1.AppendChild(pictureLocks1);

            nonVisualPictureProperties1.AppendChild(nonVisualDrawingProperties1);
            nonVisualPictureProperties1.AppendChild(nonVisualPictureDrawingProperties1);

            var blipFill1 = new BlipFill();

            var blip1 = new Blip {
                Embed = relationshipId
            };

            var blipExtensionList1 = new BlipExtensionList();

            var blipExtension1 = new BlipExtension {
                Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}"
            };

            var useLocalDpi1 = new UseLocalDpi {
                Val = false
            };

            useLocalDpi1.AddNamespaceDeclaration("a14", "http://schemas.microsoft.com/office/drawing/2010/main");

            blipExtension1.AppendChild(useLocalDpi1);

            blipExtensionList1.AppendChild(blipExtension1);

            blip1.AppendChild(blipExtensionList1);
            var sourceRectangle1 = new SourceRectangle();

            var stretch1       = new Stretch();
            var fillRectangle1 = new FillRectangle();

            stretch1.AppendChild(fillRectangle1);

            blipFill1.AppendChild(blip1);
            blipFill1.AppendChild(sourceRectangle1);
            blipFill1.AppendChild(stretch1);

            var shapeProperties1 = new ShapeProperties {
                BlackWhiteMode = BlackWhiteModeValues.Auto
            };

            var transform2D1 = new Transform2D();
            var offset1      = new Offset {
                X = 0L, Y = 0L
            };
            var extents1 = new Extents {
                Cx = extent1.Cx, Cy = extent1.Cy
            };

            transform2D1.AppendChild(offset1);
            transform2D1.AppendChild(extents1);

            var presetGeometry1 = new PresetGeometry {
                Preset = ShapeTypeValues.Rectangle
            };
            var adjustValueList1 = new AdjustValueList();

            presetGeometry1.AppendChild(adjustValueList1);
            var noFill1 = new NoFill();

            var outline1 = new Outline();
            var noFill2  = new NoFill();

            outline1.AppendChild(noFill2);

            shapeProperties1.AppendChild(transform2D1);
            shapeProperties1.AppendChild(presetGeometry1);
            shapeProperties1.AppendChild(noFill1);
            shapeProperties1.AppendChild(outline1);

            picture1.AppendChild(nonVisualPictureProperties1);
            picture1.AppendChild(blipFill1);
            picture1.AppendChild(shapeProperties1);

            graphicData1.AppendChild(picture1);

            graphic1.AppendChild(graphicData1);

            inline1.AppendChild(extent1);
            inline1.AppendChild(effectExtent1);
            inline1.AppendChild(docProperties1);
            inline1.AppendChild(nonVisualGraphicFrameDrawingProperties1);
            inline1.AppendChild(graphic1);

            drawing1.AppendChild(inline1);

            run1.AppendChild(runProperties1);
            run1.AppendChild(drawing1);

            paragraph1.AppendChild(run1);

            return(paragraph1);
        }
Example #9
0
        private void insertImage(Slide slide, Size maxSize, string imagePath, int imgId)
        {
            P.Picture picture  = new P.Picture();
            string    embedId  = string.Empty;
            string    imageExt = getImageType(imagePath);
            Size      imgSize  = new ImageInfoUtils().getPPTSize(imagePath);

            embedId = "rId" + imgId.ToString();

            P.NonVisualPictureProperties nonVisualPictureProperties = new P.NonVisualPictureProperties(
                new P.NonVisualDrawingProperties()
            {
                Id = (UInt32Value)4U, Name = "Picture " + imgId
            },
                new P.NonVisualPictureDrawingProperties(new A.PictureLocks()
            {
                NoChangeAspect = true
            }),
                new P.ApplicationNonVisualDrawingProperties());
            picture.Append(nonVisualPictureProperties);

            UseLocalDpi useLocalDpi = new UseLocalDpi()
            {
                Val = false
            };

            useLocalDpi.AddNamespaceDeclaration("a14", "http://schemas.microsoft.com/office/drawing/2010/main");
            BlipExtension blipExtension = new BlipExtension()
            {
                Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}"
            };

            blipExtension.Append(useLocalDpi);
            BlipExtensionList blipExtensionList = new BlipExtensionList();

            blipExtensionList.Append(blipExtension);

            Stretch       stretch       = new Stretch();
            FillRectangle fillRectangle = new FillRectangle();

            stretch.Append(fillRectangle);

            P.ShapeProperties shapeProperties = new P.ShapeProperties()
            {
                Transform2D = new A.Transform2D()
                {
                    Offset = new A.Offset()
                    {
                        X = (maxSize.Width - imgSize.Width) / 2, Y = (maxSize.Height - imgSize.Height) / 2
                    },
                    Extents = new A.Extents()
                    {
                        Cx = imgSize.Width, Cy = imgSize.Height
                    }
                }
            };
            shapeProperties.Append(new A.PresetGeometry()
            {
                Preset = A.ShapeTypeValues.Rectangle, AdjustValueList = new A.AdjustValueList()
            });

            Blip blip = new Blip()
            {
                Embed = embedId
            };

            blip.Append(blipExtensionList);
            P.BlipFill blipFill = new P.BlipFill()
            {
                Blip = blip
            };
            blipFill.Append(stretch);
            picture.Append(blipFill);

            picture.Append(shapeProperties);

            slide.CommonSlideData.ShapeTree.AppendChild(picture);

            ImagePart  imagePart  = slide.SlidePart.AddNewPart <ImagePart>(imageExt, embedId);
            FileStream fileStream = new FileStream(imagePath, FileMode.Open);

            imagePart.FeedData(fileStream);
            fileStream.Close();
        }
Example #10
0
        public void CreateAShape(MouseEventArgs e)
        {
            switch (status)
            {
            case Status.Line:
            {
                Shape shape = new Line();
                shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                shape.ListPoints[0]    = shape.ListPoints[1] = e.Location;
                listShapes.Add(shape);
                break;
            }

            case Status.Rectangle:
            {
                Shape shape = new Rectangle();

                shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                shape.ListPoints[0]    = shape.ListPoints[1] = e.Location;
                listShapes.Add(shape);
                break;
            }

            case Status.FillRectangle:
            {
                Shape shape = new FillRectangle();
                shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                shape.SolidBrush       = solidBrush;
                shape.HatchBrush       = hatchBrush;
                shape.ListPoints[0]    = shape.ListPoints[1] = e.Location;
                listShapes.Add(shape);
                break;
            }

            case Status.Ellipse:
            {
                Shape shape = new Ellipse();
                shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                shape.ListPoints[0]    = shape.ListPoints[1] = e.Location;
                listShapes.Add(shape);
                break;
            }

            case Status.FillEllipse:
            {
                Shape shape = new FillEllipse();
                shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                shape.SolidBrush       = solidBrush;
                shape.HatchBrush       = hatchBrush;
                shape.ListPoints[0]    = shape.ListPoints[1] = e.Location;
                listShapes.Add(shape);
                break;
            }

            case Status.Curve:
            {
                if (isCurve)
                {
                    if (isSecondClickCurve)
                    {
                        listShapes[listShapes.Count - 1].ListPoints[2] = e.Location;
                    }
                    else
                    {
                        listShapes[listShapes.Count - 1].ListPoints[1] = e.Location;
                    }
                }
                else
                {
                    Shape shape = new Curve();
                    shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                    shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                    shape.ListPoints[0]    = shape.ListPoints[1] = shape.ListPoints[2] = shape.ListPoints[3] = e.Location;
                    listShapes.Add(shape);
                }
                break;
            }

            case Status.Polygon:
            {
                if (stopDrawPolygon)
                {
                    Shape shape = new Polygon();
                    shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                    shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                    listShapes.Add(shape);
                    listShapes[listShapes.Count - 1].ListPoints[0] = e.Location;
                    stopDrawPolygon = false;
                }
                Point point = e.Location;

                listShapes[listShapes.Count - 1].ListPoints.Add(point);
                listShapes[listShapes.Count - 1].ListDxDy.Add(point);
                break;
            }

            case Status.FillPolygon:
            {
                if (stopFillPolygon)
                {
                    Shape shape = new FillPolygon();
                    shape.ItsPen           = new Pen(btnColor.BackColor, Convert.ToInt16(numThickness.Value));
                    shape.ItsPen.DashStyle = (DashStyle)cbbStyle.SelectedIndex;
                    shape.SolidBrush       = solidBrush;
                    shape.HatchBrush       = hatchBrush;
                    listShapes.Add(shape);
                    listShapes[listShapes.Count - 1].ListPoints[0] = e.Location;
                    stopFillPolygon = false;
                }
                Point point = e.Location;

                listShapes[listShapes.Count - 1].ListPoints.Add(point);
                listShapes[listShapes.Count - 1].ListDxDy.Add(point);
                break;
            }
            }
        }
Example #11
0
        private void insert(SlidePart slidePart, string imagePath, string imgIdx, uint uid)
        {
            P.Picture picture = new P.Picture();
            string    embedId = imgIdx;

            P.NonVisualPictureProperties nonVisualPictureProperties = new P.NonVisualPictureProperties(
                new P.NonVisualDrawingProperties()
            {
                Id = uid--, Name = "Picture 5"
            },
                new P.NonVisualPictureDrawingProperties(new A.PictureLocks()
            {
                NoChangeAspect = true
            }),
                new ApplicationNonVisualDrawingProperties());
            P.BlipFill blipFill = new P.BlipFill();

            BlipExtensionList blipExtensionList = new BlipExtensionList();
            BlipExtension     blipExtension     = new BlipExtension()
            {
                Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}"
            };
            UseLocalDpi useLocalDpi = new UseLocalDpi()
            {
                Val = false
            };

            useLocalDpi.AddNamespaceDeclaration("a14",
                                                "http://schemas.microsoft.com/office/drawing/2010/main");

            blipExtension.Append(useLocalDpi);
            blipExtensionList.Append(blipExtension);
            Blip blip = new Blip()
            {
                Embed = embedId
            };

            blip.Append(blipExtensionList);

            Stretch       stretch       = new Stretch();
            FillRectangle fillRectangle = new FillRectangle();

            stretch.Append(fillRectangle);

            blipFill.Append(blip);
            blipFill.Append(stretch);

            // TODO calc the size
            A.Transform2D transform2D = new A.Transform2D();
            A.Offset      offset      = new A.Offset()
            {
                X = 457200L, Y = 1524000L
            };
            A.Extents extents = new A.Extents()
            {
                Cx = 8229600L, Cy = 5029200L
            };
            transform2D.Append(offset);
            transform2D.Append(extents);

            A.PresetGeometry presetGeometry = new A.PresetGeometry()
            {
                Preset = A.ShapeTypeValues.Rectangle
            };
            A.AdjustValueList adjustValueList = new A.AdjustValueList();
            presetGeometry.Append(adjustValueList);

            P.ShapeProperties shapeProperties = new P.ShapeProperties();
            shapeProperties.Append(transform2D);
            shapeProperties.Append(presetGeometry);

            picture.Append(nonVisualPictureProperties);
            picture.Append(blipFill);
            picture.Append(shapeProperties);
            slidePart.Slide.CommonSlideData.ShapeTree.AppendChild(picture);

            var ext = System.IO.Path.GetExtension(imagePath).Substring(1);

            ext = ext.Equals("png", StringComparison.OrdinalIgnoreCase) ? "image/png" : "image/jpeg";
            ImagePart imagePart = slidePart.AddNewPart <ImagePart>(ext, embedId);

            using (FileStream fileStream = new FileStream(imagePath, FileMode.Open))
            {
                imagePart.FeedData(fileStream);
            }
        }
Example #12
0
        public Run GetRun(RunProperties runProperties)
        {
            var run = new Run {
                RunProperties = runProperties.CloneNode()
            };

            run.RunProperties.AppendChild(new NoProof());

            var drawing = new Drawing();
            var inline  = new Inline
            {
                DistanceFromTop    = (UInt32Value)0U,
                DistanceFromBottom = (UInt32Value)0U,
                DistanceFromLeft   = (UInt32Value)0U,
                DistanceFromRight  = (UInt32Value)0U
            };

            var nonVisualGraphicFrameDrawingProperties1 = new Wp.NonVisualGraphicFrameDrawingProperties();

            var graphicFrameLocks1 = new A.GraphicFrameLocks()
            {
                NoChangeAspect = true
            };

            graphicFrameLocks1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");

            nonVisualGraphicFrameDrawingProperties1.Append(graphicFrameLocks1);


            var graphic1 = new Graphic();

            graphic1.AddNamespaceDeclaration("a", "http://schemas.openxmlformats.org/drawingml/2006/main");

            var graphicData1 = new GraphicData()
            {
                Uri = "http://schemas.openxmlformats.org/drawingml/2006/picture"
            };

            var picture1 = new DocumentFormat.OpenXml.Drawing.Pictures.Picture();

            picture1.AddNamespaceDeclaration("pic", "http://schemas.openxmlformats.org/drawingml/2006/picture");

            var nonVisualPictureProperties1 = new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualPictureProperties();
            var nonVisualDrawingProperties1 = new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualDrawingProperties()
            {
                Id = (UInt32Value)1U, Name = _config.Name
            };
            var nonVisualPictureDrawingProperties1 = new DocumentFormat.OpenXml.Drawing.Pictures.NonVisualPictureDrawingProperties();

            nonVisualPictureProperties1.Append(nonVisualDrawingProperties1);
            nonVisualPictureProperties1.Append(nonVisualPictureDrawingProperties1);

            var blipFill1 = new Pic.BlipFill();
            var blip1     = new Blip()
            {
                Embed = _config.Name
            };
            var blipExtensionList1 = new BlipExtensionList();

            var blipExtension1 = new BlipExtension()
            {
                Uri = "{28A0092B-C50C-407E-A947-70E740481C1C}"
            };

            var useLocalDpi1 = new A14.UseLocalDpi()
            {
                Val = false
            };

            useLocalDpi1.AddNamespaceDeclaration("a14", "http://schemas.microsoft.com/office/drawing/2010/main");

            blipExtension1.Append(useLocalDpi1);

            blipExtensionList1.Append(blipExtension1);

            blip1.Append(blipExtensionList1);

            var stretch1       = new Stretch();
            var fillRectangle1 = new FillRectangle();

            stretch1.Append(fillRectangle1);

            blipFill1.Append(blip1);
            blipFill1.Append(stretch1);

            var shapeProperties1 = new DocumentFormat.OpenXml.Drawing.Pictures.ShapeProperties();

            var transform2D1 = new Transform2D();
            var offset1      = new Offset()
            {
                X = 0L, Y = 0L
            };

            transform2D1.Append(offset1);

            var presetGeometry1 = new PresetGeometry()
            {
                Preset = ShapeTypeValues.Rectangle
            };
            var adjustValueList1 = new AdjustValueList();

            presetGeometry1.Append(adjustValueList1);

            shapeProperties1.Append(transform2D1);
            shapeProperties1.Append(presetGeometry1);

            picture1.Append(nonVisualPictureProperties1);
            picture1.Append(blipFill1);
            picture1.Append(shapeProperties1);

            graphicData1.Append(picture1);

            graphic1.Append(graphicData1);

            inline.Append(nonVisualGraphicFrameDrawingProperties1);
            inline.Append(graphic1);
            drawing.Append(inline);
            run.AppendChild(drawing);
            return(run);
        }
        public void LCDLibTests(string argument, UpdateType updateSource)
        {
            switch (argument)
            {
            case "DrawCircle":
                int      ranX = random.Next(0, 174);
                int      ranY = random.Next(0, 174);
                Vector2I pos  = new Vector2I(ranX, ranY);

                var circle = new FillCircle(pos, random.Next(1, 50), Color.White);

                drawingLib.AddElement(circle);
                break;

            case "DrawLine":
                int ranX0 = random.Next(0, 174);
                int ranY0 = random.Next(0, 174);

                int ranX1 = random.Next(0, 174);
                int ranY1 = random.Next(0, 174);

                Vector2I pointOne = new Vector2I(ranX0, ranY0);
                Vector2I pointTwo = new Vector2I(ranX1, ranY1);

                var line = new Line(pointOne, pointTwo, Color.White);
                drawingLib.AddElement(line);
                break;

            case "DrawEllipse":
                int ranEX0 = random.Next(0, 174);
                int ranEY0 = random.Next(0, 174);

                int ranEX1 = random.Next(0, 174);
                int ranEY1 = random.Next(0, 174);

                Vector2I pointEOne = new Vector2I(ranEX0, ranEY0);
                Vector2I pointETwo = new Vector2I(ranEX1, ranEY1);

                var elipse = new FillEllipse(pointEOne, pointETwo, Color.White);
                drawingLib.AddElement(elipse);
                break;

            case "DrawRect":
                int ranRX0 = random.Next(0, 174);
                int ranRY0 = random.Next(0, 174);

                int ranRX1 = random.Next(0, 174);
                int ranRY1 = random.Next(0, 174);

                Vector2I pointROne = new Vector2I(ranRX0, ranRY0);
                Vector2I pointRTwo = new Vector2I(ranRX1, ranRY1);

                var rectangle = new FillRectangle(pointROne, pointRTwo, Color.White);
                drawingLib.AddElement(rectangle);
                break;

            case "DrawPolygon":
                var positions = new List <Vector2I>();

                for (int i = 0; i < random.Next(3, 16); i++)
                {
                    positions.Add(VectorUtils.GenerateRandomVector2I(random));
                }

                var polygon = new FillPolygon(positions, Color.White);
                drawingLib.AddElement(polygon);
                break;

            case "DrawTriangle":
                positions = new List <Vector2I>();

                positions.Add(new Vector2I(100, 1));
                positions.Add(new Vector2I(100, 100));
                positions.Add(new Vector2I(200, 150));

                polygon = new FillPolygon(positions, Color.White);
                drawingLib.AddElement(polygon);

                break;

            case "DrawCharacter":
                int      ranCX0  = random.Next(0, 174);
                int      ranCY0  = random.Next(0, 174);
                Vector2I posChar = new Vector2I(ranCX0, ranCY0);

                var character = new ResizableCharacter(posChar, 'E', Color.White, 1);
                drawingLib.AddElement(character);
                break;

            case "HelloWorld":
                int      ranTX0 = random.Next(0, 174);
                int      ranTY0 = random.Next(0, 174);
                Vector2I posT   = new Vector2I(ranTX0, ranTY0);

                text = new Text(posT, "0123456789", Color.White, 1, true);
                drawingLib.AddElement(text);
                break;

            case "UpdateText":
                if (text != null)
                {
                    text.UpdateValue("Hello World!");
                }
                break;

            case "Clear":
                drawingLib.Clear();
                break;
            }

            drawingLib.RunRenderer();
            Echo($"Tasks Left in Queue: {drawingLib.RenderQueueSize}");
        }