public static FromBMP ( |
||
b | ||
num | int | |
pal | ||
startX | int | |
startY | int | |
Результат |
public static xCollection FromBmp(Bitmap b) { PckImage.Scale = 1; switch (b.PixelFormat) { case PixelFormat.Format8bppIndexed: break; case PixelFormat.Format24bppRgb: PckImage.Scale = 2; break; } int space = PckFile.imgSpace * PckImage.Scale; ArrayList list = new ArrayList(); int cols = (b.Width + space) / (PckImage.Width + space); int rows = (b.Height + space) / (PckImage.Height + space); int num = 0; for (int y = 0; y < b.Height; y += PckImage.Height + space) { for (int x = 0; x < b.Width; x += PckImage.Width + space) { try { switch (b.PixelFormat) { case PixelFormat.Format8bppIndexed: list.Add(PckImage.FromBMP(b, num++, Palette.TFTDBattle, x, y)); break; case PixelFormat.Format24bppRgb: list.Add(PckImage.FromBMP24(b, num++, Palette.TFTDBattle, x, y)); break; } Bmp.FireLoadingEvent(num, rows * cols); } catch {} } } return(new PckFile(list)); }
public static ITile FromBmpSingle(Bitmap b, int num, Palette p) { return(PckImage.FromBMP(b, num, p, 0, 0)); }