예제 #1
0
        private Image UpdateImage()
        {
            Image image;

            if (this.stopUpdating)
            {
                return(null);
            }
            if (this.tile.order != NCGR.TileOrder.NoTiled)
            {
                this.tile.rahc.nTilesX = (ushort)(this.numericWidth.Value / 8M);
                this.tile.rahc.nTilesY = (ushort)(this.numericHeight.Value / 8M);
            }
            else
            {
                this.tile.rahc.nTilesX = (ushort)this.numericWidth.Value;
                this.tile.rahc.nTilesY = (ushort)this.numericHeight.Value;
            }
            if (this.isMap)
            {
                NCGR.NCGR_s tile = this.tile;
                tile.rahc.tileData.tiles = Convertir.BytesToTiles(Convertir.TilesToBytes(tile.rahc.tileData.tiles, (int)this.tile.other));
                image = NCGR.Get_Image(tile, this.paleta, 0, this.trackZoom.Value);
            }
            else
            {
                image = NCGR.Get_Image(this.tile, this.paleta, (int)this.tile.other, this.trackZoom.Value);
            }
            this.pic.Image = image;
            return(image);
        }
예제 #2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.oldTiles != this.comboBox1.SelectedIndex)
            {
                switch (this.comboBox1.SelectedIndex)
                {
                case 0:
                    this.tile.order = NCGR.TileOrder.NoTiled;
                    this.tile.rahc.tileData.tiles[0] = Convertir.TilesToBytes(this.tile.rahc.tileData.tiles, 0);
                    this.numericHeight.Minimum       = 0M;
                    this.numericWidth.Minimum        = 0M;
                    this.numericWidth.Increment      = 1M;
                    this.numericHeight.Increment     = 1M;
                    break;

                case 1:
                    this.tile.order = NCGR.TileOrder.Horizontal;
                    this.tile.rahc.tileData.tiles = Convertir.BytesToTiles(this.tile.rahc.tileData.tiles[0]);
                    this.numericHeight.Minimum    = 8M;
                    this.numericWidth.Minimum     = 8M;
                    this.numericWidth.Increment   = 8M;
                    this.numericHeight.Increment  = 8M;
                    break;

                case 2:
                    this.tile.order = NCGR.TileOrder.Vertical;
                    break;
                }
                this.oldTiles = this.comboBox1.SelectedIndex;
                this.UpdateImage();
            }
        }
예제 #3
0
    private static Bitmap Horizontal(NTFT tile, Color[][] palette, int startTile, int tilesX, int tilesY, int zoom = 1)
    {
        if (zoom <= 0)
        {
            zoom = 1;
        }
        Bitmap bitmap = new Bitmap((tilesX * 8) * zoom, (tilesY * 8) * zoom);

        tile.tiles = Convertir.BytesToTiles(Convertir.TilesToBytes(tile.tiles, startTile));
        startTile  = 0;
        for (int i = 0; i < tilesY; i++)
        {
            for (int j = 0; j < tilesX; j++)
            {
                for (int k = 0; k < 8; k++)
                {
                    for (int m = 0; m < 8; m++)
                    {
                        for (int n = 0; n < zoom; n++)
                        {
                            for (int num6 = 0; num6 < zoom; num6++)
                            {
                                try
                                {
                                    if (tile.tiles[j + (i * tilesX)].Length == 0)
                                    {
                                        return(bitmap);
                                    }
                                    bitmap.SetPixel(((m + (j * 8)) * zoom) + num6, ((k + (i * 8)) * zoom) + n, palette[tile.nPalette[startTile]][tile.tiles[startTile][m + (k * 8)]]);
                                }
                                catch
                                {
                                    return(bitmap);
                                }
                            }
                        }
                    }
                }
                startTile++;
            }
        }
        return(bitmap);
    }
예제 #4
0
 private void comboDepth_SelectedIndexChanged(object sender, EventArgs e)
 {
     if ((this.comboDepth.Text != this.oldDepth) && !this.stopUpdating)
     {
         byte[] buffer;
         this.oldDepth        = this.comboDepth.Text;
         this.tile.rahc.depth = (this.comboDepth.Text == "4 bpp") ? ColorDepth.Depth4Bit : ColorDepth.Depth8Bit;
         if (this.comboDepth.Text == "4 bpp")
         {
             buffer = Convertir.Bit8ToBit4(Convertir.TilesToBytes(this.tile.rahc.tileData.tiles, 0));
             if (this.tile.order != NCGR.TileOrder.NoTiled)
             {
                 this.tile.rahc.tileData.nPalette = new byte[this.tile.rahc.tileData.tiles.Length];
             }
             else
             {
                 this.tile.rahc.tileData.tiles    = new byte[][] { buffer };
                 this.tile.rahc.tileData.nPalette = new byte[this.tile.rahc.tileData.tiles[0].Length];
             }
         }
         else
         {
             buffer = Convertir.Bit4ToBit8(Convertir.TilesToBytes(this.tile.rahc.tileData.tiles, 0));
             if (this.tile.order != NCGR.TileOrder.NoTiled)
             {
                 this.tile.rahc.tileData.nPalette = new byte[this.tile.rahc.tileData.tiles.Length];
             }
             else
             {
                 this.tile.rahc.tileData.tiles    = new byte[][] { buffer };
                 this.tile.rahc.tileData.nPalette = new byte[this.tile.rahc.tileData.tiles[0].Length];
             }
         }
         this.UpdateImage();
     }
 }