コード例 #1
0
        public void BasicExchangeEngineTest()
        {
            var tsfinder = new TileSetRepo.TileSetRepo();

            tsfinder.Discover();
            var tileset_stars  = (IHueMatchingTileset)tsfinder.ByName("Stars (16x16)")[0];
            var tileset_para16 = (IHueMatchingTileset)tsfinder.ByName("16 pastels (8x8)")[0];
            var loader         = new TesselatedImageLoader();
            var tesser         = new Basic16Tesselator();
            var loaded_image   = loader.LoadFromImagelibrary("green_leaf.jpg", tesser);
            var writer         = new ImageWriter();

            var output_path = UserSettings.GetDefaultPath("output_path");

            var assembled_bitmap_pre = loaded_image.AssembleFragments();

            writer.WriteBitmap(assembled_bitmap_pre, System.IO.Path.Combine(output_path, "green_leaf_unchanged.jpg"));

            new BasicExchangeEngine(tileset_stars, loaded_image).run();
            var assembled_bitmap_stars = loaded_image.AssembleFragments();

            writer.WriteBitmap(assembled_bitmap_stars, System.IO.Path.Combine(output_path, "stars_leaf_output.jpg"));

            new BasicExchangeEngine(tileset_para16, loaded_image).run();
            var assembled_bitmap_para16 = loaded_image.AssembleFragments();

            writer.WriteBitmap(assembled_bitmap_para16, System.IO.Path.Combine(output_path, "parametric_leaf_output.jpg"));
        }
コード例 #2
0
        public void OneTime()
        {
            var tileset_path = UserSettings.GetDefaultPath("tileset_path");

            tileset_path = System.IO.Path.Combine(tileset_path, "test");
            tileset_path = System.IO.Path.Combine(tileset_path, "5_mixed_tsets");

            five_mixed_tsets = new TileSetRepo.TileSetRepo();
            five_mixed_tsets.Discover(tileset_path, false);
        }
コード例 #3
0
        public void DiscoverTileSets()
        {
            var tileset_path = UserSettings.GetDefaultPath("tileset_path");

            tileset_path = System.IO.Path.Combine(tileset_path, "test");

            var tsr_root = new TileSetRepo.TileSetRepo();

            tsr_root.Discover(tileset_path, false);
            Assert.AreEqual(2, tsr_root.NumberOfTilesets());

            var tsr_root_recur = new TileSetRepo.TileSetRepo();

            tsr_root_recur.Discover(tileset_path, true);
            Assert.AreEqual(10, tsr_root_recur.NumberOfTilesets());
        }
コード例 #4
0
        public void DocumentationImage()
        {
            var tsfinder = new TileSetRepo.TileSetRepo();

            tsfinder.Discover(UserSettings.GetDefaultPath("tileset_path"), false);
            var tileset = (IHueMatchingTileset)tsfinder.ByName("Noisy Pastels (16x16)")[0];


            var loader       = new TesselatedImageLoader();
            var tesser       = new Basic16Tesselator();
            var loaded_image = loader.LoadFromImagelibrary("Polse.jpg", tesser);
            var writer       = new ImageWriter();

            var output_path = UserSettings.GetDefaultPath("output_path");

            new BasicExchangeEngine(tileset, loaded_image).run();
            var assembled_bitmap_pre = loaded_image.AssembleFragments();

            writer.WriteBitmap(assembled_bitmap_pre, System.IO.Path.Combine(output_path, "Pastellized Polse.png"));
        }
コード例 #5
0
        /// <summary>
        /// Initialize/Construct a TileSetRepo via de-serialization from json.
        /// </summary>
        /// <returns>A de-serialized instance.</returns>
        /// <param name="serialized">JSon representation of Serialized object.</param>
        public static TileSetRepo DeSerialize(String serialized)
        {
            var tsr = new TileSetRepo();

            JsonConvert.PopulateObject(serialized, tsr);


            foreach (Dictionary <String, String> tset_data in tsr.serialized_tsets)
            {
                String tset_type       = tset_data["tset_type"];
                String tset_serialized = tset_data["tset_serialized"];

                if (tset_type == "ProceduralHSVTileSet")
                {
                    tsr.AddTileSet(ProceduralHSVTileSet.DeSerialize(tset_serialized));
                }

                System.Console.WriteLine(String.Format("type {0}, ser {1}", tset_type, tset_serialized));
            }
            return(tsr);
        }