private void OnTextChange(object sender, EventArgs e) { if (type == 1) //Unicode { pictureBox1.Image = UnicodeFonts.WriteText(font, textBox1.Text); } else { pictureBox1.Image = ASCIIText.DrawText(font, textBox1.Text); } }
private Bitmap RenderName(string name) { if (string.IsNullOrEmpty(name)) { return(ASCIIText.DrawText(10, string.Empty)); } name = name.Length <= 12 ? name : name.Substring(0, 12) + "..."; name = (StatusBar.NamePrefix ?? string.Empty) + name; return(ASCIIText.DrawText(10, name)); }
private void GenerateImage() { Frame[] animFrames = Animations.GetAnimation(m_BodyId, 0, 1, (m_Hue - 1), false); Bitmap bmp = null; if (Bestiary.UseFixes) { string fixPath = Path.Combine("Bestiary/fixes", m_MasterType.Name + ".jpg"); if (File.Exists(fixPath)) { bmp = new Bitmap(fixPath); } } if (animFrames != null || bmp != null) { using (Bitmap mobImage = new Bitmap(bmp ?? animFrames[0].Bitmap)) { using (Bitmap result = new Bitmap(m_BorderImage.Width, m_BorderImage.Height)) { using (Bitmap title = ASCIIText.DrawText(3, m_Name, 0x3B2)) { using (Graphics gr = Graphics.FromImage(result)) { using (Bitmap tz = ASCIIText.DrawText(3, " - The Retelling - Bestiary -", 1260)) { using (SolidBrush blackBrush = new SolidBrush(Color.FromArgb(60, 1, 1, 1))) { if (m_Hue > 0) { Hue hue = GetHue(m_Hue - 1); if (hue != null) { // explicitely apply the hue, GetAnimation method doesn't work for few bodyIds. hue.ApplyTo(mobImage, false); } } GraphicsUnit unit = GraphicsUnit.Pixel; RectangleF rect = mobImage.GetBounds(ref unit); int trX = (214 - (mobImage.Width >> 1)); int trY = (170 - (mobImage.Height >> 1)); int brX = (int)(trX + rect.Width); int brY = (int)(trY + rect.Height); string customBg = Bestiary.TypeRegistry[m_MasterType].Background; if (!string.IsNullOrEmpty(customBg)) { using (Bitmap cBg = new Bitmap(customBg)) { gr.DrawImage(cBg, 0.0f, 0.0f); } } else { gr.DrawImage(m_Background, 0.0f, 0.0f); } gr.FillRectangle(blackBrush, new Rectangle(22, 22, 385, 30)); gr.DrawImage( m_WaterMark, new Rectangle(0, 0, m_BorderImage.Width, m_BorderImage.Height), 0, 0, m_BorderImage.Width, m_BorderImage.Height, GraphicsUnit.Pixel, imgAttrs ); gr.DrawImage(title, ((brX + trX) >> 1) - (title.Width >> 1), trY - 5 - title.Height); gr.DrawImage(mobImage, trX, trY); gr.DrawImage(m_BorderImage, 0, 0, m_BorderImage.Width, m_BorderImage.Height); gr.DrawImage(tz, 100, 25); result.Save(Path.Combine("./Bestiary/images/", m_MasterType.Name + ".jpg"), m_Encoder, m_EncoderParameter); } } } } } } } else { Console.WriteLine("Couldn't acquire animation frames for bodyID: {0}, {1}", m_BodyId, m_Name); } }
private void OnTextChange(object sender, EventArgs e) { pictureBox1.Image = _type == 1 ? UnicodeFonts.WriteText(_font, textBox1.Text) : ASCIIText.DrawText(_font, textBox1.Text); }