summaryrefslogtreecommitdiff
path: root/MainForm.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MainForm.cs')
-rw-r--r--MainForm.cs41
1 files changed, 19 insertions, 22 deletions
diff --git a/MainForm.cs b/MainForm.cs
index efc34c5..6a48840 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -913,10 +913,9 @@ namespace BitmapFontEd
void OnGlow(object sender, System.EventArgs e)
{
- ColorDialog d=new ColorDialog();
+ AlphaColourDialog d=new AlphaColourDialog("Select Glow Colour");
d.Color=m_glowCol;
- d.FullOpen=true;
if (d.ShowDialog()==DialogResult.OK)
{
@@ -944,31 +943,27 @@ namespace BitmapFontEd
{
int x,y;
int mx,my;
- bool found;
-
- //System.Diagnostics.Debugger.Break();
c.Clear(m_edit.BackColor);
- found=false;
+ mx=Int32.MinValue;
+ my=Int32.MinValue;
- 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;
+ for(y=0;y<GfxEditor.MAX_SIZE;y++)
+ for(x=0;x<GfxEditor.MAX_SIZE;x++)
+ if (bmp.GetPixel(x,y).A!=0)
+ {
+ mx=Math.Max(mx,x);
+ my=Math.Max(my,y);
+ }
- if (!found)
+ if (mx==Int32.MinValue)
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;
-
+ System.Diagnostics.Debug.WriteLine("(pre)mx="+mx+" my="+my);
mx=Math.Min(mx+1,GfxEditor.MAX_SIZE);
my=Math.Min(my+1,GfxEditor.MAX_SIZE);
+ System.Diagnostics.Debug.WriteLine("(post)mx="+mx+" my="+my);
c.Resize((uint)mx,(uint)my);
@@ -983,10 +978,9 @@ namespace BitmapFontEd
if (fdlg.ShowDialog()==DialogResult.OK)
{
- ColorDialog coldlg=new ColorDialog();
+ AlphaColourDialog coldlg=new AlphaColourDialog("Font Colour");
coldlg.Color=Color.White;
- coldlg.FullOpen=true;
if (coldlg.ShowDialog()==DialogResult.OK)
{
@@ -995,6 +989,7 @@ namespace BitmapFontEd
Bitmap bmp=new Bitmap(GfxEditor.MAX_SIZE,
GfxEditor.MAX_SIZE,
PixelFormat.Format32bppArgb);
+
SolidBrush b=new SolidBrush(coldlg.Color);
using (Graphics g=Graphics.FromImage(bmp))
@@ -1002,12 +997,14 @@ namespace BitmapFontEd
for(byte ascii=33;ascii<127;ascii++)
{
string s=Encoding.ASCII.GetString(new byte[] {ascii});
- g.Clear(Color.Black);
+ g.Clear(Color.Transparent);
g.DrawString(s,fdlg.Font,b,0,0);
- g.Flush();
+ g.Flush(FlushIntention.Sync);
GrabChar(bmp,m_chars[ascii-32]);
}
}
+
+ m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
}
catch (Exception ex)
{