public string GetHTML() { var theme = Themes.Selected; var html = new StringBuilder("<html>"); html.Append("<head><style>\n"); html.Append(string.Format("body {{ background-color: {0}; color: {1}; }}\n", ToHtml(theme.bgOld), ToHtml(theme.fgNew))); html.Append(string.Format(".line {{ white-space: pre; font-family: Courier; width:100%; font-size: {0}pt; }}\n", Font.PointSize)); for (int i = 0; i < 256; i++) { var fg = Colorizer.GetFGColor(i); var bg = Colorizer.GetBGColor(i); html.Append(string.Format(".level_{0} {{ background-color: {1}; color: {2}; }}\n", i, ToHtml(bg), ToHtml(fg))); } html.Append("</style></head>\n"); html.Append("<body><div style='width=100%;height=100%;'>\n"); for (int i = 0; i < GetNumLines(); i++) { html.Append(string.Format("<div class='line level_{0}' id='line_{1}'>\n", GetLevel(i), i)); html.Append(string.Format("<a name='line_{0}' href='#line_{0}'></a>\n", i)); html.Append(GetHTML(i)); html.Append("</div>"); } html.Append("</div></body></html>"); return(html.ToString()); }
public Image CreateImage(int width, int height) { bitmap = new Bitmap(width, height); if (GetNumLines() > 0) { for (int y = 0; y < height; y++) { var level = GetLevel((y * GetNumLines()) / height); var color = Colorizer.GetBGColor(level); for (int x = 0; x < width; x++) { bitmap.SetPixel(x, y, color); } } } else { using (var graphics = Graphics.FromImage(bitmap)) graphics.Clear(Color.White); } return(bitmap); }