summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitmapChar.cs77
-rw-r--r--BitmapFontEd.MainForm.resourcesbin18455 -> 18455 bytes
-rw-r--r--GfxEditor.cs136
-rw-r--r--MainForm.cs85
-rw-r--r--Util.cs47
5 files changed, 175 insertions, 170 deletions
diff --git a/BitmapChar.cs b/BitmapChar.cs
index 4719b33..3033fee 100644
--- a/BitmapChar.cs
+++ b/BitmapChar.cs
@@ -29,12 +29,13 @@ namespace BitmapFontEd
/// </summary>
public class BitmapChar
{
- public BitmapChar(uint width, uint height)
+ public BitmapChar(int width, int height)
{
+ CheckSize(width,height);
m_width=width;
m_height=height;
m_data=new Color[m_width,m_height];
- Clear(Color.Empty);
+ Clear(Color.Transparent);
m_changed=false;
}
@@ -55,12 +56,12 @@ namespace BitmapFontEd
m_changed=old.m_changed;
}
- public uint Width
+ public int Width
{
get {return m_width;}
}
- public uint Height
+ public int Height
{
get {return m_height;}
}
@@ -70,8 +71,10 @@ namespace BitmapFontEd
get {return m_changed;}
}
- public void Resize(uint width, uint height)
+ public void Resize(int width, int height)
{
+ CheckSize(width,height);
+
if (width==m_width && height==m_height)
{
return;
@@ -81,10 +84,10 @@ namespace BitmapFontEd
for(int y=0;y<height;y++)
for(int x=0;x<width;x++)
- data[x,y]=Color.Empty;
+ data[x,y]=Color.Transparent;
- uint mx=Math.Min(width,m_width);
- uint my=Math.Min(height,m_height);
+ int mx=Math.Min(width,m_width);
+ int my=Math.Min(height,m_height);
for(int x=0;x<mx;x++)
for(int y=0;y<my;y++)
@@ -96,7 +99,7 @@ namespace BitmapFontEd
m_changed=true;
}
- public Color this [uint x, uint y]
+ public Color this [int x, int y]
{
set
{
@@ -154,7 +157,7 @@ namespace BitmapFontEd
public void RotateRight()
{
Color[,] d=new Color[m_width,m_height];
- uint min=Math.Min(m_width,m_height);
+ int min=Math.Min(m_width,m_height);
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
@@ -175,7 +178,7 @@ namespace BitmapFontEd
public void RotateLeft()
{
Color[,] d=new Color[m_width,m_height];
- uint min=Math.Min(m_width,m_height);
+ int min=Math.Min(m_width,m_height);
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
@@ -201,7 +204,7 @@ namespace BitmapFontEd
//
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- d[x,y]=Color.Empty;
+ d[x,y]=Color.Transparent;
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
@@ -217,6 +220,8 @@ namespace BitmapFontEd
}
}
+ Util.DumpAlpha("Shadow Overlay",d);
+
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
if (d[x,y].A!=0)
@@ -227,7 +232,7 @@ namespace BitmapFontEd
m_changed=true;
}
- public void Glow(Color col)
+ public void Edge(Color col)
{
Color[,] d=new Color[m_width,m_height];
@@ -235,7 +240,7 @@ namespace BitmapFontEd
//
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- d[x,y]=Color.Empty;
+ d[x,y]=Color.Transparent;
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
@@ -255,6 +260,8 @@ namespace BitmapFontEd
}
}
+ Util.DumpAlpha("Edge Overlay",d);
+
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
if (d[x,y].A!=0)
@@ -267,12 +274,12 @@ namespace BitmapFontEd
public void Output(Stream stream)
{
- Util.WriteUint(stream,m_width);
- Util.WriteUint(stream,m_height);
+ Util.WriteInt(stream,m_width);
+ Util.WriteInt(stream,m_height);
- for(uint x=0;x<m_width;x++)
+ for(int x=0;x<m_width;x++)
{
- for(uint y=0;y<m_height;y++)
+ for(int y=0;y<m_height;y++)
{
stream.WriteByte(m_data[x,y].B);
stream.WriteByte(m_data[x,y].G);
@@ -284,14 +291,14 @@ namespace BitmapFontEd
public static BitmapChar Input(Stream stream)
{
- uint width=Util.ReadUint(stream);
- uint height=Util.ReadUint(stream);
+ int width=Util.ReadInt(stream);
+ int height=Util.ReadInt(stream);
BitmapChar s=new BitmapChar(width,height);
- for(uint x=0;x<width;x++)
+ for(int x=0;x<width;x++)
{
- for(uint y=0;y<height;y++)
+ for(int y=0;y<height;y++)
{
int B=stream.ReadByte();
int G=stream.ReadByte();
@@ -310,19 +317,27 @@ namespace BitmapFontEd
// ------------------------------------------------
// PRIVATE
//
- private uint m_width;
- private uint m_height;
+ private int m_width;
+ private int m_height;
private Color[,] m_data;
private bool m_changed;
- private int Mod(int v, uint max)
+ private void CheckSize(int width, int height)
{
- while(v<0)
- v+=(int)max;
-
- v=v%(int)max;
+ if (width<0 || height<0)
+ {
+ throw new ArgumentException("Cannot use negative sizes");
+ }
+ }
+
+ private int Mod(int v, int m)
+ {
+ while (v<0)
+ {
+ v+=m;
+ }
- return v;
+ return v%m;
}
}
@@ -365,7 +380,7 @@ namespace BitmapFontEd
{
get
{
- uint w=m_list[0].Width;
+ int w=m_list[0].Width;
foreach (BitmapChar c in m_list)
{
diff --git a/BitmapFontEd.MainForm.resources b/BitmapFontEd.MainForm.resources
index 3ff2bf5..45acce1 100644
--- a/BitmapFontEd.MainForm.resources
+++ b/BitmapFontEd.MainForm.resources
Binary files differ
diff --git a/GfxEditor.cs b/GfxEditor.cs
index b78155a..514fa62 100644
--- a/GfxEditor.cs
+++ b/GfxEditor.cs
@@ -67,7 +67,7 @@ namespace BitmapFontEd
public const int MAX_SIZE=32;
- private const uint SIZE=256;
+ private const int SIZE=256;
private Color TRANS=Color.Empty;
// These MUST match the entries in the drop down list
@@ -90,30 +90,30 @@ namespace BitmapFontEd
private BitmapChar m_char;
private BitmapChar m_undo;
- private uint m_width;
- private uint m_height;
+ private int m_width;
+ private int m_height;
private Rectangle m_editRect;
private Bitmap m_editBmp;
private Rectangle m_prevRect;
private Bitmap m_prevBmp;
- private uint m_grid;
- private uint m_mx;
- private uint m_my;
+ private int m_grid;
+ private int m_mx;
+ private int m_my;
private bool m_drawing;
private Mode m_mode;
private Color[,] m_overlay;
- private uint m_ox;
- private uint m_oy;
+ private int m_ox;
+ private int m_oy;
private Color m_pen;
private CopyMenu m_cpMenu;
- private uint m_cpX;
- private uint m_cpY;
- private uint m_cpWidth;
- private uint m_cpHeight;
+ private int m_cpX;
+ private int m_cpY;
+ private int m_cpWidth;
+ private int m_cpHeight;
private Color[,] m_cpBuff;
private Label[] m_recent;
@@ -576,12 +576,12 @@ namespace BitmapFontEd
// -------------------------------------------------------
#region Public Interfaces
- public uint CharWidth
+ public int CharWidth
{
get {return m_width;}
}
- public uint CharHeight
+ public int CharHeight
{
get {return m_height;}
}
@@ -646,7 +646,7 @@ namespace BitmapFontEd
private void Flush(ref Graphics g)
{
- g.Flush(FlushIntention.Flush);
+ g.Flush(FlushIntention.Sync);
g.Dispose();
g=null;
}
@@ -697,8 +697,8 @@ namespace BitmapFontEd
Graphics editg=Graphics.FromImage(m_editBmp);
Graphics prevg=Graphics.FromImage(m_prevBmp);
- for(uint x=0;x<m_char.Width;x++)
- for(uint y=0;y<m_char.Height;y++)
+ for(int x=0;x<m_char.Width;x++)
+ for(int y=0;y<m_char.Height;y++)
if (m_overlay[x,y]==TRANS)
CharPlot(editg,prevg,x,y,m_char[x,y]);
else
@@ -714,18 +714,13 @@ namespace BitmapFontEd
}
private void CharPlot(Graphics edit, Graphics prev,
- uint x, uint y, Color c)
+ int x, int y, Color c)
{
- if (m_prevBmp.GetPixel((int)x,(int)y)==c)
- {
- return;
- }
-
SolidBrush p=new SolidBrush(m_backCol.BackColor);
- uint gx=x*m_grid+1;
- uint gy=y*m_grid+1;
- uint gw=m_grid-1;
+ int gx=x*m_grid+1;
+ int gy=y*m_grid+1;
+ int gw=m_grid-1;
edit.FillRectangle(p,gx,gy,gw,gw);
prev.FillRectangle(p,1+x,1+y,1,1);
@@ -753,8 +748,8 @@ namespace BitmapFontEd
m_overlay=new Color[m_char.Width,m_char.Height];
- for(uint y=0;y<m_char.Height;y++)
- for(uint x=0;x<m_char.Width;x++)
+ for(int y=0;y<m_char.Height;y++)
+ for(int x=0;x<m_char.Width;x++)
m_overlay[x,y]=TRANS;
}
@@ -765,15 +760,15 @@ namespace BitmapFontEd
return;
}
- for(uint y=0;y<m_char.Height;y++)
- for(uint x=0;x<m_char.Width;x++)
+ for(int y=0;y<m_char.Height;y++)
+ for(int x=0;x<m_char.Width;x++)
m_overlay[x,y]=TRANS;
}
private void ApplyOverlay()
{
- for(uint y=0;y<m_char.Height;y++)
- for(uint x=0;x<m_char.Width;x++)
+ for(int y=0;y<m_char.Height;y++)
+ for(int x=0;x<m_char.Width;x++)
{
if (m_overlay[x,y]!=TRANS)
m_char[x,y]=m_overlay[x,y];
@@ -784,8 +779,8 @@ namespace BitmapFontEd
private void OverlayFromSprite()
{
- for(uint y=0;y<m_char.Height;y++)
- for(uint x=0;x<m_char.Width;x++)
+ for(int y=0;y<m_char.Height;y++)
+ for(int x=0;x<m_char.Width;x++)
m_overlay[x,y]=m_char[x,y];
}
@@ -796,25 +791,25 @@ namespace BitmapFontEd
// -------------------------------------------------------
#region Copy/Paste
- private void DrawMarkBox(uint x1, uint y1,uint x2, uint y2)
+ private void DrawMarkBox(int x1, int y1,int x2, int y2)
{
RankCoord(ref x1, ref x2);
RankCoord(ref y1, ref y2);
- for(uint x=x1;x<=x2;x++)
+ for(int x=x1;x<=x2;x++)
{
m_overlay[x,y1]=m_gridCol.BackColor;
m_overlay[x,y2]=m_gridCol.BackColor;
}
- for(uint y=y1;y<=y2;y++)
+ for(int y=y1;y<=y2;y++)
{
m_overlay[x1,y]=m_gridCol.BackColor;
m_overlay[x2,y]=m_gridCol.BackColor;
}
}
- private void Copy(uint x1, uint y1, uint x2, uint y2)
+ private void Copy(int x1, int y1, int x2, int y2)
{
RankCoord(ref x1, ref x2);
RankCoord(ref y1, ref y2);
@@ -826,8 +821,8 @@ namespace BitmapFontEd
m_cpBuff=new Color[m_cpWidth,m_cpHeight];
- for(uint x=0;x<m_cpWidth;x++)
- for(uint y=0;y<m_cpHeight;y++)
+ for(int x=0;x<m_cpWidth;x++)
+ for(int y=0;y<m_cpHeight;y++)
m_cpBuff[x,y]=m_char[x1+x,y1+y];
m_drawing=false;
@@ -842,21 +837,21 @@ namespace BitmapFontEd
break;
case CopyMenu.EGravity.eTopRight:
- x-=(int)m_cpWidth;
+ x-=m_cpWidth;
break;
case CopyMenu.EGravity.eBottomLeft:
- y-=(int)m_cpHeight;
+ y-=m_cpHeight;
break;
case CopyMenu.EGravity.eBottomRight:
- x-=(int)m_cpWidth;
- y-=(int)m_cpHeight;
+ x-=m_cpWidth;
+ y-=m_cpHeight;
break;
case CopyMenu.EGravity.eCentre:
- x-=(int)m_cpWidth/2;
- y-=(int)m_cpHeight/2;
+ x-=m_cpWidth/2;
+ y-=m_cpHeight/2;
break;
}
@@ -873,11 +868,11 @@ namespace BitmapFontEd
// -------------------------------------------------------
#region Drawing Routines
- private void RankCoord(ref uint c1, ref uint c2)
+ private void RankCoord(ref int c1, ref int c2)
{
if (c1>c2)
{
- uint t=c2;
+ int t=c2;
c2=c1;
c1=t;
}
@@ -889,15 +884,10 @@ namespace BitmapFontEd
m_overlay[x,y]=col;
}
- private void DrawLine(uint ux1, uint uy1,
- uint ux2, uint uy2,
+ private void DrawLine(int x1, int y1,
+ int x2, int y2,
Color col)
{
- int x1=(int)ux1;;
- int y1=(int)uy1;
- int x2=(int)ux2;
- int y2=(int)uy2;
-
int dx=x2-x1;
int dy=y2-y1;
@@ -972,8 +962,8 @@ namespace BitmapFontEd
}
}
- private void DrawRect(uint x1, uint y1,
- uint x2, uint y2,
+ private void DrawRect(int x1, int y1,
+ int x2, int y2,
Color col, bool fill)
{
RankCoord(ref x1, ref x2);
@@ -981,19 +971,19 @@ namespace BitmapFontEd
if (fill)
{
- for(uint x=x1;x<=x2;x++)
- for(uint y=y1;y<=y2;y++)
+ for(int x=x1;x<=x2;x++)
+ for(int y=y1;y<=y2;y++)
m_overlay[x,y]=col;
}
else
{
- for(uint x=x1;x<=x2;x++)
+ for(int x=x1;x<=x2;x++)
{
m_overlay[x,y1]=col;
m_overlay[x,y2]=col;
}
- for(uint y=y1;y<=y2;y++)
+ for(int y=y1;y<=y2;y++)
{
m_overlay[x1,y]=col;
m_overlay[x2,y]=col;
@@ -1001,14 +991,12 @@ namespace BitmapFontEd
}
}
- private void DrawEllipse(uint originx, uint originy,
- uint radpointx, uint radpointy,
+ private void DrawEllipse(int ox, int oy,
+ int radpointx, int radpointy,
Color col, bool circle, bool fill)
{
- int ox=(int)originx;
- int oy=(int)originy;
- double rx=Math.Abs(ox-(int)radpointx)+1;
- double ry=Math.Abs(oy-(int)radpointy)+1;
+ double rx=Math.Abs(ox-radpointx)+1;
+ double ry=Math.Abs(oy-radpointy)+1;
if (circle)
{
@@ -1034,7 +1022,7 @@ namespace BitmapFontEd
}
}
- private void FloodFill(uint x, uint y, Color col, Color bg)
+ private void FloodFill(int x, int y, Color col, Color bg)
{
if (m_overlay[x,y]==col || m_overlay[x,y]!=bg)
{
@@ -1070,7 +1058,7 @@ namespace BitmapFontEd
void OnSizeWidth(object sender, System.EventArgs e)
{
- m_width=Convert.ToUInt32(m_sizeX.Value);
+ m_width=Convert.ToInt32(m_sizeX.Value);
if (m_char!=null)
{
@@ -1090,7 +1078,7 @@ namespace BitmapFontEd
void OnSizeHeight(object sender, System.EventArgs e)
{
- m_height=Convert.ToUInt32(m_sizeY.Value);
+ m_height=Convert.ToInt32(m_sizeY.Value);
if (m_char!=null)
{
@@ -1153,11 +1141,11 @@ namespace BitmapFontEd
return;
}
- uint x;
- uint y;
+ int x;
+ int y;
- x=(uint)e.X/m_grid;
- y=(uint)e.Y/m_grid;
+ x=e.X/m_grid;
+ y=e.Y/m_grid;
m_pos.Text=x+","+y;
diff --git a/MainForm.cs b/MainForm.cs
index 6a48840..fa13599 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -36,7 +36,7 @@ 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.Label label5;
+ private System.Windows.Forms.GroupBox m_globaladjustGroup;
private System.Windows.Forms.GroupBox m_adjustGroup;
private System.Windows.Forms.Button m_scrollDown;
private System.Windows.Forms.Button m_scrollUp;
@@ -46,8 +46,6 @@ namespace BitmapFontEd
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;
@@ -60,8 +58,10 @@ namespace BitmapFontEd
private System.Windows.Forms.MainMenu m_menu;
private System.Windows.Forms.Button m_resize;
private System.Windows.Forms.ComboBox m_asciiSelect;
+ private System.Windows.Forms.Button m_edge;
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;
@@ -143,8 +143,10 @@ namespace BitmapFontEd
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_edge = new System.Windows.Forms.Button();
this.m_asciiSelect = new System.Windows.Forms.ComboBox();
this.m_resize = new System.Windows.Forms.Button();
this.m_menu = new System.Windows.Forms.MainMenu();
@@ -157,8 +159,6 @@ namespace BitmapFontEd
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();
@@ -168,15 +168,15 @@ namespace BitmapFontEd
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.label5 = new System.Windows.Forms.Label();
+ this.m_globaladjustGroup = new System.Windows.Forms.GroupBox();
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_globaladjustGroup.SuspendLayout();
this.m_adjustGroup.SuspendLayout();
+ this.m_globaladjustGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.m_codeSelect)).BeginInit();
this.SuspendLayout();
//
@@ -252,6 +252,15 @@ 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;
@@ -266,6 +275,15 @@ namespace BitmapFontEd
this.m_quit.Text = "&Quit";
this.m_quit.Click += new System.EventHandler(this.OnQuit);
//
+ // m_edge
+ //
+ this.m_edge.Location = new System.Drawing.Point(112, 272);
+ this.m_edge.Name = "m_edge";
+ this.m_edge.Size = new System.Drawing.Size(96, 24);
+ this.m_edge.TabIndex = 17;
+ this.m_edge.Text = "Edge";
+ this.m_edge.Click += new System.EventHandler(this.OnEdge);
+ //
// m_asciiSelect
//
this.m_asciiSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -368,25 +386,6 @@ 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);
@@ -461,7 +460,7 @@ namespace BitmapFontEd
// 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_edge);
this.m_adjustGroup.Controls.Add(this.m_dropShadow);
this.m_adjustGroup.Controls.Add(this.label6);
this.m_adjustGroup.Controls.Add(this.m_rotRight);
@@ -484,14 +483,15 @@ namespace BitmapFontEd
this.m_adjustGroup.TabStop = false;
this.m_adjustGroup.Text = "Adjustments and Effects";
//
- // label5
+ // m_globaladjustGroup
//
- 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;
+ 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_codeSelect
//
@@ -559,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_globaladjustGroup.ResumeLayout(false);
this.m_adjustGroup.ResumeLayout(false);
+ this.m_globaladjustGroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.m_codeSelect)).EndInit();
this.ResumeLayout(false);
}
@@ -737,8 +737,8 @@ namespace BitmapFontEd
void OnResize(object sender, System.EventArgs e)
{
- uint w=m_edit.CharWidth;
- uint h=m_edit.CharHeight;
+ int w=m_edit.CharWidth;
+ int h=m_edit.CharHeight;
if (Util.YesNo("Sure you want to resize all characters to " + w + " by " + h))
{
@@ -911,7 +911,7 @@ namespace BitmapFontEd
}
}
- void OnGlow(object sender, System.EventArgs e)
+ void OnEdge(object sender, System.EventArgs e)
{
AlphaColourDialog d=new AlphaColourDialog("Select Glow Colour");
@@ -927,12 +927,12 @@ namespace BitmapFontEd
{
foreach (BitmapChar c in m_chars)
{
- c.Glow(m_glowCol);
+ c.Edge(m_glowCol);
}
}
else
{
- m_chars[m_selected].Glow(m_glowCol);
+ m_chars[m_selected].Edge(m_glowCol);
}
m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
@@ -965,11 +965,11 @@ namespace BitmapFontEd
my=Math.Min(my+1,GfxEditor.MAX_SIZE);
System.Diagnostics.Debug.WriteLine("(post)mx="+mx+" my="+my);
- c.Resize((uint)mx,(uint)my);
+ c.Resize(mx,my);
for(x=0;x<mx;x++)
for(y=0;y<my;y++)
- c[(uint)x,(uint)y]=bmp.GetPixel(x,y);
+ c[x,y]=bmp.GetPixel(x,y);
}
void OnGrabFont(object sender, System.EventArgs e)
@@ -1013,6 +1013,5 @@ namespace BitmapFontEd
}
}
}
-
}
}
diff --git a/Util.cs b/Util.cs
index 314cc3d..4589775 100644
--- a/Util.cs
+++ b/Util.cs
@@ -22,6 +22,7 @@ using System.Windows.Forms;
using System.Text;
using System.IO;
using System.Drawing;
+using System.Diagnostics;
namespace BitmapFontEd
{
@@ -53,19 +54,6 @@ namespace BitmapFontEd
MessageBoxButtons.OK,MessageBoxIcon.Information);
}
- public static uint ReadUint(Stream str)
- {
- uint l=0;
-
- for(int f=0;f<4;f++)
- {
- int b=str.ReadByte();
- l|=(uint)(b<<(f*8));
- }
-
- return l;
- }
-
public static int ReadInt(Stream str)
{
int l=0;
@@ -79,15 +67,6 @@ namespace BitmapFontEd
return l;
}
- public static void WriteUint(Stream str, uint l)
- {
- for(uint f=0;f<4;f++)
- {
- str.WriteByte((byte)(l&0xff));
- l=l>>8;
- }
- }
-
public static void WriteInt(Stream str, int l)
{
for(uint f=0;f<4;f++)
@@ -111,6 +90,30 @@ namespace BitmapFontEd
str.Read(b,0,len);
return Encoding.ASCII.GetString(b);
}
+
+ public static void DumpAlpha(string title, Color[,] col)
+ {
+ Debug.WriteLine("**** "+title+" ****");
+
+ for(int y=0;y<col.GetLength(1);y++)
+ {
+ string s="";
+
+ for(int x=0;x<col.GetLength(0);x++)
+ {
+ if (col[x,y].A==0)
+ {
+ s+=".";
+ }
+ else
+ {
+ s+=Encoding.ASCII.GetString(new byte[] {(byte)(65+col[x,y].A/10)});
+ }
+ }
+
+ Debug.WriteLine(s);
+ }
+ }
private Util()
{