Пример #1
0
        private void CreateTiles(ImageBase <TPixel, TValue> image, Func <TiledImage <TPixel, TValue, TTile>, TileCoordinate, TTile> tileCreator)
        {
            tileCreator        = (tileCreator ?? new Func <TiledImage <TPixel, TValue, TTile>, TileCoordinate, TTile>(TiledImage <TPixel, TValue, TTile> .CreateTile));
            this.WidthInTiles  = image.Width / this.TileLinearSize;
            this.HeightInTiles = image.Height / this.TileLinearSize;
            if (this.BoundaryTilesAllowed)
            {
                if (image.Width % this.TileLinearSize > 0)
                {
                    this.WidthInTiles++;
                }
                if (image.Height % this.TileLinearSize > 0)
                {
                    this.HeightInTiles++;
                }
            }
            this.tiles = new TTile[this.WidthInTiles * this.HeightInTiles];
            for (int i = 0; i < this.tiles.Length; i++)
            {
                this[i] = tileCreator(this, this.CreateCoordinate(i));
            }
            int num  = this.BoundaryTilesAllowed ? image.Width : (this.WidthInTiles * this.TileLinearSize);
            int num2 = this.BoundaryTilesAllowed ? image.Height : (this.HeightInTiles * this.TileLinearSize);

            for (int j = 0; j < num2; j++)
            {
                for (int k = 0; k < num; k++)
                {
                    TTile ttile = this[k / this.TileLinearSize, j / this.TileLinearSize];
                    ttile.RegisterPixel(image[k, j]);
                }
            }
            foreach (TTile ttile2 in this.tiles)
            {
                ttile2.Lock();
            }
        }
Пример #2
0
 public LabTiledImage(ImageBase <ArgbPixel, byte> image, int tileSize, float scale) : base(image, tileSize, scale, false, new Func <TiledImage <ArgbPixel, byte, LabTile>, TileCoordinate, LabTile>(LabTiledImage.CreateTile))
 {
 }