Пример #1
0
        // non-allocation image generator
        public static Bitmap GetBitmapLayerAcre(FieldItemLayer layer, int x0, int y0, int scale, int[] acre1, int[] acreScale, Bitmap dest, int transparency = -1)
        {
            var w = layer.GridWidth;
            var h = layer.GridHeight;

            LoadPixelsFromLayer(layer, x0, y0, w, acre1);
            w *= scale;
            h *= scale;
            ImageUtil.ScalePixelImage(acre1, acreScale, w, h, scale);

            if (transparency >> 24 != 0xFF)
            {
                ImageUtil.SetAllTransparencyTo(acreScale, transparency);
            }

            // draw symbols over special items now?
            DrawDirectionals(acreScale, layer, w, x0, y0, scale);

            // Slap on a grid
            DrawGrid(acreScale, w, h, scale);

            // Return final data
            ImageUtil.SetBitmapData(dest, acreScale);
            return(dest);
        }
Пример #2
0
 public static Bitmap CreateMap(TerrainLayer mgr, int scale, int x, int y, int[] scale1, int[] scaleX, Bitmap map)
 {
     CreateMap(mgr, scale1);
     ImageUtil.ScalePixelImage(scale1, scaleX, map.Width, map.Height, scale);
     ImageUtil.SetBitmapData(map, scaleX);
     return(DrawReticle(map, mgr, x, y, scale));
 }
Пример #3
0
        // unused -- allocates!
        public static Bitmap GetBitmapLayerAcre(FieldItemLayer layer, int x0, int y0, int scale)
        {
            var map  = GetBitmapLayerAcre(layer, x0, y0, out int mh, out int mw);
            var data = ImageUtil.ScalePixelImage(map, scale, mw, mh, out var w, out var h);

            // draw symbols over special items now?
            DrawDirectionals(data, layer, w, x0, y0, scale);

            // Slap on a grid
            DrawGrid(data, w, h, scale);

            // Return final data
            return(ImageUtil.GetBitmap(data, w, h));
        }
Пример #4
0
        public static Bitmap CreateMap(TerrainLayer mgr, int[] scale1, int[] scaleX, Bitmap map, int scale, int acreIndex = -1)
        {
            CreateMap(mgr, scale1);
            ImageUtil.ScalePixelImage(scale1, scaleX, map.Width, map.Height, scale);
            ImageUtil.SetBitmapData(map, scaleX);

            if (acreIndex < 0)
            {
                return(map);
            }

            var acre = MapGrid.Acres[acreIndex];
            var x    = acre.X * mgr.GridWidth;
            var y    = acre.Y * mgr.GridHeight;

            return(DrawReticle(map, mgr, x, y, scale));
        }
Пример #5
0
 private static void SetAcreTerrainPixels(int x, int y, TerrainLayer t, int[] data, int[] scaleX, int scale)
 {
     GetAcre1(x, y, t, data);
     ImageUtil.ScalePixelImage(data, scaleX, 16 * scale, 16 * scale, scale);
 }