0x8BitDev / MAPeD-SPReD

NES/SMS/PCE/ZX/SMD development tools
https://pcengine.proboards.com/thread/1281/dev-tools-maped-spred-linux
MIT License
32 stars 1 forks source link

export tiles or blocks as 16*16 bmp #6

Closed codediy closed 2 years ago

codediy commented 2 years ago

when use the export tiles bmp in Tiled ,it is so long,and not beautiful

image

so change export bmp as 16x16 bmp

image

//MainForm.cs export_tiles_blocks_data

// draw images into bitmap  16x16
// width : 16*_data_size
// height : Math.Ceiling(num_active_tiles/16)
var bmpWidth = 16 * _data_size;
var bmpHeight = (int)Math.Ceiling((float)num_active_tiles / 16) * _data_size;
Bitmap bmp = new Bitmap(bmpWidth, bmpHeight);
// Bitmap bmp = new Bitmap( _data_size * num_active_tiles, _data_size );//, PixelFormat.Format24bppRgb );

Graphics gfx = Graphics.FromImage( bmp );
gfx.InterpolationMode   = InterpolationMode.NearestNeighbor;
gfx.PixelOffsetMode     = PixelOffsetMode.HighQuality;

for( i = 0; i < num_active_tiles; i++ )
{
// gfx.DrawImage( _image_list.Images[ i ], i * _data_size, 0, _data_size, _data_size );
var x = i % 16;
var y = (int) Math.Floor((float)i / 16);

gfx.DrawImage(_image_list.Images[i], x * _data_size, y * _data_size, _data_size, _data_size);
}
0x8BitDev commented 2 years ago

Done! Thanks for the suggestion. Compiled binaries in the development build.