private static void DrawCost(PdfCanvas canvas, Rectangle rectangle, int dividerCost, PdfFont font, Cursor topCursor)
        {
            const float textHeight        = 12f;
            const float fontSize          = 14f;
            const float textWidthPadding  = 6.5f;
            const float textHeightPadding = 4f;
            var         textRectangle     = new Rectangle(
                rectangle.GetLeft() + textWidthPadding,
                topCursor.GetCurrent() - (textHeight + textHeightPadding),
                rectangle.GetWidth(),
                textHeight);

            DrawText(canvas, dividerCost.ToString(), textRectangle, font, ColorConstants.BLACK, fontSize, FontWeight.Regular);
            topCursor.AdvanceCursor(-(textRectangle.GetHeight() + textHeightPadding));

            const float imageHeight    = 15f;
            var         imageRectangle = new Rectangle(
                rectangle.GetLeft(),
                topCursor.GetCurrent() + 3 - imageHeight,
                rectangle.GetWidth(),
                imageHeight);

            DrawImage(imageRectangle, canvas, Path.Combine(CurrentPath, "AeonsEnd", "Aether.png"), centerHorizontally: true, centerVertically: true);
            topCursor.AdvanceCursor(-imageRectangle.GetHeight());
        }
        private static void DrawCosts(
            PdfFont boldFont,
            DominionCard card,
            Rectangle rectangle,
            PdfCanvas canvas,
            Cursor topCursor)
        {
            const float firstCostImageHeightOffset = 3f;

            topCursor.AdvanceCursor(-firstCostImageHeightOffset);
            const float costPadding         = 1f;
            var         hasAnyCoinCost      = !string.IsNullOrWhiteSpace(card.Cost);
            var         hasZeroCoinCost     = card.Cost == "0";
            var         hasPotionCost       = card.Potcost == 1;
            var         hasDebtCost         = card.Debtcost.HasValue;
            var         hasAnyCost          = hasAnyCoinCost || hasPotionCost || hasDebtCost;
            var         hasOnlyZeroCoinCost = hasZeroCoinCost && !hasPotionCost && !hasDebtCost;

            if (hasAnyCoinCost && (!hasZeroCoinCost || hasOnlyZeroCoinCost))
            {
                DrawCost(boldFont, rectangle, canvas, topCursor, card.Cost, costPadding);
            }
            if (hasPotionCost)
            {
                DrawPotionCost(rectangle, canvas, topCursor, costPadding);
            }
            if (hasDebtCost)
            {
                DrawDebtCost(boldFont, rectangle, canvas, topCursor, card.Debtcost, costPadding);
            }
            if (!hasAnyCost)
            {
                topCursor.AdvanceCursor(-4f);
            }
        }
        private static void DrawCost(PdfContentByte canvas, Rectangle rectangle, int dividerCost, BaseFont baseFont, Cursor topCursor)
        {
            const float textHeight        = 12f;
            const float fontSize          = 14f;
            const float textHeightPadding = 0f;
            const float textWidthPadding  = 10f;
            var         font          = new Font(baseFont, fontSize, Font.NORMAL, BaseColor.BLACK);
            var         textRectangle = new Rectangle(
                rectangle.Left + textWidthPadding,
                topCursor.GetCurrent() - (textHeight + textHeightPadding),
                rectangle.Right,
                topCursor.GetCurrent() - textHeightPadding);

            DrawText(canvas, dividerCost.ToString(), textRectangle, font);
            topCursor.AdvanceCursor(-(textRectangle.Height + textHeightPadding));

            const float imageHeight    = 15f;
            var         imageRectangle = new Rectangle(
                rectangle.Left,
                topCursor.GetCurrent() + 3 - imageHeight,
                rectangle.Right,
                topCursor.GetCurrent() + 3);

            DrawImage(imageRectangle, canvas, GetCurrentPath + @"AeonsEnd\Aether.png", centerHorizontally: true, centerVertically: false);
            topCursor.AdvanceCursor(-imageRectangle.Height);
        }
示例#4
0
        private static void DrawFactionsAndTypes(Hero hero, Rectangle rectangle, PdfCanvas canvas, Cursor topCursor, Cursor bottomCursor)
        {
            foreach (var faction in hero.Factions)
            {
                DrawFaction(rectangle, canvas, topCursor, faction);
            }

            var leftHalfRectangle     = new Rectangle(rectangle.GetLeft(), rectangle.GetBottom(), rectangle.GetWidth() / 2, rectangle.GetHeight());
            var rightHalfRectangle    = new Rectangle(rectangle.GetLeft() + rectangle.GetWidth() / 2, rectangle.GetBottom(), rectangle.GetWidth() / 2, rectangle.GetHeight());
            var secondaryBottomCursor = new Cursor();

            secondaryBottomCursor.AdvanceCursor(bottomCursor.GetCurrent());
            for (var i = 0; i < hero.Cards.Count; i++)
            {
                var card = hero.Cards[i];
                var halfRectangleToUse = i % 2 != 0 ? leftHalfRectangle : rightHalfRectangle;
                var cursorToUse        = i % 2 != 0 ? bottomCursor : secondaryBottomCursor;
                var cardTypes          = card.HeroCardSection1.HeroCardTypes;
                if (card.HeroCardSection2 != null)
                {
                    cardTypes = cardTypes.Concat(card.HeroCardSection2.HeroCardTypes).ToList();
                }
                if (cardTypes.Count == 1)
                {
                    DrawSingleCardType(cardTypes.Single(), halfRectangleToUse, canvas, cursorToUse);
                }
                else
                {
                    DrawCompositeType(cardTypes, halfRectangleToUse, canvas, cursorToUse);
                }
            }
        }
        public static byte[] CreateLabels(IEnumerable <Expansion> expansionsToPrint)
        {
            var cardsToPrint = DominionCardDataAccess.GetCardsToPrint(expansionsToPrint);

            var trajan               = Path.Combine(CurrentPath, "Fonts", "TRAJANPROREGULAR.TTF");
            var trajanBold           = Path.Combine(CurrentPath, "Fonts", "TRAJANPROBOLD.TTF");
            var font                 = PdfFontFactory.CreateFont(trajan, true);
            var boldFont             = PdfFontFactory.CreateFont(trajanBold, true);
            var drawActionRectangles = cardsToPrint.SelectMany(card => new List <Action <PdfCanvas, Rectangle> >
            {
                (canvas, rectangle) =>
                {
                    var topCursor    = new Cursor();
                    var bottomCursor = new Cursor();
                    topCursor.AdvanceCursor(rectangle.GetTop());
                    bottomCursor.AdvanceCursor(rectangle.GetBottom());
                    DrawBackgroundImage(card.SuperType, rectangle, canvas);
                    DrawCosts(boldFont, card, rectangle, canvas, topCursor);
                    DrawSetImageAndReturnTop(rectangle, bottomCursor, card.Set.Image, canvas);

                    var cardName = card.GroupName ?? card.Name;
                    DrawCardText(rectangle, topCursor, bottomCursor, canvas, cardName, font, card.SuperType);
                }
            }).ToList();
            var drawActionRectangleQueue = new Queue <Action <PdfCanvas, Rectangle> >(drawActionRectangles);

            return(PdfGenerator.DrawRectangles(drawActionRectangleQueue, ColorConstants.WHITE));
        }
        private static void DrawBackground(PdfContentByte canvas, Rectangle rectangle, string dividerType, Cursor topCursor, Cursor bottomCursor)
        {
            var image = DrawImage(rectangle, canvas, GetCurrentPath + $@"AeonsEnd\{dividerType}.png", centerHorizontally: true, centerVertically: true);

            bottomCursor.AdvanceCursor(image.AbsoluteY);
            topCursor.AdvanceCursor(bottomCursor.GetCurrent() + image.ScaledHeight);
        }
        private static void DrawBackgroundImage(CardSuperType superType, Rectangle rectangle, PdfContentByte canvas, Cursor topCursor, Cursor bottomCursor)
        {
            var imageNameTokens = superType.Card_type_image.Split('.');
            var imagePath       = GetCurrentPath + $@"Dominion\{imageNameTokens[0]}_nc.{imageNameTokens[1]}";
            var image           = DrawImage(rectangle, canvas, imagePath, true, true);

            bottomCursor.AdvanceCursor(image.AbsoluteY);
            topCursor.AdvanceCursor(bottomCursor.GetCurrent() + image.ScaledHeight);
        }
        private static void DrawPotionCost(Rectangle rectangle, PdfContentByte canvas, Cursor topCursor, float costPadding)
        {
            const float potionCostRectangleHeight  = 6f;
            const float potionCostImageWidthOffset = 6f;

            topCursor.AdvanceCursor(-(potionCostRectangleHeight + costPadding));
            var currentCostRectangle = new Rectangle(rectangle.Left + potionCostImageWidthOffset, topCursor.GetCurrent(),
                                                     rectangle.Right, topCursor.GetCurrent() + potionCostRectangleHeight);

            DrawImage(currentCostRectangle, canvas, GetCurrentPath + @"Dominion\potion.png");
        }
        private static void DrawGoldLabel(Rectangle rectangle, Cursor topCursor, PdfContentByte canvas, Beer beer)
        {
            const float goldLabelImageHeight        = 12f;
            const float goldLabelImageHeightPadding = 3f;
            var         goldLabelRectangle          = new Rectangle(
                rectangle.Left,
                topCursor.GetCurrent() - goldLabelImageHeight,
                rectangle.Right,
                topCursor.GetCurrent());

            DrawImage(goldLabelRectangle, canvas, GetCurrentPath + "Brewcrafters\\" + beer.GoldLabelImageName, centerHorizontally: true);
            topCursor.AdvanceCursor(-(goldLabelRectangle.Height + goldLabelImageHeightPadding));
        }
示例#10
0
        private static void DrawBarrel(Rectangle rectangle, Cursor topCursor, PdfCanvas canvas)
        {
            const float barrelImageHeight        = 12f;
            const float barrelImageHeightPadding = 3f;
            var         barrelRectangle          = new Rectangle(
                rectangle.GetLeft(),
                topCursor.GetCurrent() - barrelImageHeight,
                rectangle.GetWidth(),
                barrelImageHeight);

            DrawImage(barrelRectangle, canvas, Path.Combine(CurrentPath, "Brewcrafters", "Barrel.png"), centerHorizontally: true);
            topCursor.AdvanceCursor(-(barrelRectangle.GetHeight() + barrelImageHeightPadding));
        }
示例#11
0
        private static void DrawGoldLabel(Rectangle rectangle, Cursor topCursor, PdfCanvas canvas, Beer beer)
        {
            const float goldLabelImageHeight        = 12f;
            const float goldLabelImageHeightPadding = 3f;
            var         goldLabelRectangle          = new Rectangle(
                rectangle.GetLeft(),
                topCursor.GetCurrent() - goldLabelImageHeight,
                rectangle.GetWidth(),
                goldLabelImageHeight);

            DrawImage(goldLabelRectangle, canvas, Path.Combine(CurrentPath, "Brewcrafters", beer.GoldLabelImageName), centerHorizontally: true);
            topCursor.AdvanceCursor(-(goldLabelRectangle.GetHeight() + goldLabelImageHeightPadding));
        }
        private static void DrawBarrel(Rectangle rectangle, Cursor topCursor, PdfContentByte canvas)
        {
            const float barrelImageHeight        = 12f;
            const float barrelImageHeightPadding = 3f;
            var         barrelRectangle          = new Rectangle(
                rectangle.Left,
                topCursor.GetCurrent() - barrelImageHeight,
                rectangle.Right,
                topCursor.GetCurrent());

            DrawImage(barrelRectangle, canvas, GetCurrentPath + "Brewcrafters\\Barrel.png", centerHorizontally: true);
            topCursor.AdvanceCursor(-(barrelRectangle.Height + barrelImageHeightPadding));
        }
        private static void DrawPotionCost(Rectangle rectangle, PdfCanvas canvas, Cursor topCursor, float costPadding)
        {
            const float potionCostRectangleHeight  = 6f;
            const float potionCostImageWidthOffset = 6f;

            topCursor.AdvanceCursor(-(potionCostRectangleHeight + costPadding));
            var currentCostRectangle = new Rectangle(
                rectangle.GetLeft() + potionCostImageWidthOffset,
                topCursor.GetCurrent(),
                rectangle.GetWidth() - potionCostImageWidthOffset,
                potionCostRectangleHeight);

            DrawImage(currentCostRectangle, canvas, Path.Combine(CurrentPath, "Dominion", "potion.png"));
        }
示例#14
0
 private static Action <PdfCanvas, Rectangle> CreateActionToDrawNameAndSet(string name, string set, PdfFont baseFont, Color color)
 {
     return((canvas, rectangle) =>
     {
         var topCursor = new Cursor();
         var bottomCursor = new Cursor();
         const float startOfLabelOffset = 4f;
         topCursor.AdvanceCursor(rectangle.GetTop() - startOfLabelOffset);
         bottomCursor.AdvanceCursor(rectangle.GetBottom() + startOfLabelOffset);
         TextSharpHelpers.DrawRoundedRectangle(canvas, rectangle, color);
         DrawCardText(rectangle, topCursor, bottomCursor, canvas, name, baseFont);
         DrawSetText(rectangle, topCursor, bottomCursor, canvas, set, baseFont);
     });
 }
示例#15
0
        private static void DrawCardType(Rectangle rectangle, PdfCanvas canvas, Cursor bottomCursor, string imagePath)
        {
            const float cardImageHeight        = 10f;
            const float cardImageHeightPadding = 3f;
            var         cardRectangle          = new Rectangle(
                rectangle.GetLeft(),
                bottomCursor.GetCurrent(),
                rectangle.GetWidth(),
                cardImageHeight);

            DrawImage(cardRectangle, canvas, imagePath,
                      centerHorizontally: true);

            bottomCursor.AdvanceCursor(cardRectangle.GetHeight() + cardImageHeightPadding);
        }
        private static void DrawHops(Rectangle rectangle, Cursor topCursor, PdfContentByte canvas)
        {
            const float hopsImageHeight        = 10f;
            const float hopsImageHeightPadding = 3f;
            const float hopsImageWidth         = 14f;
            const float hopsImageWidthPadding  = 7f;
            var         hopsRectangle          = new Rectangle(
                rectangle.Left + hopsImageWidthPadding,
                topCursor.GetCurrent() - hopsImageHeight,
                rectangle.Left + hopsImageWidthPadding + hopsImageWidth,
                topCursor.GetCurrent());

            DrawImage(hopsRectangle, canvas, GetCurrentPath + "Brewcrafters\\Hops.png", centerVertically: true);
            topCursor.AdvanceCursor(-(hopsRectangle.Height + hopsImageHeightPadding));
        }
        private static void DrawExpansionLogo(PdfCanvas canvas, Rectangle rectangle, string expansion, PdfFont font, Cursor bottomCursor)
        {
            const float textHeight        = 18f;
            const float fontSize          = 8f;
            const float textWidthPadding  = 8f;
            const float textHeightPadding = 1f;
            var         textRectangle     = new Rectangle(
                rectangle.GetLeft() + textWidthPadding,
                bottomCursor.GetCurrent() + textHeightPadding,
                rectangle.GetWidth(),
                textHeight);

            DrawText(canvas, expansion, textRectangle, font, ColorConstants.BLACK, fontSize, FontWeight.Regular);
            bottomCursor.AdvanceCursor(textRectangle.GetHeight() + textHeightPadding);
        }
示例#18
0
        private static void DrawHops(Rectangle rectangle, Cursor topCursor, PdfCanvas canvas)
        {
            const float hopsImageHeight        = 10f;
            const float hopsImageHeightPadding = 3f;
            const float hopsImageWidth         = 14f;
            const float hopsImageWidthPadding  = 7f;
            var         hopsRectangle          = new Rectangle(
                rectangle.GetLeft() + hopsImageWidthPadding,
                topCursor.GetCurrent() - hopsImageHeight,
                hopsImageWidth,
                hopsImageHeight);

            DrawImage(hopsRectangle, canvas, Path.Combine(CurrentPath, "Brewcrafters", "Hops.png"), centerVertically: true);
            topCursor.AdvanceCursor(-(hopsRectangle.GetHeight() + hopsImageHeightPadding));
        }
        private static void DrawSetImageAndReturnTop(Rectangle rectangle, Cursor bottomCursor, string image, PdfContentByte canvas)
        {
            const float setImageHeight       = 7f;
            const float setImageWidthOffset  = 7f;
            const float setImageHeightOffset = 7f;
            var         setImageRectangle    = new Rectangle(rectangle.Left + setImageWidthOffset,
                                                             bottomCursor.GetCurrent() + setImageHeightOffset,
                                                             rectangle.Right,
                                                             bottomCursor.GetCurrent() + setImageHeightOffset + setImageHeight);

            if (!string.IsNullOrWhiteSpace(image))
            {
                DrawImage(setImageRectangle, canvas, GetCurrentPath + $@"Dominion\{image}");
            }
            bottomCursor.AdvanceCursor(setImageRectangle.Height + setImageHeightOffset);
        }
        private static void DrawExpansionLogo(PdfContentByte canvas, Rectangle rectangle, string expansion, BaseFont baseFont, Cursor bottomCursor)
        {
            const float textHeight        = 18f;
            const float fontSize          = 8f;
            const float textHeightPadding = 1f;
            const float textWidthPadding  = 10f;
            var         font          = new Font(baseFont, fontSize, Font.NORMAL, BaseColor.BLACK);
            var         textRectangle = new Rectangle(
                rectangle.Left + textWidthPadding,
                bottomCursor.GetCurrent() + textHeightPadding,
                rectangle.Right,
                bottomCursor.GetCurrent() + textHeightPadding + textHeight);

            DrawText(canvas, expansion, textRectangle, font);
            bottomCursor.AdvanceCursor(textRectangle.Height + textHeightPadding);
        }
        private static void DrawSetImageAndReturnTop(Rectangle rectangle, Cursor bottomCursor, string image, PdfCanvas canvas)
        {
            const float setImageHeight       = 7f;
            const float setImageWidthOffset  = 7f;
            const float setImageHeightOffset = 7f;
            var         setImageRectangle    = new Rectangle(
                rectangle.GetLeft() + setImageWidthOffset,
                bottomCursor.GetCurrent() + setImageHeightOffset,
                rectangle.GetWidth() - setImageWidthOffset,
                setImageHeight);

            if (!string.IsNullOrWhiteSpace(image))
            {
                DrawImage(setImageRectangle, canvas, Path.Combine(CurrentPath, "Dominion", $"{image}"));
            }
            bottomCursor.AdvanceCursor(setImageRectangle.GetHeight() + setImageHeightOffset);
        }
示例#22
0
        public static byte[] CreateLabels()
        {
            var garamond     = Path.Combine(CurrentPath, "Fonts", "GARA.TTF");
            var garamondBold = Path.Combine(CurrentPath, "Fonts", "GARABD.TTF");
            var font         = PdfFontFactory.CreateFont(garamond, true);
            var boldFont     = PdfFontFactory.CreateFont(garamondBold, true);

            var beers                = GetBeers();
            var labelBackground      = new DeviceRgb(254, 246, 229);
            var drawActionRectangles = beers.SelectMany(beer => new List <Action <PdfCanvas, Rectangle> >
            {
                (canvas, rectangle) =>
                {
                    TextSharpHelpers.DrawRectangle(canvas, rectangle, labelBackground);
                    //name
                    //gold label
                    const float startOfLabelOffset = 4f;
                    var topCursor = new Cursor();
                    topCursor.AdvanceCursor(rectangle.GetTop() - startOfLabelOffset);
                    if (beer.Points > 0)
                    {
                        DrawPoints(rectangle, topCursor, canvas, beer, boldFont);
                    }
                    if (beer.Barrel)
                    {
                        DrawBarrel(rectangle, topCursor, canvas);
                    }
                    if (beer.Hops)
                    {
                        DrawHops(rectangle, topCursor, canvas);
                    }
                    if (!string.IsNullOrEmpty(beer.GoldLabelImageName))
                    {
                        DrawGoldLabel(rectangle, topCursor, canvas, beer);
                    }

                    DrawBeerName(rectangle, topCursor, canvas, beer, font);
                }
            }).ToList();

            var drawActionRectangleQueue = new Queue <Action <PdfCanvas, Rectangle> >(drawActionRectangles);

            return(PdfGenerator.DrawRectangles(
                       drawActionRectangleQueue,
                       ColorConstants.WHITE));
        }
        public static byte[] CreateLabels()
        {
            var garamond     = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "GARA.TTF");
            var garamondBold = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "GARABD.TTF");
            var baseFont     = BaseFont.CreateFont(garamond, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
            var boldBaseFont = BaseFont.CreateFont(garamondBold, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);

            var beers                = GetBeers();
            var labelBackground      = new CMYKColor(0, 8, 26, 0);
            var drawActionRectangles = beers.SelectMany(beer => new List <Action <PdfContentByte, Rectangle> >
            {
                (canvas, rectangle) =>
                {
                    TextSharpHelpers.DrawRectangle(canvas, rectangle, labelBackground);
                    //name
                    //gold label
                    const float startOfLabelOffset = 4f;
                    var topCursor = new Cursor();
                    topCursor.AdvanceCursor(rectangle.Top - startOfLabelOffset);
                    if (beer.Points > 0)
                    {
                        DrawPoints(rectangle, topCursor, canvas, beer, boldBaseFont);
                    }
                    if (beer.Barrel)
                    {
                        DrawBarrel(rectangle, topCursor, canvas);
                    }
                    if (beer.Hops)
                    {
                        DrawHops(rectangle, topCursor, canvas);
                    }
                    if (!string.IsNullOrEmpty(beer.GoldLabelImageName))
                    {
                        DrawGoldLabel(rectangle, topCursor, canvas, beer);
                    }

                    DrawBeerName(rectangle, topCursor, canvas, beer, baseFont);
                }
            }).ToList();

            var drawActionRectangleQueue = new Queue <Action <PdfContentByte, Rectangle> >(drawActionRectangles);

            return(PdfGenerator.DrawRectangles(
                       drawActionRectangleQueue,
                       BaseColor.WHITE));
        }
        private static void DrawCost(BaseFont boldBaseFont, Rectangle rectangle, PdfContentByte canvas, Cursor topCursor, string cardCost, float costPadding)
        {
            const float costFontSize             = 7.5f;
            const float costTextWidthOffset      = 4.5f;
            const float coinCostImageWidthOffset = 4.5f;
            const float costTextHeightOffset     = 4.5f;
            const float coinCostRectangleHeight  = 14.5f;

            topCursor.AdvanceCursor(-(coinCostRectangleHeight + costPadding));
            var currentCostRectangle = new Rectangle(rectangle.Left + coinCostImageWidthOffset, topCursor.GetCurrent(),
                                                     rectangle.Right, topCursor.GetCurrent() + coinCostRectangleHeight);

            DrawImage(currentCostRectangle, canvas, GetCurrentPath + @"Dominion\coin_small.png");

            var font = new Font(boldBaseFont, costFontSize, Font.BOLD, BaseColor.BLACK);

            DrawText(canvas, cardCost, currentCostRectangle, costTextWidthOffset, costTextHeightOffset, font);
        }
        private static void DrawFaction(Rectangle rectangle, PdfContentByte canvas, Cursor topCursor, HeroFaction heroFaction)
        {
            const float factionImageHeight        = 10f;
            const float factionImageHeightPadding = 3f;
            var         factionRectangle          = new Rectangle(
                rectangle.Left,
                topCursor.GetCurrent() - factionImageHeight,
                rectangle.Right,
                topCursor.GetCurrent());

            if (heroFaction != HeroFaction.Unaffiliated)
            {
                DrawImage(factionRectangle, canvas, GetCurrentPath + $"Legendary\\Images\\Factions\\{heroFaction}.png",
                          centerHorizontally: true);
            }

            topCursor.AdvanceCursor(-(factionRectangle.Height + factionImageHeightPadding));
        }
        private static void DrawDebtCost(BaseFont boldBaseFont, Rectangle rectangle, PdfContentByte canvas, Cursor topCursor, int?debtCost, float costPadding)
        {
            const float debtCostImageWidthOffset = 5f;
            const float debtCostRectangleHeight  = 13f;
            const float debtCostFontSize         = 7.5f;

            topCursor.AdvanceCursor(-(debtCostRectangleHeight + costPadding));
            var currentCostRectangle = new Rectangle(rectangle.Left + debtCostImageWidthOffset, topCursor.GetCurrent(),
                                                     rectangle.Right, topCursor.GetCurrent() + debtCostRectangleHeight);

            DrawImage(currentCostRectangle, canvas, GetCurrentPath + @"Dominion\debt.png");

            const float debtCostTextWidthOffset  = 3.5f;
            const float debtCostTextHeightOffset = 4f;
            var         costText = debtCost.ToString();
            var         font     = new Font(boldBaseFont, debtCostFontSize, Font.BOLD, BaseColor.BLACK);

            DrawText(canvas, costText, currentCostRectangle, debtCostTextWidthOffset, debtCostTextHeightOffset, font);
        }
示例#27
0
        private static void DrawPoints(Rectangle rectangle, Cursor topCursor, PdfCanvas canvas, Beer beer, PdfFont font)
        {
            const float pointsImageHeight        = 12f;
            const float pointsImageHeightPadding = 3f;
            var         pointsRectangle          = new Rectangle(
                rectangle.GetLeft(),
                topCursor.GetCurrent() - pointsImageHeight,
                rectangle.GetWidth(),
                pointsImageHeight);

            DrawImage(pointsRectangle, canvas, Path.Combine(CurrentPath, "Brewcrafters", "Points.png"), centerHorizontally: true);
            topCursor.AdvanceCursor(-(pointsRectangle.GetHeight() + pointsImageHeightPadding));
            const float pointsTextWidthOffset  = 9f;
            const float pointsTextHeightOffset = 3.5f;
            const float pointsFontSize         = 10f;
            var         pointsText             = beer.Points.ToString();

            DrawText(canvas, pointsText, pointsRectangle, pointsTextWidthOffset, pointsTextHeightOffset, font, ColorConstants.BLACK, pointsFontSize, FontWeight.Bold);
        }
        private static void DrawCost(PdfFont font, Rectangle rectangle, PdfCanvas canvas, Cursor topCursor, string cardCost, float costPadding)
        {
            const float costFontSize             = 7.5f;
            const float costTextWidthOffset      = 2.5f;
            const float coinCostImageWidthOffset = 4.5f;
            const float costTextHeightOffset     = 4.5f;
            const float coinCostRectangleHeight  = 14.5f;

            topCursor.AdvanceCursor(-(coinCostRectangleHeight + costPadding));
            var currentCostRectangle = new Rectangle(
                rectangle.GetLeft() + coinCostImageWidthOffset,
                topCursor.GetCurrent(),
                rectangle.GetWidth() - coinCostImageWidthOffset,
                coinCostRectangleHeight);

            DrawImage(currentCostRectangle, canvas, Path.Combine(CurrentPath, "Dominion", "coin_small.png"));

            DrawText(canvas, cardCost, currentCostRectangle, costTextWidthOffset, costTextHeightOffset, font, ColorConstants.BLACK, costFontSize, FontWeight.Bold);
        }
        private static void DrawPoints(Rectangle rectangle, Cursor topCursor, PdfContentByte canvas, Beer beer, BaseFont boldBaseFont)
        {
            const float pointsImageHeight        = 12f;
            const float pointsImageHeightPadding = 3f;
            var         pointsRectangle          = new Rectangle(
                rectangle.Left,
                topCursor.GetCurrent() - pointsImageHeight,
                rectangle.Right,
                topCursor.GetCurrent());

            DrawImage(pointsRectangle, canvas, GetCurrentPath + "Brewcrafters\\Points.png", centerHorizontally: true);
            topCursor.AdvanceCursor(-(pointsRectangle.Height + pointsImageHeightPadding));
            const float pointsTextWidthOffset  = 11.5f;
            const float pointsTextHeightOffset = 3.5f;
            const float pointsFontSize         = 10f;
            var         pointsText             = beer.Points.ToString();
            var         font = new Font(boldBaseFont, pointsFontSize, Font.BOLD, BaseColor.BLACK);

            DrawText(canvas, pointsText, pointsRectangle, pointsTextWidthOffset, pointsTextHeightOffset, font);
        }
示例#30
0
        private static void DrawFaction(Rectangle rectangle, PdfCanvas canvas, Cursor topCursor, HeroFaction heroFaction)
        {
            const float factionImageHeight        = 10f;
            const float factionImageHeightPadding = 3f;
            var         factionRectangle          = new Rectangle(
                rectangle.GetLeft(),
                topCursor.GetCurrent() - factionImageHeight,
                rectangle.GetWidth(),
                factionImageHeight);

            if (heroFaction != HeroFaction.Unaffiliated)
            {
                DrawImage(
                    factionRectangle,
                    canvas,
                    Path.Combine(CurrentPath, "Legendary", "images", "Factions", $"{heroFaction}.png"),
                    centerHorizontally: true);
            }

            topCursor.AdvanceCursor(-(factionRectangle.GetHeight() + factionImageHeightPadding));
        }