private void PrintPointsForTool(NewToolCard newCard, CardImage cardImage) { var graphics = cardImage.Graphics; var usableRectangWithPadding = cardImage.UsableRectangWithPadding; PrintPoints( graphics, newCard.Points, usableRectangWithPadding.X, usableRectangWithPadding.Y); }
private void PrintToolImage(NewToolCard newCard, CardImage cardImage) { var graphics = cardImage.Graphics; var usableRectangWithPadding = cardImage.UsableRectangWithPadding; var cardFrontLargeImageSize = usableRectangWithPadding.Width - (2 * cardFrontSmallImageSize); GraphicsUtilities.PrintScaledPng( graphics, newCard.Tool, usableRectangWithPadding.X + usableRectangWithPadding.Width / 2 - cardFrontLargeImageSize / 2, usableRectangWithPadding.Y + usableRectangWithPadding.Height / 2 - (cardFrontLargeImageSize / 2), cardFrontLargeImageSize, cardFrontLargeImageSize); }
private void PrintCardName(NewToolCard newCard, CardImage cardImage) { var graphics = cardImage.Graphics; var usableRectangWithPadding = cardImage.UsableRectangWithPadding; var cardNameFont = new Font(headerFontFamily, toolHeaderFontSize, GraphicsUnit.Pixel); var topRectangle = new RectangleF(usableRectangWithPadding.X, usableRectangWithPadding.Y + cardFrontSmallImageSize, usableRectangWithPadding.Width, cardNameFont.Height); var bottomRectangle = new RectangleF(usableRectangWithPadding.X, usableRectangWithPadding.Y + cardFrontSmallImageSize + cardNameFont.Height, usableRectangWithPadding.Width, cardNameFont.Height); var nameParts = newCard.Name.Split(' '); var firstNamePart = nameParts.Take(nameParts.Length - 2).ToList(); var lastNamePart = nameParts.Skip(firstNamePart.Count).ToList(); GraphicsUtilities.DrawString(graphics, string.Join(" ", firstNamePart), cardNameFont, GraphicsUtilities.BlackBrush, topRectangle, GraphicsUtilities.FullCenterAlignment); GraphicsUtilities.DrawString(graphics, string.Join(" ", lastNamePart), cardNameFont, GraphicsUtilities.BlackBrush, bottomRectangle, GraphicsUtilities.FullCenterAlignment); }
private void PrintResourceProduced(NewToolCard newCard, Graphics graphics, int x, int y) { var font = new Font(bodyFontFamily, imageLabelFontSize); GraphicsUtilities.PrintImageWithText( graphics, newCard.ResourceProduced, x, y, cardFrontSmallImageSize, cardFrontSmallImageSize, "+", 0, (int)(cardFrontSmallImageSize * (2.0 / 5)), font); }
public CardImage CreateToolCardFront(NewToolCard newCard, int index) { var cardImage = new CardImage($"Tier {newCard.Tier} Front - {newCard.Name} {index}", ImageOrientation.Portrait); cardImage.PrintCardBorderAndBackground(newCard.Color, standardCardBackgroundColor); var usableRectangWithPadding = cardImage.UsableRectangWithPadding; var graphics = cardImage.Graphics; if (newCard.Points > 0) { PrintPointsForTool(newCard, cardImage); } PrintToolIcon(newCard, graphics, usableRectangWithPadding.X + (usableRectangWithPadding.Width / 2) - (cardFrontSmallImageSize / 2), usableRectangWithPadding.Y); PrintResourceProduced(newCard, graphics, usableRectangWithPadding.Right - cardFrontSmallImageSize, usableRectangWithPadding.Y); PrintCardName(newCard, cardImage); PrintToolImage(newCard, cardImage); PrintCostsForTool(newCard, cardImage); return(cardImage); }
private void PrintCostsForTool(NewToolCard newCard, CardImage cardImage) { var font = new Font(bodyFontFamily, imageLabelFontSize); var graphics = cardImage.Graphics; var usableRectangWithPadding = cardImage.UsableRectangWithPadding; var costList = newCard.Costs.ToList(); for (var costIndex = 0; costIndex < costList.Count; costIndex++) { GraphicsUtilities.PrintImageWithText( graphics, costList[costIndex].Key, usableRectangWithPadding.X, usableRectangWithPadding.Bottom - ((costIndex + 1) * cardFrontSmallImageSize), cardFrontSmallImageSize, cardFrontSmallImageSize, costList[costIndex].Value.ToString(), 0, (int)(cardFrontSmallImageSize * (2.0 / 5)), font); } }
private void PrintToolIcon(NewToolCard newCard, Graphics graphics, int x, int y) { GraphicsUtilities.PrintScaledPng(graphics, $"{newCard.Tool} BW", x, y, cardFrontSmallImageSize, cardFrontSmallImageSize); }