Esempio n. 1
0
        public static void LoadImage(string path, int tileSize, int offsetX, int offsetY)
        {
            Bitmap image = LoadCroppedImage(path, tileSize, offsetX, offsetY);
            int width = image.Width;
            int height = image.Height;

            Images = new ImageCollection(path, tileSize, width, height, offsetX, offsetY);

            allSortedTiles = new TileSorting();

            Images.SetSubImageByRefFromImage(ref image, 0);

            //loadedImage = canvas;
        }
Esempio n. 2
0
        public void GetSubImageTileIndex()
        {
            int width = 96;
            int height = 96;
            int tileSize = 16;

            int offsetX = 0;
            int offsetY = 0;

            ImageCollection imageGroup = new ImageCollection("", tileSize, width, height, offsetX, offsetY);

            int tileIndex, subImageIndex, subImageTileIndex;

            tileIndex = 0;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 0);

            subImageTileIndex = imageGroup.GetSubImageTileIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageTileIndex == 0);

            tileIndex = 3;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 1);

            subImageTileIndex = imageGroup.GetSubImageTileIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageTileIndex == 0);

            tileIndex = 8;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 0);

            subImageTileIndex = imageGroup.GetSubImageTileIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageTileIndex == 5);

            tileIndex = 21;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 3);

            subImageTileIndex = imageGroup.GetSubImageTileIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageTileIndex == 3);
        }
Esempio n. 3
0
        public void GetTileIndex()
        {
            int width = 1440;
            int height = 864;
            int tileSize = 32;

            int offsetX = 0;
            int offsetY = 0;

            ImageCollection imageGroup = new ImageCollection("", tileSize, width, height, offsetX, offsetY);

            int tileIndex, subImageIndex, subImageTileIndex;

            subImageIndex = 0;
            subImageTileIndex = 0;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 0);

            subImageTileIndex = 5;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 5);

            subImageTileIndex = 6;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 45);

            subImageTileIndex = 41;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 275);

            subImageIndex = 1;
            subImageTileIndex = 0;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 6);

            subImageTileIndex = 5;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 11);

            subImageTileIndex = 6;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 51);

            subImageTileIndex = 41;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 281);

            subImageIndex = 7;
            subImageTileIndex = 0;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 42);

            subImageTileIndex = 2;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 44);

            subImageTileIndex = 3;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 87);

            subImageTileIndex = 20;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 314);

            subImageIndex = 8;
            subImageTileIndex = 0;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 315);

            subImageTileIndex = 5;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 320);

            subImageTileIndex = 6;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 360);

            subImageTileIndex = 41;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 590);

            subImageIndex = 24;
            subImageTileIndex = 0;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 945);

            subImageTileIndex = 5;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 950);

            subImageTileIndex = 6;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 990);

            subImageTileIndex = 35;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 1175);

            subImageIndex = 31;
            subImageTileIndex = 0;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 987);

            subImageTileIndex = 2;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 989);

            subImageTileIndex = 3;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 1032);

            subImageTileIndex = 15;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 1212);

            subImageTileIndex = 17;
            tileIndex = imageGroup.GetTileIndex(subImageIndex, subImageTileIndex);
            Assert.IsTrue(tileIndex == 1214);
        }
Esempio n. 4
0
        public void GetSubImageIndex()
        {
            int width = 1440;
            int height = 864;
            int tileSize = 32;

            int offsetX = 0;
            int offsetY = 0;

            ImageCollection imageGroup = new ImageCollection("", tileSize, width, height, offsetX, offsetY);

            int tileIndex, subImageIndex;

            tileIndex = 0;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 0);

            tileIndex = 5;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 0);

            tileIndex = 45;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 0);

            tileIndex = 275;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 0);

            tileIndex = 6;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 1);

            tileIndex = 11;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 1);

            tileIndex = 51;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 1);

            tileIndex = 281;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 1);

            tileIndex = 42;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 7);

            tileIndex = 44;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 7);

            tileIndex = 84;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 7);

            tileIndex = 314;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 7);

            tileIndex = 945;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 24);

            tileIndex = 950;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 24);

            tileIndex = 990;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 24);

            tileIndex = 1175;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 24);

            tileIndex = 987;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 31);

            tileIndex = 989;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 31);

            tileIndex = 1032;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 31);

            tileIndex = 1214;
            subImageIndex = imageGroup.GetSubImageIndexFromTileIndex(tileIndex);
            Assert.IsTrue(subImageIndex == 31);
        }