summaryrefslogtreecommitdiff
path: root/BitmapChar.cs
diff options
context:
space:
mode:
Diffstat (limited to 'BitmapChar.cs')
-rw-r--r--BitmapChar.cs48
1 files changed, 20 insertions, 28 deletions
diff --git a/BitmapChar.cs b/BitmapChar.cs
index 12d3aae..4719b33 100644
--- a/BitmapChar.cs
+++ b/BitmapChar.cs
@@ -34,7 +34,7 @@ namespace BitmapFontEd
m_width=width;
m_height=height;
m_data=new Color[m_width,m_height];
- Clear(Color.Black);
+ Clear(Color.Empty);
m_changed=false;
}
@@ -81,7 +81,7 @@ namespace BitmapFontEd
for(int y=0;y<height;y++)
for(int x=0;x<width;x++)
- data[x,y]=Color.Black;
+ data[x,y]=Color.Empty;
uint mx=Math.Min(width,m_width);
uint my=Math.Min(height,m_height);
@@ -201,17 +201,17 @@ namespace BitmapFontEd
//
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- d[x,y]=Color.Black;
+ d[x,y]=Color.Empty;
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- if (m_data[x,y]!=Color.Black)
+ if (m_data[x,y].A!=0)
{
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)
+ m_data[nx,ny].A==0)
{
d[nx,ny]=col;
}
@@ -219,7 +219,7 @@ namespace BitmapFontEd
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- if (d[x,y]!=Color.Black)
+ if (d[x,y].A!=0)
{
m_data[x,y]=d[x,y];
}
@@ -235,11 +235,11 @@ namespace BitmapFontEd
//
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- d[x,y]=Color.Black;
+ d[x,y]=Color.Empty;
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- if (m_data[x,y]!=Color.Black)
+ if (m_data[x,y].A!=0)
{
for(int dx=-1;dx<2;dx++)
for(int dy=-1;dy<2;dy++)
@@ -248,7 +248,7 @@ namespace BitmapFontEd
int ny=y+dy;
if (nx>=0 && nx<m_width && ny>=0 && ny<m_height &&
- m_data[nx,ny]==Color.Black)
+ m_data[nx,ny].A==0)
{
d[nx,ny]=col;
}
@@ -257,7 +257,7 @@ namespace BitmapFontEd
for(int y=0;y<m_height;y++)
for(int x=0;x<m_width;x++)
- if (d[x,y]!=Color.Black)
+ if (d[x,y].A!=0)
{
m_data[x,y]=d[x,y];
}
@@ -274,14 +274,10 @@ namespace BitmapFontEd
{
for(uint y=0;y<m_height;y++)
{
- if (m_data[x,y]!=Color.Black)
- {
- Util.WriteInt(stream,m_data[x,y].ToArgb());
- }
- else
- {
- Util.WriteInt(stream,0);
- }
+ stream.WriteByte(m_data[x,y].B);
+ stream.WriteByte(m_data[x,y].G);
+ stream.WriteByte(m_data[x,y].R);
+ stream.WriteByte(m_data[x,y].A);
}
}
}
@@ -297,16 +293,12 @@ namespace BitmapFontEd
{
for(uint y=0;y<height;y++)
{
- int col=Util.ReadInt(stream);
-
- if (col==0)
- {
- s[x,y]=Color.Black;
- }
- else
- {
- s[x,y]=Color.FromArgb(255,(col&0xff0000)>>16,(col&0xff00)>>8,col&0xff);
- }
+ int B=stream.ReadByte();
+ int G=stream.ReadByte();
+ int R=stream.ReadByte();
+ int A=stream.ReadByte();
+
+ s[x,y]=Color.FromArgb(A,R,G,B);
}
}