FromBMP() публичный статический Метод

public static FromBMP ( Bitmap b, int num, Palette pal, int startX, int startY ) : PckImage
b System.Drawing.Bitmap
num int
pal Palette
startX int
startY int
Результат PckImage
Пример #1
0
        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));
        }
Пример #2
0
 public static ITile FromBmpSingle(Bitmap b, int num, Palette p)
 {
     return(PckImage.FromBMP(b, num, p, 0, 0));
 }