Пример #1
0
 private static void LoadBitmapLayer(FieldItem[] items, int[] bmpData, int width, int height)
 {
     for (int x = 0; x < width; x++)
     {
         var ix = x * height;
         for (int y = 0; y < height; y++)
         {
             var index = ix + y;
             var tile  = items[index];
             bmpData[(y * width) + x] = FieldItemSprite.GetItemColor(tile).ToArgb();
         }
     }
 }
Пример #2
0
        private static void LoadPixelsFromLayer(FieldItemLayer layer, int x0, int y0, int width, int[] bmpData)
        {
            var stride = layer.GridWidth;

            for (int y = 0; y < stride; y++)
            {
                var baseIndex = (y * width);
                for (int x = 0; x < stride; x++)
                {
                    var tile  = layer.GetTile(x + x0, y + y0);
                    var color = FieldItemSprite.GetItemColor(tile).ToArgb();
                    var index = baseIndex + x;
                    bmpData[index] = color;
                }
            }
        }
Пример #3
0
        public Bitmap GetItemArray(IReadOnlyList <FieldItem> items, int height)
        {
            //var items = FieldItem.GetArray(SAV.Main.Data.Slice(0x20191C, 0xA8000));
            var width = items.Count / height;

            var png = new Bitmap(width * Width, height * Height);
            var gfx = Graphics.FromImage(png);

            for (int i = 0; i < items.Count; i++)
            {
                var x = Height * (i / height);
                var y = Width * (i % height);
                FieldItemSprite.DrawItemAt(gfx, items[i], x, y, x + Width - 1, y + Height - 1);
            }

            return(png);
        }