summaryrefslogtreecommitdiff
path: root/GfxEditor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GfxEditor.cs')
-rw-r--r--GfxEditor.cs136
1 files changed, 62 insertions, 74 deletions
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;