Skip to content

Commit

Permalink
Added x space between tiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-polyakov committed Oct 11, 2016
1 parent 87379fc commit dbd46d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static void Main(string[] args)
var tileHeight = BitmapExtensions.SampleTile.Height;
var halfTileWidth = tileWidth/2;
var halfTileHeight = tileHeight/2;
var xSpace = 2;

if (!Directory.Exists(outputFolder))
{
Expand All @@ -34,14 +35,14 @@ public static void Main(string[] args)
{
using (var inputBitmap = new Bitmap(inputFile))
{
var n = Math.Ceiling((double) (inputBitmap.Width - initTileX)/tileWidth);
var n = Math.Ceiling((double) (inputBitmap.Width - initTileX)/(tileWidth + xSpace));
var m = Math.Ceiling((double) (inputBitmap.Height - initTileY)/tileHeight)*2;
for (var i = 0; i < n; i++)
{
for (var j = 0; j < m; j++)
{
using (var outputBitmap = inputBitmap.CreateTile(
initTileX + i*tileWidth - halfTileWidth*(1 - j%2),
initTileX + i*tileWidth - halfTileWidth*(1 - j%2) + i*xSpace,
initTileY + j*halfTileHeight - halfTileHeight))
{
if (outputBitmap.IsTransparent())
Expand Down

0 comments on commit dbd46d0

Please sign in to comment.