public Bitmap drawTextOnImage(SmashOverlayGenerator form, bool swap, bool camSwap) { string cam1 = GenFcns.removeWinLoseTags(form.Competitor1); string cam2 = GenFcns.removeWinLoseTags(form.Competitor2); setFontSizes(form.ResourceType, form.Competitor1, form.Competitor2); Bitmap image = base.getImage(); Graphics g = Graphics.FromImage(image); if (!swap) { g.DrawString(form.Competitor1, Name1Font, Brushes.White, Competitor1Point.getPoint(), Player1Format); g.DrawString(form.Competitor2, Name2Font, Brushes.White, Competitor2Point.getPoint(), Player2Format); g.DrawString(form.Score1, ScoreFont, Brushes.White, Score1Point.getPoint(), ScoreFormat); g.DrawString(form.Score2, ScoreFont, Brushes.White, Score2Point.getPoint(), ScoreFormat); } else { g.DrawString(form.Competitor1, Name1Font, Brushes.White, Competitor2Point.getPoint(), Player2Format); g.DrawString(form.Competitor2, Name2Font, Brushes.White, Competitor1Point.getPoint(), Player1Format); g.DrawString(form.Score1, ScoreFont, Brushes.White, Score2Point.getPoint(), ScoreFormat); g.DrawString(form.Score2, ScoreFont, Brushes.White, Score1Point.getPoint(), ScoreFormat); } if (!camSwap) { g.DrawString(cam1, Name1Font, Brushes.White, Competitor1WebcamPoint.getPoint(), NameFormat); g.DrawString(cam2, Name2Font, Brushes.White, Competitor2WebcamPoint.getPoint(), NameFormat); } else { g.DrawString(cam2, Name1Font, Brushes.White, Competitor1WebcamPoint.getPoint(), NameFormat); g.DrawString(cam1, Name2Font, Brushes.White, Competitor2WebcamPoint.getPoint(), NameFormat); } if (RoundPoint == null) { g.DrawString(form.TournamentName + " | " + form.TournamentRound, TournamentFont, Brushes.White, TournamentNameRoundPoint.getPoint(), NameFormat); } else { g.DrawString(form.TournamentName, TournamentFont, Brushes.White, TournamentNameRoundPoint.getPoint(), TourneyFormat); RoundFont = new Font(FontFamily.GenericSerif, 25, FontStyle.Bold); g.DrawString(form.TournamentRound, RoundFont, Brushes.White, RoundPoint.getPoint(), NameFormat); } if (DatePoint != null) { g.DrawString(form.CurrentDateTime.ToString("MMMM dd, yyyy"), TournamentFont, Brushes.White, DatePoint.getPoint(), DateFormat); } return(image); }
public override System.Drawing.Bitmap drawTextOnImage(SmashOverlayGenerator form) { //IF FONT IS NOT INSTALLED WE INSTALL IT GenFcns.installFonts(form, "EARTHQUAKE.TTF", pfc); GenFcns.installFonts(form, "FLAPHEAD.TTF", pfc); //fontsInstalled(form, "EARTHQUAKE"); //fontsInstalled(form, "FLAPHEAD"); //fontsInstalled(form, "zekton rg"); setFontSizes(form.ResourceType, form.MatchupCompetitor1, form.MatchupCompetitor2); if (!GenFcns.isNullOrEmpty(Gametype) && Gametype.Equals("doubles")) { setFontSizes(form.ResourceType, Competitor3, Competitor4); } TournamentName = form.TournamentName; TournamentRound = form.TournamentRound; Competitor1 = form.MatchupCompetitor1; Competitor2 = form.MatchupCompetitor2; StringFormat nameFormat = new StringFormat(); StringFormat tournamentFormat = new StringFormat(); Bitmap image = base.getImage(); Graphics g = Graphics.FromImage(image); nameFormat.LineAlignment = StringAlignment.Center; nameFormat.Alignment = StringAlignment.Center; tournamentFormat.Alignment = StringAlignment.Center; //DRAW CHARACTERS drawCharactersOnImage(g, Character1Path, Character1Point, Character2Path, Character2Point); //DRAW BANNER Pen p = new Pen(Color.LightCyan, (float)50.0); SolidBrush b = new SolidBrush(Color.MediumPurple); SolidBrush bBorder = new SolidBrush(Color.White); Rectangle r = new Rectangle(new Point(0, 800), new Size(1920, 200)); Rectangle rBorder = new Rectangle(new Point(0, 780), new Size(1920, 240)); g.FillRectangle(bBorder, rBorder); g.FillRectangle(b, r); FontFamily earthquakeFamily = pfc.Families[0]; FontFamily flapheadFamily = pfc.Families[1]; Font earthquake = new Font(earthquakeFamily, 120); Font flaphead = new Font(flapheadFamily, 120); //DRAW COMPETITOR INFORMATION g.DrawString(form.MatchupCompetitor1, earthquake, Brushes.White, Competitor1Point.getPoint(), nameFormat); g.DrawString(form.MatchupCompetitor2, earthquake, Brushes.White, Competitor2Point.getPoint(), nameFormat); //g.DrawString("THIS IS A TEST", f1, Brushes.Yellow, new Point(0, 0), nameFormat); //g.DrawString(form.TournamentName, TournamentFont, Brushes.White, TournamentPoint.getPoint(), tournamentFormat); //DRAW TOURNAMENT STUFFS string tournamentLogoPath = ListBoxFcns.getResourcePath(form.ProductName, "tournament", "*****@*****.**"); Image logoImage = base.getImage(tournamentLogoPath); g.DrawImage(logoImage, TournamentPoint.getPoint()); g.DrawString(form.TournamentRound, flaphead, Brushes.White, TournamentRoundPoint.getPoint(), tournamentFormat); Image img = (Image)image; Bitmap newImage = new Bitmap(img, new Size(640, 400)); return(newImage); }