public void WriteToImage(Int32 imageHeight, ImageDetails details, Boolean save = false) { // details is a whole page to be converted into an image Image image = new Bitmap(details.Width, imageHeight); using (Graphics drawing = Graphics.FromImage(image)) { drawing.Clear(details.BackgroundColor); drawing.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; _lineLeft = 0; LineRight = 0; LineTop = 0; LineBottom = 0; CursorX = 0; CursorY = 0; using (Brush textBrush = new SolidBrush(details.TextColor)) { foreach (List <ImageText> lineOfPieces in details.TextPieces) { DrawListOfImageText(drawing, textBrush, lineOfPieces); } } if (save) { drawing.Save(); } } if (save) { image.Save(details.Path); } }
public void CreateImage(ImageDetails details) { WriteToImage(MAX_HEIGHT, details, false); WriteToImage((Int32)LineTop, details, true); }