CannonShooter/data/CreateSpriteSheet_Barrel.linq

30 lines
981 B
Plaintext
Raw Permalink Normal View History

2015-09-17 14:37:44 +02:00
<Query Kind="Program">
<Namespace>System.Drawing</Namespace>
<Namespace>System.Drawing.Imaging</Namespace>
</Query>
void Main()
{
2015-09-17 15:35:24 +02:00
Image input = Image.FromFile(@"F:\Eigene Dateien\Dropbox\Programming\Java\workspace\Cannon Shooter\data\cannon_barrel_base.png");
2015-09-17 14:37:44 +02:00
2015-09-17 21:02:27 +02:00
Image output = new Bitmap(input.Width * 4, input.Height * 8, PixelFormat.Format32bppArgb);
2015-09-17 14:37:44 +02:00
using (Graphics g = Graphics.FromImage(output))
{
for (int x = 0; x < 4; x++)
{
2015-09-17 21:02:27 +02:00
for (int y = 0; y < 8; y++)
2015-09-17 14:37:44 +02:00
{
int idx = y*4 + x;
2015-09-18 15:04:14 +02:00
g.DrawImageUnscaledAndClipped(input, new Rectangle(input.Width * x, input.Height * y, input.Width - idx * 8 - 58, input.Height));
2015-09-17 14:37:44 +02:00
2015-09-18 15:04:14 +02:00
g.DrawImage(input, new Rectangle(input.Width * (x+1) - idx * 8 - 58, input.Height * y, 58, input.Height), new Rectangle(input.Width - 58, 0, 58, input.Height), GraphicsUnit.Pixel);
2015-09-17 14:37:44 +02:00
}
}
}
output.Dump();
output.Save(@"F:\Eigene Dateien\Dropbox\Programming\Java\workspace\Cannon Shooter\android\assets\cannon_barrel.png");
}