예제 #1
0
 public static Product CreateCurvedTextProduct()
 {
     return(new Product
     {
         Surfaces = { new Surface(400,                                                                                                   400)
                      {
                          PrintAreas = { new PrintArea(new RectangleF(0,                                                                                                                                     0, 400, 400)) },
                          Containers =
                          {
                              new SurfaceContainer(new Collection <BaseItem>
                     {
                         new CurvedTextItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", Path.CreateEllipsePath(35,            50,                                         175, 175)),
                         new CurvedTextItem("<p>" +
                                            "<span style=\"color:rgb(0,255,0)\">Lorem ipsum dolor sit amet, </span>" +
                                            "<span style=\"color:rgb(0,255,0)\">consectetur adipiscing elit, </span>" +
                                            "<span>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</span></p>",
                                            Path.CreateEllipsePath(195,                                                                                                                                     50, 175, 175))
                         {
                             IsRichText = true
                         }
                     })
                          }
                      } }
     });
 }
예제 #2
0
        public static Product CreateVectorMaskProduct()
        {
            var photo = new FileInfo(HostingEnvironment.MapPath("~/assets/photo.jpg"));

            var items = new System.Collections.ObjectModel.Collection <BaseItem>();

            var imageItem = new ImageItem(photo, new PointF(10, 10), 100, 100);

            imageItem.Mask = new ItemMask
            {
                VectorMask = Path.CreateEllipsePath(
                    imageItem.SourceRectangle.X,
                    imageItem.SourceRectangle.Y,
                    imageItem.SourceRectangle.Width,
                    imageItem.SourceRectangle.Height)
            };

            items.Add(imageItem);

            var placeholderRectangle = new RectangleF(120, 10, 100, 100);
            var placeholderContent   = new ImageItem(photo,
                                                     placeholderRectangle.Location,
                                                     placeholderRectangle.Width,
                                                     placeholderRectangle.Height);

            var placeholder = new PlaceholderItem(placeholderContent, placeholderRectangle);
            var radius      = new[] { new SizeF(5, 5), new SizeF(10, 10) };

            var placeholderMask = Path.CreateRoundedRectanglePath(
                placeholderRectangle,
                new[] { radius[0], radius[1], radius[0], radius[1] });

            placeholder.Mask = new ItemMask {
                VectorMask = placeholderMask
            };

            items.Add(placeholder);

            var shape = new ShapeItem(Path.CreateRectanglePath(230, 10, 100, 100))
            {
                Mask = new ItemMask {
                    VectorMask = Path.CreateEllipsePath(180, 10, 100, 100)
                }
            };

            items.Add(shape);

            var boundedTextMask = new Path();

            boundedTextMask.MoveTo(340, 10);
            boundedTextMask.LineTo(390, 60);
            boundedTextMask.LineTo(340, 110);
            boundedTextMask.LineTo(290, 60);
            boundedTextMask.Close();

            items.Add(new BoundedTextItem(TestText.LoremIpsum, new RectangleF(290, 10, 100, 100), fontSize: 6)
            {
                Mask = new ItemMask {
                    VectorMask = boundedTextMask
                }
            });

            var surface = new Surface(400, 400)
            {
                PrintAreas = { new PrintArea(new RectangleF(0, 0, 400, 200)) },
                Containers =
                {
                    new SurfaceContainer(items)
                    {
                        Name = Const.MainContainerName
                    }
                }
            };

            return(new Product {
                Surfaces = { surface }
            });
        }