From 600287f275063dde1ea6f55fd9aa5247d27256cf Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 21 May 2005 02:38:48 +0000 Subject: Changed use of uints to ints (casting was getting silly). Fixed some funnies with edits -- font import now seem to work, somehow. --- GfxEditor.cs | 136 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 62 insertions(+), 74 deletions(-) (limited to 'GfxEditor.cs') 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;xc2) { - 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; -- cgit v1.2.3