git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1256 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
2
OpenRa.BlockCacheVisualizer/Form1.Designer.cs
generated
2
OpenRa.BlockCacheVisualizer/Form1.Designer.cs
generated
@@ -33,7 +33,7 @@ namespace OpenRa.BlockCacheVisualizer
|
|||||||
//
|
//
|
||||||
// flowLayoutPanel1
|
// flowLayoutPanel1
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel1.AutoScroll = true;
|
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.MenuHighlight;
|
||||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ namespace OpenRa.BlockCacheVisualizer
|
|||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
ClientSize = new Size(525,525);
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||||
|
MaximizeBox = false;
|
||||||
|
Text = "PNG Block Cache Visualizer";
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|
||||||
OpenFileDialog d = new OpenFileDialog();
|
OpenFileDialog d = new OpenFileDialog();
|
||||||
@@ -24,6 +28,8 @@ namespace OpenRa.BlockCacheVisualizer
|
|||||||
if (DialogResult.OK != d.ShowDialog())
|
if (DialogResult.OK != d.ShowDialog())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string filename = d.FileName;
|
string filename = d.FileName;
|
||||||
string palname = Path.GetDirectoryName(filename) + "\\palette-cache.png";
|
string palname = Path.GetDirectoryName(filename) + "\\palette-cache.png";
|
||||||
|
|
||||||
@@ -39,6 +45,7 @@ namespace OpenRa.BlockCacheVisualizer
|
|||||||
|
|
||||||
pb.SizeMode = PictureBoxSizeMode.AutoSize;
|
pb.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
pb.Image = b;
|
pb.Image = b;
|
||||||
|
pb.BackColor = Color.White;
|
||||||
|
|
||||||
flowLayoutPanel1.Controls.Add(pb);
|
flowLayoutPanel1.Controls.Add(pb);
|
||||||
}
|
}
|
||||||
@@ -52,18 +59,18 @@ namespace OpenRa.BlockCacheVisualizer
|
|||||||
return (hax & 0xff) | (hax >> 8);
|
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 ExtractChannelToBitmap(Bitmap src, Bitmap pal, uint mask)
|
||||||
{
|
{
|
||||||
Bitmap dest = new Bitmap(src.Width / 2, src.Height / 2, pal.PixelFormat);
|
Bitmap dest = new Bitmap(src.Width / 2, src.Height / 2, pal.PixelFormat);
|
||||||
|
|
||||||
BitmapData destData = dest.LockBits(new Rectangle(new Point(), dest.Size), ImageLockMode.WriteOnly,
|
BitmapData destData = Lock(dest, ImageLockMode.WriteOnly);
|
||||||
dest.PixelFormat);
|
BitmapData paletteData = Lock(pal, ImageLockMode.ReadOnly);
|
||||||
|
BitmapData srcData = Lock(src, ImageLockMode.ReadOnly);
|
||||||
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);
|
|
||||||
|
|
||||||
int destStride = destData.Stride/4;
|
int destStride = destData.Stride/4;
|
||||||
int srcStride = srcData.Stride/4;
|
int srcStride = srcData.Stride/4;
|
||||||
|
|||||||
Reference in New Issue
Block a user