From 2e6da6a044ba37a974efe29dda1c55e5c8f8b2f1 Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Tue, 11 Oct 2016 19:09:58 +0700 Subject: [PATCH] Fixed alignment of odd rows. --- ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs b/ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs index 8a06e40..106cc01 100644 --- a/ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs +++ b/ArcanumTextureSlicer/ArcanumTextureSlicer/Program.cs @@ -24,7 +24,8 @@ public static void Main(string[] args) var tileHeight = BitmapExtensions.SampleTile.Height; var halfTileWidth = tileWidth/2; var halfTileHeight = tileHeight/2; - var xSpace = 2; + const int xSpace = 2; + const int halfXSpace = 1; if (!Directory.Exists(outputFolder)) { @@ -41,8 +42,10 @@ public static void Main(string[] args) { for (var j = 0; j < m; j++) { + var evenRow = j%2; + var oddRow = 1 - evenRow; using (var outputBitmap = inputBitmap.CreateTile( - initTileX + i*tileWidth - halfTileWidth*(1 - j%2) + i*xSpace, + initTileX + i*tileWidth - halfTileWidth*oddRow + i*xSpace + halfXSpace*evenRow, initTileY + j*halfTileHeight - halfTileHeight)) { if (outputBitmap.IsTransparent())