diff options
author | Ian C <ianc@noddybox.co.uk> | 2005-05-18 01:34:00 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2005-05-18 01:34:00 +0000 |
commit | cac0e5a6f3baeaa2e891677c79bba00ff3c44e1a (patch) | |
tree | 79af3f1c867974c49bb0bb492daea721b6f37fc3 | |
parent | 81ed3c21ad7624a383a721c9509f671bd6f5ac23 (diff) |
Development changes
-rw-r--r-- | BitmapChar.cs | 38 | ||||
-rw-r--r-- | BitmapFontEd.MainForm.resources | bin | 17457 -> 18455 bytes | |||
-rw-r--r-- | GfxEditor.cs | 2 | ||||
-rw-r--r-- | MainForm.cs | 240 | ||||
-rw-r--r-- | Util.cs | 5 |
5 files changed, 234 insertions, 51 deletions
diff --git a/BitmapChar.cs b/BitmapChar.cs index 432dce8..12d3aae 100644 --- a/BitmapChar.cs +++ b/BitmapChar.cs @@ -227,6 +227,44 @@ namespace BitmapFontEd m_changed=true;
}
+ public void Glow(Color col)
+ {
+ Color[,] d=new Color[m_width,m_height];
+
+ // I'm sure this is too convoluted...
+ //
+ for(int y=0;y<m_height;y++)
+ for(int x=0;x<m_width;x++)
+ d[x,y]=Color.Black;
+
+ for(int y=0;y<m_height;y++)
+ for(int x=0;x<m_width;x++)
+ if (m_data[x,y]!=Color.Black)
+ {
+ for(int dx=-1;dx<2;dx++)
+ for(int dy=-1;dy<2;dy++)
+ {
+ int nx=x+dx;
+ int ny=y+dy;
+
+ if (nx>=0 && nx<m_width && ny>=0 && ny<m_height &&
+ m_data[nx,ny]==Color.Black)
+ {
+ d[nx,ny]=col;
+ }
+ }
+ }
+
+ for(int y=0;y<m_height;y++)
+ for(int x=0;x<m_width;x++)
+ if (d[x,y]!=Color.Black)
+ {
+ m_data[x,y]=d[x,y];
+ }
+
+ m_changed=true;
+ }
+
public void Output(Stream stream)
{
Util.WriteUint(stream,m_width);
diff --git a/BitmapFontEd.MainForm.resources b/BitmapFontEd.MainForm.resources Binary files differindex 686a6ad..3ff2bf5 100644 --- a/BitmapFontEd.MainForm.resources +++ b/BitmapFontEd.MainForm.resources diff --git a/GfxEditor.cs b/GfxEditor.cs index 0b09ce3..f5f002a 100644 --- a/GfxEditor.cs +++ b/GfxEditor.cs @@ -63,6 +63,8 @@ namespace BitmapFontEd private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label m_recent8;
+ public const int MAX_SIZE=32;
+
private const uint SIZE=256;
private Color TRANS=Color.Empty;
diff --git a/MainForm.cs b/MainForm.cs index 078741e..efc34c5 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -19,6 +19,8 @@ //
using System;
using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Text;
using System.IO;
@@ -34,19 +36,23 @@ namespace BitmapFontEd private System.Windows.Forms.Label label1;
private System.Windows.Forms.MenuItem m_helpMenu;
private System.Windows.Forms.NumericUpDown m_codeSelect;
- private System.Windows.Forms.GroupBox m_globaladjustGroup;
+ private System.Windows.Forms.Label label5;
private System.Windows.Forms.GroupBox m_adjustGroup;
private System.Windows.Forms.Button m_scrollDown;
private System.Windows.Forms.Button m_scrollUp;
+ private System.Windows.Forms.MenuItem m_break1;
private System.Windows.Forms.MenuItem m_fileMenu;
private System.Windows.Forms.Button m_mirrorVertical;
private System.Windows.Forms.Button m_rotRight;
private System.Windows.Forms.Button m_revert;
private System.Windows.Forms.Button m_dropShadow;
+ private System.Windows.Forms.GroupBox m_globaladjustGroup;
+ private System.Windows.Forms.Button m_glow;
private System.Windows.Forms.MenuItem m_about;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button m_scrollRight;
private System.Windows.Forms.CheckBox m_applyAll;
+ private System.Windows.Forms.Button m_grabFont;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button m_rotLeft;
private System.Windows.Forms.Label label4;
@@ -56,13 +62,11 @@ namespace BitmapFontEd private System.Windows.Forms.ComboBox m_asciiSelect;
private System.Windows.Forms.MenuItem m_quit;
private System.Windows.Forms.MenuItem m_save;
- private System.Windows.Forms.Label label5;
private System.Windows.Forms.MenuItem m_saveAs;
private System.Windows.Forms.Button m_scrollLeft;
private System.Windows.Forms.GroupBox m_editGroup;
private System.Windows.Forms.MenuItem m_new;
private System.Windows.Forms.MenuItem m_open;
- private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.Button m_mirrorHorizontal;
private System.Windows.Forms.GroupBox m_selectGroup;
private System.Windows.Forms.Button m_clear;
@@ -75,6 +79,8 @@ namespace BitmapFontEd private DropShadowForm m_shadowForm;
+ private Color m_glowCol=Color.White;
+
public MainForm()
{
//
@@ -132,13 +138,11 @@ namespace BitmapFontEd this.m_clear = new System.Windows.Forms.Button();
this.m_selectGroup = new System.Windows.Forms.GroupBox();
this.m_mirrorHorizontal = new System.Windows.Forms.Button();
- this.menuItem6 = new System.Windows.Forms.MenuItem();
this.m_open = new System.Windows.Forms.MenuItem();
this.m_new = new System.Windows.Forms.MenuItem();
this.m_editGroup = new System.Windows.Forms.GroupBox();
this.m_scrollLeft = new System.Windows.Forms.Button();
this.m_saveAs = new System.Windows.Forms.MenuItem();
- this.label5 = new System.Windows.Forms.Label();
this.m_save = new System.Windows.Forms.MenuItem();
this.m_quit = new System.Windows.Forms.MenuItem();
this.m_asciiSelect = new System.Windows.Forms.ComboBox();
@@ -148,27 +152,31 @@ namespace BitmapFontEd this.label4 = new System.Windows.Forms.Label();
this.m_rotLeft = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label();
+ this.m_grabFont = new System.Windows.Forms.Button();
this.m_applyAll = new System.Windows.Forms.CheckBox();
this.m_scrollRight = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.m_about = new System.Windows.Forms.MenuItem();
+ this.m_glow = new System.Windows.Forms.Button();
+ this.m_globaladjustGroup = new System.Windows.Forms.GroupBox();
this.m_dropShadow = new System.Windows.Forms.Button();
this.m_revert = new System.Windows.Forms.Button();
this.m_rotRight = new System.Windows.Forms.Button();
this.m_mirrorVertical = new System.Windows.Forms.Button();
this.m_fileMenu = new System.Windows.Forms.MenuItem();
+ this.m_break1 = new System.Windows.Forms.MenuItem();
this.m_scrollUp = new System.Windows.Forms.Button();
this.m_scrollDown = new System.Windows.Forms.Button();
this.m_adjustGroup = new System.Windows.Forms.GroupBox();
- this.m_globaladjustGroup = new System.Windows.Forms.GroupBox();
+ this.label5 = new System.Windows.Forms.Label();
this.m_codeSelect = new System.Windows.Forms.NumericUpDown();
this.m_helpMenu = new System.Windows.Forms.MenuItem();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.m_selectGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.m_charSelect)).BeginInit();
- this.m_adjustGroup.SuspendLayout();
this.m_globaladjustGroup.SuspendLayout();
+ this.m_adjustGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.m_codeSelect)).BeginInit();
this.SuspendLayout();
//
@@ -177,7 +185,7 @@ namespace BitmapFontEd this.m_clear.Location = new System.Drawing.Point(8, 40);
this.m_clear.Name = "m_clear";
this.m_clear.Size = new System.Drawing.Size(96, 24);
- this.m_clear.TabIndex = 2;
+ this.m_clear.TabIndex = 3;
this.m_clear.Text = "Clear";
this.m_clear.Click += new System.EventHandler(this.OnClear);
//
@@ -201,15 +209,10 @@ namespace BitmapFontEd this.m_mirrorHorizontal.Location = new System.Drawing.Point(8, 88);
this.m_mirrorHorizontal.Name = "m_mirrorHorizontal";
this.m_mirrorHorizontal.Size = new System.Drawing.Size(96, 24);
- this.m_mirrorHorizontal.TabIndex = 4;
+ this.m_mirrorHorizontal.TabIndex = 5;
this.m_mirrorHorizontal.Text = "Horizontal";
this.m_mirrorHorizontal.Click += new System.EventHandler(this.OnHorizontalMirror);
//
- // menuItem6
- //
- this.menuItem6.Index = 4;
- this.menuItem6.Text = "-";
- //
// m_open
//
this.m_open.Index = 1;
@@ -229,7 +232,7 @@ namespace BitmapFontEd this.m_editGroup.Location = new System.Drawing.Point(8, 8);
this.m_editGroup.Name = "m_editGroup";
this.m_editGroup.Size = new System.Drawing.Size(408, 328);
- this.m_editGroup.TabIndex = 0;
+ this.m_editGroup.TabIndex = 1;
this.m_editGroup.TabStop = false;
this.m_editGroup.Text = "Editor";
//
@@ -238,7 +241,7 @@ namespace BitmapFontEd this.m_scrollLeft.Location = new System.Drawing.Point(8, 136);
this.m_scrollLeft.Name = "m_scrollLeft";
this.m_scrollLeft.Size = new System.Drawing.Size(96, 24);
- this.m_scrollLeft.TabIndex = 7;
+ this.m_scrollLeft.TabIndex = 8;
this.m_scrollLeft.Text = "Left";
this.m_scrollLeft.Click += new System.EventHandler(this.OnLeftScroll);
//
@@ -249,15 +252,6 @@ namespace BitmapFontEd this.m_saveAs.Text = "S&ave as...";
this.m_saveAs.Click += new System.EventHandler(this.OnSaveAs);
//
- // label5
- //
- this.label5.Location = new System.Drawing.Point(8, 200);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(72, 16);
- this.label5.TabIndex = 11;
- this.label5.Text = "Rotate";
- this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
// m_save
//
this.m_save.Index = 2;
@@ -279,7 +273,7 @@ namespace BitmapFontEd this.m_asciiSelect.MaxDropDownItems = 20;
this.m_asciiSelect.Name = "m_asciiSelect";
this.m_asciiSelect.Size = new System.Drawing.Size(64, 21);
- this.m_asciiSelect.TabIndex = 8;
+ this.m_asciiSelect.TabIndex = 9;
this.m_asciiSelect.SelectedIndexChanged += new System.EventHandler(this.OnSelectByChar);
//
// m_resize
@@ -287,7 +281,7 @@ namespace BitmapFontEd this.m_resize.Location = new System.Drawing.Point(8, 16);
this.m_resize.Name = "m_resize";
this.m_resize.Size = new System.Drawing.Size(88, 24);
- this.m_resize.TabIndex = 0;
+ this.m_resize.TabIndex = 1;
this.m_resize.Text = "Resize All";
this.m_resize.Click += new System.EventHandler(this.OnResize);
//
@@ -303,7 +297,7 @@ namespace BitmapFontEd this.m_charSelect.Maximum = 94;
this.m_charSelect.Name = "m_charSelect";
this.m_charSelect.Size = new System.Drawing.Size(392, 42);
- this.m_charSelect.TabIndex = 5;
+ this.m_charSelect.TabIndex = 6;
this.m_charSelect.Scroll += new System.EventHandler(this.OnSelectChar);
//
// label4
@@ -320,7 +314,7 @@ namespace BitmapFontEd this.m_rotLeft.Location = new System.Drawing.Point(8, 216);
this.m_rotLeft.Name = "m_rotLeft";
this.m_rotLeft.Size = new System.Drawing.Size(96, 24);
- this.m_rotLeft.TabIndex = 12;
+ this.m_rotLeft.TabIndex = 13;
this.m_rotLeft.Text = "Left";
this.m_rotLeft.Click += new System.EventHandler(this.OnRotateLeft);
//
@@ -333,6 +327,15 @@ namespace BitmapFontEd this.label6.Text = "Special Effects";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
+ // m_grabFont
+ //
+ this.m_grabFont.Location = new System.Drawing.Point(8, 304);
+ this.m_grabFont.Name = "m_grabFont";
+ this.m_grabFont.Size = new System.Drawing.Size(96, 24);
+ this.m_grabFont.TabIndex = 18;
+ this.m_grabFont.Text = "Grab Font";
+ this.m_grabFont.Click += new System.EventHandler(this.OnGrabFont);
+ //
// m_applyAll
//
this.m_applyAll.Location = new System.Drawing.Point(8, 16);
@@ -346,7 +349,7 @@ namespace BitmapFontEd this.m_scrollRight.Location = new System.Drawing.Point(112, 136);
this.m_scrollRight.Name = "m_scrollRight";
this.m_scrollRight.Size = new System.Drawing.Size(96, 24);
- this.m_scrollRight.TabIndex = 8;
+ this.m_scrollRight.TabIndex = 9;
this.m_scrollRight.Text = "Right";
this.m_scrollRight.Click += new System.EventHandler(this.OnRightScroll);
//
@@ -365,12 +368,31 @@ namespace BitmapFontEd this.m_about.Text = "&About";
this.m_about.Click += new System.EventHandler(this.OnAbout);
//
+ // m_glow
+ //
+ this.m_glow.Location = new System.Drawing.Point(112, 272);
+ this.m_glow.Name = "m_glow";
+ this.m_glow.Size = new System.Drawing.Size(96, 24);
+ this.m_glow.TabIndex = 17;
+ this.m_glow.Text = "Glow";
+ this.m_glow.Click += new System.EventHandler(this.OnGlow);
+ //
+ // m_globaladjustGroup
+ //
+ this.m_globaladjustGroup.Controls.Add(this.m_resize);
+ this.m_globaladjustGroup.Location = new System.Drawing.Point(424, 8);
+ this.m_globaladjustGroup.Name = "m_globaladjustGroup";
+ this.m_globaladjustGroup.Size = new System.Drawing.Size(216, 48);
+ this.m_globaladjustGroup.TabIndex = 2;
+ this.m_globaladjustGroup.TabStop = false;
+ this.m_globaladjustGroup.Text = "Global Adjustments";
+ //
// m_dropShadow
//
this.m_dropShadow.Location = new System.Drawing.Point(8, 272);
this.m_dropShadow.Name = "m_dropShadow";
this.m_dropShadow.Size = new System.Drawing.Size(96, 24);
- this.m_dropShadow.TabIndex = 15;
+ this.m_dropShadow.TabIndex = 16;
this.m_dropShadow.Text = "Drop Shadow";
this.m_dropShadow.Click += new System.EventHandler(this.OnDropShadow);
//
@@ -379,7 +401,7 @@ namespace BitmapFontEd this.m_revert.Location = new System.Drawing.Point(304, 64);
this.m_revert.Name = "m_revert";
this.m_revert.Size = new System.Drawing.Size(88, 24);
- this.m_revert.TabIndex = 6;
+ this.m_revert.TabIndex = 7;
this.m_revert.Text = "Revert";
this.m_revert.Click += new System.EventHandler(this.OnRevert);
//
@@ -388,7 +410,7 @@ namespace BitmapFontEd this.m_rotRight.Location = new System.Drawing.Point(112, 216);
this.m_rotRight.Name = "m_rotRight";
this.m_rotRight.Size = new System.Drawing.Size(96, 24);
- this.m_rotRight.TabIndex = 13;
+ this.m_rotRight.TabIndex = 14;
this.m_rotRight.Text = "Right";
this.m_rotRight.Click += new System.EventHandler(this.OnRotateRight);
//
@@ -397,7 +419,7 @@ namespace BitmapFontEd this.m_mirrorVertical.Location = new System.Drawing.Point(112, 88);
this.m_mirrorVertical.Name = "m_mirrorVertical";
this.m_mirrorVertical.Size = new System.Drawing.Size(96, 24);
- this.m_mirrorVertical.TabIndex = 5;
+ this.m_mirrorVertical.TabIndex = 6;
this.m_mirrorVertical.Text = "Vertical";
this.m_mirrorVertical.Click += new System.EventHandler(this.OnVerticalMirror);
//
@@ -409,16 +431,21 @@ namespace BitmapFontEd this.m_open,
this.m_save,
this.m_saveAs,
- this.menuItem6,
+ this.m_break1,
this.m_quit});
this.m_fileMenu.Text = "&File";
//
+ // m_break1
+ //
+ this.m_break1.Index = 4;
+ this.m_break1.Text = "-";
+ //
// m_scrollUp
//
this.m_scrollUp.Location = new System.Drawing.Point(8, 168);
this.m_scrollUp.Name = "m_scrollUp";
this.m_scrollUp.Size = new System.Drawing.Size(96, 24);
- this.m_scrollUp.TabIndex = 9;
+ this.m_scrollUp.TabIndex = 10;
this.m_scrollUp.Text = "Up";
this.m_scrollUp.Click += new System.EventHandler(this.OnUpScroll);
//
@@ -427,12 +454,14 @@ namespace BitmapFontEd this.m_scrollDown.Location = new System.Drawing.Point(112, 168);
this.m_scrollDown.Name = "m_scrollDown";
this.m_scrollDown.Size = new System.Drawing.Size(96, 24);
- this.m_scrollDown.TabIndex = 10;
+ this.m_scrollDown.TabIndex = 11;
this.m_scrollDown.Text = "Down";
this.m_scrollDown.Click += new System.EventHandler(this.OnDownScroll);
//
// m_adjustGroup
//
+ this.m_adjustGroup.Controls.Add(this.m_grabFont);
+ this.m_adjustGroup.Controls.Add(this.m_glow);
this.m_adjustGroup.Controls.Add(this.m_dropShadow);
this.m_adjustGroup.Controls.Add(this.label6);
this.m_adjustGroup.Controls.Add(this.m_rotRight);
@@ -455,21 +484,20 @@ namespace BitmapFontEd this.m_adjustGroup.TabStop = false;
this.m_adjustGroup.Text = "Adjustments and Effects";
//
- // m_globaladjustGroup
+ // label5
//
- this.m_globaladjustGroup.Controls.Add(this.m_resize);
- this.m_globaladjustGroup.Location = new System.Drawing.Point(424, 8);
- this.m_globaladjustGroup.Name = "m_globaladjustGroup";
- this.m_globaladjustGroup.Size = new System.Drawing.Size(216, 48);
- this.m_globaladjustGroup.TabIndex = 2;
- this.m_globaladjustGroup.TabStop = false;
- this.m_globaladjustGroup.Text = "Global Adjustments";
+ this.label5.Location = new System.Drawing.Point(8, 200);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(72, 16);
+ this.label5.TabIndex = 11;
+ this.label5.Text = "Rotate";
+ this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// m_codeSelect
//
this.m_codeSelect.Location = new System.Drawing.Point(88, 64);
this.m_codeSelect.Maximum = new System.Decimal(new int[] {
- 127,
+ 126,
0,
0,
0});
@@ -481,7 +509,7 @@ namespace BitmapFontEd this.m_codeSelect.Name = "m_codeSelect";
this.m_codeSelect.ReadOnly = true;
this.m_codeSelect.Size = new System.Drawing.Size(64, 20);
- this.m_codeSelect.TabIndex = 9;
+ this.m_codeSelect.TabIndex = 10;
this.m_codeSelect.Value = new System.Decimal(new int[] {
32,
0,
@@ -531,8 +559,8 @@ namespace BitmapFontEd this.Closing += new System.ComponentModel.CancelEventHandler(this.OnClosing);
this.m_selectGroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.m_charSelect)).EndInit();
- this.m_adjustGroup.ResumeLayout(false);
this.m_globaladjustGroup.ResumeLayout(false);
+ this.m_adjustGroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.m_codeSelect)).EndInit();
this.ResumeLayout(false);
}
@@ -682,7 +710,7 @@ namespace BitmapFontEd {
if (!m_inSelect)
{
- SelectChar(Convert.ToInt32(m_codeSelect.Value-32));
+ SelectChar(Convert.ToInt32(m_codeSelect.Value)-32);
}
}
@@ -727,9 +755,12 @@ namespace BitmapFontEd if (m_applyAll.Checked)
{
- foreach (BitmapChar c in m_chars)
+ if (Util.YesNo("Clear ALL Characters?"))
{
- c.Clear(m_edit.SelectedBackground);
+ foreach (BitmapChar c in m_chars)
+ {
+ c.Clear(m_edit.SelectedBackground);
+ }
}
}
else
@@ -879,5 +910,112 @@ namespace BitmapFontEd m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
}
}
+
+ void OnGlow(object sender, System.EventArgs e)
+ {
+ ColorDialog d=new ColorDialog();
+
+ d.Color=m_glowCol;
+ d.FullOpen=true;
+
+ if (d.ShowDialog()==DialogResult.OK)
+ {
+ m_glowCol=d.Color;
+
+ FetchEdit();
+
+ if (m_applyAll.Checked)
+ {
+ foreach (BitmapChar c in m_chars)
+ {
+ c.Glow(m_glowCol);
+ }
+ }
+ else
+ {
+ m_chars[m_selected].Glow(m_glowCol);
+ }
+
+ m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
+ }
+ }
+
+ private void GrabChar(Bitmap bmp, BitmapChar c)
+ {
+ int x,y;
+ int mx,my;
+ bool found;
+
+ //System.Diagnostics.Debugger.Break();
+
+ c.Clear(m_edit.BackColor);
+
+ found=false;
+
+ for(my=GfxEditor.MAX_SIZE-1;my>=0 && !found;my--)
+ for(x=0;x<GfxEditor.MAX_SIZE && !found;x++)
+ if (!Util.IsBlack(bmp.GetPixel(x,my)))
+ found=true;
+
+ if (!found)
+ return;
+
+ found=false;
+
+ for(mx=GfxEditor.MAX_SIZE-1;mx>=0 && !found;mx--)
+ for(y=0;y<GfxEditor.MAX_SIZE && !found;y++)
+ if (!Util.IsBlack(bmp.GetPixel(mx,y)))
+ found=true;
+
+ mx=Math.Min(mx+1,GfxEditor.MAX_SIZE);
+ my=Math.Min(my+1,GfxEditor.MAX_SIZE);
+
+ c.Resize((uint)mx,(uint)my);
+
+ for(x=0;x<mx;x++)
+ for(y=0;y<my;y++)
+ c[(uint)x,(uint)y]=bmp.GetPixel(x,y);
+ }
+
+ void OnGrabFont(object sender, System.EventArgs e)
+ {
+ FontDialog fdlg=new FontDialog();
+
+ if (fdlg.ShowDialog()==DialogResult.OK)
+ {
+ ColorDialog coldlg=new ColorDialog();
+
+ coldlg.Color=Color.White;
+ coldlg.FullOpen=true;
+
+ if (coldlg.ShowDialog()==DialogResult.OK)
+ {
+ try
+ {
+ Bitmap bmp=new Bitmap(GfxEditor.MAX_SIZE,
+ GfxEditor.MAX_SIZE,
+ PixelFormat.Format32bppArgb);
+ SolidBrush b=new SolidBrush(coldlg.Color);
+
+ using (Graphics g=Graphics.FromImage(bmp))
+ {
+ for(byte ascii=33;ascii<127;ascii++)
+ {
+ string s=Encoding.ASCII.GetString(new byte[] {ascii});
+ g.Clear(Color.Black);
+ g.DrawString(s,fdlg.Font,b,0,0);
+ g.Flush();
+ GrabChar(bmp,m_chars[ascii-32]);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Util.Error("Problem grabbing font:\n"+ex.Message+"\n\n"+ex.StackTrace);
+ }
+ }
+ }
+ }
+
}
}
@@ -21,6 +21,7 @@ using System; using System.Windows.Forms;
using System.Text;
using System.IO;
+using System.Drawing;
namespace BitmapFontEd
{
@@ -52,6 +53,10 @@ namespace BitmapFontEd MessageBoxButtons.OK,MessageBoxIcon.Information);
}
+ public static bool IsBlack(Color c)
+ {
+ return c.R==0 && c.G==0 && c.B==0;
+ }
public static uint ReadUint(Stream str)
{
|