Esempio n. 1
0
        protected override void Paint(Graphics graphics, float widthInInches, float heightInInches, float dpiX, float dpiY,
                                      float xMarginInInches, float yMarginInInches, int?pageNumber = null)
        {
            var pen = new Pen(options.Colour);

            IGridPixelDimensions pixelDimensions;
            IGrid grid;

            switch (options.GridType)
            {
            case GridType.Hex:
                pixelDimensions = new HexGridPixelDimensions(xMarginInInches, yMarginInInches, widthInInches,
                                                             heightInInches, options.PolygonsPerInch, dpiX, dpiY);
                grid = new HexGrid(pixelDimensions);
                break;

            case GridType.Square:
                pixelDimensions = new SquareGridPixelDimensions(xMarginInInches, yMarginInInches, widthInInches,
                                                                heightInInches, options.PolygonsPerInch, dpiX, dpiY);
                grid = new SquareGrid(pixelDimensions);
                break;

            default:
                throw new IndexOutOfRangeException();
            }

            var pathDrawer = new PathDrawer(graphics, pen);

            pathDrawer.DrawPaths(grid.GetGrid());
        }
Esempio n. 2
0
        protected override void Paint(Graphics graphics, float widthInInches, float heightInInches, float dpiX,
                                      float dpiY, float xMarginInInches, float yMarginInInches, int?pageNumber = null)
        {
            using (var image = GetType().Assembly.GetManifestResourceStream("HexDrawer.Images.GreenGoblin.png"))
            {
                var pixelDimensions = new TuckBoxPixelDimensions(options.HeightInInches, options.WidthInInches,
                                                                 options.DepthInInches, xMarginInInches, yMarginInInches, TabAsFractionOfDepth, CornerAsFractionOfTab,
                                                                 100, 100);

                var tuckBox    = new TuckBox(pixelDimensions, image);
                var pen        = Pens.Black;
                var pathDrawer = new PathDrawer(graphics, pen);
                var paths      = new List <Path>();

                switch (pageNumber)
                {
                case null:
                    paths.AddRange(tuckBox.GetFrontAndSides());
                    paths.AddRange(tuckBox.GetAttachedBack());
                    break;

                case 1:
                    paths.AddRange(tuckBox.GetFrontAndSides());
                    break;

                case 2:
                    paths.AddRange(tuckBox.GetSeparateBack());
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(pageNumber));
                }

                foreach (var path in paths)
                {
                    pathDrawer.DrawPaths(path);
                }
            }
        }