git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1256 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
chrisf
2007-07-14 15:11:07 +00:00
parent 06e0491607
commit ee55ffe097
2 changed files with 16 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRa.BlockCacheVisualizer
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.MenuHighlight;
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";

View File

@@ -15,6 +15,10 @@ namespace OpenRa.BlockCacheVisualizer
public Form1()
{
InitializeComponent();
ClientSize = new Size(525,525);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
Text = "PNG Block Cache Visualizer";
Visible = true;
OpenFileDialog d = new OpenFileDialog();
@@ -24,6 +28,8 @@ namespace OpenRa.BlockCacheVisualizer
if (DialogResult.OK != d.ShowDialog())
return;
string filename = d.FileName;
string palname = Path.GetDirectoryName(filename) + "\\palette-cache.png";
@@ -39,6 +45,7 @@ namespace OpenRa.BlockCacheVisualizer
pb.SizeMode = PictureBoxSizeMode.AutoSize;
pb.Image = b;
pb.BackColor = Color.White;
flowLayoutPanel1.Controls.Add(pb);
}
@@ -52,18 +59,18 @@ namespace OpenRa.BlockCacheVisualizer
return (hax & 0xff) | (hax >> 8);
}
static BitmapData Lock(Bitmap b, ImageLockMode mode)
{
return b.LockBits(new Rectangle(new Point(), b.Size), mode, b.PixelFormat);
}
Bitmap ExtractChannelToBitmap(Bitmap src, Bitmap pal, uint mask)
{
Bitmap dest = new Bitmap(src.Width / 2, src.Height / 2, pal.PixelFormat);
BitmapData destData = dest.LockBits(new Rectangle(new Point(), dest.Size), ImageLockMode.WriteOnly,
dest.PixelFormat);
BitmapData paletteData = pal.LockBits(new Rectangle(new Point(), pal.Size), ImageLockMode.ReadOnly,
pal.PixelFormat);
BitmapData srcData = src.LockBits(new Rectangle(new Point(), src.Size), ImageLockMode.ReadOnly,
src.PixelFormat);
BitmapData destData = Lock(dest, ImageLockMode.WriteOnly);
BitmapData paletteData = Lock(pal, ImageLockMode.ReadOnly);
BitmapData srcData = Lock(src, ImageLockMode.ReadOnly);
int destStride = destData.Stride/4;
int srcStride = srcData.Stride/4;